1import{a as As}from"./chunk-NBX5ZK6X.js";import{a as ja}from"./chunk-G4GNUOK6.js";import{a as Cl}from"./chunk-THKSQTQE.js";import{a as fl,b as hl}from"./chunk-GSRQUHXW.js";import{a as Sl,b as xl}from"./chunk-BQ76WF36.js";import{a as Dn,b as pn,c as Ho}from"./chunk-JCY2UKTD.js";import{a as ml,b as Ba}from"./chunk-22T65NAS.js";import{a as qa,b as R0}from"./chunk-2TPD4FZS.js";import{a as ti,b as nl,c as ii,d as ni,e as ai,f as al}from"./chunk-V3ZHC4EX.js";import{a as Lr}from"./chunk-HJE6M4Z6.js";import{b as Yd}from"./chunk-7UI4UMBR.js";import{a as Xe,b as Ze,c as at,d as cl}from"./chunk-GDBLA6S5.js";import{a as Jt,b as Kd,d as Nt,e as Ot,f as Ft,g as Mt,h as tl,m as w0,n as Pn,o as Wa}from"./chunk-C6G5O5E2.js";import{$a as kd,$b as Zd,$d as Fn,$f as ta,$h as D0,Ac as le,Af as Tt,Ah as Oi,Ai as El,B as fr,Bc as $,Be as c0,Bf as x0,Bh as un,Cc as ie,Cf as wr,Ci as $i,Da as zn,Db as ot,Dd as bs,Df as me,Di as B0,Eb as jd,Ec as Qt,Ef as Pa,Fa as Od,Fc as We,Fd as zo,Fe as ro,Ff as wt,Fh as kt,Ga as Ae,Gc as e0,Gd as ci,Ge as Cn,Gf as ri,Gh as Ai,Ha as T,Hb as oe,Hc as Wo,Hd as d0,He as br,Hf as f0,Hh as pl,Ia as se,Ib as vi,Ic as t0,Ie as yr,Ih as Qi,Ja as ge,Jc as jo,Jf as h0,Ka as ir,Kb as qo,Ke as Ar,Kf as Ni,Ld as p0,Le as oo,Lf as Dr,Lh as ia,Mb as wn,Mc as i0,Me as Rr,Mf as lt,Mh as _n,N as yd,Na as wa,Nb as Bo,Nd as Kt,Ne as vn,Nf as C0,Nh as Ki,Oa as Le,Ob as Lt,Oc as Vt,Od as fi,Of as Gt,Oh as A0,P as Ad,Pa as hr,Pb as Qd,Pc as Ln,Pd as jn,Q as Rd,Qa as Fd,Qb as gi,Qd as ft,Qe as u0,Qf as or,Ra as Te,Rb as Bi,Rd as re,Re as Ji,Rf as v0,Rh as Ri,Sa as Md,Sb as La,Sd as Xo,Se as _a,Sf as dt,Ta as Ud,Tb as $d,Tc as nr,Td as Zo,Te as lo,Tf as g0,Th as Un,Ua as De,Ub as gr,Ud as Nn,Uf as Ut,Uh as ul,Va as Cr,Vb as zd,Vd as On,Ve as ys,Vf as ui,Wa as vr,Wb as yt,Wd as m0,We as so,Wf as yi,Wh as Fr,Xa as Pd,Xb as Na,Xc as M,Xd as Ui,Xf as _i,Xh as Mr,Ya as Gd,Yb as pi,Yc as n0,Yf as rl,Yh as Ha,Za as Ss,Zb as Xd,Zd as ze,Zf as it,_a as be,_b as mi,_c as a0,_d as Je,_f as ea,ab as An,ac as ye,ad as ar,ae as qe,ai as L0,b as vd,ba as wd,bb as Rn,bc as Hi,bd as to,be as St,bi as po,c as Qe,cb as Xn,cd as Ts,cf as Zn,ci as N0,d as gd,db as qd,dc as he,dd as r0,df as ei,di as O0,eb as Bd,ed as Wn,ef as ct,ei as F0,f as Uo,fc as Be,fd as io,ff as de,fg as T0,fi as M0,g as Td,gb as Da,gc as et,gd as Oe,gg as Ga,gi as U0,h as Id,hb as Hd,hd as no,hg as I0,hi as P0,i as $n,ib as Vo,id as Fa,ie as Jo,ig as ht,ii as G0,j as Po,jc as Jd,jd as Yo,jg as ji,ji as _l,k as Aa,kc as ua,kf as _0,kg as cn,ki as k0,l as Go,lc as Cs,ld as Qo,lf as E0,lg as Yi,mc as Tr,md as ao,mf as Ie,mg as b0,nc as vs,nd as Ir,nf as Mn,ng as Nr,o as bd,oa as Dd,oc as gs,od as Rt,of as Jn,og as Or,p as Ra,pd as rr,pf as il,pg as ol,qa as mt,qc as P,qd as Li,qf as Ne,qg as ll,qi as V0,r as Zt,rc as At,rf as Ii,s as Jr,sc as Ti,sd as Ko,se as Ma,sf as bi,ta as Ld,td as ae,tf as Ua,tg as ka,ua as Nd,uc as Hn,ud as o0,uf as $t,ug as sl,vc as nt,vd as l0,ve as el,vf as S0,vg as dl,wd as s0,wf as mn,wg as Va,xa as Pe,xc as Oa,xd as Is,xf as zt,y as tr,ya as si,yc as Se,yf as Wi,yg as y0,z as ko,za as eo,zb as Wd,zd as $o,zf as Re,zh as oi,zi as q0}from"./chunk-URX3Z3IY.js";import{c as Vd,d as xs,f as fs,h as hs}from"./chunk-F2X3VGZZ.js";import{a as je}from"./chunk-JFVED2Z4.js";import{$ as Mi,$a as vt,$c as qn,Aa as ee,Ba as _d,Bc as ne,C as ue,Ca as D,Cc as pe,D as ms,Dc as Kn,Ec as er,Fc as hd,G as md,Gb as Oo,Ha as Ed,Hb as Fo,I as Zr,Ib as Ve,J as cd,Jb as p,Kb as ga,Lb as ve,Lc as I,Mb as Pt,Mc as y,N,Nb as Bt,Nc as $e,Oc as ma,Pb as f,Pc as ca,Qb as J,Qc as A,Rb as Zi,S as Do,Sb as G,Tb as k,Ub as n,V as Lo,Vb as a,Wb as R,Wc as Mo,X as cs,Xb as Ta,Yb as Ia,Za as jt,Zb as xr,_ as ud,_b as b,a as Vi,aa as ln,ad as Es,bb as l,bd as Cd,cc as h,cd as Ye,dc as m,dd as Bn,ea as Sr,ec as ba,fa as te,fc as ya,gb as g,gc as q,h as pd,hc as xd,ic as gt,kc as Vn,la as No,lb as bn,lc as X,ma as E,mc as Y,na as S,nc as Q,oa as pa,pa as us,q as Fe,qa as Ci,qb as B,qc as Ee,r as wi,rb as sn,rc as e,sc as v,tb as Sd,tc as K,u as wo,ub as dn,uc as qi,vc as fd,w as da,wa as Yt,wb as _,wc as H,xa as _s,xc as W,y as we,yc as j,za as Dt,zc as yn}from"./chunk-QZE3DK7K.js";import{a as Di,b as ki,h as He,k as Er}from"./chunk-BI7C37SH.js";var H0=(()=>{class r extends Vo{static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["EyeIcon"]],features:[dn],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M0.0535499 7.25213C0.208567 7.59162 2.40413 12.4 7 12.4C11.5959 12.4 13.7914 7.59162 13.9465 7.25213C13.9487 7.2471 13.9506 7.24304 13.952 7.24001C13.9837 7.16396 14 7.
108239 14 7.00001C14 6.91762 13.9837 6.83605 13.952 6.76001C13.9506 6.75697 13.9487 6.75292 13.9465 6.74788C13.7914 6.4084 11.5959 1.60001 7 1.60001C2.40413 1.60001 0.208567 6.40839 0.0535499 6.74788C0.0512519 6.75292 0.0494023 6.75697 0.048 6.76001C0.0163137 6.83605 0 6.91762 0 7.00001C0 7.08239 0.0163137 7.16396 0.048 7.24001C0.0494023 7.24304 0.0512519 7.2471 0.0535499 7.25213ZM7 11.2C3.664 11.2 1.736 7.92001 1.264 7.00001C1.736 6.08001 3.664 2.80001 7 2.80001C10.336 2.80001 12.264 6.08001 12.736 7.00001C12.264 7.92001 10.336 11.2 7 11.2ZM5.55551 9.16182C5.98308 9.44751 6.48576 9.6 7 9.6C7.68891 9.59789 8.349 9.32328 8.83614 8.83614C9.32328 8.349 9.59789 7.68891 9.59999 7C9.59999 6.48576 9.44751 5.98308 9.16182 5.55551C8.87612 5.12794 8.47006 4.7947 7.99497 4.59791C7.51988 4.40112 6.99711 4.34963 6.49276 4.44995C5.98841 4.55027 5.52513 4.7979 5.16152 5.16152C4.7979 5.52513 4.55027 5.98841 4.44995 6.49276C4.34963 6.99711 4.40112 7.51988 4.59791 7.99497C4.7947 8.47006 5.12794 8.87612 5.55551 9.16182ZM6.2222 5.83594C6.45243 5.6821 6.7231 5.6 7 5.6C7.37065 5.6021 7.72553 5.75027 7.98762 6.01237C8.24972 6.27446 8.39789 6.62934 8.4 7C8.4 7.27689 8.31789 7.54756 8.16405 7.77779C8.01022 8.00802 7.79157 8.18746 7.53575 8.29343C7.27994 8.39939 6.99844 8.42711 6.72687 8.37309C6.4553 8.31908 6.20584 8.18574 6.01005 7.98994C5.81425 7.79415 5.68091 7.54469 5.6269 7.27312C5.57288 7.00155 5.6006 6.72006 5.70656 6.46424C5.81253 6.20842 5.99197 5.98977 6.2222 5.83594Z","fill","currentColor"]],template:function(o,i){o&1&&(pa(),n(0,"svg",0),R(1,"path",1),a()),o&2&&(Bt(i.getClassNames()),Ve("aria-label",i.ariaLabel)("aria-hidden",i.ariaHidden)("role",i.role))},encapsulation:2})}return r})();var W0=(()=>{class r extends Vo{pathId;ngOnInit(){this.pathId="url(#"+Dd()+")"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["EyeSlashIcon"]],features:[dn],decls:6,vars:7,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["fill-rule","evenodd","clip-rule","evenodd","d","M13.9414 6.74792C13.9437 6.75295 13.9455 6.757 13.9469 6.76003C13.982 6.8394 14.0001 6.9252 14.0001 7.01195C14.0001 7.0987 13.982 7.1845 13.9469 7.26386C13.6004 8.00059 13.1711 8.69549 12.6674 9.33515C12.6115 9.4071 12.54 9.46538 12.4582 9.50556C12.3765 9.54574 12.2866 9.56678 12.1955 9.56707C12.0834 9.56671 11.9737 9.53496 11.8788 9.47541C11.7838 9.41586 11.7074 9.3309 11.6583 9.23015C11.6092 9.12941 11.5893 9.01691 11.6008 8.90543C11.6124 8.79394 11.6549 8.68793 11.7237 8.5994C12.1065 8.09726 12.4437 7.56199 12.7313 6.99995C12.2595 6.08027 10.3402 2.8014 6.99732 2.8014C6.63723 2.80218 6.27816 2.83969 5.92569 2.91336C5.77666 2.93304 5.62568 2.89606 5.50263 2.80972C5.37958 2.72337 5.29344 2.59398 5.26125 2.44714C5.22907 2.30031 5.2532 2.14674 5.32885 2.01685C5.40451 1.88696 5.52618 1.79021 5.66978 1.74576C6.10574 1.64961 6.55089 1.60134 6.99732 1.60181C11.5916 1.60181 13.7864 6.40856 13.9414 6.74792ZM2.20333 1.61685C2.35871 1.61411 2.5091 1.67179 2.6228 1.77774L12.2195 11.3744C12.3318 11.4869 12.3949 11.6393 12.3949 11.7983C12.3949 11.9572 12.3318 12.1097 12.2195 12.2221C12.107 12.3345 11.9546 12.3976 11.7956 12.3976C11.6367 12.3976 11.4842 12.3345 11.3718 12.2221L10.5081 11.3584C9.46549 12.0426 8.24432 12.4042 6.99729 12.3981C2.403 12.3981 0.208197 7.59135 0.0532336 7.25198C0.0509364 7.24694 0.0490875 7.2429 0.0476856 7.23986C0.0162332 7.16518 3.05176e-05 7.08497 3.05176e-05 7.00394C3.05176e-05 6.92291 0.0162332 6.8427 0.0476856 6.76802C0.631261 5.47831 1.46902 4.31959 2.51084 3.36119L1.77509 2.62545C1.66914 2.51175 1.61146 2.36136 1.61421 2.20597C1.61695 2.05059 1.6799 1.90233 1.78979 1.79244C1.89968 1.68254 2.04794 1.6196 2.20333 1.61685ZM7.45314 8.35147L5.68574 6.57609V6.5361C5.5872 6.78938 5.56498 7.06597 5.62183 7.33173C5.67868 7.59749 5.8121 7.84078 6.00563 8.03158C6.19567 8.21043 6.43052 8.33458 6.68533 8.39089C6.94014 8.44721 7.20543 8.43359 7.45314 8.35147ZM1.26327 6.99994C1.7351 7.91163 3.64645 11.1985 6.99729 11.1985C7.9267 11.2048 8.8408 10.9618 9.64438 10.4947L8.35682 9.20718C7.86027 9.51441 7.27449 9.64491 6.69448 9.57752C6.11446 9.51014 5.57421 9.24881 5.16131 8.83592C4.74842 8.42303 4.4871 7.88277 4.41971 7.30276C4.35232 6.72274 4.48282 6.13697 4.79005 5.64041L3.35855 4.2089C2.4954 5.00336 1.78523 5.94935 1.26327 6.99994Z","fill","currentColor"],[3,"id"],["width","14","height","14","fill","white"]],template:function(o,i){o&1&&(pa(),n(0,"svg",0)(1,"g"),R(2,"path",1),a(),n(3,"defs")(4,"clipPath",2),R(5,"rect",3),a()()()),o&2&&(Bt(i.getClassNames()),Ve("aria-label",i.ariaLabel)("aria-hidden",i.ariaHidden)("role",i.role),l(),Ve("clip-path",i.pathId),l(3),p("id",i.pathId))},encapsulation:2})}return r})();po.register(...G0);var j0=po;var Rs=(()=>{class r{platformId;el;zone;type;plugins=[];width;height;responsive=!0;ariaLabel;ariaLabelledBy;get data(){return this._data}set data(t){this._data=t,this.reinit()}get options(){return this._options}set options(t){this._options=t,this.reinit()}onDataSelect=new Yt;isBrowser=!1;initialized;_data;_options={};chart;constructor(t,o,i){this.platformId=t,this.el=o,this.zone=i}ngAfterViewInit(){this.initChart(),this.initialized=!0}onCanvasClick(t){if(this.chart){let o=this.chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1),i=this.chart.getElementsAtEventForMode(t,"dataset",{intersect:!0},!1);o&&o[0]&&i&&this.onDataSelect.emit({originalEvent:t,element:o[0],dataset:i})}}initChart(){if(Jr(this.platformId)){let t=this.options||{};t.responsive=this.responsive,t.responsive&&(this.height||this.width)&&(t.maintainAspectRatio=!1),this.zone.runOutsideAngular(()=>{this.chart=new j0(this.el.nativeElement.children[0].children[0],{type:this.t
1ype,data:this.data,options:this.options,plugins:this.plugins})})}}getCanvas(){return this.el.nativeElement.children[0].children[0]}getBase64Image(){return this.chart.toBase64Image()}generateLegend(){if(this.chart)return this.chart.generateLegend()}refresh(){this.chart&&this.chart.update()}reinit(){this.chart&&(this.chart.destroy(),this.initChart())}ngOnDestroy(){this.chart&&(this.chart.destroy(),this.initialized=!1,this.chart=null)}static \u0275fac=function(o){return new(o||r)(g(Ed),g(_d),g(_s))};static \u0275cmp=B({type:r,selectors:[["p-chart"]],inputs:{type:"type",plugins:"plugins",width:"width",height:"height",responsive:[2,"responsive","responsive",qn],ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",data:"data",options:"options"},outputs:{onDataSelect:"onDataSelect"},decls:2,vars:8,consts:[[2,"position","relative"],["role","img",3,"click"]],template:function(o,i){o&1&&(n(0,"div",0)(1,"canvas",1),h("click",function(c){return i.onCanvasClick(c)}),a()()),o&2&&(ga("width",i.responsive&&!i.width?null:i.width)("height",i.responsive&&!i.height?null:i.height),l(),Ve("aria-label",i.ariaLabel)("aria-labelledby",i.ariaLabelledBy)("width",i.responsive&&!i.width?null:i.width)("height",i.responsive&&!i.height?null:i.height))},dependencies:[Zt,si],encapsulation:2,changeDetection:0})}return r})(),vl=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[Rs,si,si]})}return r})();var Fc=["*"],Mc=({dt:r})=>` 2.p-divider-horizontal { 3 display: flex; 4 width: 100%; 5 position: relative; 6 align-items: center; 7 margin: ${r("divider.horizontal.margin")}; 8 padding: ${r("divider.horizontal.padding")}; 9} 10 11.p-divider-horizontal:before { 12 position: absolute; 13 display: block; 14 inset-block-start: 50%; 15 inset-inline-start: 0; 16 width: 100%; 17 content: ""; 18 border-block-start: 1px solid ${r("divider.border.color")}; 19} 20 21.p-divider-horizontal .p-divider-content { 22 padding: ${r("divider.horizontal.content.padding")}; 23} 24 25.p-divider-vertical { 26 min-height: 100%; 27 display: flex; 28 position: relative; 29 justify-content: center; 30 margin: ${r("divider.vertical.margin")}; 31 padding: ${r("divider.vertical.padding")}; 32} 33 34.p-divider-vertical:before { 35 position: absolute; 36 display: block; 37 inset-block-start: 0; 38 inset-inline-start: 50%; 39 height: 100%; 40 content: ""; 41 border-inline-start: 1px solid ${r("divider.border.color")}; 42} 43 44.p-divider.p-divider-vertical .p-divider-content { 45 padding: ${r("divider.vertical.content.padding")}; 46} 47 48.p-divider-content { 49 z-index: 1; 50 background: ${r("divider.content.background")}; 51 color: ${r("divider.content.color")}; 52} 53 54.p-divider-solid.p-divider-horizontal:before { 55 border-block-start-style: solid; 56} 57 58.p-divider-solid.p-divider-vertical:before { 59 border-inline-start-style: solid; 60} 61 62.p-divider-dashed.p-divider-horizontal:before { 63 border-block-start-style: dashed; 64} 65 66.p-divider-dashed.p-divider-vertical:before { 67 border-inline-start-style: dashed; 68} 69 70.p-divider-dotted.p-divider-horizontal:before { 71 border-block-start-style: dotted; 72} 73 74.p-divider-dotted.p-divider-vertical:before { 75 border-inline-start-style: dotted; 76} 77 78.p-divider-left:dir(rtl), 79.p-divider-right:dir(rtl) { 80 flex-direction: row-reverse; 81} 82`,Uc={root:({props:r})=>({justifyContent:r.layout==="horizontal"?r.align==="center"||r.align===null?"center":r.align==="left"?"flex-start":r.align==="right"?"flex-end":null:null,alignItems:r.layout==="vertical"?r.align==="center"||r.align===null?"center":r.align==="top"?"flex-start":r.align==="bottom"?"flex-end":null:null})},Pc={root:({props:r})=>["p-divider p-component","p-divider-"+r.layout,"p-divider-"+r.type,{"p-divider-left":r.layout==="horizontal"&&(!r.align||r.align==="left")},{"p-divider-center":r.layout==="horizontal"&&r.align==="center"},{"p-divider-right":r.layout==="horizontal"&&r.align==="right"},{"p-divider-top":r.layout==="vertical"&&r.align==="top"},{"p-divider-center":r.layout==="vertical"&&(!r.align||r.align==="center")},{"p-divider-bottom":r.layout==="vertical"&&r.align==="bottom"}],content:"p-divider-content"},Y0=(()=>{class r extends zn{name="divider";theme=Mc;classes=Pc;inlineStyles=Uc;static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var Gc=(()=>{class r extends Xn{style;styleClass;layout="horizontal";type="solid";align;_componentStyle=te(Y0);get hostClass(){return this.styleClass}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["p-divider"]],hostVars:33,hostBindings:function(o,i){o&2&&(Ve("aria-orientation",i.layout)("data-pc-name","divider")("role","separator"),Bt(i.hostClass),ga("justify-content",i.layout==="horizontal"?i.align==="center"||i.align===void 0?"center":i.align==="left"?"flex-start":i.align==="right"?"flex-end":null:null)("align-items",i.layout==="vertical"?i.align==="center"||i.align===void 0?"center":i.align==="top"?"flex-start":i.align==="bottom"?"flex-end":null:null),ve("p-divider",!0)("p-component",!0)("p-divider-horizontal",i.layout==="horizontal")("p-divider-vertical",i.layout==="vertical")("p-divider-solid",i.type==="solid")("p-divider-dashed",i.type==="dashed")("p-divider-dotted",i.type==="dotted")("p-divider-left",i.layout==="horizontal"&&(!i.align||i.align==="left"))("p-divider-center",i.layout==="horizontal"&&i.align==="center"||i.layout==="vertical"&&(!i.align||i.align==="center"))("p-divider-right",i.layout==="horizontal"&&i.align==="right")("p-divider-top",i.layout==="vertical"&&i.align==="top")("p-divider-bottom",i.layout==="vertical"&&i.align==="bottom"))},inputs:{style:"style",styleClass:"styleClass",layout:"layout",type:"type",align:"align"},features:[yn([Y0]),dn],ngContentSelectors:Fc,decls:2,vars:0,consts:[[1,"p-div
82ider-content"]],template:function(o,i){o&1&&(ba(),n(0,"div",0),ya(1),a())},dependencies:[Zt,si],encapsulation:2,changeDetection:0})}return r})(),gl=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[Gc]})}return r})();var kc=["*"],Vc={root:"p-inputgroupaddon"},Q0=(()=>{class r extends zn{name="inputgroupaddon";classes=Vc;static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})(),mo=(()=>{class r extends Xn{style;styleClass;_componentStyle=te(Q0);get hostStyle(){return this.style}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["p-inputgroup-addon"],["p-inputGroupAddon"]],hostVars:7,hostBindings:function(o,i){o&2&&(Ve("data-pc-name","inputgroupaddon"),Pt(i.hostStyle),Bt(i.styleClass),ve("p-inputgroupaddon",!0))},inputs:{style:"style",styleClass:"styleClass"},features:[yn([Q0]),dn],ngContentSelectors:kc,decls:1,vars:0,template:function(o,i){o&1&&(ba(),ya(0))},dependencies:[Zt],encapsulation:2})}return r})(),Tl=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[mo,si,si]})}return r})();var qc=["*"],Bc=({dt:r})=>` 83.p-inputgroup, 84.p-inputgroup .p-floatlabel, 85.p-inputgroup .p-iftalabel { 86 display: flex; 87 align-items: stretch; 88 width: 100%; 89} 90 91.p-inputgroup .p-inputtext, 92.p-inputgroup .p-inputwrapper { 93 flex: 1 1 auto; 94 width: 1%; 95} 96 97.p-inputgroupaddon { 98 display: flex; 99 align-items: center; 100 justify-content: center; 101 padding: ${r("inputgroup.addon.padding")}; 102 background: ${r("inputgroup.addon.background")}; 103 color: ${r("inputgroup.addon.color")}; 104 border-block-start: 1px solid ${r("inputgroup.addon.border.color")}; 105 border-block-end: 1px solid ${r("inputgroup.addon.border.color")}; 106 min-width: ${r("inputgroup.addon.min.width")}; 107} 108 109.p-inputgroupaddon:first-child, 110.p-inputgroupaddon + .p-inputgroupaddon { 111 border-inline-start: 1px solid ${r("inputgroup.addon.border.color")}; 112} 113 114.p-inputgroupaddon:last-child { 115 border-inline-end: 1px solid ${r("inputgroup.addon.border.color")}; 116} 117 118.p-inputgroupaddon:has(.p-button) { 119 padding: 0; 120 overflow: hidden; 121} 122 123.p-inputgroupaddon .p-button { 124 border-radius: 0; 125} 126 127.p-inputgroup > .p-component, 128.p-inputgroup > .p-inputwrapper > .p-component, 129.p-inputgroup:first-child > p-button > .p-button, 130.p-inputgroup > .p-floatlabel > .p-component, 131.p-inputgroup > .p-floatlabel > .p-inputwrapper > .p-component, 132.p-inputgroup > .p-iftalabel > .p-component, 133.p-inputgroup > .p-iftalabel > .p-inputwrapper > .p-component { 134 border-radius: 0; 135 margin: 0; 136} 137 138.p-inputgroupaddon:first-child, 139.p-inputgroup > .p-component:first-child, 140.p-inputgroup > .p-inputwrapper:first-child > .p-component, 141.p-inputgroup > .p-floatlabel:first-child > .p-component, 142.p-inputgroup > .p-floatlabel:first-child > .p-inputwrapper > .p-component, 143.p-inputgroup > .p-iftalabel:first-child > .p-component, 144.p-inputgroup > .p-iftalabel:first-child > .p-inputwrapper > .p-component { 145 border-start-start-radius: ${r("inputgroup.addon.border.radius")}; 146 border-end-start-radius: ${r("inputgroup.addon.border.radius")}; 147} 148 149.p-inputgroupaddon:last-child, 150.p-inputgroup > .p-component:last-child, 151.p-inputgroup > .p-inputwrapper:last-child > .p-component, 152.p-inputgroup > .p-floatlabel:last-child > .p-component, 153.p-inputgroup > .p-floatlabel:last-child > .p-inputwrapper > .p-component, 154.p-inputgroup > .p-iftalabel:last-child > .p-component, 155.p-inputgroup > .p-iftalabel:last-child > .p-inputwrapper > .p-component { 156 border-start-end-radius: ${r("inputgroup.addon.border.radius")}; 157 border-end-end-radius: ${r("inputgroup.addon.border.radius")}; 158} 159 160.p-inputgroup .p-component:focus, 161.p-inputgroup .p-component.p-focus, 162.p-inputgroup .p-inputwrapper-focus, 163.p-inputgroup .p-component:focus ~ label, 164.p-inputgroup .p-component.p-focus ~ label, 165.p-inputgroup .p-inputwrapper-focus ~ label { 166 z-index: 1; 167} 168 169.p-inputgroup > .p-button:not(.p-button-icon-only) { 170 width: auto; 171} 172 173/*For PrimeNG*/ 174 175.p-inputgroup p-button:first-child, .p-inputgroup p-button:last-child { 176 display: inline-flex; 177} 178 179.p-inputgroup:has(> p-button:first-child) .p-button{ 180 border-start-start-radius: ${r("inputgroup.addon.border.radiu
180s")}; 181 border-end-start-radius: ${r("inputgroup.addon.border.radius")}; 182} 183 184.p-inputgroup:has(> p-button:last-child) .p-button { 185 border-start-end-radius: ${r("inputgroup.addon.border.radius")}; 186 border-end-end-radius: ${r("inputgroup.addon.border.radius")}; 187} 188`,Hc={root:({props:r})=>["p-inputgroup",{"p-inputgroup-fluid":r.fluid}]},$0=(()=>{class r extends zn{name="inputgroup";theme=Bc;classes=Hc;static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var co=(()=>{class r extends Xn{style;styleClass;_componentStyle=te($0);static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["p-inputgroup"],["p-inputGroup"],["p-input-group"]],hostAttrs:[1,"p-inputgroup"],hostVars:5,hostBindings:function(o,i){o&2&&(Ve("data-pc-name","inputgroup"),Pt(i.style),Bt(i.styleClass))},inputs:{style:"style",styleClass:"styleClass"},features:[yn([$0]),dn],ngContentSelectors:qc,decls:1,vars:0,template:function(o,i){o&1&&(ba(),ya(0))},dependencies:[Zt,si],encapsulation:2})}return r})(),Il=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[co,si,si]})}return r})();var Wc=["content"],jc=["footer"],Yc=["header"],Qc=["clearicon"],Kc=["hideicon"],$c=["showicon"],zc=["input"],Xc=()=>({class:"p-password-toggle-mask-icon p-password-mask-icon"}),Zc=(r,d)=>({showTransitionParams:r,hideTransitionParams:d}),Jc=r=>({value:"visible",params:r}),eu=r=>({width:r});function tu(r,d){if(r&1){let t=b();n(0,"TimesIcon",8),h("click",function(){E(t);let i=m(2);return S(i.clear())}),a()}r&2&&Ve("data-pc-section","clearIcon")}function iu(r,d){}function nu(r,d){r&1&&_(0,iu,0,0,"ng-template")}function au(r,d){if(r&1){let t=b();Ta(0),_(1,tu,1,1,"TimesIcon",7),n(2,"span",8),h("click",function(){E(t);let i=m();return S(i.clear())}),_(3,nu,1,0,null,9),a(),Ia()}if(r&2){let t=m();l(),p("ngIf",!t.clearIconTemplate&&!t._clearIconTemplate),l(),Ve("data-pc-section","clearIcon"),l(),p("ngTemplateOutlet",t.clearIconTemplate||t._clearIconTemplate)}}function ru(r,d){if(r&1){let t=b();n(0,"EyeSlashIcon",12),h("click",function(){E(t);let i=m(3);
188return S(i.onMaskToggle())}),a()}r&2&&Ve("data-pc-section","hideIcon")}function ou(r,d){}function lu(r,d){r&1&&_(0,ou,0,0,"ng-template")}function su(r,d){if(r&1){let t=b();n(0,"span",13),h("click",function(){E(t);let i=m(3);return S(i.onMaskToggle())}),_(1,lu,1,0,null,14),a()}if(r&2){let t=m(3);l(),p("ngTemplateOutlet",t.hideIconTemplate||t._hideIconTemplate)("ngTemplateOutletContext",ne(2,Xc))}}function du(r,d){if(r&1&&(Ta(0),_(1,ru,1,1,"EyeSlashIcon",10)(2,su,2,3,"span",11),Ia()),r&2){let t=m(2);l(),p("ngIf",!t.hideIconTemplate&&!t._hideIconTemplate),l(),p("ngIf",t.hideIconTemplate||t._hideIconTemplate)}}function pu(r,d){if(r&1){let t=b();n(0,"EyeIcon",12),h("click",function(){E(t);let i=m(3);return S(i.onMaskToggle())}),a()}r&2&&Ve("data-pc-section","showIcon")}function mu(r,d){}function cu(r,d){r&1&&_(0,mu,0,0,"ng-template")}function uu(r,d){if(r&1){let t=b();n(0,"span",13),h("click",function(){E(t);let i=m(3);return S(i.onMaskToggle())}),_(1,cu,1,0,null,9),a()}if(r&2){let t=m(3);l(),p("ngTemplateOutlet",t.showIconTemplate||t._showIconTemplate)}}function _u(r,d){if(r&1&&(Ta(0),_(1,pu,1,1,"EyeIcon",10)(2,uu,2,1,"span",11),Ia()),r&2){let t=m(2);l(),p("ngIf",!t.showIconTemplate&&!t._showIconTemplate),l(),p("ngIf",t.showIconTemplate||t._showIconTemplate)}}function Eu(r,d){if(r&1&&(Ta(0),_(1,du,3,2,"ng-container",5)(2,_u,3,2,"ng-container",5),Ia()),r&2){let t=m();l(),p("ngIf",t.unmasked),l(),p("ngIf",!t.unmasked)}}function Su(r,d){r&1&&xr(0)}function xu(r,d){r&1&&xr(0)}function fu(r,d){if(r&1&&(Ta(0),_(1,xu,1,0,"ng-container",9),Ia()),r&2){let t=m(2);l(),p("ngTemplateOutlet",t.contentTemplate||t._contentTemplate)}}function hu(r,d){if(r&1&&(n(0,"div",17)(1,"div",18),R(2,"div",3),I(3,"mapper"),a(),n(4,"div",19),e(5),a()()),r&2){let t=m(2);l(),Ve("data-pc-section","meter"),l(),p("ngClass",$e(3,6,t.meter,t.strengthClass))("ngStyle",pe(9,eu,t.meter?t.meter.width:"")),Ve("data-pc-section","meterLabel"),l(2),Ve("data-pc-section","info"),l(),v(t.infoText)}}function Cu(r,d){r&1&&xr(0)}function vu(r,d){if(r&1){let t=b();n(0,"div",15,1),h("click",function(i){E(t);let s=m();return S(s.onOverlayClick(i))})("@overlayAnimation.start",function(i){E(t);let s=m();return S(s.onAnimationStart(i))})("@overlayAnimation.done",function(i){E(t);let s=m();return S(s.onAnimationEnd(i))}),_(2,Su,1,0,"ng-container",9)(3,fu,2,1,"ng-container",16)(4,hu,6,11,"ng-template",null,2,A)(6,Cu,1,0,"ng-container",9),a()}if(r&2){let t=Ee(5),o=m();p("@overlayAnimation",pe(9,Jc,Kn(6,Zc,o.showTransitionOptions,o.hideTransitionOptions))),Ve("data-pc-section","panel"),l(2),p("ngTemplateOutlet",o.headerTemplate||o._headerTemplate),l(),p("ngIf",o.contentTemplate||o._contentTemplate)("ngIfElse",t),l(3),p("ngTemplateOutlet",o.footerTemplate||o._footerTemplate)}}var gu=({dt:r})=>` 189.p-password { 190 display: inline-flex; 191 position: relative; 192} 193 194.p-password .p-password-overlay { 195 min-width: 100%; 196} 197 198.p-password-meter { 199 height: ${r("password.meter.height")}; 200 background: ${r("password.meter.background")}; 201 border-radius: ${r("password.meter.border.radius")}; 202} 203 204.p-password-meter-label { 205 height: 100%; 206 width: 0; 207 transition: width 1s ease-in-out; 208 border-radius: ${r("password.meter.border.radius")}; 209} 210 211.p-password-meter-weak { 212 background: ${r("password.strength.weak.background")}; 213} 214 215.p-password-meter-medium { 216 background: ${r("password.strength.medium.background")}; 217} 218 219.p-password-meter-strong { 220 background: ${r("password.strength.strong.background")}; 221} 222 223.p-password-fluid { 224 display: flex; 225} 226 227.p-password-fluid .p-password-input { 228 width: 100%; 229} 230 231.p-password-input::-ms-reveal, 232.p-password-input::-ms-clear { 233 display: none; 234} 235 236.p-password-overlay { 237 position: absolute; 238 padding: ${r("password.overlay.padding")}; 239 background: ${r("password.overlay.background")}; 240 color: ${r("password.overlay.color")}; 241 border: 1px solid ${r("password.overlay.border.color")}; 242 box-shadow: ${r("password.overlay.shadow")}; 243 border-radius: ${r("password.overlay.border.radius")}; 244} 245 246.p-password-content { 247 display: flex; 248 flex-direction: column; 249 gap: ${r("password.content.gap")}; 250} 251 252.p-password-toggle-mask-icon { 253 inset-inline-end: ${r("form.field.padding.x")}; 254 color: ${r("password.icon.color")}; 255 position: absolute; 256 top: 50%; 257 margin-top: calc(-1 * calc(${r("icon.size")} / 2)); 258 width: ${r("icon.size")}; 259 height: ${r("icon.size")}; 260} 261 262.p-password:has(.p-password-toggle-mask-icon) .p-password-clear-icon, 263.p-password:has(.p-password-toggle-mask-icon) .p-password-input { 264 padding-inline-end: calc((${r("form.field.padding.x")} * 2) + ${r("icon.size")}); 265} 266 267/* For PrimeNG */ 268p-password.ng-invalid.ng-dirty .p-inputtext {
269 border-color: ${r("inputtext.invalid.border.color")}; 270} 271 272p-password.ng-invalid.ng-dirty .p-inputtext:enabled:focus { 273 border-color: ${r("inputtext.focus.border.color")}; 274} 275 276p-password.ng-invalid.ng-dirty .p-inputtext::placeholder { 277 color: ${r("inputtext.invalid.placeholder.color")}; 278} 279 280.p-password-clear-icon { 281 position: absolute; 282 top: 50%; 283 margin-top: -0.5rem; 284 cursor: pointer; 285 inset-inline-end: ${r("form.field.padding.x")}; 286 color: ${r("form.field.icon.color")}; 287} 288 289.p-password-fluid-directive { 290 width:100% 291} 292`,Tu={root:({instance:r})=>({position:r.appendTo==="self"?"relative":void 0})},Iu={root:({instance:r})=>({"p-password p-component p-inputwrapper":!0,"p-inputwrapper-filled":r.filled(),"p-variant-filled":'instance.variant === "filled" || instance.config.inputVariant() === "filled" || instance.config.inputStyle() === "filled"',"p-inputwrapper-focus":r.focused,"p-password-fluid":r.hasFluid}),pcInput:"p-password-input",maskIcon:"p-password-toggle-mask-icon p-password-mask-icon",unmaskIcon:"p-password-toggle-mask-icon p-password-unmask-icon",overlay:"p-password-overlay p-component",content:"p-password-content",meter:"p-password-meter",meterLabel:({instance:r})=>`p-password-meter-label ${r.meter?"p-password-meter-"+r.meter.strength:""}`,meterText:"p-password-meter-text"},X0=(()=>{class r extends zn{name="password";theme=gu;classes=Iu;inlineStyles=Tu;static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var bu=(()=>{class r{transform(t,o,...i){return o(t,...i)}static \u0275fac=function(o){return new(o||r)};static \u0275pipe=Sd({name:"mapper",type:r,pure:!0})}return r})(),yu={provide:Od,useExisting:ud(()=>Ya),multi:!0},Ya=(()=>{class r extends Xn{ariaLabel;fluid;ariaLabelledBy;label;disabled;promptLabel;mediumRegex="^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})";strongRegex="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})";weakLabel;mediumLabel;maxLength;strongLabel;inputId;feedback=!0;appendTo;toggleMask;size;inputStyleClass;styleClass;style;inputStyle;showTransitionOptions=".12s cubic-bezier(0, 0, 0.2, 1)";hideTransitionOptions=".1s linear";autocomplete;placeholder;showClear=!1;autofocus;variant;tabindex;onFocus=new Yt;onBlur=new Yt;onClear=new Yt;input;contentTemplate;footerTemplate;headerTemplate;clearIconTemplate;hideIconTemplate;showIconTemplate;templates;_contentTemplate;_footerTemplate;_headerTemplate;_clearIconTemplate;_hideIconTemplate;_showIconTemplate;overlayVisible=!1;meter;infoText;focused=!1;unmasked=!1;mediumCheckRegExp;strongCheckRegExp;resizeListener;scrollHandler;overlay;value=null;onModelChange=()=>{};onModelTouched=()=>{};translationSubscription;_componentStyle=te(X0);get hasFluid(){let o=this.el.nativeElement.closest("p-fluid");return this.fluid||!!o}overlayService=te(Ld);ngOnInit(){super.ngOnInit(),this.infoText=this.promptText(),this.mediumCheckRegExp=new RegExp(this.mediumRegex),this.strongCheckRegExp=new RegExp(this.strongRegex),this.translationSubscription=this.config.translationObserver.subscribe(()=>{this.updateUI(this.value||"")})}
292ngAfterContentInit(){this.templates.forEach(t=>{switch(t.getType()){case"content":this._contentTemplate=t.template;break;case"header":this._headerTemplate=t.template;break;case"footer":this._footerTemplate=t.template;break;case"clearicon":this._clearIconTemplate=t.template;break;case"hideicon":this._hideIconTemplate=t.template;break;case"showicon":this._showIconTemplate=t.template;break;default:this._contentTemplate=t.template;break}})}onAnimationStart(t){switch(t.toState){case"visible":this.overlay=t.element,qo.set("overlay",this.overlay,this.config.zIndex.overlay),this.appendContainer(),this.alignOverlay(),this.bindScrollListener(),this.bindResizeListener();break;case"void":this.unbindScrollListener(),this.unbindResizeListener(),this.overlay=null;break}}onAnimationEnd(t){switch(t.toState){case"void":qo.clear(t.element);break}}appendContainer(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.overlay):this.document.getElementById(this.appendTo).appendChild(this.overlay))}alignOverlay(){this.appendTo?(this.overlay.style.minWidth=Ad(this.input.nativeElement)+"px",yd(this.overlay,this.input.nativeElement)):Rd(this.overlay,this.input.nativeElement)}onInput(t){this.value=t.target.value,this.onModelChange(this.value)}onInputFocus(t){this.focused=!0,this.feedback&&(this.overlayVisible=!0),this.onFocus.emit(t)}onInputBlur(t){this.focused=!1,this.feedback&&(this.overlayVisible=!1),this.onModelTouched(),this.onBlur.emit(t)}onKeyUp(t){if(this.feedback){let o=t.target.value;if(this.updateUI(o),t.code==="Escape"){this.overlayVisible&&(this.overlayVisible=!1);return}this.overlayVisible||(this.overlayVisible=!0)}}updateUI(t){let o=null,i=null;switch(this.testStrength(t)){case 1:o=this.weakText(),i={strength:"weak",width:"33.33%"};break;case 2:o=this.mediumText(),i={strength:"medium",width:"66.66%"};break;case 3:o=this.strongText(),i={strength:"strong",width:"100%"};break;default:o=this.promptText(),i=null;break}this.meter=i,this.infoText=o}
292onMaskToggle(){this.unmasked=!this.unmasked}onOverlayClick(t){this.overlayService.add({originalEvent:t,target:this.el.nativeElement})}testStrength(t){let o=0;return this.strongCheckRegExp.test(t)?o=3:this.mediumCheckRegExp.test(t)?o=2:t.length&&(o=1),o}writeValue(t){t===void 0?this.value=null:this.value=t,this.feedback&&this.updateUI(this.value||""),this.cd.markForCheck()}registerOnChange(t){this.onModelChange=t}registerOnTouched(t){this.onModelTouched=t}setDisabledState(t){this.disabled=t,this.cd.markForCheck()}bindScrollListener(){Jr(this.platformId)&&(this.scrollHandler||(this.scrollHandler=new qd(this.input.nativeElement,()=>{this.overlayVisible&&(this.overlayVisible=!1)})),this.scrollHandler.bindScrollListener())}bindResizeListener(){if(Jr(this.platformId)&&!this.resizeListener){let t=this.document.defaultView;this.resizeListener=this.renderer.listen(t,"resize",()=>{this.overlayVisible&&!wd()&&(this.overlayVisible=!1)})}}unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}unbindResizeListener(){this.resizeListener&&(this.resizeListener(),this.resizeListener=null)}containerClass(t){return{"p-password p-component p-inputwrapper":!0,"p-input-icon-right":t}}get rootClass(){return this._componentStyle.classes.root({instance:this})}inputFieldClass(t){return{"p-password-input":!0,"p-disabled":t}}strengthClass(t){return`p-password-meter-label p-password-meter${t?.strength?`-${t.strength}`:""}`}filled(){return this.value!=null&&this.value.toString().length>0}promptText(){return this.promptLabel||this.getTranslation(eo.PASSWORD_PROMPT)}weakText(){return this.weakLabel||this.getTranslation(eo.WEAK)}mediumText(){return this.mediumLabel||this.getTranslation(eo.MEDIUM)}strongText(){return this.strongLabel||this.getTranslation(eo.STRONG)}restoreAppend(){this.overlay&&this.appendTo&&(this.appendTo==="body"?this.renderer.removeChild(this.document.body,this.overlay):this.document.getElementById(this.appendTo).removeChild(this.overlay))}inputType(t){return t?"text":"password"}getTranslation(t){return this.config.getTranslation(t)}clear(){this.value=null,this.onModelChange(this.value),this.writeValue(this.value),this.onClear.emit()}ngOnDestroy(){this.overlay&&(qo.clear(this.overlay),this.overlay=null),this.restoreAppend(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.translationSubscription&&this.translationSubscription.unsubscribe(),super.ngOnDestroy()}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["p-password"]],contentQueries:function(o,i,s){if(o&1&&(Vn(s,Wc,4),Vn(s,jc,4),Vn(s,Yc,4),Vn(s,Qc,4),Vn(s,Kc,4),Vn(s,$c,4),Vn(s,Pe,4)),o&2){let c;Y(c=Q())&&(i.contentTemplate=c.first),Y(c=Q())&&(i.footerTemplate=c.first),Y(c=Q())&&(i.headerTemplate=c.first),Y(c=Q())&&(i.clearIconTemplate=c.first),Y(c=Q())&&(i.hideIconTemplate=c.first),Y(c=Q())&&(i.showIconTemplate=c.first),Y(c=Q())&&(i.templates=c)}},viewQuery:function(o,i){if(o&1&&X(zc,5),o&2){let s;Y(s=Q())&&(i.input=s.first)}},inputs:{ariaLabel:"ariaLabel",fluid:[2,"fluid","fluid",qn],ariaLabelledBy:"ariaLabelledBy",label:"label",disabled:[2,"disabled","disabled",qn],promptLabel:"promptLabel",mediumRegex:"mediumRegex",strongRegex:"strongRegex",weakLabel:"weakLabel",mediumLabel:"mediumLabel",maxLength:[2,"maxLength","maxLength",Es],strongLabel:"strongLabel",inputId:"inputId",feedback:[2,"feedback","feedback",qn],appendTo:"appendTo",toggleMask:[2,"toggleMask","toggleMask",qn],size:"size",inputStyleClass:"inputStyleClass",styleClass:"styleClass",style:"style",inputStyle:"inputStyle",showTransitionOptions:"showTransitionOptions",hideTransitionOptions:"hideTransitionOptions",autocomplete:"autocomplete",placeholder:"placeholder",showClear:[2,"showClear","showClear",qn],autofocus:[2,"autofocus","autofocus",qn],variant:"variant",tabindex:[2,"tabindex","tabindex",Es]},outputs:{onFocus:"onFocus",onBlur:"onBlur",onClear:"onClear"},features:[yn([yu,X0]),dn],decls:8,vars:34,consts:[["input",""],["overlay",""],["content",""],[3,"ngClass","ngStyle"],["pInputText","",3,"input","focus","blur","keyup","disabled","pSize","ngClass","ngStyle","value","variant","pAutoFocus"],[4,"ngIf"],["class","p-password-overlay p-component",3,"click",4,"ngIf"],["class","p-password-clear-icon",3,"click",4,"ngIf"],[1,"p-password-clear-icon",3,"click"],[4,"ngTemplateOutlet"],["class","p-password-toggle-mask-icon p-password-mask-icon",3,"click",4,"ngIf"],[3,"click",4,"ngIf"],[1,"p-password-toggle-mask-icon","p-password-mask-icon",3,"click"],[3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"p-password-overlay","p-component",3,"click"],[4,"ngIf","ngIfElse"],[1,"p-password-content"],[1,"p-password-meter"],[1,"p-password-meter-text"]],template:function(o,i){if(o&1){let s=b();n(0,"div",3)(1,"input",4,0),I(3,"mapper"),I(4,"mapper"),h("input",function(u){return E(s),S(i.onInput(u))})("focus",function(u){return E(s),S(i.onInputFocus(u))})("blur",function(u){return E(s),S(i.onInputBlur(u))})("keyup",function(u){return E(s),S(i.onKeyUp(u))}),a(),_(5,au,4,3,"ng-container",5)(6,Eu,3,2,"ng-container",5)(7,vu,7,11,"div",6),a()}o&2&&(Bt(i.styleClass),p("ngClass",i.rootClass)("ngStyle",i.style),Ve("data-pc-name","password")("data-pc-section","root"),l(),Bt(i.inputStyleClass),p("disabled",i.disabled)("pSize",i.size)("ngClass",$e(3,28,i.disabled,i.inputFieldClass))("ngStyle",i.inputStyle)("value",i.value)("variant",i.variant)("pAutoFocus",
292i.autofocus),Ve("label",i.label)("aria-label",i.ariaLabel)("aria-labelledBy",i.ariaLabelledBy)("id",i.inputId)("tabindex",i.tabindex)("type",$e(4,31,i.unmasked,i.inputType))("placeholder",i.placeholder)("autocomplete",i.autocomplete)("maxlength",i.maxLength)("data-pc-section","input"),l(4),p("ngIf",i.showClear&&i.value!=null),l(),p("ngIf",i.toggleMask),l(),p("ngIf",i.overlayVisible))},dependencies:[Zt,Qe,Uo,Po,$n,ye,Bd,Wd,W0,H0,bu,si],encapsulation:2,data:{animation:[Vd("overlayAnimation",[hs(":enter",[fs({opacity:0,transform:"scaleY(0.8)"}),xs("{{showTransitionParams}}")]),hs(":leave",[xs("{{hideTransitionParams}}",fs({opacity:0}))])])]},changeDetection:0})}return r})(),Z0=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[Ya,si,si]})}return r})();var Au=()=>["general"],Ru=()=>["work-order"],wu=()=>["subscription"],Du=()=>["inventory"],Lu=()=>["event"],Nu=()=>["gis"],Ou=()=>["integrations"],Fu=()=>["developer"];function Mu(r,d){r&1&&(e(0,` 293 `),n(1,"span",9),e(2,"APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION"),a(),e(3,` 294 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 295 `))}function Uu(r,d){r&1&&(e(0,` 296 `),n(1,"p-button",8),e(2,` 297 `),_(3,Mu,7,0,"ng-template",null,0,A),e(5,` 298 `),a(),e(6,` 299 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,wu))("fluid",!0))}function Pu(r,d){r&1&&(e(0,` 300 `),n(1,"span",9),e(2,"APP_SETTINGS.GENERAL.GENERAL"),a(),e(3,` 301 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 302 `))}function Gu(r,d){r&1&&(e(0,` 303 `),n(1,"span",9),e(2,"APP_SETTINGS.WORK_ORDER.WORK_ORDER"),a(),e(3,` 304 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 305 `))}function ku(r,d){r&1&&(e(0,` 306 `),n(1,"span",9),e(2,"APP_SETTINGS.INVENTORY.INVENTORY"),a(),e(3,` 307 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 308 `))}function Vu(r,d){r&1&&(e(0,` 309 `),n(1,"p-button",11),e(2,` 310 `),_(3,ku,7,0,"ng-template",null,0,A),e(5,` 311 `),a(),e(6,` 312 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,Du))("fluid",!0))}function qu(r,d){r&1&&(e(0,` 313 `),n(1,"span",9),e(2,"APP_SETTINGS.EVENT.EVENTS"),a(),e(3,` 314 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 315 `))}function Bu(r,d){r&1&&(e(0,` 316 `),n(1,"p-button",12),e(2,` 317 `),_(3,qu,7,0,"ng-template",null,0,A),e(5,` 318 `),a(),e(6,` 319 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,Lu))("fluid",!0))}function Hu(r,d){r&1&&(e(0,` 320 `),n(1,"span",9),e(2,"APP_SETTINGS.GIS.GIS"),a(),e(3,` 321 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 322 `))}function Wu(r,d){r&1&&(e(0,` 323 `),n(1,"p-button",13),e(2,` 324 `),_(3,Hu,7,0,"ng-template",null,0,A),e(5,` 325 `),a(),e(6,` 326 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,Nu))("fluid",!0))}function ju(r,d){r&1&&(e(0,` 327 `),n(1,"span",9),e(2,"APP_SETTINGS.INTEGRATIONS.INTEGRATIONS"),a(),e(3,` 328 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 329 `))}function Yu(r,d){r&1&&(e(0,` 330 `),n(1,"p-button",14),e(2,` 331 `),_(3,ju,7,0,"ng-template",null,0,A),e(5,` 332 `),a(),e(6,` 333 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,Ou))("fluid",!0))}function Qu(r,d){r&1&&(e(0,` 334 `),n(1,"span",9),e(2,"APP_SETTINGS.DEVELOPER.DEVELOPER"),a(),e(3,` 335 `),n(4,"i",10),e(5,"chevron_right"),a(),e(6,` 336 `))}function Ku(r,d){r&1&&(e(0,` 337 `),n(1,"p-button",15),e(2,` 338 `),_(3,Qu,7,0,"ng-template",null,0,A),e(5,` 339 `),a(),e(6,` 340 `)),r&2&&(l(),p("text",!0)("routerLink",ne(3,Fu))("fluid",!0))}function $u(r,d){if(r&1&&(e(0,` 341 `),e(1,` 342 `),_(2,Uu,7,4),n(3,"p-button",6),e(4,` 343 `),_(5,Pu,7,0,"ng-template",null,0,A),e(7,` 344 `),a(),e(8,` 345 `),n(9,"p-button",7),e(10,` 346 `),_(11,Gu,7,0,"ng-template",null,0,A),e(13,` 347 `),a(),e(14,` 348 `),_(15,Vu,7,4)(16,Bu,7,4)(17,Wu,7,4)(18,Yu,7,4)(19,Ku,7,4)),r&2){let t=m();
348l(2),f(t.isSuperUser()?2:-1),l(),p("text",!0)("routerLink",ne(12,Au))("fluid",!0),l(6),p("text",!0)("routerLink",ne(13,Ru))("fluid",!0),l(6),f(t.inventoryManagementDisabled()?-1:15),l(),f(t.hasEventModule()?16:-1),l(),f(t.hasGisModule()?17:-1),l(),f(t.hasEventModule()?18:-1),l(),f(t.hasApiAccess()?19:-1)}}var J0=(()=>{class r{authService;userService;isSuperUser=D(!1);canManageAppSubscription=D(!1);displaySpinner=D(!0);hasApiAccess=D(!1);showButtons=D(!1);apiDisabled=D(!0);inventoryManagementDisabled=D(!0);hasEventModule=D(!1);hasGisModule=D(!1);card={colorScheme:{light:{bodyPadding:"0"}}};constructor(t,o){this.authService=t,this.userService=o,this.apiDisabled.set(!this.authService.qwareSubscription?.apiAccess),this.inventoryManagementDisabled.set(!this.authService.qwareSubscription?.inventoryManagement),this.hasEventModule.set(this.authService.tenant.EventsModule),this.hasGisModule.set(this.authService.tenant.GisModule),this.isSuperUser.set(this.authService.userHasPrivilege(ae.IS_SUPER_USER)),this.canManageAppSubscription.set(this.authService.userHasPrivilege(ae.CAN_MANAGE_APP_SUBSCRIPTION)),this.hasApiAccess.set(!this.apiDisabled()&&this.isSuperUser())}ngOnInit(){this.authService.currentUser?.Id?this.userService.getUserSettings(this.authService.currentUser?.Id).subscribe(t=>{let o=t;if(o&&o.length>0){let i=o.find(s=>s.TenantId===this.authService.tenant.Id);this.hasApiAccess.set(!this.apiDisabled()&&(i?.HasApiAccess??this.isSuperUser()))}this.displayButtons()}):this.displayButtons()}displayButtons(){this.showButtons.set(!0),this.displaySpinner.set(!1)}static \u0275fac=function(o){return new(o||r)(g(de),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-app-settings"]],standalone:!1,decls:16,vars:3,consts:[["content",""],[1,"col-12"],[1,"form-container"],["translate","","id","qware.app-settings.page-header",1,"page-header"],[3,"dt"],["id","qware.app-settings.developer.spinner",3,"displaySpinner"],["id","qware.app-settings.general-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.work-order-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.subscription-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["translate","",1,"p-button-label"],[1,"material-icons"],["id","qware.app-settings.inventory-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.events-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.gis-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.integrations-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"],["id","qware.app-settings.developer-button","severity","secondary","styleClass","app-settings-button","type","button",1,"button-container",3,"text","routerLink","fluid"]],template:function(o,i){o&1&&(n(0,"div",1),e(1,` 349 `),n(2,"div",2),e(3,` 350 `),n(4,"h3",3),e(5,` 351 APP_SETTINGS.APP_SETTINGS 352 `),a(),e(6,` 353 `),n(7,"p-card",4),e(8,` 354 `),n(9,"qware-spinner",5),e(10,` 355 `),_(11,$u,20,14),a(),e(12,` 356 `),a(),e(13,` 357 `),a(),e(14,` 358`),a(),e(15,` 359`)),o&2&&(l(7),p("dt",i.card),l(2),p("displaySpinner",i.displaySpinner()),l(2),f(i.showButtons()?11:-1))},dependencies:[oe,Ie,me,et,$],styles:[`qware-app-settings .button-container .app-settings-button{border-width:0px 0px 1px 0px;border-color:var(--p-surface-600);border-radius:0;justify-content:space-between}qware-app-settings .button-container:first-of-type .app-settings-button{border-top-right-radius:4px;border-top-left-radius:4px}qware-app-settings .button-container:last-of-type .app-settings-button{border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-width:0px}qware-app-settings .button-container:not(:last-of-type) .app-settings-button:hover{border-width:0px 0px 1px 0px;border-color:var(--p-surface-600)}qware-app-settings .button-container:not(:last-of-type) .app-settings-button:active{border-width:0px 0px 1px 0px;border-color:var(--p-surface-600)} 360`],encapsulation:2})}return r})();var Sn=(()=>{class r{get API_URL(){return this.instanceDataService.BAS_CONNECT_URL}http=te(fr);instanceDataService=te(Zn);testConnection(t){let o=We.stringify(t),i=new tr("Content-Type: application/json");return this.http.post(this.API_URL+"connection/test",o,{headers:i})}getConnection(){return this.http.get(this.API_URL+"connection")}createConnection(t){let o=We.stringify(t),i=new tr("Content-Type: application/json");return this.http.post(this.API_URL+"connection",o,{headers:i})}updateConnection(t){let o=We.stringify(t),i=new tr("Content-Type: application/json");return this.http.put(this.API_URL+"connection",o,{headers:i})}discoverZones(t,o,i){let s=new ko;return s=s.set("host",t),s=s.set("port",o.toString()),s=s.set("deviceInstance",i.toString()),this.http.get(this.API_URL+"zones",{params:s})}getMappings(){return this.http.get(this.API_URL+"mappings")}createMapping(t){let o=We.stringify(t),i=new tr("Content-Type: application/json");return this.http.post(this.API_URL+"mappings",o,{headers:i})}createMappings(t){let o=We.stringify(t),i=new tr("Content-Type: application/json");return this.http.post(this.API_URL+"mappings/batch",o,{headers:i})}updateMapping(t,o){let i=We.stringify(o),s=new tr("Content-Type: application/json");return this.http.put(this.API_URL+"mappings/"+t,i,{headers:s})}deleteMapping(t){return this.http.delete(this.API_URL+"mappings/"+t)}deleteConnection(t){return this.http.delete(this.API_URL+"connection/"+t)}getAgentToken(){return this.http.get(this.API_URL+"token")}rotateAgentToken(){return this.http.post(this.API_URL+"rotateToken",null)}revokeAgentToken(){return this.http.post(this.API_URL+"revokeToken",null)}getAgentInstallerDownload(){return this.http.get(this.API_URL+"agent/download")}getRejectionCount(){return this.http.get(this.API_URL+"rejection-count")}getRejectedEvents(t){let o=new ko().set("pageNumber",t.pageNumber.toString()).set("pageSize",t.pageSize.toString());return this.http.get(this.API_URL+"rejected-events",{params:o})}getActivityLog(t){let o=new ko().set("pageNumber",t.pageNumber.toString()).set("pageSize",t.pageSize.toString());return t.dateFrom&&(o=o.set("dateFrom",t.dateFrom)),t.dateTo&&(o=o.set("dateTo",t.dateTo)),this.http.get(this.API_URL+"activity-log",{params:o})}static \u0275fac=function(o){return new(o||r)};static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var zu=["icon"],Xu=["*"];
360function Zu(r,d){if(r&1&&R(0,"span",4),r&2){let t=m(2);p("ngClass",t.icon)}}function Ju(r,d){if(r&1&&(Ta(0),_(1,Zu,1,1,"span",3),Ia()),r&2){let t=m();l(),p("ngIf",t.icon)}}function e_(r,d){}function t_(r,d){r&1&&_(0,e_,0,0,"ng-template")}function i_(r,d){if(r&1&&(n(0,"span",5),_(1,t_,1,0,null,6),a()),r&2){let t=m();l(),p("ngTemplateOutlet",t.iconTemplate||t._iconTemplate)}}var n_=({dt:r})=>` 361.p-tag { 362 display: inline-flex; 363 align-items: center; 364 justify-content: center; 365 background: ${r("tag.primary.background")}; 366 color: ${r("tag.primary.color")}; 367 font-size: ${r("tag.font.size")}; 368 font-weight: ${r("tag.font.weight")}; 369 padding: ${r("tag.padding")}; 370 border-radius: ${r("tag.border.radius")}; 371 gap: ${r("tag.gap")}; 372} 373 374.p-tag-icon { 375 font-size: ${r("tag.icon.size")}; 376 width: ${r("tag.icon.size")}; 377 height:${r("tag.icon.size")}; 378} 379 380.p-tag-rounded { 381 border-radius: ${r("tag.rounded.border.radius")}; 382} 383 384.p-tag-success { 385 background: ${r("tag.success.background")}; 386 color: ${r("tag.success.color")}; 387} 388 389.p-tag-info { 390 background: ${r("tag.info.background")}; 391 color: ${r("tag.info.color")}; 392} 393 394.p-tag-warn { 395 background: ${r("tag.warn.background")}; 396 color: ${r("tag.warn.color")}; 397} 398 399.p-tag-danger { 400 background: ${r("tag.danger.background")}; 401 color: ${r("tag.danger.color")}; 402} 403 404.p-tag-secondary { 405 background: ${r("tag.secondary.background")}; 406 color: ${r("tag.secondary.color")}; 407} 408 409.p-tag-contrast { 410 background: ${r("tag.contrast.background")}; 411 color: ${r("tag.contrast.color")}; 412} 413`,a_={root:({props:r})=>["p-tag p-component",{"p-tag-info":r.severity==="info","p-tag-success":r.severity==="success","p-tag-warn":r.severity==="warn","p-tag-danger":r.severity==="danger","p-tag-secondary":r.severity==="secondary","p-tag-contrast":r.severity==="contrast","p-tag-rounded":r.rounded}],icon:"p-tag-icon",label:"p-tag-label"},ep=(()=>{class r extends zn{name="tag";theme=n_;classes=a_;static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var lr=(()=>{class r extends Xn{get style(){return this._style}set style(t){this._style=t,this.cd.markForCheck()}styleClass;severity;value;icon;rounded;iconTemplate;templates;_iconTemplate;_style;_componentStyle=te(ep);ngAfterContentInit(){this.templates?.forEach(t=>{switch(t.getType()){case"icon":this._iconTemplate=t.template;break}})}containerClass(){let t="p-tag p-component";return this.severity&&(t+=` p-tag-${this.severity}`),this.rounded&&(t+=" p-tag-rounded"),this.styleClass&&(t+=` ${this.styleClass}`),t}static \u0275fac=(()=>{let t;return function(i){return(t||(t=Ci(r)))(i||r)}})();static \u0275cmp=B({type:r,selectors:[["p-tag"]],contentQueries:function(o,i,s){if(o&1&&(Vn(s,zu,4),Vn(s,Pe,4)),o&2){let c;Y(c=Q())&&(i.iconTemplate=c.first),Y(c=Q())&&(i.templates=c)}},hostVars:4,hostBindings:function(o,i){o&2&&(Pt(i.style),Bt(i.containerClass()))},inputs:{style:"style",styleClass:"styleClass",severity:"severity",value:"value",icon:"icon",rounded:[2,"rounded","rounded",qn]},features:[yn([ep]),dn],ngContentSelectors:Xu,decls:5,vars:3,consts:[[4,"ngIf"],["class","p-tag-icon",4,"ngIf"],[1,"p-tag-label"],["class","p-tag-icon",3,"ngClass",4,"ngIf"],[1,"p-tag-icon",3,"ngClass"],[1,"p-tag-icon"],[4,"ngTemplateOutlet"]],template:function(o,i){o&1&&(ba(),ya(0),_(1,Ju,2,1,"ng-container",0)(2,i_,2,1,"span",1),n(3,"span",2),e(4),a()),o&2&&(l(),p("ngIf",!i.iconTemplate&&!i._iconTemplate),l(),p("ngIf",i.iconTemplate||i._iconTemplate),l(2),v(i.value))},dependencies:[Zt,Qe,Uo,Po,si],encapsulation:2,changeDetection:0})}return r})(),Qa=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({imports:[lr,si,si]})}return r})();function r_(r,d){r&1&&(e(0,` 414 `),n(1,"tr"),e(2,` 415 `),n(3,"th",4),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.COL_EVENT"),a(),e(5,` 416 `),n(6,"th",4),e(7,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.COL_EVENT_START"),a(),e(8,` 417 `),n(9,"th",4),e(10,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.COL_REJECTED_AT"),a(),e(11,` 418 `),n(12,"th",4),e(13,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.COL_REASON"),a(),e(14,` 419 `),n(15,"th",4),e(16,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.COL_STATUS"),a(),e(17,` 420 `),a(),e(18,` 421 `))}
421function o_(r,d){if(r&1&&(e(0,` 422 `),n(1,"tr"),e(2,` 423 `),n(3,"td"),e(4),a(),e(5,` 424 `),n(6,"td"),e(7),I(8,"date"),a(),e(9,` 425 `),n(10,"td"),e(11),I(12,"date"),a(),e(13,` 426 `),n(14,"td"),e(15),a(),e(16,` 427 `),n(17,"td"),e(18,` 428 `),R(19,"p-tag",10),e(20,` 429 `),a(),e(21,` 430 `),a(),e(22,` 431 `)),r&2){let t=d.$implicit;l(4),v(t.EventName),l(3),v($e(8,5,t.EventStartUTC,"medium")),l(4),v(t.LastRejectedUTC?$e(12,8,t.LastRejectedUTC,"medium"):"\u2014"),l(4),v(t.LastRejectionReason||"\u2014"),l(4),p("value",t.Status)}}function l_(r,d){r&1&&(e(0,` 432 `),n(1,"tr"),e(2,` 433 `),n(3,"td",11),e(4,` 434 `),n(5,"div",12),e(6,` 435 'APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.EMPTY 436 `),a(),e(7,` 437 `),a(),e(8,` 438 `),a(),e(9,` 439 `))}var tp=(()=>{class r{basConnectService=te(Sn);ngLocation=te(vd);toastService=te(Se);translate=te(le);rows=D([]);totalCount=D(0);pageSize=D(25);firstRow=D(0);loading=D(!0);ngOnInit(){this.loadPage({first:0,rows:this.pageSize()})}loadPage(t){let o=t.first??0,i=t.rows??this.pageSize(),s=Math.floor(o/i)+1;this.firstRow.set(o),this.pageSize.set(i),this.loading.set(!0),this.basConnectService.getRejectedEvents({pageNumber:s,pageSize:i}).pipe(N()).subscribe({next:c=>{this.rows.set(c.Results??[]),this.totalCount.set(c.TotalResults??0),this.loading.set(!1)},error:()=>{this.loading.set(!1),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.LOAD_ERROR"]).pipe(N()).subscribe(c=>{this.toastService.error(c["SHARED.ERROR_LABEL"],c["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.LOAD_ERROR"])})}})}back(){this.ngLocation.back()}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-rejected-events"]],decls:34,vars:13,consts:[[1,"page-container"],[1,"page-header"],["type","button","severity","secondary","id","qware.app-settings.integrations.bas-rejected.back",3,"onClick","text","label"],[1,"material-icons"],["translate",""],[3,"displaySpinner"],["currentPageReportTemplate","{first}-{last} of {totalRecords}","id","qware.app-settings.integrations.bas-rejected.table",3,"onLazyLoad","value","paginator","rows","totalRecords","lazy","first","dataKey","showCurrentPageReport"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],["severity","warn",3,"value"],["colspan","5"],["translate","",1,"no-results"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 440 `),n(2,"div",1),e(3,` 441 `),n(4,"p-button",2),I(5,"translate"),h("onClick",function(){return i.back()}),e(6,` 442 `),n(7,"i",3),e(8,"arrow_back"),a(),e(9,` 443 `),a(),e(10,` 444 `),n(11,"h2",4),e(12,` 445 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.TITLE 446 `),a(),e(13,` 447 `),a(),e(14,` 448 449 `),n(15,"p-card"),e(16,` 450 `),n(17,"p",4),e(18,` 451 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.DESCRIPTION 452 `),a(),e(19,` 453 454 `),n(20,"qware-spinner",5),e(21,` 455 `),n(22,"p-table",6),h("onLazyLoad",function(c){return i.loadPage(c)}),e(23,` 456 `),_(24,r_,19,0,"ng-template",7),e(25,` 457 `),_(26,o_,23,11,"ng-template",8),e(27,` 458 `),_(28,l_,10,0,"ng-template",9),e(29,` 459 `),a(),e(30,` 460 `),a(),e(31,` 461 `),a(),e(32,` 462`),a(),e(33,` 463`)),o&2&&(l(4),p("text",!0)("label",y(5,11,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_LIST.BACK")),l(16),p("displaySpinner",i.loading()),l(2),p("value",i.rows())("paginator",!0)("rows",i.pageSize())("totalRecords",i.totalCount())("lazy",!0)("first",i.firstRow())("dataKey","Id")("showCurrentPageReport",!0))},dependencies:[vi,oe,Pe,Mn,Ie,Aa,me,ka,ht,Qa,lr,Qt,ie,$],styles:[".page-container[_ngcontent-%COMP%]{padding:1rem}.page-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:1rem}.page-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.no-results[_ngcontent-%COMP%]{padding:1rem;text-align:center;color:var(--text-color-secondary)}"],changeDetection:0})}return r})();var Ur=He(nt());var s_=["bodyDropdown"],d_=["bodyEditor"],p_=["selectionInput"],m_=["drawer"],c_=r=>({limit:r}),u_=r=>({"disabled-row":r}),ip=r=>({label:r}),np=(r,d)=>d.Id;function __(r,d){if(r&1&&(e(0,` 464 `),n(1,"small",22),e(2,` 465 `),n(3,"div",23),e(4),a(),e(5,` 466 `),a(),e(6,` 467 `)),r&2){let t=d.$implicit;l(4),v(t)}}function E_(r,d){if(r&1&&(e(0,` 468 `),G(1,__,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function S_(r,d){r&1&&(e(0,` 469 `),n(1,"div",24),e(2,` 470 `),n(3,"div",23),e(4,"CHECKLIST.DRAG_DROP"),a(),e(5,` 471 `),a(),e(6,` 472 `))}
472function x_(r,d){if(r&1&&(e(0,` 473 `),n(1,"span",36),e(2),a(),e(3,` 474 `)),r&2){let t=m().$implicit;l(2),K(` 475 `,(t==null||t.Task==null?null:t.Task.State)==="DISABLED"?"SHARED.DISABLED":"SHARED.DELETED",` 476 `)}}function f_(r,d){if(r&1&&(e(0,` 477 `),n(1,"div",37),e(2),I(3,"translate"),I(4,"translate"),a(),e(5,` 478 `)),r&2){let t=m().$implicit;l(2),qi(` 479 `,y(3,2,"CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+(t==null||t.Task==null?null:t.Task.VerificationFieldType)),` 480 `,$e(4,4,"CHECKLIST.TASK.SUBTEXT",pe(7,ip,t==null||t.Task==null?null:t.Task.FieldLabel)),` 481 `)}}function h_(r,d){if(r&1){let t=b();e(0,` 482 `),n(1,"p-button",34),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.configureSelection(i))}),e(2,` 483 `),n(3,"i",35),e(4,"settings"),a(),e(5,` 484 `),a(),e(6,` 485 `)}r&2&&(l(),p("rounded",!0)("text",!0))}function C_(r,d){if(r&1){let t=b();e(0,` 486 `),n(1,"div",25),e(2,` 487 `),n(3,"div",26),e(4,` 488 `),n(5,"div",27),e(6,` 489 `),n(7,"i",28),e(8,"drag_handle"),a(),e(9,` 490 `),a(),e(10,` 491 `),n(11,"div",29),e(12,` 492 `),n(13,"div",30),e(14,` 493 `),n(15,"div",31),e(16),_(17,x_,4,1),a(),e(18,` 494 `),_(19,f_,6,9),a(),e(20,` 495 `),n(21,"div",32),e(22,` 496 `),_(23,h_,7,2),a(),e(24,` 497 `),n(25,"div",33),e(26,` 498 `),n(27,"p-button",34),h("onClick",function(){let i=E(t).$index,s=m();return S(s.deleteSelection(i))}),e(28,` 499 `),n(29,"i",35),e(30,"delete"),a(),e(31,` 500 `),a(),e(32,` 501 `),a(),e(33,` 502 `),a(),e(34,` 503 `),a(),e(35,` 504 `),a(),e(36,` 505 `)}if(r&2){let t=d.$implicit;l(13),p("ngClass",pe(7,u_,(t==null||t.Task==null?null:t.Task.State)!=="ACTIVE")),l(3),K(` 506 `,t==null||t.Task==null?null:t.Task.Description,` 507 `),l(),f((t==null||t.Task==null?null:t.Task.State)!=="ACTIVE"?17:-1),l(2),f(!(t==null||t.Task==null)&&t.Task.FieldLabel?19:-1),l(4),f((t==null||t.Task==null?null:t.Task.State)==="ACTIVE"?23:-1),l(4),p("rounded",!0)("text",!0)}}function v_(r,d){if(r&1&&(e(0,` 508 `),n(1,"div",38),e(2,` 509 `),n(3,"span",39),e(4),I(5,"truncate"),I(6,"translate"),a(),e(7,` 510 `),a(),e(8,` 511 `)),r&2){let t,o=m();l(4),qi(` 512 `,$e(5,2,(t=o.activeTaskConfig==null||o.activeTaskConfig.Task==null?null:o.activeTaskConfig.Task.Description)!==null&&t!==void 0?t:"",50),"\xA0-\xA0",y(6,5,"CHECKLIST.SETTINGS"),` 513 `)}}function g_(r,d){r&1&&(e(0,` 514 `),n(1,"span",35),e(2,"expand_more"),a(),e(3,` 515 `))}function T_(r,d){r&1&&(e(0,` 516 `),n(1,"label"),e(2),I(3,"translate"),a(),e(4,` 517 `)),r&2&&(l(2),v(y(3,1,"CHECKLIST.CONFIG.REQUIRED_WORK_ORDER_VERIFICATION")))}function I_(r,d){r&1&&(e(0,` 518 `),n(1,"label"),e(2),I(3,"translate"),a(),e(4,` 519 `)),r&2&&(l(2),v(y(3,1,"CHECKLIST.CONFIG.REQUIRED_ASSET_VERIFICATION")))}function b_(r,d){r&1&&(e(0,` 520 `),n(1,"label"),e(2),I(3,"translate"),a(),e(4,` 521 `)),r&2&&(l(2),v(y(3,1,"CHECKLIST.CONFIG.REQUIRED_LOCATION_VERIFICATION")))}function y_(r,d){if(r&1){let t=b();e(0,` 522 `),n(1,"div",40),e(2,` 523 `),n(3,"div"),e(4,` 524 `),n(5,"div",41),e(6,` 525 `),n(7,"p-floatlabel"),e(8,` 526 `),n(9,"p-select",42),e(10,` 527 `),_(11,g_,4,0,"ng-template",43),e(12,` 528 `),a(),e(13,` 529 `),n(14,"label",44),e(15,` 530 `),n(16,"span"),e(17),I(18,"translate"),a(),e(19,` 531 `),n(20,"span",45),e(21," *"),a(),e(22,` 532 `),a(),e(23,` 533 `),a(),e(24,` 534 `),a(),e(25,` 535 `),n(26,"div",46),e(27,` 536 `),_(28,T_,5,3)(29,I_,5,3)(30,b_,5,3),R(31,"p-checkbox",47),e(32,` 537 `),a(),e(33,` 538 `),e(34,`
539 `),n(35,"div",48),e(36,` 540 `),n(37,"p-button",49),I(38,"translate"),h("onClick",function(){E(t);let i=m();return S(i.clearConfig())}),e(39,` 541 `),a(),e(40,` 542 `),n(41,"p-button",50),I(42,"translate"),h("onClick",function(){E(t);let i=m();return S(i.applyConfig())}),e(43,` 543 `),a(),e(44,` 544 `),a(),e(45,` 545 `),a(),e(46,` 546 `),a(),e(47,` 547 `)}if(r&2){let t=m();l(),p("hidden",!t.activeTaskConfig)("formGroup",t.configForm),l(8),p("options",t.verificationTypeOptions)("fluid",!0),l(8),v(y(18,15,"CHECKLIST.CONFIG.VERIFICATION_TYPE")),l(9),p("hidden",!t.configForm.controls.VerificationType.value),l(2),f(t.configForm.controls.VerificationType.value==="WORK_ORDER"?28:-1),l(),f(t.configForm.controls.VerificationType.value==="ASSIGNED_ASSETS"?29:-1),l(),f(t.configForm.controls.VerificationType.value==="ASSIGNED_LOCATIONS"?30:-1),l(),p("binary",!0),l(6),q("label",y(38,17,"SHARED.CLEAR")),p("text",!0),l(4),q("label",y(42,19,"SHARED.APPLY")),p("text",!0)("disabled",!t.configForm.valid||t.configForm.pristine)}}function A_(r,d){r&1&&(e(0,` 548 `),n(1,"span",35),e(2,"expand_more"),a(),e(3,` 549 `))}function R_(r,d){if(r&1){let t=b();e(0,` 550 `),n(1,"p-select",52),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.drawerView,i)||(s.drawerView=i),S(i)}),e(2,` 551 `),_(3,A_,4,0,"ng-template",43),e(4,` 552 `),a(),e(5,` 553 `)}if(r&2){let t=m(2);l(),p("options",t.allDrawerViews),H("ngModel",t.drawerView)}}function w_(r,d){r&1&&(e(0,` 554 `),n(1,"span",53),e(2,"CHECKLIST.ADD_TASKS"),a(),e(3,` 555 `))}function D_(r,d){if(r&1&&(e(0,` 556 `),n(1,"div",51),e(2,` 557 `),_(3,R_,6,2)(4,w_,4,0),a(),e(5,` 558 `)),r&2){let t=m();l(3),f(t.editMode?3:4)}}function L_(r,d){if(r&1&&(e(0,` 559 `),n(1,"div",37),e(2),I(3,"translate"),I(4,"translate"),a(),e(5,` 560 `)),r&2){let t=m().$implicit;l(2),qi(` 561 `,y(3,2,"CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+(t==null||t.Task==null?null:t.Task.VerificationFieldType)),` 562 `,$e(4,4,"CHECKLIST.TASK.SUBTEXT",pe(7,ip,t==null||t.Task==null?null:t.Task.FieldLabel)),` 563 `)}}function N_(r,d){if(r&1&&(e(0,` 564 `),n(1,"div",58),e(2,` 565 `),n(3,"div",26),e(4,` 566 `),n(5,"div",27),e(6,` 567 `),n(7,"i",28),e(8,"drag_handle"),a(),e(9,` 568 `),a(),e(10,` 569 `),n(11,"div",59),e(12,` 570 `),n(13,"div"),e(14,` 571 `),n(15,"div",31),e(16),a(),e(17,` 572 `),_(18,L_,6,9),a(),e(19,` 573 `),a(),e(20,` 574 `),a(),e(21,` 575 `),a(),e(22,` 576 `)),r&2){let t=d.$implicit;l(16),v(t.Task==null?null:t.Task.Description),l(2),f(!(t==null||t.Task==null)&&t.Task.FieldLabel?18:-1)}}function O_(r,d){if(r&1){let t=b();e(0,` 577 `),n(1,"div",54),e(2,` 578 `),n(3,"p-iconfield",55),e(4,` 579 `),n(5,"p-inputicon"),e(6,` 580 `),n(7,"span",35),e(8,"search"),a(),e(9,` 581 `),a(),e(10,` 582 `),n(11,"input",56),I(12,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.generalFilter,i)||(s.generalFilter=i),S(i)}),h("keyup",function(){E(t);let i=m();return S(i.taskFilterOnChange())}),a(),e(13,` 583 `),a(),e(14,` 584 `),n(15,"div",57),j("dragulaModelChange",function(i){E(t);let s=m();return W(s.filteredTasks,i)||(s.filteredTasks=i),S(i)}),e(16,` 585 `),G(17,N_,23,2,null,null,np),a(),e(19,` 586 `),a(),e(20,` 587 `)}if(r&2){let t=m();l(11),q("placeholder",y(12,4,"SHARED.SEARCH")),H("ngModel",t.generalFilter),p("fluid",!0),l(4),H("dragulaModel",t.filteredTasks),l(2),k(t.filteredTasks)}}function F_(r,d){if(r&1){let t=b();e(0,` 588 `),n(1,"div",54),e(2,` 589 `),n(3,"qware-entity-history",60),j("parentSpinnerStateChange",function(i){E(t);let s=m();return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(4,` 590 `),a(),e(5,` 591 `),a(),e(6,` 592 `)}if(r&2){let t=m();l(3),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap)("str
592ictlyThisEntity",!0),H("parentSpinnerState",t.displayDrawerSpinner)}}var yl=(()=>{class r{authService;dragulaService;fb;route;taskService;translate;bodyDropdown;bodyEditor;selectionInput;drawer;autoFocus=!0;taskLimit;form;isCreate=!1;checklist;previewOption;submitted=!1;validationErrors;allValuesLoaded=new Yt;configChanged=new Yt;previewOptionChange=new Yt;displayDrawerSpinner=D(!1);activeTaskConfig;allDrawerViews=[];configForm;drawerView=0;editMode=!1;filteredTasks=[];generalFilter="";historyCreatedText;historyNameMap=new Map;historyIdMap=new Map;selectedTasks=[];showConfigSidebar=!1;showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;userEnabledSidebar=!1;verificationTypeOptions=[];allChecklistTasks=[];taskVerificationTypes=[];dragulaSubs=new Vi;subscriptions;translations={};auditLoggingDisabled=!0;constructor(t,o,i,s,c,u){this.authService=t,this.dragulaService=o,this.fb=i,this.route=s,this.taskService=c,this.translate=u,this.editMode=this.route.snapshot.params.id,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.dragulaService.createGroup("CHECKLISTTASKS",{moves:(x,C,O)=>O?O.className==="drag-handle":!1,accepts:(x,C)=>C?C.id!=="source-column":!1}),this.dragulaSubs.add(o.dragend("CHECKLISTTASKS").subscribe(()=>{this.setFormValue(),this.taskFilterOnChange()})),this.dragulaSubs.add(o.drag("CHECKLISTTASKS").subscribe(()=>{this.previewOption==="PREVIEW"&&!this.isCreate?this.previewOption="EDIT":this.previewOption==="PREVIEW"&&(this.previewOption="CREATE"),this.previewOptionChange.emit(this.previewOption),this.showSidebar&&window.innerWidth<=Je.lgbreak&&this.toggleSidebar()}))}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}ngOnChanges(t){t.checklist&&this.checklist&&(this.drawerView=this.checklist&&this.checklist.State===M.DELETED?1:0,Ur.default.isEmpty(this.allDrawerViews)||(this.allDrawerViews[0].disabled=this.checklist&&this.checklist.State===M.DELETED),this.checklist.ChecklistTasks&&this.checklist.ChecklistTasks.length>0&&this.taskFilterOnChange())}loadData(){let t=[this.translate.get(["AUDIT.CHECKLIST","SHARED.DISABLED","SHARED.DELETED","CHECKLIST.CONFIG.WORK_ORDER","CHECKLIST.CONFIG.ASSIGNED_ASSETS","CHECKLIST.CONFIG.ASSIGNED_LOCATIONS","CHECKLIST.ADD_TASKS","SHARED.AUDIT_LOG"]).pipe(N()),this.taskService.getTaskVerificationFieldTypes(),this.taskService.getTasks(this.authService.tenant.Id)],o=this.form.get("ChecklistTasks");this.editMode&&o!==null&&t.push(o.valueChanges.pipe(N())),ue(t).pipe(we(i=>{this.translations=i[0];let s=i[1],c=i[2];this.selectedTasks=i[3]??[],this.allChecklistTasks=c.map(x=>({Id:x.Id,TenantId:x.TenantId,ChecklistId:this.checklist?.Id,TaskId:x.Id,Task:x})),this.filteredTasks=Ur.default.differenceWith(this.allChecklistTasks,this.selectedTasks,(x,C)=>x.Id===C.TaskId).filter(x=>x.Task?.State===M.ACTIVE);let u=[{label:this.translations["CHECKLIST.ADD_TASKS"],value:0,disabled:this.checklist&&this.checklist.State===M.DELETED}];return this.auditLoggingDisabled||u.push({label:this.translations["SHARED.AUDIT_LOG"],value:1}),this.allDrawerViews=u,this.verificationTypeOptions=[{label:this.translations["CHECKLIST.CONFIG.WORK_ORDER"],value:"WORK_ORDER"},{label:this.translations["CHECKLIST.CONFIG.ASSIGNED_ASSETS"],value:"ASSIGNED_ASSETS"},{label:this.translations["CHECKLIST.CONFIG.ASSIGNED_LOCATIONS"],value:"ASSIGNED_LOCATIONS"}],this.taskVerificationTypes=s.filter(x=>x!=="UNKNOWN").map(x=>({label:x,value:x})),this.setHistoryParams(),this.translate.get(s.map(x=>"CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+x))})).subscribe(i=>{let s=i;this.taskVerificationTypes.forEach(c=>{c.label=s["CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+c.label]}),this.setFormValue(),this.form.markAsPristine(),this.form.markAsUntouched(),this.allValuesLoaded.emit(!0)})}createForm(){this.configForm=this.fb.group({VerificationType:this.fb.control("WORK_ORDER",T.required),VerificationRequired:this.fb.control(!1)})}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.CHECKLIST"]+" "+this.form.get("Name")?.value;let t=new Map;t.set("Name","CHECKLIST.NAME"),this.historyNameMap=t}ngOnDestroy(){this.dragulaService.destroy("CHECKLISTTASKS"),this.dragulaSubs&&!this.dragulaSubs.closed&&this.dragulaSubs.unsubscribe(),this.subscriptions&&!this.subscriptions.closed&&this.subscriptions.unsubscribe()}setFormValue(){this.selectedTasks.forEach((t,o)=>{t.TaskOrder=o,t.VerificationType||(t.VerificationType="WORK_ORDER",t.VerificationTypeSelectItem=this.verificationTypeOptions.find(i=>i.value==="WORK_ORDER")),t.VerificationRequired||(t.VerificationRequired=!1)}),this.form.get("ChecklistTasks")?.setValue(this.selectedTasks),this.form.get("ChecklistTasks")?.markAsDirty(),this.form.get("ChecklistTasks")?.markAsTouched(),this.configChanged.emit()}deleteSelection(t){this.removeConfigs(this.selectedTasks[t]),this.selectedTasks.splice(t,1),this.setFormValue(),this.taskFilterOnChange()}configureSelection(t){this.showConfigSidebar=!0,this.activeTaskConfig=this.selectedTasks[t],this.activeTaskConfig&&(this.configForm.patchValue(this.activeTaskConfig),this.configForm.markAsPristine(),this.configForm.markAsUntouched())}toggleSidebar(t){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Ur.default.clone(this.showSidebar),this.showSidebar&&(this.drawerView=t??0)}applyConfig(){let t=Object.assign(this.activeTaskConfig,this.configForm.value);t.VerificationType=this.configForm.controls.VerificationType.value??"WORK_ORDER",t.VerificationRequired=this.configForm.controls.VerificationRequired.value??!1,this.setPreviewForm()}setPreviewForm(){this.showConfigSidebar=!1,this.clearConfig(),this.form.markAsDirty(),this.form.markAsTouched(),this.setFormValue()}clearConfig(){this.configForm.reset(),this.configForm.patchValue({VerificationType:"WORK_ORDER",VerificationRequired:!1}),this.configForm.markAsDirty(),this.configForm.markAsTouched()}taskFilterOnChange(){let t=Ur.default.differenceWith(this.allChecklistTasks,this.selectedTasks,(o,i)=>o.Id===i.TaskId);this.filteredTasks=t.filter(o=>o.Task?.State===M.ACTIVE&&o.Task?.Description&&o.Task?.VerificationFieldType&&(o.Task?.Description.toLowerCase().indexOf(this.generalFilter.toLowerCase())>-1||o.Task?.VerificationFieldType.toLowerCase().indexOf(this.generalFilter.toLowerCase())>-1)),this.filteredTasks=Ur.default.sortBy(this.filteredTasks,o=>(o.Task?.Name??"").toLowerCase())}
592removeConfigs(t){t.VerificationType=void 0,t.VerificationTypeSelectItem=void 0}static \u0275fac=function(o){return new(o||r)(g(de),g(Dn),g(be),g(he),g(Pn),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-checklist-details"]],viewQuery:function(o,i){if(o&1&&(X(s_,7),X(d_,7),X(p_,5),X(m_,7)),o&2){let s;Y(s=Q())&&(i.bodyDropdown=s.first),Y(s=Q())&&(i.bodyEditor=s.first),Y(s=Q())&&(i.selectionInput=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},inputs:{autoFocus:"autoFocus",taskLimit:"taskLimit",form:"form",isCreate:"isCreate",checklist:"checklist",previewOption:"previewOption",submitted:"submitted",validationErrors:"validationErrors"},outputs:{allValuesLoaded:"allValuesLoaded",configChanged:"configChanged",previewOptionChange:"previewOptionChange"},standalone:!1,features:[No],decls:73,vars:32,consts:[["header",""],["content",""],["drawerContainer",""],["drawer",""],[3,"hidden"],[3,"lockEditing"],[3,"formGroup"],[1,"header-inputfield"],["id","qware.checklist.details.input.title","tabindex","1","type","text","pInputText","","formControlName","Name","variant","filled","name","Name",2,"padding-left","0.643rem","font-weight","500",3,"fluid","qwareFocus","placeholder"],[1,"validation-error",3,"hidden"],["id","qware.checklist.details.error.name-req","translate","",3,"hidden"],["id","qware.checklist.details.error.name-length","translate","",3,"hidden"],["id","qware.checklist.details.error.dup-name","translate","",3,"hidden"],[1,"grid","drag-area","flex-inline"],[1,"col-12","checklist-column-container"],["dragula","CHECKLISTTASKS","id","selected-tasks",1,"drag-column",3,"dragulaModelChange","dragulaModel"],[1,"validation-error",2,"padding","0 0.5rem",3,"hidden"],["id","qware.checklist.config.task-length","translate","",3,"hidden","translateParams"],["id","qware.checklist.config.content-drawer-container","position","right",3,"visibleChange","onHide","visible","closeOnEscape"],["id","qware.checklist.create.content-drawer-container"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape","appendTo"],[3,"displaySpinner","isAbsolute"],[1,"validation-error"],["translate",""],[1,"empty-checklist-column"],[1,"cf-container"],[1,"checklist-task"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline","task-content"],[3,"ngClass"],[1,"primary-text"],[1,"config-button"],[1,"delete-button"],["type","button","severity","secondary","styleClass","icon-only-button","tabindex","-1",3,"onClick","rounded","text"],[1,"material-icons"],["translate","",1,"badge"],[1,"secondary-text"],["id","qware.custom-field-layout.create.config-drawer-header",1,"drawer-header"],[1,"drawer-header-title"],[1,"sidebar-content",3,"hidden","formGroup"],[1,"medium-input","single-autocomplete"],["formControlName","VerificationType","optionLabel","label","id","qware.checklist-config.verification-type","optionValue","value","variant","filled",3,"options","fluid"],["pTemplate","dropdownicon"],["id","qware.checklist-config.verification-type.label","for","qware.checklist-config.verification-type"],[1,"required-mark"],[1,"medium-input","flex-inline","flex-space-between",3,"hidden"],["name","VerificationRequired","formControlName","VerificationRequired",3,"binary"],[1,"sidebar-actions"],["tabindex","1000","id","qware.task.config.button.clear","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.task.config.button.save","type","submit",3,"onClick","text","disabled","label"],["id","qware.custom-field-layout.create.drawer-header",1,"drawer-header"],[3,"ngModelChange","options","ngModel"],["translate","",1,"drawer-header-title"],[1,"sidebar-content","no-apply"],["iconPosition","left"],["type","text","pInputText","","size","30","id","qware.checklist.details.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","fluid"],["dragula","CHECKLISTTASKS","id","source-column",3,"dragulaModelChange","dragulaModel"],[1,"task-container"],[1,"flex-inline"],["entityType","checklist",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","strictlyThisEntity","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",4),e(1,` 593 `),n(2,"qware-edit-lock",5),e(3,` 594 `),n(4,"div",6),e(5,` 595 `),n(6,"div",7),e(7,` 596 `),R(8,"input",8),I(9,"translate"),e(10,` 597 `),n(11,"small",9),e(12,` 598 `),n(13,"div",10),e(14,` 599 CHECKLIST.ERROR.NAME_REQUIRED 600 `),a(),e(15,` 601 `),n(16,"div",11),e(17,` 602 CHECKLIST.ERROR.NAME_LENGTH 603 `),a(),e(18,` 604 `),n(19,"div",12),e(20,` 605 CHECKLIST.ERROR.DUPLICATE_NAME 606 `),a(),e(21,` 607 `),a(),e(22,` 608 `),_(23,E_,3,0),a(),e(24,` 609 `),n(25,"div",13),e(26,` 610 `),n(27,"div",14),e(28,` 611 `),_(29,S_,7,0),n(30,"div",15),j("dragulaModelChange",function(u){return E(s),W(i.selectedTasks,u)||(i.selectedTasks=u),S(u)}),e(31,` 612 `),G(32,C_,37,9,null,null,np),a(),e(34,` 613 `),a(),e(35,` 614 `),n(36,"small",16),e(37,` 615 `),n(38,"div",17),e(39,` 616 SUBSCRIPTION.ERROR.TASK_LIMIT_REACHED 617 `),a(),e(40,` 618 `),a(),e(41,` 619 `),a(),e(42,` 620 621 `),e(43,` 622 `),n(44,"p-drawer",18),j("visibleChange",function(u){return E(s),W(i.showConfigSidebar,u)||(i.showConfigSidebar=u),S(u)}),h("onHide",function(){return E(s),S(i.clearConfig())}),e(45,` 623 `),_(46,v_,9,7,"ng-template",null,0,A),e(48,` 624 `),_(49,y_,48,21,"ng-template",null,1,A),e(51,` 625 `),a(),e(52,` 626 `),a(),e(53,` 627 `),a(),e(54,` 628`),a(),e(55,` 629 630`),e(56,` 631`),n(57,"div",19,2),e(59,` 632 `),n(60,"p-drawer",20,3),j("visibleChange",function(u){return E(s),W(i.showSidebar,u)||(i.showSidebar=u),S(u)}),h("onHide",function(){return E(s),S(i.userEnabledSidebar=!1)}),e(62,` 633 `),_(63,D_,6,1,"ng-template",null,0,A),e(65,` 634 `),n(66,"qware-spinner",21),e(67,` 635 `),_(68,O_,21,6)(69,F_,7,5),a(),e(70,` 636 `),a(),e(71,` 637`),a(),e(72,` 638`)}if(o&2){let s=Ee(58);p("hidden",i.previewOption==="PREVIEW"),l(2),p("lockEditing",i.checklist!==void 0&&i.checklist.State==="DELETED"),l(2),p("formGroup",i.form),l(4),q("placeholder",y(9,28,"CHECKLIST.CHECKLIST_NAME")),p("fluid",!0)("qwareFocus",i.autoFocus),l(3),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.duplicateString)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?23:-1),l(6),f(i.selectedTasks&&i.selectedTasks.length===0?29:-1),l(),ve("drag-column-border",i.selectedTasks&&i.selectedTasks.length>0),H("dragulaModel",i.selectedTasks),l(2),k(i.selectedTasks),l(4),p("hidden",i.form.controls.ChecklistTasks.valid||i.form.controls.ChecklistTasks.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.ChecklistTasks.errors!=null&&i.form.controls.ChecklistTasks.errors.maxlength))("translateParams",pe(30,c_,i.taskLimit)),l(6),H("visible",i.showConfigSidebar),p("closeOnEscape",!1),l(16),H("visible",i.showSidebar),p("modal",i.showMask)("transitionOptions",i.sidebarOptions)("closeOnEscape",!1)("appendTo",s),l(6),p("displaySpinner",i.displayDrawerSpinner())("isAbsolute",!0),l(2),f(i.drawerView===0?68:i.drawerView===1?69:-1)}},dependencies:[Pe,oe,yt,Qe,pn,Lt,Ne,je,Ae,se,ge,Le,pi,mi,ye,Gt,Ut,me,Te,De,it,$,i0,ie],styles:[`qware-checklist-details .drag-area{padding:1em}qware-checklist-details .drag-area .checklist-column-container{position:relative}qware-checklist-details .drag-area .checklist-column-container .empty-checklist-column{pointer-events:none;position:absolute;width:calc(100% - 1rem);height:80px;color:var(--p-surface-700)}qware-checklist-details .drag-area .checklist-column-container .empty-checklist-column div{line-height:80px;text-align:center;vertical-align:middle}qware-checklist-details .drag-area .checklist-column-container .drag-column{min-height:80px;border:1px dashed var(--p-surface-700);padding:0 .5rem}qware-checklist-details .drag-area .checklist-column-container .drag-column-border{border:1px solid var(--p-surface-800);border-radius:4px}qware-checklist-details .desktop-sidebar-mask{display:none}qware-checklist-details .sidebar-content .task-search,qware-checklist-details .sidebar-content .task-search>.search-input{width:100%}qware-checklist-details .sidebar-content .task-container{border-radius:4px}qware-checklist-details .sidebar-content .task-container:last-of-type>.checklist-task{margin-bottom:0}qware-checklist-details .text-box-container .text-box{max-height:180px;overflow-y:auto!important}qware-checklist-details .checklist-task{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0);margin:.5rem 0;border-radius:4px}qware-checklist-details .checklist-task>div:nth-of-type(2){padding:.5rem .75rem}qware-checklist-details .checklist-task>div:nth-of-type(2)>div:first-child{flex:1 1 auto}qware-checklist-details .checklist-task>div:nth-of-type(2) .config-button,qware-checklist-details .checklist-task>div:nth-of-type(2) .delete-button{flex:0 0 auto;justify-items:flex-end}qware-checklist-details .checklist-task .secondary-text{color:var(--p-surface-800)}qware-checklist-details .checklist-task .primary-text{font-weight:500;margin-bottom:.25rem}qware-checklist-details .checklist-task .validation-error{margin-top:.5rem}qware-checklist-details #qware\\.task-checklist\\.create\\.content-drawer-container{z-index:1000}body>.gu-mirror .checklist-task{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0);margin:.75rem;border-radius:4px}body>.gu-mirror .checklist-task .flex-inline{padding:.5rem .75rem}body>.gu-mirror .checklist-task .secondary-text{color:var(--p-surface-800)}body>.gu-mirror .checklist-task .primary-text{font-weight:500}body>.gu-mirror .checklist-task .task-content>div:first-of-type{flex:1 1 auto}body>.gu-mirror .checklist-task .task-content .delete-button,body>.gu-mirror .checklist-task .task-content .config-button{flex:0 1 auto} 639`],encapsulation:2})}return r})();var M_=["actionsMenu"],U_=["details"];function P_(r,d){if(r&1){let t=b();e(0,` 640 `),n(1,"div",21),e(2,` 641 `),n(3,"p-selectbutton",22),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedPreviewOption,i)||(s.selectedPreviewOption=i),S(i)}),e(4,` 642 `),a(),e(5,` 643 `),a(),e(6,` 644 `)}if(r&2){let t=m();l(3),p("unselectable",!0)("options",t.previewOptions),H("ngModel",t.selectedPreviewOption),p("allowEmpty",!1)}}function G_(r,d){if(r&1&&(e(0,` 645 `),n(1,"a",23),e(2,` 646 `),n(3,"span",24),e(4),a(),e(5,` 647 `),n(6,"span",25),e(7),a(),e(8,` 648 `),a(),e(9,` 649 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}var op=(()=>{class r{authService;checklistService;fb;responseService;route;router;toastService;translate;actionsMenu;details;actionItems=[];isActive=!1;checklistForm;displaySpinner=!0;moreItems=[];previewOptions=[];selectedPreviewOption="CREATE";submitted=!1;validationErrors;taskLimit=Number.MAX_VALUE;checklistCreateCard={colorScheme:{light:{bodyPadding:"0"}}};allChecklistNames=[];constructor(t,o,i,s,c,u,x,C){this.authService=t,this.checklistService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.toastService=x,this.translate=C}ngOnInit(){this.checklistForm=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),ChecklistTasks:this.fb.control([],[T.required,T.maxLength(this.taskLimit)])}),ue([this.translate.get(["SHARED.CREATE","SHARED.PREVIEW","CHECKLIST.ADD_TASKS"]).pipe(N()),this.checklistService.getChecklistNames(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1];this.moreItems=[{label:o["CHECKLIST.ADD_TASKS"],icon:Nd.PLUS,command:()=>this.details.toggleSidebar()}],this.previewOptions=[{label:o["SHARED.CREATE"],value:"CREATE"},{label:o["SHARED.PREVIEW"],value:"PREVIEW"}],this.allChecklistNames=i,this.checklistForm.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allChecklistNames)]),this.displaySpinner=!1})}isDirty(){return this.checklistForm.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllChecklists"),this.router.navigate(["../../",P.checklist,P.list],t)}configChanged(){}save(){if(!this.submitted)if(this.checklistForm.valid){let t=this.checklistForm.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.UpdatedByUserId=this.authService.currentUser?.Id,t.CreatedByUserId=this.authService.currentUser?.Id,t.State=M.ACTIVE,t.ChecklistTasks?.forEach(o=>{o.Id=void 0,o.TenantId=this.authService.tenant.Id,o.UpdatedByUserId=this.authService.currentUser?.Id,o.CreatedByUserId=this.authService.currentUser?.Id}),this.checklistService.createOrUpdateChecklist(t).subscribe({next:()=>{localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllChecklists"),this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.SUCCESS.CREATE","../../"+P.checklist+"/"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.checklistForm)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}static \u0275fac=function(o){return new(o||r)(g(de),g(Ha),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-checklist-create"]],viewQuery:function(o,i){if(o&1&&(X(M_,5),X(U_,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.details=s.first)}},standalone:!1,decls:63,vars:23,consts:[["moreMenu",""],["item",""],["details",""],[1,"grid"],[1,"col-12","lg:col-8","edit-data-container",3,"keydown.enter"],["id","qware.checklist.create.spinner",3,"displaySpinner"],[1,"form-container"],[1,"flex-inline","header-container"],[1,"flex-inline","align-items-center"],["translate","","id","qware.checklist.create.page-header",1,"page-header"],[1,"flex-inline"],[1,"top-indent-large","flex-inline","align-right","preview-button-container"],[1,"top-indent-large","more-container"],["id","qware.checklist.create.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],[3,"dt"],[3,"configChanged","previewOptionChange","form","submitted","validationErrors","previewOption","isCreate","taskLimit"],[1,"flex-inline","align-right","action-bar",3,"hidden"],["tabindex","1000","id","qware.checklist.create.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.checklist.create.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"preview-buttons"],[3,"ngModelChange","unselectable","options","ngModel","allowEmpty"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"]],template:function(o,i){if(o&1){let s=b();n(0,"div",3),e(1,` 650 `),e(2,` 651 `),n(3,"div",4),h("keydown.enter",function(){return E(s),S(i.save())}),e(4,` 652 `),n(5,"qware-spinner",5),e(6,` 653 `),n(7,"div",6),e(8,` 654 `),n(9,"div",7),e(10,` 655 `),n(11,"div",8),e(12,` 656 `),n(13,"h3",9),e(14,` 657 CHECKLIST.CREATE_CHECKLIST 658 `),a(),e(15,` 659 `),a(),e(16,` 660 `),n(17,"div",10),e(18,` 661 `),n(19,"div",11),e(20,` 662 `),_(21,P_,7,4),a(),e(22,` 663 `),n(23,"div",12),e(24,` 664 `),n(25,"p-menu",13,0),h("click",function(){E(s);let u=Ee(26);return S(u.hide())}),e(27,` 665 `),_(28,G_,10,2,"ng-template",null,1,A),e(30,` 666 `),a(),e(31,` 667 `),n(32,"p-button",14),h("onClick",function(u){return E(s),Ee(26).toggle(u),S(i.isActive=!i.isActive)}),e(33,` 668 `),n(34,"i",15),e(35,"more_vert"),a(),e(36,` 669 `),a(),e(37,` 670
670 `),a(),e(38,` 671 `),a(),e(39,` 672 `),a(),e(40,` 673 `),n(41,"p-card",16),e(42,` 674 `),n(43,"qware-checklist-details",17,2),h("configChanged",function(){return E(s),S(i.configChanged())}),j("previewOptionChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),e(45,` 675 `),a(),e(46,` 676 `),n(47,"div",18),e(48,` 677 `),n(49,"p-button",19),I(50,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(51,` 678 `),a(),e(52,` 679 `),n(53,"p-button",20),I(54,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(55,` 680 `),a(),e(56,` 681 `),a(),e(57,` 682 `),a(),e(58,` 683 `),a(),e(59,` 684 `),a(),e(60,` 685 `),a(),e(61,` 686`),a(),e(62,` 687`)}o&2&&(l(5),p("displaySpinner",i.displaySpinner),l(16),f(-1),l(4),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(9),p("dt",i.checklistCreateCard),l(2),p("form",i.checklistForm)("submitted",i.submitted)("validationErrors",i.validationErrors),H("previewOption",i.selectedPreviewOption),p("isCreate",!0)("taskLimit",i.taskLimit),l(4),p("hidden",i.selectedPreviewOption==="PREVIEW"),l(2),q("label",y(50,19,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(54,21,"SHARED.SAVE")),p("text",!0)("disabled",!i.checklistForm.valid||!i.checklistForm.dirty))},dependencies:[oe,Ie,se,Le,lt,me,ot,Ga,$,yl,ie],styles:[".form-container[_ngcontent-%COMP%]{max-width:100%}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%]{display:block}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type{flex:1 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type > div[_ngcontent-%COMP%]{margin:.5rem 0}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .layout-type[_ngcontent-%COMP%]{margin:0 .5rem}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{flex:1 1 auto;height:36px;margin-bottom:.5rem}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{justify-content:flex-start}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%]{flex:0 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-bottom:0}}"]})}return r})();var lp=He(nt());var k_=["actionsMenu"],V_=["details"];function q_(r,d){if(r&1){let t=b();e(0,` 688 `),n(1,"div",25),e(2,` 689 `),n(3,"p-selectbutton",26),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedPreviewOption,i)||(s.selectedPreviewOption=i),S(i)}),e(4,` 690 `),a(),e(5,` 691 `),a(),e(6,` 692 `)}if(r&2){let t=m();l(3),p("unselectable",!0)("options",t.previewOptions),H("ngModel",t.selectedPreviewOption),p("allowEmpty",!1)}}function B_(r,d){if(r&1&&(e(0,` 693 `),n(1,"a",27),e(2,` 694 `),n(3,"span",28),e(4),a(),e(5,` 695 `),n(6,"span",29),e(7),a(),e(8,` 696 `),a(),e(9,` 697 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function H_(r,d){r&1&&(e(0,` 698 `),n(1,"span",31),e(2,"SHARED.ACTIONS"),a(),e(3,` 699 `),n(4,"i",18),e(5,"expand_more"),a(),e(6,` 700 `))}function W_(r,d){if(r&1){let t=b();e(0,` 701 `),n(1,"p-button",30),h("onClick",function(i){E(t),m();let s=Ee(23);return S(s.toggle(i))}),e(2,` 702 `),_(3,H_,7,0,"ng-template",null,4,A),e(5,` 703 `),a(),e(6,` 704 `)}r&2&&(l(),p("raised",!0))}function j_(r,d){if(r&1&&(e(0,` 705 `),n(1,"a",27),e(2,` 706 `),n(3,"span",28),e(4),a(),e(5,` 707 `),n(6,"span",29),e(7),a(),e(8,` 708 `),a(),e(9,` 709 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}var sp=(()=>{class r{authService;confirmationService;checklistService;fb;responseService;route;router;toastService;translate;actionsMenu;details;actionItems=[];isActive=!1;checklist;checklistForm;displaySpinner=!0;moreItems=[];previewOptions=[];selectedPreviewOption="EDIT";submitted=!1;validationErrors;checklistEditCard={colorScheme:{light:{bodyPadding:"0"}}};checklistRoute="../../../"+P.checklist+"/"+P.list;redirectPage;constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.confirmationService=o,this.checklistService=i,this.fb=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O}
709ngOnInit(){this.redirectPage=localStorage.getItem(Oe.REDIRECT_FROM_PAGE)??void 0,localStorage.removeItem(Oe.REDIRECT_FROM_PAGE),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.EDIT","SHARED.PREVIEW","SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","CHECKLIST.ADD_TASKS","CHECKLIST.CONFIG.WORK_ORDER","CHECKLIST.CONFIG.ASSIGNED_ASSETS","CHECKLIST.CONFIG.ASSIGNED_LOCATIONS"]).pipe(N()),this.checklistService.getChecklistNames(this.authService.tenant.Id),this.checklistService.getChecklist(this.authService.tenant.Id,this.route.snapshot.params.id)]).subscribe(t=>{let o=t[0],i=t[1];this.checklist=t[2],this.moreItems=[{id:"tasks.action",label:o["CHECKLIST.ADD_TASKS"],icon:"add",command:()=>this.details.toggleSidebar(0),disabled:this.checklist?.State===M.DELETED},{id:"audit.log.action",label:o["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.details.toggleSidebar(1)}],this.previewOptions=[{label:o["SHARED.EDIT"],value:"EDIT"},{label:o["SHARED.PREVIEW"],value:"PREVIEW"}];let s=[{id:"disable.action",label:o["SHARED.DISABLE"],icon:"block",command:()=>this.disableChecklist()},{id:"enable.action",label:o["SHARED.ENABLE"],icon:"check",command:()=>this.enableChecklist()},{id:"delete.action",label:o["SHARED.DELETE"],icon:"delete",command:()=>this.deleteChecklist()}];this.checklist?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&s.push({id:"restore.action",label:o["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreChecklist()}),this.actionItems=s.filter(c=>this.checklist?.State===M.DISABLED?c.id!=="disable.action":this.checklist?.State===M.DELETED?c.id!=="disable.action"&&c.id!=="enable.action"&&c.id!=="delete.action":c.id!=="enable.action"),this.checklist?.ChecklistTasks?.forEach(c=>{c.VerificationType&&c.VerificationType!=="UNKNOWN"&&(c.VerificationTypeSelectItem={label:o["CHECKLIST.CONFIG."+c.VerificationType],value:c.VerificationType})}),this.checklistForm.patchValue(lp.default.cloneDeep(this.checklist)),i=i.filter(c=>this.checklist&&c!==this.checklist.Name),this.checklistForm.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(i)]),this.checklist.State==="DELETED"&&this.checklistForm.disable()})}createForm(){this.checklistForm=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),ChecklistTasks:this.fb.control([],T.required)})}isDirty(){return this.checklistForm.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};this.redirectPage||localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllChecklists"),this.router.navigate([this.checklistRoute],t)}configChanged(){}save(){if(!this.submitted)if(this.checklistForm.valid){let t=this.checklistForm.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=this.checklist?.State??M.ACTIVE,t.Id=this.checklist?.Id,t.Type=this.checklist?.Type,t.UpdatedByUserId=this.authService.currentUser?.Id,t.CreatedByUserId=this.checklist?.CreatedByUserId,t.CreatedDateUTC=this.checklist?.CreatedDateUTC,t.ChecklistTasks?.forEach(o=>{o.UpdatedByUserId=this.authService.currentUser?.Id,o.Id===o.TaskId&&(o.Id=void 0,o.CreatedByUserId=this.authService.currentUser?.Id)}),this.checklistService.createOrUpdateChecklist(t).subscribe({next:()=>{this.successNavigation("CHECKLIST.SUCCESS.SAVE",{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.checklistForm)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableChecklist(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.checklist?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.checklist&&(this.displaySpinner=!0,this.submitted=!0,this.checklist.State=M.DISABLED,this.checklistService.createOrUpdateChecklist(this.checklist).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.DISABLE")},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableChecklist(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.checklist?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.checklist&&(this.displaySpinner=!0,this.submitted=!0,this.checklist.State=M.ACTIVE,this.checklistService.createOrUpdateChecklist(this.checklist).subscribe({next:()=>{this.successNavigation("CHECKLIST.SUCCESS.ENABLE")},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteChecklist(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.checklist?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.checklist&&(this.displaySpinner=!0,this.submitted=!0,this.checklist.State=M.DELETED,this.checklistService.createOrUpdateChecklist(this.checklist).subscribe({next:()=>{this.successNavigation("CHECKLIST.SUCCESS.DELETE")},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreChecklist(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.checklist?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.checklist&&(this.displaySpinner=!0,this.submitted=!0,this.checklist.State=M.ACTIVE,this.checklistService.createOrUpdateChecklist(this.checklist).subscribe({next:()=>{this.successNavigation("CHECKLIST.SUCCESS.RESTORE")},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}successNavigation(t,o){this.redirectPage||localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.displaySpinner=!1,this.responseService.onSuccess(t,this.checklistRoute,this.route,o)}static \u0275fac=function(o){return new(o||r)(g(de),g(mt),g(Ha),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-checklist-edit"]],viewQuery:function(o,i){if(o&1&&(X(k_,7),X(V_,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.details=s.first)}},standalone:!1,decls:73,vars:26,consts:[["actionsMenu",""],["item",""],["moreMenu",""],["details",""],["content",""],[1,"grid"],[1,"col-12","lg:col-8","edit-data-container"],[1,"form-container"],[1,"flex-inline","header-container"],[1,"flex-inline","align-items-center"],["translate","","id","qware.checklist.page-header",1,"page-header"],[1,"flex-inline"],[1,"top-indent-large","flex-inline","align-right","preview-button-container"],[1,"top-indent-large","actions-container"],["id","qware.checklist.edit.edit.actions-menu",3,"model","popup"],[1,"top-indent-large","more-container"],["id","qware.checklist.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],["id","qware.checklist.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"configChanged","previewOptionChange","allValuesLoaded","form","submitted","validationErrors","previewOption","checklist","autoF
709ocus"],[1,"flex-inline","align-right","action-bar",3,"hidden"],["tabindex","1000","id","qware.checklist.edit.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.checklist.edit.button.save","type","submit",3,"onClick","text","disabled","label"],[1,"preview-buttons"],[3,"ngModelChange","unselectable","options","ngModel","allowEmpty"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.checklist.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"]],template:function(o,i){if(o&1){let s=b();n(0,"div",5),e(1,` 710 `),n(2,"div",6),e(3,` 711 `),n(4,"div",7),e(5,` 712 `),n(6,"div",8),e(7,` 713 `),n(8,"div",9),e(9,` 714 `),n(10,"h3",10),e(11,` 715 CHECKLIST.EDIT_CHECKLIST 716 `),a(),e(12,` 717 `),a(),e(13,` 718 `),n(14,"div",11),e(15,` 719 `),n(16,"div",12),e(17,` 720 `),_(18,q_,7,4),a(),e(19,` 721 `),n(20,"div",13),e(21,` 722 `),n(22,"p-menu",14,0),e(24,` 723 `),_(25,B_,10,2,"ng-template",null,1,A),e(27,` 724 `),a(),e(28,` 725 `),_(29,W_,7,1),a(),e(30,` 726 `),n(31,"div",15),e(32,` 727 `),n(33,"p-menu",16,2),h("click",function(){E(s);let u=Ee(34);return S(u.hide())}),e(35,` 728 `),_(36,j_,10,2,"ng-template",null,1,A),e(38,` 729 `),a(),e(39,` 730 `),n(40,"p-button",17),h("onClick",function(u){return E(s),Ee(34).toggle(u),S(i.isActive=!i.isActive)}),e(41,` 731 `),n(42,"i",18),e(43,"more_vert"),a(),e(44,` 732 `),a(),e(45,` 733 `),a(),e(46,` 734 `),a(),e(47,` 735 `),a(),e(48,` 736 `),n(49,"qware-spinner",19),e(50,` 737 `),n(51,"p-card",20),e(52,` 738 `),n(53,"qware-checklist-details",21,3),h("configChanged",function(){return E(s),S(i.configChanged())}),j("previewOptionChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),h("allValuesLoaded",function(){return E(s),S(i.displaySpinner=!1)}),e(55,` 739 `),a(),e(56,` 740 `),n(57,"div",22),e(58,` 741 `),n(59,"p-button",23),I(60,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(61,` 742 `),a(),e(62,` 743 `),n(63,"p-button",24),I(64,"translate"),h("onClick",function(){return E(s),S(i.save())}),e(65,` 744 `),a(),e(66,` 745 `),a(),e(67,` 746 `),a(),e(68,` 747 `),a(),e(69,` 748 `),a(),e(70,` 749 `),a(),e(71,` 750`),a(),e(72,` 751`)}o&2&&(l(18),f(-1),l(4),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?29:-1),l(4),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(9),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.checklistEditCard),l(2),p("form",i.checklistForm)("submitted",i.submitted)("validationErrors",i.validationErrors),H("previewOption",i.selectedPreviewOption),p("checklist",i.checklist)("autoFocus",!1),l(4),p("hidden",i.selectedPreviewOption!=="EDIT"),l(2),q("label",y(60,22,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(64,24,"SHARED.SAVE")),p("text",!0)("disabled",!i.checklistForm.valid||!i.checklistForm.dirty))},dependencies:[oe,Ie,se,Le,lt,me,ot,Ga,$,yl,ie],styles:[`.form-container{max-width:100%}@media screen and (max-width: 768px){.form-container .header-container{display:block}}.form-container .header-container>div:last-of-type{flex:1 1 auto}@media screen and (max-width: 768px){.form-container .header-container>div:last-of-type>div{margin-top:.5rem}}.form-container .header-container .layout-type{margin:0 .5rem}.form-container .header-container .preview-button-container{flex:1 1 auto;height:36px;margin-bottom:.5rem;margin-right:.5rem}@media screen and (max-width: 768px){.form-container .header-container .preview-button-container{justify-content:flex-start}}.form-container .header-container .actions-container{flex:0 1 auto}@media screen and (max-width: 768px){.form-container .header-container .actions-container button{margin-bottom:0}} 752`],encapsulation:2})}return r})();var _p=He(nt());var pt=He(nt());var Y_=["attachments"],Q_=["bodyDropdown"],K_=["bodyEditor"],$_=["selectionInput"],z_=["drawer"],X_=["subjectDropdown"],Z_=["subjectEditor"],J_=r=>({limit:r}),pp=r=>({"disabled-row":r}),mp=r=>({fieldName:r}),dp=r=>({value:r}),Ms=()=>({standalone:!0}),cp=()=>({"max-width.px":200}),Ns=(r,d)=>d.Id;function eE(r,d){if(r&1&&(e(0,` 753 `),n(1,"small",30),e(2,` 754 `),n(3,"div",31),e(4),a(),e(5,` 755 `),a(),e(6,` 756 `)),r&2){let t=d.$implicit;l(4),v(t)}}function tE(r,d){if(r&1&&(e(0,` 757 `),G(1,eE,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function iE(r,d){r&1&&(e(0,` 758 `),n(1,"div",32),e(2,` 759 `),n(3,"div",31),e(4,"CUSTOM_FIELD_LAYOUT.DRAG_DROP"),a(),e(5,` 760 `),a(),e(6,` 761 `))}function nE(r,d){if(r&1&&(e(0,` 762 `),n(1,"span",45),e(2),a(),e(3,` 763 `)),r&2){let t=m().$implicit;l(2),K(` 764 `,t.State==="DISABLED"?"SHARED.DISABLED":"SHARED.DELETED",` 765 `)}}function aE(r,d){if(r&1&&(e(0,` 766 `),n(1,"div",46),e(2,` 767 `),n(3,"span",47),e(4,`
768 CUSTOM_FIELD_LAYOUT.ERROR.DEPENDENT_FIELD_MISSING 769 `),a(),e(5,` 770 `),a(),e(6,` 771 `)),r&2){let t,o=m().$implicit;l(3),p("translateParams",pe(1,mp,(t=o.DependentFieldNameSelectItem==null?null:o.DependentFieldNameSelectItem.label)!==null&&t!==void 0?t:""))}}function rE(r,d){if(r&1){let t=b();e(0,` 772 `),n(1,"p-button",43),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.configureSelection(i,"LEFT"))}),e(2,` 773 `),n(3,"i",44),e(4,"settings"),a(),e(5,` 774 `),a(),e(6,` 775 `)}r&2&&(l(),p("rounded",!0)("text",!0))}function oE(r,d){if(r&1){let t=b();e(0,` 776 `),n(1,"div",33),e(2,` 777 `),n(3,"div",34),e(4,` 778 `),n(5,"div",35),e(6,` 779 `),n(7,"i",36),e(8,"drag_handle"),a(),e(9,` 780 `),a(),e(10,` 781 `),n(11,"div",37),e(12,` 782 `),n(13,"div",38),e(14,` 783 `),n(15,"div",39),e(16),I(17,"translate"),_(18,nE,4,1),a(),e(19,` 784 `),n(20,"div",40),e(21),a(),e(22,` 785 `),_(23,aE,7,3),a(),e(24,` 786 `),n(25,"div",41),e(26,` 787 `),_(27,rE,7,2),a(),e(28,` 788 `),n(29,"div",42),e(30,` 789 `),n(31,"p-button",43),h("onClick",function(){let i=E(t).$index,s=m();return S(s.deleteSelection(i,"LEFT"))}),e(32,` 790 `),n(33,"i",44),e(34,"delete"),a(),e(35,` 791 `),a(),e(36,` 792 `),a(),e(37,` 793 `),a(),e(38,` 794 `),a(),e(39,` 795 `),a(),e(40,` 796 `)}if(r&2){let t=d.$implicit;l(13),p("ngClass",pe(11,pp,t.State!=="ACTIVE")),l(3),qi(` 797 `,t.Name," (",y(17,9,"CUSTOM_FIELD.TYPES."+t.Type),`) 798 `),l(2),f(t.State!=="ACTIVE"?18:-1),l(3),v(t.Description),l(2),f(t.DependentFieldMissing?23:-1),l(4),f(t.State==="ACTIVE"?27:-1),l(4),p("rounded",!0)("text",!0)}}function lE(r,d){r&1&&(e(0,` 799 `),n(1,"div",32),e(2,` 800 `),n(3,"div",31),e(4,"CUSTOM_FIELD_LAYOUT.DRAG_DROP"),a(),e(5,` 801 `),a(),e(6,` 802 `))}function sE(r,d){if(r&1&&(e(0,` 803 `),n(1,"span",45),e(2),a(),e(3,` 804 `)),r&2){let t=m().$implicit;l(2),K(` 805 `,t.State==="DISABLED"?"SHARED.DISABLED":"SHARED.DELETED",` 806 `)}}function dE(r,d){if(r&1&&(e(0,` 807 `),n(1,"div",46),e(2,` 808 `),n(3,"span",47),e(4,"CUSTOM_FIELD_LAYOUT.ERROR.DEPENDENT_FIELD_MISSING"),a(),e(5,` 809 `),a(),e(6,` 810 `)),r&2){let t,o=m().$implicit;l(3),p("translateParams",pe(1,mp,(t=o.DependentFieldNameSelectItem==null?null:o.DependentFieldNameSelectItem.label)!==null&&t!==void 0?t:""))}}function pE(r,d){if(r&1){let t=b();e(0,` 811 `),n(1,"p-button",43),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.configureSelection(i,"RIGHT"))}),e(2,` 812 `),n(3,"i",44),e(4,"settings"),a(),e(5,` 813 `),a(),e(6,` 814 `)}r&2&&(l(),p("rounded",!0)("text",!0))}function mE(r,d){if(r&1){let t=b();e(0,` 815 `),n(1,"div",33),e(2,` 816 `),n(3,"div",34),e(4,` 817 `),n(5,"div",35),e(6,` 818 `),n(7,"i",36),e(8,"drag_handle"),a(),e(9,` 819 `),a(),e(10,` 820 `),n(11,"div",37),e(12,` 821 `),n(13,"div",38),e(14,` 822 `),n(15,"div",39),e(16),I(17,"translate"),_(18,sE,4,1),a(),e(19,` 823 `),n(20,"div",40),e(21),a(),e(22,` 824 `),_(23,dE,7,3),a(),e(24,` 825 `),n(25,"div",41),e(26,` 826 `),_(27,pE,7,2),a(),e(28,` 827 `),n(29,"div",42),e(30,` 828 `),n(31,"p-button",43),h("onClick",function(){let i=E(t).$index,s=m();return S(s.deleteSelection(i,"RIGHT"))}),e(32,` 829 `),n(33,"i",44),e(34,"delete"),a(),e(35,` 830 `),a(),e(36,` 831 `),a(),e(37,` 832 `),a(),e(38,` 833 `),a(),e(39,` 834 `),a(),e(40,` 835 `)}if(r&2){let t=d.$implicit;l(13),p("ngClass",pe(11,pp,t.State!=="ACTIVE")),l(3),qi(` 836 `,t.Name," (",y(17,9,"CUSTOM_FIELD.TYPES."+t.Type),`) 837 `),l(2),f(t.State!=="ACTIVE"?18:-1),l(3),v(t.Description),l(2),f(t.DependentFieldMissing?23:-1),l(4),f(t.State==="ACTIVE"?27:-1),l(4),p("rounded",!0)("text",!0)}}function cE(r,d){if(r&1&&(e(0,` 838 `),n(1,"div",48),e(2,` 839 `),n(3,"span",49),e(4),I(5,"translate"),a(),e(6,` 840 `),a(),e(7,` 841 `)),r&2){let t=m();l(4),qi("",t.activeCustomFieldConfig==null?null:t.activeCustomFieldConfig.Name,"\xA0-\xA0",y(5,2,"CUSTOM_FIELD_LAYOUT.SETTINGS"),"")}}function uE(r,d){if(r&1&&(e(0,` 842 `),n(1,"div",76),e(2,` 843 `),n(3,"p-floatlabel"),e(4,` 844 `),n(5,"textarea",77),e(6," "),a(),e(7,` 845 `),n(8,"label",78),e(9,` 846 `),n(10,"span",31),e(11,"CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE"),a(),e(12,` 847 `),a(),e(13,` 848 `),a(),e(14,` 849 `),n(15,"small",57),e(16,` 850 `),n(17,"div",58),e(18,` 851 CUSTOM_FIELD_LAYOUT.CONFIG.ERROR.DEFAULT_VALUE_LENGTH 852 `),a(),e(19,` 853 `),a(),e(20,` 854 `),a(),e(21,` 855 `)),r&2){let t=m(2);l(5),p("tabindex",2)("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",t.configForm.controls.DefaultValue.valid||t.configForm.controls.DefaultValue.pristine&&!t.configSubmitted),l(2),p("hidden",!(t.configForm.controls.DefaultValue.errors!=null&&t.configForm.controls.DefaultValue.errors.maxlength))}}function _E(r,d){r&1&&(e(0,` 856 `),n(1,"span",44),e(2,"expand_less"),a(),e(3,` 857 `))}function EE(r,d){r&1&&(e(0,` 858 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 859 `))}function SE(r,d){if(r&1&&(e(0,` 860 `),n(1,"div",79),e(2,` 861 `),n(3,"p-floatlabel"),e(4,` 862 `),n(5,"p-inputnumber",80),e(6,` 863 `),_(7,_E,4,0,"ng-template",null,6,A),e(9,` 864 `),_(10,EE,4,0,"ng-template",null,7,A),e(12,` 865 `),a(),e(13,` 866 `),n(14,"label",81),e(15,` 867 `),n(16,"span",31),e(17,"CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE"),a(),e(18,` 868 `),a(),e(19,` 869 `),a(),e(20,` 870 `),n(21,"small",57),e(22,` 871 `),n(23,"div",58),e(24,` 872 CUSTOM_FIELD_LAYOUT.CONFIG.ERROR.DEFAULT_VALUE_LENGTH 873 `),a(),e(25,` 874 `),a(),e(26,` 875 `),a(),e(27,` 876 `)),r&2){let t=m(2);l(5),p("tabindex",2)("currency",t.currencyType)("showButtons",!0)("fluid",!0),l(16),p("hidden",t.configForm.controls.DefaultValue.valid||t.configForm.controls.DefaultValue.pristine&&!t.configSubmitted),l(2),p("hidden",!(t.configForm.controls.DefaultValue.errors!=null&&t.configForm.controls.DefaultValue.errors.maxlength))}}function xE(r,d){r&1&&(e(0,` 877 `),n(1,"span",44),e(2,"expand_less"),a(),e(3,` 878 `))}function fE(r,d){r&1&&(e(0,` 879 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 880 `))}function hE(r,d){if(r&1&&(e(0,` 881 `),n(1,"div",79),e(2,` 882 `),n(3,"p-floatlabel"),e(4,` 883 `),n(5,"p-inputnumber",82),e(6,` 884 `),_(7,xE,4,0,"ng-template",null,6,A),e(9,` 885 `),_(10,fE,4,0,"ng-template",null,7,A),e(12,` 886 `),a(),e(13,` 887 `),n(14,"label",83),e(15,` 888 `),n(16,"span",31),e(17,"CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE"),a(),e(18,` 889 `),a(),e(19,` 890 `),a(),e(20,` 891 `),n(21,"small",57),e(22,` 892 `),n(23,"div",58),e(24,` 893 CUSTOM_FIELD_LAYOUT.CONFIG.ERROR.DEFAULT_VALUE_LENGTH 894 `),a(),e(25,` 895 `),a(),e(26,` 896 `),a(),e(27,` 897 `)),r&2){let t=m(2);l(5),p("tabindex",2)("fluid",!0)("showButtons",!0),l(16),p("hidden",t.configForm.controls.DefaultValue.valid||t.configForm.controls.DefaultValue.pristine&&!t.configSubmitted),l(2),p("hidden",!(t.configForm.controls.DefaultValue.errors!=null&&t.configForm.controls.DefaultValue.errors.maxlength))}}function CE(r,d){r&1&&(e(0,` 898 `),n(1,"div",51),e(2,` 899 `),n(3,"label",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE"),a(),e(5,` 900 `),n(6,"p-checkbox",84),e(7,` 901 `),a(),e(8,` 902 `),a(),e(9,` 903 `)),r&2&&(l(6),p("qwareFocus",!0)("tabindex",2)("binary",!0))}function vE(r,d){r&1&&(e(0,` 904 `),n(1,"span",44),e(2,"expand_less"),a(),e(3,` 905 `))}function gE(r,d){r&1&&(e(0,` 906 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 907 `))}function TE(r,d){if(r&1&&(e(0,` 908 `),n(1,"div",79),e(2,` 909 `),n(3,"p-floatlabel"),e(4,` 910 `),n(5,"p-inputnumber",85),e(6,` 911 `),_(7,vE,4,0,"ng-template",null,6,A),e(9,` 912 `),_(10,gE,4,0,"ng-template",null,7,A),e(12,` 913 `),a(),e(13,` 914 `),n(14,"label",86),e(15,` 915 `),n(16,"span",31),e(17,"CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE"),a(),e(18,"\xA0"),n(19,"span",31),e(20,"CUSTOM_FIELD_LAYOUT.CONFIG.NUMBER_DAYS_LATER"),a(),e(21,` 916 `),a(),e(22,` 917 `),a(),e(23,` 918 `),n(24,"small",57),e(25,` 919 `),n(26,"div",58),e(27,` 920 CUSTOM_FIELD_LAYOUT.CONFIG.ERROR.DEFAULT_VALUE_LENGTH 921 `),a(),e(28,` 922 `),a(),e(29,` 923 `),a(),e(30,` 924 `)),r&2){let t=m(2);l(5),p("tabindex",2)("showButtons",!0)("fluid",!0),l(19),p("hidden",t.configForm.controls.DefaultValueDaysLater.valid||t.configForm.controls.DefaultValueDaysLater.pristine&&!t.configSubmitted),l(2),p("hidden",!(t.configForm.controls.DefaultValueDaysLater.errors!=null&&t.configForm.controls.DefaultValueDaysLater.errors.maxlength))}}function IE(r,d){if(r&1&&(e(0,` 925 `),n(1,"div",79),e(2,` 926 `),n(3,"qware-autocomplete",87),e(4,` 927 `),a(),e(5,` 928 `),a(),e(6,` 929 `)),r&2){let t=m(2);l(3),p("singleSelect",!0)("tabindex",2)("options",t.defaultValueOptions)("virtualScroll",!0)("virtualScrollItemSize",38)}}function bE(r,d){if(r&1&&(e(0,` 930 `),n(1,"div",79),e(2,` 931 `),n(3,"qware-autocomplete",88),e(4,` 932 `),a(),e(5,` 933 `),a(),e(6,` 934 `)),r&2){let t=m(2);l(3),p("tabindex",2)("options",t.defaultValueOptions)("virtualScroll",!0)("virtualScrollItemSize",38)}}function yE(r,d){if(r&1){let t=b();e(0,` 935 `),n(1,"div"),e(2,` 936 `),n(3,"qware-attachments",89,8),h("docsChanged",function(i){E(t);let s=m(2);return S(s.setDocs(i))}),a(),e(5,` 937 `),a(),e(6,` 938 `)}if(r&2){let t=m(2);l(3),p("form",t.configForm)("docs",t.docs)}}function AE(r,d){r&1&&(e(0,` 939 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 940 `))}function RE(r,d){r&1&&(e(0,` 941 `),n(1,"span",44),e(2,"search"),a(),e(3,` 942 `))}function wE(r,d){if(r&1){let t=b();e(0,` 943 `),n(1,"span",90),e(2,` 944 `),n(3,"p-select",91,9),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m(2);return S(i.selectChanged("subject"))}),e(6,` 945 `),_(7,AE,4,0,"ng-template",92),e(8,` 946 `),_(9,RE,4,0,"ng-template",93),e(10,` 947 `),a(),e(11,` 948 `),a(),e(12,` 949 `)}if(r&2){let t=m(2);l(3),q("placeholder",y(5,7,"MERGE_FIELDS.SELECT")),p("options",t.customFieldSubjectFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(9,Ms))("panelStyle",ne(10,cp))("filter",!0)("fluid",!0)}}function DE(r,d){r&1&&(e(0,` 950 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 951 `))}function LE(r,d){r&1&&(e(0,` 952 `),n(1,"span",44),e(2,"search"),a(),e(3,` 953 `))}function NE(r,d){if(r&1){let t=b();e(0,` 954 `),n(1,"span",94),e(2,` 955 `),e(3,`
956 `),R(4,"select",95),e(5,` 957 `),R(6,"select",96),e(7,` 958 `),a(),e(8,` 959 `),n(9,"span",94),e(10,` 960 `),e(11,` 961 `),R(12,"button",97),e(13,` 962 `),R(14,"button",98),e(15,` 963 `),R(16,"button",99),e(17,` 964 `),a(),e(18,` 965 `),n(19,"span",94),e(20,` 966 `),e(21,` 967 `),R(22,"button",100),e(23,` 968 `),R(24,"button",101),e(25,` 969 `),R(26,"button",102),e(27,` 970 `),R(28,"button",103),e(29,` 971 `),a(),e(30,` 972 `),n(31,"span",94),e(32,` 973 `),e(33,` 974 `),R(34,"button",104),e(35,` 975 `),a(),e(36,` 976 `),e(37,` 977 `),n(38,"span",94),e(39,` 978 `),R(40,"button",105),e(41,` 979 `),a(),e(42,` 980 `),n(43,"span",90),e(44,` 981 `),n(45,"p-select",106,10),I(47,"translate"),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m(2);return S(i.selectChanged("body"))}),e(48,` 982 `),_(49,DE,4,0,"ng-template",92),e(50,` 983 `),_(51,LE,4,0,"ng-template",93),e(52,` 984 `),a(),e(53,` 985 `),a(),e(54,` 986 `)}if(r&2){let t=m(2);l(45),q("placeholder",y(47,7,"MERGE_FIELDS.SELECT")),p("options",t.customFieldBodyFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(9,Ms))("filter",!0)("fluid",!0)("panelStyle",ne(10,cp))}}function OE(r,d){r&1&&(e(0,` 987 `),n(1,"span",44),e(2,"expand_less"),a(),e(3,` 988 `))}function FE(r,d){r&1&&(e(0,` 989 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 990 `))}function ME(r,d){r&1&&(e(0,` 991 `),n(1,"span"),e(2,` 992 `),n(3,"span",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.FEE_VALUE"),a(),n(5,"span",64),e(6," *"),a(),e(7,` 993 `),a(),e(8,` 994 `))}function UE(r,d){r&1&&(e(0,` 995 `),n(1,"span"),e(2,` 996 `),n(3,"span",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.FEE_AMOUNT_PER_HOUR"),a(),n(5,"span",64),e(6," *"),a(),e(7,` 997 `),a(),e(8,` 998 `))}function PE(r,d){r&1&&(e(0,` 999 `),n(1,"span"),e(2,` 1000 `),n(3,"span",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.FEE_AMOUNT_EACH"),a(),n(5,"span",64),e(6," *"),a(),e(7,` 1001 `),a(),e(8,` 1002 `))}function GE(r,d){r&1&&(e(0,` 1003 `),n(1,"span"),e(2,` 1004 `),n(3,"span",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.FEE_AMOUNT"),a(),n(5,"span",64),e(6," *"),a(),e(7,` 1005 `),a(),e(8,` 1006 `))}function kE(r,d){r&1&&(e(0,` 1007 `),n(1,"span"),e(2,` 1008 `),n(3,"span",31),e(4,"CUSTOM_FIELD_LAYOUT.CONFIG.FEE_AMOUNT_PER_HOUR"),a(),n(5,"span",64),e(6," *"),a(),e(7,` 1009 `),a(),e(8,` 1010 `))}function VE(r,d){if(r&1&&(e(0,` 1011 `),_(1,GE,9,0)(2,kE,9,0)),r&2){let t=m(4);l(),f(t.feeType==="FIXED"?1:t.feeType==="BY_EVENT_HOUR"?2:-1)}}function qE(r,d){if(r&1&&(e(0,` 1012 `),n(1,"tr"),e(2,` 1013 `),n(3,"th",110),e(4),I(5,"translate"),a(),e(6,` 1014 `),n(7,"th",110),e(8,` 1015 `),_(9,VE,3,1),a(),e(10,` 1016 `),a(),e(11,` 1017 `)),r&2){let t=m(3);l(4),K(` 1018 `,y(5,2,"SHARED.OPTION"),` 1019 `),l(5),f((t.activeCustomFieldConfig==null?null:t.activeCustomFieldConfig.Type)==="SINGLE_SELECT"||(t.activeCustomFieldConfig==null?null:t.activeCustomFieldConfig.Type)==="MULTIPLE_SELECT"?9:-1)}}function BE(r,d){r&1&&(e(0,` 1020 `),n(1,"span",44),e(2,"expand_less"),a(),e(3,` 1021 `))}function HE(r,d){r&1&&(e(0,` 1022 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 1023 `))}function WE(r,d){if(r&1){let t=b();e(0,` 1024 `),n(1,"tr"),e(2,` 1025 `),n(3,"td"),e(4),a(),e(5,` 1026 `),n(6,"td"),e(7,` 1027 `),n(8,"p-floatlabel"),e(9,` 1028 `),n(10,"p-inputnumber",111),j("ngModelChange",function(i){let s=E(t).$implicit;return W(s.feeAmount,i)||(s.feeAmount=i),S(i)}),h("ngModelChange",function(){E(t);let i=m(3);return S(i.feeAmountTableValueChanged())}),e(11,` 1029 `),_(12,BE,4,0,"ng-template",null,6,A),e(14,` 1030 `),_(15,HE,4,0,"ng-template",null,7,A),e(17,` 1031 `),a(),e(18,` 1032 `),a(),e(19,` 1033 `),a(),e(20,` 1034 `),a(),e(21,` 1035 `)}if(r&2){let t=d.$implicit,o=m(3);l(4),K(` 1036 `,t.option,` 1037 `),l(6),p("currency",o.currencyType),H("ngModel",t.feeAmount),p("ngModelOptions",ne(9,Ms))("showButtons",!0)("min",0)("allowEmpty",!1)("required",o.layoutType==="EVENTS"&&(o.configForm.controls.AssignFee.value||!1)&&((o.activeCustomFieldConfig==null?null:o.activeCustomFieldConfig.Type)==="SINGLE_SELECT"||(o.activeCustomFieldConfig==null?null:o.activeCustomFieldConfig.Type)==="MULTIPLE_SELECT"))("fluid",!0)}}function jE(r,d){if(r&1&&(e(0,` 1038 `),n(1,"p-table",107),e(2,` 1039 `),_(3,qE,12,4,"ng-template",108),e(4,` 1040 `),_(5,WE,22,10,"ng-template",109),e(6,` 1041 `),a(),e(7,` 1042 `)),r&2){let t=m(2);l(),p("value",t.feeAmountsTable)("scrollable",!0)}}function YE(r,d){if(r&1){let t=b();e(0,` 1043 `),n(1,"div",50),e(2,` 1044 `),n(3,"div"),e(4,` 1045 `),e(5,` 1046 `),n(6,"div",51),e(7,` 1047 `),n(8,"label"),e(9),I(10,"translate"),a(),e(11,` 1048 `),R(12,"p-checkbox",52),e(13,` 1049 `),a(),e(14,` 1050 1051 `),_(15,uE,22,7)(16,SE,28,6)(17,hE,28,5)(18,CE,10,3)(19,TE,31,5)(20,IE,7,5)(21,bE,7,4)(22,yE,7,2),e(23,` 1052 1053 `),e(24,` 1054 `),n(25,"div",53),e(26,` 1055 `),n(27,"qware-autocomplete",54),h("selectChange",function(i){E(t);let s=m();return S(s.dependentFieldChanged(i))})("unselectChange",function(i){E(t);let s=m();return S(s.dependentFieldChanged(i))}),e(28,` 1056 `),a(),e(29,` 1057 `),a(),e(30,` 1058 1059 `),e(31,` 1060 `),n(32,"div",55),e(33,` 1061 `),n(34,"qware-autocomplete",56),e(35,` 1062 `),a(),e(36,` 1063 `),n(37,"small",57),e(38,` 1064 `),n(39,"div",58),e(40,`
1065 CUSTOM_FIELD_LAYOUT.ERROR.PARENT_FIELD_WHEN_REQUIRED 1066 `),a(),e(41,` 1067 `),a(),e(42,` 1068 `),a(),e(43,` 1069 1070 `),e(44,` 1071 `),n(45,"div",51),e(46,` 1072 `),n(47,"label"),e(48),I(49,"translate"),a(),e(50,` 1073 `),n(51,"p-checkbox",59),h("onChange",function(){E(t);let i=m();return S(i.sendEmailOnChange())}),e(52,` 1074 `),a(),e(53,` 1075 `),a(),e(54,` 1076 1077 `),e(55,` 1078 `),n(56,"div",55),e(57,` 1079 `),n(58,"qware-autocomplete",60),e(59,` 1080 `),a(),e(60,` 1081 `),n(61,"small",57),e(62,` 1082 `),n(63,"div",58),e(64,` 1083 CUSTOM_FIELD_LAYOUT.ERROR.SEND_EMAIL_WHEN_REQUIRED 1084 `),a(),e(65,` 1085 `),a(),e(66,` 1086 `),a(),e(67,` 1087 1088 `),e(68,` 1089 `),n(69,"div",55),e(70,` 1090 `),n(71,"qware-autocomplete",61),I(72,"translate"),I(73,"translate"),e(74,` 1091 `),a(),e(75,` 1092 `),n(76,"small",57),e(77,` 1093 `),n(78,"div",58),e(79,` 1094 CUSTOM_FIELD_LAYOUT.ERROR.EMAIL_RECIPIENTS_REQUIRED 1095 `),a(),e(80,` 1096 `),a(),e(81,` 1097 `),a(),e(82,` 1098 1099 `),e(83,` 1100 `),n(84,"div",62),e(85,` 1101 `),n(86,"label",63),e(87,` 1102 `),n(88,"span",31),e(89,"CUSTOM_FIELD_LAYOUT.CONFIG.SUBJECT"),a(),e(90,` 1103 `),n(91,"span",64),e(92," *"),a(),e(93,` 1104 `),a(),e(94,` 1105 `),n(95,"p-editor",65,4),e(97,` 1106 `),_(98,wE,13,11,"ng-template",null,0,A),e(100,` 1107 `),a(),e(101,` 1108 `),n(102,"small",57),e(103,` 1109 `),n(104,"div",66),e(105,` 1110 CUSTOM_FIELD_LAYOUT.ERROR.SUBJECT_LENGTH 1111 `),a(),e(106,` 1112 `),n(107,"div",58),e(108,` 1113 CUSTOM_FIELD_LAYOUT.ERROR.SUBJECT_REQUIRED 1114 `),a(),e(109,` 1115 `),a(),e(110,` 1116 `),a(),e(111,` 1117 1118 `),e(112,` 1119 `),n(113,"div",62),e(114,` 1120 `),n(115,"label",63),e(116,` 1121 `),n(117,"span",31),e(118,"CUSTOM_FIELD_LAYOUT.CONFIG.BODY"),a(),e(119,` 1122 `),n(120,"span",64),e(121," *"),a(),e(122,` 1123 `),a(),e(123,` 1124 `),n(124,"p-editor",67,5),e(126,` 1125 `),_(127,NE,55,11,"ng-template",null,0,A),e(129,` 1126 `),a(),e(130,` 1127 `),n(131,"small",57),e(132,` 1128 `),n(133,"div",66),e(134,` 1129 CUSTOM_FIELD_LAYOUT.ERROR.BODY_LENGTH 1130 `),a(),e(135,` 1131 `),n(136,"div",58),e(137,` 1132 CUSTOM_FIELD_LAYOUT.ERROR.BODY_REQUIRED 1133 `),a(),e(138,` 1134 `),a(),e(139,` 1135 `),a(),e(140,` 1136 1137 `),e(141,` 1138 `),n(142,"div",68),e(143,` 1139 `),n(144,"label"),e(145),I(146,"translate"),a(),e(147,` 1140 `),n(148,"p-checkbox",69),h("onChange",function(){E(t);let i=m();return S(i.assignFeeOnChange())}),e(149,` 1141 `),a(),e(150,` 1142 `),a(),e(151,` 1143 1144 `),e(152,` 1145 `),n(153,"div",55),e(154,` 1146 `),n(155,"qware-autocomplete",70),h("selectChange",function(i){E(t);let s=m();return S(s.feeTypeOnChange(i))})("unselectChange",function(i){E(t);let s=m();return S(s.feeTypeOnChange(i))}),e(156,` 1147 `),a(),e(157,` 1148 `),a(),e(158,` 1149 1150 `),e(159,` 1151 `),n(160,"div",55),e(161,` 1152 `),n(162,"p-floatlabel"),e(163,` 1153 `),n(164,"p-inputnumber",71),e(165,` 1154 `),_(166,OE,4,0,"ng-template",null,6,A),e(168,` 1155 `),_(169,FE,4,0,"ng-template",null,7,A),e(171,` 1156 `),a(),e(172,` 1157 `),n(173,"label",72),e(174,` 1158 `),_(175,ME,9,0)(176,UE,9,0)(177,PE,9,0),a(),e(178,` 1159 `),a(),e(179,` 1160 `),a(),e(180,` 1161 1162 `),e(181,` 1163 `),n(182,"div",55),e(183,` 1164 `),_(184,jE,8,2),a(),e(185,` 1165 1166 `),e(186,` 1167 `),n(187,"div",73),e(188,` 1168 `),n(189,"p-button",74),I(190,"translate"),h("onClick",function(){E(t);let i=m();return S(i.clearConfig())}),e(191,` 1169 `),a(),e(192,` 1170 `),n(193,"p-button",75),I(194,"translate"),h("onClick",function(){E(t);let i=m();return S(i.applyConfig())}),e(195,` 1171 `),a(),e(196,` 1172 `),a(),e(197,` 1173 `),a(),e(198,` 1174 `),a(),e(199,` 1175 `)}if(r&2){let t,o,i=m();l(),p("hidden",!i.activeCustomFieldConfig)("formGroup",i.configForm),l(8),v(y(10,75,"CUSTOM_FIELD_LAYOUT.CONFIG.FIELD_REQUIRED")),l(3),p("qwareFocus",!0)("tabindex",1)("binary",!0),l(3),f((t=i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="INPUT"?15:t==="CURRENCY"?16:t==="NUMBER"?17:t==="BOOLEAN"?18:t==="DATE"?19:t==="SINGLE_SELECT"?20:t==="MULTIPLE_SELECT"?21:t==="FILE"?22:-1),l(12),p("singleSelect",!0)("tabindex",3)("options",i.dependentFieldOptions),l(5),p("hidden",!(i.configForm.controls.DependentFieldNameSelectItem.value!=null&&i.configForm.controls.DependentFieldNameSelectItem.value.value)),l(2),p("singleSelect",!0)("tabindex",4)("options",i.allConditionOptions)("isRequired",!0),l(3),p("hidden",i.configForm.controls.DependentFieldConditionSelectItem.valid&&(i.configForm.controls.DependentFieldConditionSelectItem.value==null?null:i.configForm.controls.DependentFieldConditionSelectItem.value.value)||i.configForm.controls.DependentFieldConditionSelectItem.pristine&&!i.configSubmitted),l(2),p("hidden",!(i.configForm.controls.DependentFieldConditionSelectItem.errors!=null&&i.configForm.controls.DependentFieldConditionSelectItem.errors.required||i.configForm.controls.DependentFieldConditionSelectItem.value)),l(9),K("",y(49,77,"CUSTOM_FIELD_LAYOUT.CONFIG.SEND_EMAIL"),"?"),l(3),p("tabindex",5)("binary",!0),l(5),p("hidden",!i.emailRequired),l(2),p("singleSelect",!0)("tabindex",6)("options",i.allConditionOptions)("isRequired",!0),l(3),p("hidden",i.configForm.controls.SendEmailConditionSelectItem.valid&&(i.configForm.controls.SendEmailConditionSelectItem.value==null?null:i.configForm.controls.SendEmailConditionSelectItem.value.value)||i.configForm.controls.SendEmailConditionSelectItem.pristine&&!i.configSubmitted),l(2),p("hidden",!(i.configForm.controls.SendEmailConditionSelectItem.errors!=null&&i.configForm.controls.SendEmailConditionSelectItem.errors.required||i.configForm.controls.SendEmailConditionSelectItem.value)),l(6),p("hidden",!i.emailRequired),l(2),gt("label","",y(72,79,"CUSTOM_FIELD_LAYOUT.CONFIG.EMAIL_RECIPIENTS")," (",y(73,81,"CUSTOM_FIELD_LAYOUT.CONFIG.USER_GROUPS"),")"),p("tabindex",7)("options",i.allUserGroupOptions)("isRequired",!0)("virtualScroll",!0)("virtualScrollItemSize",38),l(5),p("hidden",i.configForm.controls.EmailRecipientsSelectItems.val
1175id&&((o=i.configForm.controls.EmailRecipientsSelectItems.value==null?null:i.configForm.controls.EmailRecipientsSelectItems.value.length)!==null&&o!==void 0?o:0)>0||i.configForm.controls.EmailRecipientsSelectItems.pristine&&!i.configSubmitted),l(2),p("hidden",!(i.configForm.controls.EmailRecipientsSelectItems.errors!=null&&i.configForm.controls.EmailRecipientsSelectItems.errors.required||i.configForm.controls.EmailRecipientsSelectItems.value)),l(6),p("hidden",!i.emailRequired),l(18),p("hidden",i.configForm.controls.EmailSubject.valid||i.configForm.controls.EmailSubject.pristine&&!i.configSubmitted),l(2),p("hidden",!(i.configForm.controls.EmailSubject.errors!=null&&i.configForm.controls.EmailSubject.errors.maxlength))("translateParams",pe(89,dp,i.configForm.controls.EmailSubject.value)),l(3),p("hidden",!(i.configForm.controls.EmailSubject.errors!=null&&i.configForm.controls.EmailSubject.errors.required)),l(6),p("hidden",!i.emailRequired),l(18),p("hidden",i.configForm.controls.EmailBody.valid||i.configForm.controls.EmailBody.pristine&&!i.configSubmitted),l(2),p("hidden",!(i.configForm.controls.EmailBody.errors!=null&&i.configForm.controls.EmailBody.errors.maxlength))("translateParams",pe(91,dp,i.configForm.controls.EmailBody.value)),l(3),p("hidden",!(i.configForm.controls.EmailBody.errors!=null&&i.configForm.controls.EmailBody.errors.required)),l(6),p("hidden",!0),l(3),v(y(146,83,"CUSTOM_FIELD_LAYOUT.CONFIG.ASSIGN_FEE")),l(3),p("tabindex",10)("binary",!0),l(5),p("hidden",!(i.layoutType==="EVENTS"&&i.configForm.controls.AssignFee&&i.configForm.controls.AssignFee.value&&((i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="SINGLE_SELECT"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="MULTIPLE_SELECT"))),l(2),p("tabindex",11)("options",i.feeTypeOptions)("selectedOption",i.selectedFeeTypeOption)("singleSelect",!0)("isRequired",(i.configForm.controls.AssignFee.value||!1)&&((i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="SINGLE_SELECT"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="MULTIPLE_SELECT")),l(5),p("hidden",!(i.layoutType==="EVENTS"&&i.configForm.controls.AssignFee&&i.configForm.controls.AssignFee.value&&((i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="NUMBER"))),l(4),p("tabindex",12)("currency",i.currencyType)("fluid",!0)("showButtons",!0)("min",0)("required",i.assignFee!==void 0&&(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"),l(11),f(i.feeType==="FIXED"&&(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"?175:-1),l(),f(i.feeType==="BY_EVENT_HOUR"&&(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="BOOLEAN"?176:-1),l(),f((i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="NUMBER"?177:-1),l(5),p("hidden",!(i.layoutType==="EVENTS"&&i.configForm.controls.AssignFee&&i.configForm.controls.AssignFee.value&&((i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="SINGLE_SELECT"||(i.activeCustomFieldConfig==null?null:i.activeCustomFieldConfig.Type)==="MULTIPLE_SELECT"))),l(2),f(i.feeAmountsTable?184:-1),l(5),q("label",y(190,85,"SHARED.CLEAR")),p("text",!0),l(4),q("label",y(194,87,"SHARED.APPLY")),p("text",!0)("disabled",!i.configForm.valid||!i.configForm.dirty)}}function QE(r,d){r&1&&(e(0,` 1176 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 1177 `))}function KE(r,d){if(r&1){let t=b();e(0,` 1178 `),n(1,"p-select",113),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.drawerView,i)||(s.drawerView=i),S(i)}),e(2,` 1179 `),_(3,QE,4,0,"ng-template",92),e(4,` 1180 `),a(),e(5,` 1181 `)}if(r&2){let t=m(2);l(),p("options",t.allDrawerViews),H("ngModel",t.drawerView)}}function $E(r,d){r&1&&(e(0,` 1182 `),n(1,"span",114),e(2,"CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"),a(),e(3,` 1183 `))}function zE(r,d){if(r&1&&(e(0,` 1184 `),n(1,"div",112),e(2,` 1185 `),_(3,KE,6,2)(4,$E,4,0),a(),e(5,` 1186 `)),r&2){let t=m();l(3),f(t.editMode?3:4)}}function XE(r,d){if(r&1&&(e(0,` 1187 `),n(1,"div",33),e(2,` 1188 `),n(3,"div",34),e(4,` 1189 `),n(5,"div",35),e(6,` 1190 `),n(7,"i",36),e(8,"drag_handle"),a(),e(9,` 1191 `),a(),e(10,` 1192 `),n(11,"div",37),e(12,` 1193 `),n(13,"div"),e(14,` 1194 `),n(15,"div",39),e(16),I(17,"translate"),a(),e(18,` 1195 `),n(19,"div",40),e(20),a(),e(21,` 1196 `),a(),e(22,` 1197 `),a(),e(23,` 1198 `),a(),e(24,` 1199 `),a(),e(25,` 1200 `)),r&2){let t=d.$implicit;l(16),qi("",t.Name," (",y(17,3,"CUSTOM_FIELD.TYPES."+t.Type),")"),l(4),v(t.Description)}}function ZE(r,d){if(r&1){let t=b();e(0,` 1201 `),n(1,"div",115),e(2,` 1202 `),n(3,"p-iconfield",116),e(4,` 1203 `),n(5,"p-inputicon"),e(6,` 1204 `),n(7,"span",44),e(8,"search"),a(),e(9,` 1205 `),a(),e(10,` 1206 `),n(11,"input",117),I(12,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.generalFilter,i)||(s.generalFilter=i),S(i)}),h("keyup",function(){E(t);let i=m();return S(i.customFieldFilterOnChange())}),a(),e(13,` 1207 `),a(),e(14,` 1208 1209 `),n(15,"div",118),j("dragulaModelChange",function(i){E(t);let s=m();return W(s.filteredCustomFields,i)||(s.filteredCustomFields=i),S(i)}),e(16,` 1210 `),G(17,XE,26,5,null,null,Ns),a(),e(19,` 1211 `),a(),e(20,` 1212 `)}if(r&2){let t=m();l(11),q("placeholder",y(12,4,"SHARED.SEARCH")),H("ngModel",t.generalFilter),p("fluid",!0),l(4),H("dragulaModel",t.filteredCustomFields),l(2),k(t.filteredCustomFields)}}function JE(r,d){if(r&1){let t=b();e(0,` 1213 `),n(1,"div",115),e(2,` 1214 `),n(3,"qware-entity-history",119),j("parentSpinnerStateChange",function(i){E(t);let s=m();return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(4,` 1215 `),a(),e(5,` 1216 `),a(),e(6,` 1217 `)}if(r&2){let t=m();l(3),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap)("str
1217ictlyThisEntity",!0),H("parentSpinnerState",t.displayDrawerSpinner)}}var Rl=(()=>{class r{appSettingsService;attachmentService;authService;customFieldService;documentService;dragulaService;fb;instanceDataService;route;translate;userGroupService;attachments;bodyDropdown;bodyEditor;selectionInput;drawer;subjectDropdown;subjectEditor;autoFocus=!0;customFieldLimit;form;isCreate=!1;layout;layoutType;previewOption;submitted=!1;validationErrors;allValuesLoaded=new Yt;configChanged=new Yt;previewOptionChange=new Yt;displayDrawerSpinner=D(!1);activeCustomFieldConfig;allConditionOptions=[];allDependentFieldOptions=[];allDrawerViews=[];allUserGroupOptions=[];assignFee=!1;configForm;configSubmitted=!1;currencyType="USD";customFieldBodyFields=[];customFieldSubjectFields=[];defaultFeeOption;defaultValueOptions=[];dependentFieldOptions=[];docs=[];drawerView=0;editMode=!1;emailRequired=!1;feeAmountsTable=[];feeType;feeTypeOptions=[];filteredCustomFields=[];generalFilter="";historyCreatedText;historyNameMap=new Map;historyIdMap=new Map;leftColumnFields=[];rightColumnFields=[];selectedFeeTypeOption;selectedMergeField;showConfigSidebar=!1;showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;userEnabledSidebar=!1;assetBodyFields=[];assetSubjectFields=[];customFields=[];customFieldTypes=[];dragulaSubs=new Vi;eventBodyFields=[];eventSubjectFields=[];inventoryBodyFields=[];inventorySubjectFields=[];subscriptions;translations={};workOrderSubjectFields=[];workOrderBodyFields=[];auditLoggingDisabled=!0;constructor(t,o,i,s,c,u,x,C,O,w,F){this.appSettingsService=t,this.attachmentService=o,this.authService=i,this.customFieldService=s,this.documentService=c,this.dragulaService=u,this.fb=x,this.instanceDataService=C,this.route=O,this.translate=w,this.userGroupService=F,this.editMode=this.route.snapshot.params.id,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.dragulaService.createGroup("LAYOUTFIELDS",{moves:(L,U,V)=>V?V.className==="drag-handle":!1,accepts:(L,U)=>U?U.id!=="source-column":!1}),this.dragulaSubs.add(u.dragend("LAYOUTFIELDS").subscribe(()=>{this.setFormValue(),this.customFieldFilterOnChange()})),this.dragulaSubs.add(u.drag("LAYOUTFIELDS").subscribe(()=>{this.previewOption==="PREVIEW"&&!this.isCreate?this.previewOption="EDIT":this.previewOption==="PREVIEW"&&(this.previewOption="CREATE"),this.previewOptionChange.emit(this.previewOption),this.showSidebar&&window.innerWidth<=Je.lgbreak&&this.toggleSidebar()}))}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}ngOnChanges(t){t.layoutType&&this.layoutType&&this.updateMergeFieldOptions(),t.layout&&this.layout&&(this.drawerView=this.layout&&this.layout.State===M.DELETED?1:0,pt.default.isEmpty(this.allDrawerViews)||(this.allDrawerViews[0].disabled=this.layout&&this.layout.State===M.DELETED))}feeAmountTableValueChanged(){this.configForm.markAsDirty(),this.configForm.markAsTouched()}loadData(){let t=["ASSETS","COMMENTS","COMPLETED_DATE","CREATION_DATE","CREATED_BY","DUE_DATE","GUEST_EMAIL","GUEST_NAME","GUEST_PHONE","LINK_TO_WO","LOCATIONS","MOD_BY","MOD_DATE","PRIORITY","REQUESTER","SERVICE_AREA","STATUS","WO_NUMBER","WO_TYPE"],o=["ASSET_NAME","LINK_TO_ASSET","PURCHASE_DATE","PURCHASE_PRICE","RETIRE_DATE","TAG_NAME","LOCATION"],i=["COST_PER_ISSUE_UNIT","COST_PER_PURCHASE_UNIT","INVENTORY_NAME","ISSUE_QUANTITY_PER_UNIT_OF_PURCHASE","LINK_TO_INVENTORY","STOCK_NUMBER","UNIT_OF_ISSUE","UNIT_OF_PURCHASE"],s=["ASSIGNED_TO","CATEGORY","DESCRIPTION","MAKE","MODEL","SELECT","SERIAL_NUMBER","VENDOR"],c=["EVENT_CALENDAR","EVENT_CATEGORY","EVENT_START_DATE","EVENT_END_DATE","EVENT_DESCRIPTION","EVENT_GROUP","EVENT_LOCATIONS","EVENT_NAME","EVENT_REQUESTER","EVENT_STATUS","EVENT_IS_BLOCKING"],u=pt.default.concat(t,o,i,s,c).map(w=>`MERGE_FIELDS.${w}`),x=[this.translate.get(pt.default.concat(u,["SHARED.DISABLED","SHARED.DELETED","CUSTOM_FIELD_LAYOUT.CONFIG.HAS_NO_VALUE","CUSTOM_FIELD_LAYOUT.CONFIG.HAS_A_VALUE","CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS","SHARED.AUDIT_LOG","AUDIT.CUSTOM_FIELD_LAYOUT","EVENT.FIXED","EVENT.BY_EVENT_HOUR"])).pipe(N()),this.appSett
1217ingsService.getAppSettings().pipe(N()),this.customFieldService.getCustomFieldTypes(),this.customFieldService.getCustomFields(this.authService.tenant.Id),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id)],C=this.form.get("Fields");this.editMode&&C!==null&&x.push(C.valueChanges.pipe(N()));let O=[];ue(x).pipe(we(w=>{this.translations=w[0];let F=w[1],L=w[2];this.customFields=w[3];let U=w[4],V=w[5];O=w[6]??[],this.currencyType=F.CurrencyType??"USD";let z=[{label:this.translations["CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"],value:0,disabled:this.layout&&this.layout.State===M.DELETED}];this.auditLoggingDisabled||z.push({label:this.translations["SHARED.AUDIT_LOG"],value:1}),this.allDrawerViews=z;let ce=[{label:this.translations["MERGE_FIELDS.ASSIGNED_TO"],value:"[ASSIGNED_TO]"},{label:this.translations["MERGE_FIELDS.COMPLETED_DATE"],value:"[COMPLETED_DATE]"},{label:this.translations["MERGE_FIELDS.CREATED_BY"],value:"[CREATED_BY]"},{label:this.translations["MERGE_FIELDS.CREATION_DATE"],value:"[CREATION_DATE]"}];F.DueDate&&ce.push({label:this.translations["MERGE_FIELDS.DUE_DATE"],value:"[DUE_DATE]"}),F.WorkOrderGuestForm&&(ce.push({label:this.translations["MERGE_FIELDS.GUEST_EMAIL"],value:"[GUEST_EMAIL]"}),ce.push({label:this.translations["MERGE_FIELDS.GUEST_NAME"],value:"[GUEST_NAME]"}),ce.push({label:this.translations["MERGE_FIELDS.GUEST_PHONE"],value:"[GUEST_PHONE_NUMBER]"})),ce.push({label:this.translations["MERGE_FIELDS.MOD_BY"],value:"[MODIFIED_BY]"}),ce.push({label:this.translations["MERGE_FIELDS.MOD_DATE"],value:"[MODIFICATION_DATE]"}),F.Priority&&ce.push({label:this.translations["MERGE_FIELDS.PRIORITY"],value:"[PRIORITY]"}),ce.push({label:this.translations["MERGE_FIELDS.REQUESTER"],value:"[REQUESTER]"}),ce.push({label:this.translations["MERGE_FIELDS.SERVICE_AREA"],value:"[SERVICE_AREA]"}),ce.push({label:this.translations["MERGE_FIELDS.STATUS"],value:"[STATUS]"}),ce.push({label:this.translations["MERGE_FIELDS.WO_NUMBER"],value:"[WORK_ORDER_NUMBER]"}),ce.push({label:this.translations["MERGE_FIELDS.WO_TYPE"],value:"[WORK_ORDER_TYPE]"});let Z=pt.default.concat(ce,[{label:this.translations["MERGE_FIELDS.ASSETS"],value:"[ASSETS]"},{label:this.translations["MERGE_FIELDS.COMMENTS"],value:"[COMMENTS]"},{label:this.translations["MERGE_FIELDS.DESCRIPTION"],value:"[DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.LINK_TO_WO"],value:"[WORK_ORDER_LINK]"},{label:this.translations["MERGE_FIELDS.LOCATIONS"],value:"[LOCATIONS]"}]);Z=pt.default.sortBy(Z,Ue=>(Ue.label??"").toLowerCase()),this.assetSubjectFields=[{label:this.translations["MERGE_FIELDS.ASSET_NAME"],value:"[ASSET_NAME]"},{label:this.translations["MERGE_FIELDS.ASSIGNED_TO"],value:"[ASSIGNED_TO]"},{label:this.translations["MERGE_FIELDS.CATEGORY"],value:"[ASSET_CATEGORY]"},{label:this.translations["MERGE_FIELDS.LOCATION"],value:"[LOCATION]"},{label:this.translations["MERGE_FIELDS.MAKE"],value:"[MAKE]"},{label:this.translations["MERGE_FIELDS.MODEL"],value:"[MODEL]"},{label:this.translations["MERGE_FIELDS.PURCHASE_DATE"],value:"[PURCHASE_DATE]"},{label:this.translations["MERGE_FIELDS.PURCHASE_PRICE"],value:"[PURCHASE_PRICE]"},{label:this.translations["MERGE_FIELDS.RETIRE_DATE"],value:"[RETIRE_DATE]"},{label:this.translations["MERGE_FIELDS.SERIAL_NUMBER"],value:"[SERIAL_NUMBER]"},{label:this.translations["MERGE_FIELDS.TAG_NAME"],value:"[TAG_NAME]"},{label:this.translations["MERGE_FIELDS.VENDOR"],value:"[VENDOR]"}];let fe=pt.default.concat(this.assetSubjectFields,[{label:this.translations["MERGE_FIELDS.DESCRIPTION"],value:"[DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.LINK_TO_ASSET"],value:"[ASSET_LINK]"}]);fe=pt.default.sortBy(fe,Ue=>(Ue.label??"").toLowerCase()),this.inventorySubjectFields=[{label:this.translations["MERGE_FIELDS.CATEGORY"],value:"[CATEGORY]"},{label:this.translations["MERGE_FIELDS.COST_PER_ISSUE_UNIT"],value:"[COST_PER_ISSUE_UNIT]"},{label:this.translations["MERGE_FIELDS.COST_PER_PURCHASE_UNIT"],value:"[COST_PER_PURCHASE_UNIT]"},{label:this.translations["MERGE_FIELDS.INVENTORY_NAME"],value:"[INVENTORY_NAME]"},{label:this.translations["MERGE_FIELDS.ISSUE_QUANTITY_PER_UNIT_OF_PURCHASE"],value:"[ISSUE_QUANTITY_PER_UNIT_OF_PURCHASE]"},{label:this.translations["MERGE_FIELDS.MAKE"],value:"[MAKE]"},{label:this.translations["MERGE_FIELDS.MODEL"],value:"[MODEL]"},{label:this.translations["MERGE_FIELDS.SERIAL_NUMBER"],value:"[SERIAL_NUMBER]"},{label:this.translations["MERGE_FIELDS.STOCK_NUMBER"],value:"[STOCK_NUMBER]"},{label:this.translations["MERGE_FIELDS.UNIT_OF_ISSUE"],value:"[UNIT_OF_ISSUE]"},{label:this.translations["MERGE_FIELDS.UNIT_OF_PURCHASE"],value:"[UNIT_OF_PURCHASE]"},{label:this.translations["MERGE_FIELDS.VENDOR"],value:"[VENDOR]"}];let Me=pt.default.concat(this.inventorySubjectFields,[{label:this.translations["MERGE_FIELDS.DESCRIPTION"],value:"[DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.LINK_TO_INVENTORY"],value:"[INVENTORY_LINK]"}]);Me=pt.default.sortBy(Me,Ue=>(Ue.label??"").toLowerCase());let ke=[{label:this.translations["MERGE_FIELDS.EVENT_CALENDAR"],value:"[EVENT_CALENDAR]"},{label:this.translations["MERGE_FIELDS.EVENT_CATEGORY"],value:"[EVENT_CATEGORY]"},{label:this.translations["MERGE_FIELDS.EVENT_END_DATE"],value:"[EVENT_END_DATE]"},{label:this.translations["MERGE_FIELDS.EVENT_GROUP"],value:"[EVENT_GROUP]"},{label:this.translations["MERGE_FIELDS.EVENT_NAME"],value:"[EVENT_NAME]"},{label:this.translations["MERGE_FIELDS.EVENT_REQUESTER"],value:"[EVENT_REQUESTER]"},{label:this.translations["MERGE_FIELDS.EVENT_START_DATE"],value:"[EVENT_START_DATE]"},{label:this.translations["MERGE_FIELDS.EVENT_STATUS"],value:"[EVENT_STATUS]"}];ke=pt.default.sortBy(ke,Ue=>(Ue.label??"").toLowerCase());let Xt=pt.default.concat(this.eventSubjectFields,[{label:this.translations["MERGE_FIELDS.EVENT_CALENDAR"],value:"[EVENT_CALENDAR]"},{label:this.translations["MERGE_FIELDS.EVENT_CATEGORY"],value:"[EVENT_CATEGORY]"},{label:this.translations["MERGE_FIELDS.EVENT_DESCRIPTION"],value:"[EVENT_DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.EVENT_END_DATE"],value:"[EVENT_END_DATE]"},{label:this.translations["MERGE_FIELDS.EVENT_GROUP"],value:"[EVENT_GROUP]"},{label:this.translations["MERGE_FIELDS.EVENT_IS_BLOCKING"],value:"[EVENT_IS_BLOCKING]"},{label:this.translations["MERGE_FIELDS.EVENT_LOCATIONS"],value:"[EVENT_LOCATIONS]"},{label:this.translations["MERGE_FIELDS.EVENT_NAME"],value:"[EVENT_NAME]"},{label:this.translations["MERGE_FIELDS.EVENT_REQUESTER"],value:"[EVENT_REQUESTER]"},{label:this.translations["MERGE_FIELDS.EVENT_START_DATE"],value:"[EVENT_START_DATE]"},{label:this.translations["MERGE_FIELDS.EVENT_STATUS"],value:"[EVENT_STATUS]"}]);Xt=pt.default.sortBy(Xt,Ue=>(Ue.label??"").toLowerCase());let hi=pt.default.groupBy(V,Ue=>Ue.Type),Gi=pt.default.sortBy(pt.default.uniqBy(pt.default.flatten((hi.WORKORDERS??[]).map(Ue=>(Ue.Fields??[]).filter(Wt=>Wt.State===M.ACTIVE))),"ParentId"),Ue=>(Ue.Name??"").toLowerCase()).map(Ue=>({label:Ue.Name,value:this.customFieldService.formatMergeField(Ue.Name??"")})),on=pt.default.sortBy(pt.default.uniqBy(pt.default.flatten((hi.ASSETS??[]).map(Ue=>(Ue.Fields??[]).filter(Wt=>Wt.State===M.ACTIVE))),"ParentId"),Ue=>(Ue.Name??"").toLowerCase()).map(Ue=>({label:Ue.Name,value:this.customFieldService.formatMergeField(Ue.Name??"")})),Ro=pt.default.sortBy(pt.default.uniqBy(pt.default.flatten((hi.INVENTORY??[]).map(Ue=>(Ue.Fields??[]).filter(Wt=>Wt.State===M.ACTIVE))),"ParentId"),Ue=>(Ue.Name??"").toLowerCase()).map(Ue=>({label:Ue.Name,value:this.customFieldService.formatMergeField(Ue.Name??"")})),In=pt.default.sortBy(pt.default.uniqBy(pt.default.flatten((hi.EVENTS??[]).map(Ue=>(Ue.Fields??[]).filter(Wt=>Wt.State===M.ACTIVE))),"ParentId"),Ue=>(Ue.Name??"").toLowerCase()).map(Ue=>({label:Ue.Name,value:this.customFieldService.formatMergeField(Ue.Name??"")}));this.workOrderSubjectFields=ce,this.workOrderBodyFields=pt.default.concat(Z,Gi),this.assetBodyFields=pt.default.concat(fe,on),this.inventoryBo
1217dyFields=pt.default.concat(Me,Ro),this.eventSubjectFields=ke,this.eventBodyFields=pt.default.concat(Xt,In),this.updateMergeFieldOptions(),this.allConditionOptions=[{label:this.translations["CUSTOM_FIELD_LAYOUT.CONFIG.HAS_A_VALUE"],value:"HAS_VALUE"},{label:this.translations["CUSTOM_FIELD_LAYOUT.CONFIG.HAS_NO_VALUE"],value:"NO_VALUE"}],this.customFieldTypes=L.filter(Ue=>Ue!=="UNKNOWN").map(Ue=>({label:Ue,value:Ue})),this.filteredCustomFields=this.customFields.filter(Ue=>Ue.State===M.ACTIVE),this.allUserGroupOptions=U.map(Ue=>({label:Ue.Name,value:Ue.Id})),this.feeTypeOptions=[{label:this.translations["EVENT.FIXED"],value:zo.FIXED},{label:this.translations["EVENT.BY_EVENT_HOUR"],value:zo.BY_EVENT_HOUR}],this.selectedFeeTypeOption=this.feeTypeOptions[0],this.setHistoryParams();let xi=[];return O&&(O.forEach(Ue=>{if(Ue.Type==="FILE"&&Ue.DefaultValue){let Wt=We.unstringify(Ue.DefaultValue);xi=pt.default.concat(xi,Wt)}}),xi=pt.default.uniq(xi)),ue([this.translate.get(L.map(Ue=>"CUSTOM_FIELD.TYPES."+Ue)).pipe(N()),xi.length>0?this.documentService.getDocumentsById(xi).pipe(N()):Fe([])])})).subscribe(w=>{this.customFieldTypes.forEach(F=>{let L=w[0],U=w[1];F.label=L["CUSTOM_FIELD.TYPES."+F.label],O=pt.default.orderBy(O,V=>
1217V.LayoutOrder),U&&O.filter(V=>V.Type==="FILE").forEach(V=>{let z=We.unstringify(V.DefaultValue);z&&(V.DefaultValueQwareDocuments=U.filter(ce=>ce.Id&&z.indexOf(ce.Id)>-1),V.DefaultValueQwareDocuments.forEach(ce=>{ce.DocumentURL=this.instanceDataService.DOCUMENT_CONTAINER_URL+this.authService.tenant.Id+"/"+ce.Id+"."+ce.DocType}))}),this.leftColumnFields=O.filter(V=>V.LayoutOrder&&V.LayoutOrder<200),this.rightColumnFields=O.filter(V=>V.LayoutOrder&&V.LayoutOrder>=200),this.filteredCustomFields=pt.default.differenceWith(this.customFields,O,(V,z)=>V.Id===z.Id||V.Id===z.ParentId).filter(V=>V.State===M.ACTIVE),this.setFormValue(),this.form.markAsPristine(),this.form.markAsUntouched(),this.allValuesLoaded.emit(!0)})})}createForm(){this.configForm=this.fb.group({IsRequired:this.fb.control(!1),DefaultValue:this.fb.control(null),DefaultValueSelectItem:this.fb.control(null),DefaultValueSelectItems:this.fb.control([]),DefaultValueDaysLater:this.fb.control(null),DependentFieldNameSelectItem:this.fb.control(null),DependentFieldConditionSelectItem:this.fb.control(null),SendEmail:this.fb.control(!1),SendEmailConditionSelectItem:this.fb.control(null),EmailRecipientsSelectItems:this.fb.control([]),EmailSubject:this.fb.control(""),EmailBody:this.fb.control(""),AssignFee:this.fb.control(!1),FeeType:this.fb.control(""),FeeAmount:this.fb.control(0)})}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.CUSTOM_FIELD_LAYOUT"]+" "+this.form.get("Name")?.value;let t=new Map;t.set("EmailRecipients",[this.allUserGroupOptions,"value","label"]),t.set("AssociatedEntity",[this.customFields,"Id","Name"]),t.set("DependentFieldName",[this.customFields,"Id","Name"]),this.historyIdMap=t;let o=new Map;o.set("Name","CUSTOM_FIELD_LAYOUT.NAME"),this.historyNameMap=o}ngOnDestroy(){this.dragulaService.destroy("LAYOUTFIELDS"),this.dragulaSubs&&!this.dragulaSubs.closed&&this.dragulaSubs.unsubscribe(),this.subscriptions&&!this.subscriptions.closed&&this.subscriptions.unsubscribe()}setFormValue(){let t=pt.default.concat(this.leftColumnFields,this.rightColumnFields);this.leftColumnFields.forEach((o,i)=>{o.LayoutOrder=100+i,o.DependentFieldMissing=o.DependentFieldName!==void 0&&!t.find(s=>s.Id===o.DependentFieldName)}),this.rightColumnFields.forEach((o,i)=>{o.LayoutOrder=200+i,o.DependentFieldMissing=o.DependentFieldName!==void 0&&!t.find(s=>s.Id===o.DependentFieldName)}),t=pt.default.concat(this.leftColumnFields,this.rightColumnFields),this.form.get("Fields")?.setValue(t),this.form.get("Fields")?.markAsDirty(),this.form.get("Fields")?.markAsTouched(),this.allDependentFieldOptions=t.map(o=>({label:o.Name,value:o.Id})),this.configChanged.emit()}deleteSelection(t,o){let i;o==="LEFT"?(this.removeConfigs(this.leftColumnFields[t]),i=this.leftColumnFields.splice(t,1)[0]):o==="RIGHT"&&(this.removeConfigs(this.rightColumnFields[t]),i=this.rightColumnFields.splice(t,1)[0]),this.leftColumnFields.forEach(s=>{s.DependentFieldName===i.Id&&(s.DependentFieldName=i.ParentId??i.Id)}),this.rightColumnFields.forEach(s=>{s.DependentFieldName===i.Id&&(s.DependentFieldName=i.ParentId??i.Id)}),this.setFormValue(),this.customFieldFilterOnChange()}configureSelection(t,o){this.showConfigSidebar=!0,o==="LEFT"?this.activeCustomFieldConfig=this.leftColumnFields[t]:o==="RIGHT"&&(this.activeCustomFieldConfig=this.rightColumnFields[t]);let i=pt.default.concat(this.leftColumnFields,this.rightColumnFields),s=[{label:this.activeCustomFieldConfig?.Name,value:this.activeCustomFieldConfig?.Id}],c=i.filter(u=>u.DependentFieldName===this.activeCustomFieldConfig?.Id);for(;c.length>0;)c.forEach(u=>{s.push({label:u.Name,value:u.Id}),c.splice(c.indexOf(u),1),i.filter(C=>C.DependentFieldName===u.Id).forEach(C=>{c.push(C)})});if(this.dependentFieldOptions=pt.default.differenceWith(this.allDependentFieldOptions,s,pt.default.isEqual),this.activeCustomFieldConfig?.Type==="SINGLE_SELECT"){if(this.activeCustomFieldConfig.Options){this.defaultValueOptions=this.activeCustomFieldConfig.Options.map(x=>({label:x,value:x}));let u=[];this.activeCustomFieldConfig.FeeAmounts?this.defaultValueOptions.forEach(x=>{x.label&&this.activeCustomFieldConfig?.FeeAmounts&&u.push({option:x.label,feeAmount:this.activeCustomFieldConfig.FeeAmounts[x.label]??0})}):this.defaultValueOptions.forEach(x=>{x.label&&u.push({option:x.label,feeAmount:0})}),this.feeAmountsTable=u}this.activeCustomFieldConfig.AssignFee&&this.feeTypeOnChange({label:this.translations["EVENT."+this.activeCustomFieldConfig.FeeType],value:this.activeCustomFieldConfig.FeeType}),this.activeCustomFieldConfig.DefaultValue&&(this.activeCustomFieldConfig.DefaultValueSelectItem=this.defaultValueOptions.find(u=>u.value===this.activeCustomFieldConfig?.DefaultValue))}else if(this.activeCustomFieldConfig?.Type==="MULTIPLE_SELECT"){if(this.activeCustomFieldConfig.Options){this.defaultValueOptions=this.activeCustomFieldConfig.Options.map(x=>({label:x,value:x}));let u=[];this.activeCustomFieldConfig.FeeAmounts?this.defaultValueOptions.forEach(x=>{x.label&&this.activeCustomFieldConfig?.FeeAmounts&&u.push({option:x.label,feeAmount:this.activeCustomFieldConfig.FeeAmounts[x.label]??0})}):this.defaultValueOptions.forEach(x=>{x.label&&u.push({option:x.label,feeAmount:0})}),this.feeAmountsTable=u}this.activeCustomFieldConfig.AssignFee&&this.feeTypeOnChange({label:this.translations["EVENT."+this.activeCustomFieldConfig.FeeType],value:this.activeCustomFieldConfig.FeeType}),this.activeCustomFieldConfig.DefaultValue&&(this.activeCustomFieldConfig.DefaultValueSelectItems=this.defaultValueOptions.filter(u=>We.unstringify(this.activeCustomFieldConfig?.DefaultValue).indexOf(u.value)>-1))}else this.activeCustomFieldConfig?.Type==="DATE"&&this.activeCustomFieldConfig.DefaultValue&&typeof this.activeCustomFieldConfig.DefaultValue=="string"?this.activeCustomFieldConfig.DefaultValue=this.activeCustomFieldConfig.DefaultValue:this.activeCustomFieldConfig?.Type==="BOOLEAN"&&(this.activeCustomFieldConfig.AssignFee&&this.feeTypeOnChange({label:this.translations["EVENT."+this.activeCustomFieldConfig.FeeType],value:this.activeCustomFieldConfig.FeeType}),this.activeCustomFieldConfig.DefaultValue&&typeof this.activeCustomFieldConfig.DefaultValue=="string"&&(this.activeCustomFieldConfig.DefaultValue=We.unstringify(this.activeCustomFieldConfig.DefaultValue)));
1217this.activeCustomFieldConfig?.DependentFieldName&&(this.activeCustomFieldConfig.DependentFieldNameSelectItem=this.allDependentFieldOptions.find(u=>u.value===this.activeCustomFieldConfig?.DependentFieldName)),this.activeCustomFieldConfig?.DependentFieldCondition&&(this.activeCustomFieldConfig.DependentFieldConditionSelectItem=this.allConditionOptions.find(u=>u.value===this.activeCustomFieldConfig?.DependentFieldCondition)),this.activeCustomFieldConfig?.SendEmailCondition&&(this.activeCustomFieldConfig.SendEmailConditionSelectItem=this.allConditionOptions.find(u=>u.value===this.activeCustomFieldConfig?.SendEmailCondition)),this.activeCustomFieldConfig?.EmailRecipients&&(this.activeCustomFieldConfig.EmailRecipientsSelectItems=this.allUserGroupOptions.filter(u=>this.activeCustomFieldConfig?.EmailRecipients&&this.activeCustomFieldConfig.EmailRecipients.indexOf(u.value)>-1)),this.activeCustomFieldConfig?.Type==="FILE"&&this.activeCustomFieldConfig?.DefaultValueQwareDocuments&&(this.docs=this.activeCustomFieldConfig.DefaultValueQwareDocuments),this.activeCustomFieldConfig&&(this.configForm.patchValue(this.activeCustomFieldConfig),this.sendEmailOnChange(),this.dependentFieldChanged(this.configForm.get("DependentFieldNameSelectItem")?.value??void 0),this.configForm.markAsPristine(),this.configForm.markAsUntouched())}toggleSidebar(t){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=pt.default.clone(this.showSidebar),this.showSidebar&&(this.drawerView=t??0)}applyConfig(){let t=Object.assign(this.activeCustomFieldConfig,this.configForm.value);if(t.Type==="SINGLE_SELECT"?t.DefaultValue=t.DefaultValueSelectItem?.value||null:t.Type==="MULTIPLE_SELECT"&&t.DefaultValueSelectItems?t.DefaultValue=We.stringify(t.DefaultValueSelectItems.map(o=>o.value)):t.Type==="DATE"&&t.DefaultValueDaysLater!==void 0&&(t.DefaultValue=t.DefaultValueDaysLater),t.DependentFieldName=t.DependentFieldNameSelectItem?.value,t.DependentFieldCondition=t.DependentFieldConditionSelectItem?.value,t.SendEmailCondition=t.SendEmailConditionSelectItem?.value,t.EmailRecipients=t.EmailRecipientsSelectItems?.map(o=>o.value),t.AssignFee)if(t.Type==="SINGLE_SELECT"||t.Type==="MULTIPLE_SELECT"){let o={};this.feeAmountsTable.forEach(i=>{o[i.option]=i.feeAmount}),t.FeeAmounts=o}else t.Type==="NUMBER"&&(t.FeeType=zo.FIXED);this.layoutType==="EVENTS"&&t.AssignFee&&(t.Type==="SINGLE_SELECT"||t.Type==="MULTIPLE_SELECT"||t.Type==="BOOLEAN")&&this.feeTypeOnChange(this.feeTypeOptions.find(o=>o.value===t.FeeType)),t.Type==="FILE"?this.attachments.fileup.files.length>0?(this.subscriptions=this.attachmentService.upload().subscribe(o=>{this.activeCustomFieldConfig&&(this.activeCustomFieldConfig.DefaultValue=We.stringify(o??[]),this.activeCustomFieldConfig.DefaultValueQwareDocuments=this.attachments.newDocs,this.activeCustomFieldConfig?.DefaultValueQwareDocuments.forEach((i,s)=>{i.Id=o?o[s]:"",i.DocumentURL=this.instanceDataService.DOCUMENT_CONTAINER_URL+this.authService.tenant.Id+"/"+i.Id+"."+i.DocType}),this.setPreviewForm())}),this.attachments.fileup.uploader()):this.attachments.docs&&this.attachments.docs.length===0&&this.activeCustomFieldConfig?(this.activeCustomFieldConfig.DefaultValue=void 0,this.setPreviewForm()):this.setPreviewForm():this.setPreviewForm()}setPreviewForm(){this.showConfigSidebar=!1,this.clearConfig(),this.form.markAsDirty(),this.form.markAsTouched(),this.setFormValue()}clearConfig(){this.configForm.reset(),this.configForm.patchValue({IsRequired:!1,DefaultValue:null,DependentFieldNameSelectItem:null,DependentFieldConditionSelectItem:null,SendEmail:!1,SendEmailConditionSelectItem:null,EmailRecipientsSelectItems:[],EmailSubject:"",EmailBody:"",AssignFee:!1,FeeType:null,FeeAmount:0}),this.assignFee=!1,this.docs=[],this.attachments&&this.attachments.fileup&&this.attachments.fileup.clear(),this.sendEmailOnChange(),this.dependentFieldChanged(void 0),this.configForm.markAsDirty(),this.configForm.markAsTouched()}customFieldFilterOnChange(){let t=pt.default.differenceWith(this.customFields,this.leftColumnFields,(o,i)=>o.Id===i.Id||o.Id===i.ParentId);t=pt.default.differenceWith(t,this.rightColumnFields,(o,i)=>o.Id===i.Id||o.Id===i.ParentId),this.filteredCustomFields=t.filter(o=>o.State!==M.ACTIVE||!o.Name||!o.Type?!1:this.generalFilter&&this.generalFilter.length>0?o.Name.toLowerCase().indexOf(this.generalFilter.toLowerCase())>-1||o.Description!==void 0&&o.Description.toLowerCase().indexOf(this.generalFilter.toLowerCase())>-1||o.Type.toLowerCase().indexOf(this.generalFilter.toLowerCase())>-1:!0),this.filteredCustomFields=pt.default.sortBy(this.filteredCustomFields,o=>(o.Name??"").toLowerCase())}sendEmailOnChange(){this.emailRequired=this.configForm.get("SendEmail")?.value??void 0;let t=this.configForm.get("SendEmailConditionSelectItem"),o=this.configForm.get("EmailRecipientsSelectItems"),i=this.configForm.get("EmailSubject"),s=this.configForm.get("EmailBody");this.emailRequired?(t?.setValidators(T.required),o?.setValidators(T.required),i?.setValidators([T.required,T.maxLength(fi)]),s?.setValidators([T.required,T.maxLength(Kt)])):(t?.clearValidators(),o?.clearValidators(),i?.setValidators([T.maxLength(fi)]),s?.setValidators([T.maxLength(Kt)]),t?.setValue(null),o?.setValue([]),i?.setValue(""),s?.setValue("")),t?.updateValueAndValidity(),o?.updateValueAndValidity(),i?.updateValueAndValidity(),s?.updateValueAndValidity()}assignFeeOnChange(){this.assignFee=this.configForm.get("AssignFee")?.value??void 0,this.assignFee?(this.activeCustomFieldConfig&&(this.activeCustomFieldConfig.Type==="BOOLEAN"?(this.configForm.get("FeeType")?.setValidators(T.required),this.configForm.get("FeeAmount")?.setValidators([T.required,T.min(0)])):this.activeCustomFieldConfig.Type==="NUMBER"?this.configForm.get("FeeAmount")?.setValidators([T.required,T.min(0)]):this.activeCustomFieldConfig.Type==="SINGLE_SELECT"||this.activeCustomFieldConfig.Type),this.feeTypeOnChange(this.feeTypeOptions[0])):(this.activeCustomFieldConfig&&(this.activeCustomFieldConfig.Type==="BOOLEAN"?(this.configForm.get("FeeType")?.clearValidators(),this.configForm.get("FeeAmount")?.clearValidators()):this.activeCustomFieldConfig.Type==="NUMBER"&&this.configForm.get("FeeAmount")?.clearValidators()),this.feeTypeOnChange(void 0))}feeTypeOnChange(t){t&&t.value?(this.selectedFeeTypeOption=t,this.feeType=t.value,this.configForm.get("FeeType")?.setValue(this.feeType??null)):(this.selectedFeeTypeOption=void 0,this.feeType=void 0,this.configForm.get("FeeType")?.setValue(this.feeType??null)),this.configForm.markAsDirty(),this.configForm.markAsTouched()}dependentFieldChanged(t){if(!(t instanceof Event)){let o=this.configForm.get("DependentFieldConditionSelectItem");t?o?.setValidators(T.required):(o?.clearValidators(),o?.setValue(null)),o?.updateValueAndValidity()}}selectChanged(t){if(this.selectedMergeField){let o=t==="subject"?this.subjectEditor.quill:this.bodyEditor.quill,i=0,s=o.history.quill.selection.savedRange;s&&(s.length===0?i=s.index:(i=s.index,o.deleteText(s.index,s.length))),o.insertText(i,this.selectedMergeField,"user"),o.setSelection(o.getText(0).length),o.focus(),this.bodyDropdown.updateModel(void 0),this.subjectDropdown.updateModel(void 0)}}
1217removeConfigs(t){t.DefaultValue=void 0,t.DefaultValueDaysLater=void 0,t.DefaultValueQwareDocuments=void 0,t.DefaultValueSelectItem=void 0,t.DefaultValueSelectItems=void 0,t.DependentFieldCondition=void 0,t.DependentFieldConditionSelectItem=void 0,t.DependentFieldName=void 0,t.DependentFieldNameSelectItem=void 0,t.IsRequired=!1,t.SendEmail=!1,t.AssignFee=!1,t.FeeType=void 0,t.FeeAmount=0,t.FeeAmounts=void 0}updateMergeFieldOptions(){switch(this.layoutType){case"WORKORDERS":this.customFieldBodyFields=this.workOrderBodyFields??[],this.customFieldSubjectFields=this.workOrderSubjectFields??[];break;case"ASSETS":this.customFieldBodyFields=this.assetBodyFields??[],this.customFieldSubjectFields=this.assetSubjectFields??[];break;case"INVENTORY":this.customFieldBodyFields=this.inventoryBodyFields??[],this.customFieldSubjectFields=this.inventorySubjectFields??[];break;case"EVENTS":this.customFieldBodyFields=this.eventBodyFields??[],this.customFieldSubjectFields=this.eventSubjectFields??[];break;default:this.customFieldBodyFields=[],this.customFieldSubjectFields=[];break}}setDocs(t){t instanceof Event||(this.docs=t)}static \u0275fac=function(o){return new(o||r)(g(dt),g(ui),g(de),g($t),g(mn),g(Dn),g(be),g(Zn),g(he),g(le),g(Tt))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-layout-details"]],viewQuery:function(o,i){if(o&1&&(X(Y_,5),X(Q_,5),X(K_,5),X($_,5),X(z_,7),X(X_,5),X(Z_,5)),o&2){let s;Y(s=Q())&&(i.attachments=s.first),Y(s=Q())&&(i.bodyDropdown=s.first),Y(s=Q())&&(i.bodyEditor=s.first),Y(s=Q())&&(i.selectionInput=s.first),Y(s=Q())&&(i.drawer=s.first),Y(s=Q())&&(i.subjectDropdown=s.first),Y(s=Q())&&(i.subjectEditor=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},inputs:{autoFocus:"autoFocus",customFieldLimit:"customFieldLimit",form:"form",isCreate:"isCreate",layout:"layout",layoutType:"layoutType",previewOption:"previewOption",submitted:"submitted",validationErrors:"validationErrors"},outputs:{allValuesLoaded:"allValuesLoaded",configChanged:"configChanged",previewOptionChange:"previewOptionChange"},standalone:!1,features:[No],decls:82,vars:36,consts:[["header",""],["content",""],["drawerContainer",""],["drawer",""],["subjectEditor",""],["bodyEditor",""],["incrementbuttonicon",""],["decrementbuttonicon",""],["attachments",""],["subjectDropdown",""],["bodyDropdown",""],[3,"hidden"],[3,"lockEditing"],[3,"formGroup"],[1,"header-inputfield"],["id","qware.cflayout.input.title","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"fluid","qwareFocus","placeholder"],[1,"validation-error","layout-name-error",3,"hidden"],["id","qware.custom-field-layout.details.error.name-req","translate","",3,"hidden"],["id","qware.custom-field-layout.details.error.name-length","translate","",3,"hidden"],["id","qware.custom-field-layout.details.error.dup-name","translate","",3,"hidden"],[1,"grid","drag-area","flex-inline"],[1,"col-12","lg:col-6","md:col-6","layout-column-container"],["dragula","LAYOUTFIELDS","id","left-column",1,"drag-column",3,"dragulaModelChange","dragulaModel"],["dragula","LAYOUTFIELDS","id","right-column",1,"drag-column",3,"dragulaModelChange","dragulaModel"],[1,"validation-error",2,"padding","0 0.5rem",3,"hidden"],["id","qware.custom-field-layout.config.custom-field-length","translate","",3,"hidden","translateParams"],["id","qware.custom-field-layout.config.content-drawer-container","position","right",3,"visibleChange","onHide","visible","closeOnEscape"],["id","qware.custom-field-layout.create.content-drawer-container"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape","appendTo"],["id","qware.custom-field-layout.details.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"validation-error","layout-name-error"],["translate",""],[1,"empty-layout-column"],[1,"cf-container"],[1,"layout-custom-field"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline"],[3,"ngClass"],[1,"primary-text"],[1,"secondary-text"],[1,"config-button"],[1,"delete-button"],["type","button","severity","secondary","styleClass","icon-only-button","tabindex","-1",3,"onClick","rounded","text"],[1,"material-icons"],["translate","",1,"badge"],[1,"validation-error"],["translate","",3,"translateParams"],["id","qware.custom-field-layout.create.config-drawer-header",1,"drawer-header"],[1,"drawer-header-title"],[1,"sidebar-content","body",3,"hidden","formGroup"],[1,"medium-input","flex-inline","flex-space-between"],["name","IsRequired","formControlName","IsRequired",3,"qwareFocus","tabindex","binary"],[1,"medium-input","single-autocomplete"],["formControlName","Depen
1217dentFieldNameSelectItem","labelId","qware.custom-field-layout-config.label.dependent-field","label","CUSTOM_FIELD_LAYOUT.CONFIG.PARENT_FIELD","elementId","qware.custom-field-layout-config.dependent-field",3,"selectChange","unselectChange","singleSelect","tabindex","options"],[1,"medium-input",3,"hidden"],["formControlName","DependentFieldConditionSelectItem","labelId","qware.custom-field-layout-config.label.dependent-field-condition","label","CUSTOM_FIELD_LAYOUT.CONFIG.SHOW_FIELD_WHEN_PARENT","elementId","qware.custom-field-layout-config.dependent-field-condition",3,"singleSelect","tabindex","options","isRequired"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],["name","SendEmail","formControlName","SendEmail",3,"onChange","tabindex","binary"],["formControlName","SendEmailConditionSelectItem","labelId","qware.custom-field-layout-config.label.send-email-condition","label","CUSTOM_FIELD_LAYOUT.CONFIG.SEND_EMAIL_WHEN_FIELD","elementId","qware.custom-field-layout-config.send-email-condition",3,"singleSelect","tabindex","options","isRequired"],["formControlName","EmailRecipientsSelectItems","labelId","qware.custom-field-layout-config.label.email-recipients","elementId","qware.custom-field-layout-config.email-recipients",3,"tabindex","options","isRequired","label","virtualScroll","virtualScrollItemSize"],[1,"medium-input",2,"margin-top","-0.9rem",3,"hidden"],[1,"standalone-label"],[1,"required-mark"],["formControlName","EmailSubject"],["translate","",3,"hidden","translateParams"],["formControlName","EmailBody"],[1,"medium-input","flex-inline","flex-space-between",3,"hidden"],["name","AssignFee","formControlName","AssignFee",3,"onChange","tabindex","binary"],["formControlName","FeeType","labelId","qware.custom-field-layout-config.label.fee-type","label","CUSTOM_FIELD_LAYOUT.CONFIG.FEE_TYPE","elementId","qware.custom-field-layout-config.fee-type",3,"selectChange","unselectChange","tabindex","options","selectedOption","singleSelect","isRequired"],["mode","currency","formControlName","FeeAmount","variant","filled","inputId","qware.custom-field-layout-config.fee-value.input",1,"is-filled",3,"tabindex","currency","fluid","showButtons","min","required"],["for","qware.custom-field-layout-config.fee-value.input","id","qware.custom-field-layout-config.fee-value.label"],[1,"sidebar-actions"],["tabindex","1000","id","qware.custom-field.config.button.clear","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.custom-field.config.button.save","type","submit",3,"onClick","text","disabled","label"],[1,"medium-input","text-box-container"],["pTextarea","","formControlName","DefaultValue","id","qware.custom-field-layout.details.input.text-default","variant","filled",1,"text-box",3,"tabindex","rows","cols","autoResize","fluid"],["for","qware.custom-field-layout.details.input.text-default"],[1,"medium-input"],["formControlName","DefaultValue","mode","currency","id","qware.custom-field-layout.details.input.currency-default","variant","filled",1,"is-filled",3,"tabindex","currency","showButtons","fluid"],["for","qware.custom-field-layout.details.input.currency-default"],["formControlName","DefaultValue","variant","filled","id","qware.custom-field-layout.details.input.number-default",1,"is-filled",3,"tabindex","fluid","showButtons"],["for","qware.custom-field-layout.details.input.number-default"],["name","BoolDefaultValue","formControlName","DefaultValue",3,"qwareFocus","tabindex","binary"],["inputId","qware.custom-field-layout.details.input.date-default","formControlName","DefaultValueDaysLater","variant","filled",1,"is-filled",3,"tabindex","showButtons","fluid"],["for","qware.custom-field-layout.details.input.date-default"],["formControlName","DefaultValueSelectItem","labelId","qware.custom-field-layout-config.label.select","label","CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE","elementId","qware.custom-field-layout-config.single-select",3,"singleSelect","tabindex","options","virtualScroll","virtualScrollItemSize"],["formControlName","DefaultValueSelectItems","labelId","qware.custom-field-layout-config.label.select","label","CUSTOM_FIELD_LAYOUT.CONFIG.DEFAULT_VALUE","elementId","qware.custom-field-layout-config.multi-select",3,"tabindex","options","virtualScroll","virtualScrollItemSize"],[3,"docsCh
1217anged","form","docs"],[1,"ql-formats","merge-field"],["appendTo","body",3,"ngModelChange","onChange","options","placeholder","ngModel","ngModelOptions","panelStyle","filter","fluid"],["pTemplate","dropdownicon"],["pTemplate","filtericon"],[1,"ql-formats"],[1,"ql-color"],[1,"ql-background"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"],[1,"ql-link"],[1,"ql-clean"],["appendTo","body",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","filter","fluid","panelStyle"],["responsiveLayout","stack",3,"value","scrollable"],["pTemplate","header"],["pTemplate","body"],[2,"text-align","center"],["mode","currency","variant","filled",1,"is-filled",3,"ngModelChange","currency","ngModel","ngModelOptions","showButtons","min","allowEmpty","required","fluid"],["id","qware.custom-field-layout.create.drawer-header",1,"drawer-header"],[3,"ngModelChange","options","ngModel"],["translate","",1,"drawer-header-title"],[1,"sidebar-content","no-apply"],["iconPosition","left"],["type","text","pInputText","","size","30","id","qware.custom-field-layout.create.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","fluid"],["dragula","LAYOUTFIELDS","id","source-column",3,"dragulaModelChange","dragulaModel"],["entityType","customFieldLayout",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","strictlyThisEntity","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",11),e(1,` 1218 `),n(2,"qware-edit-lock",12),e(3,` 1219 `),n(4,"div",13),e(5,` 1220 `),n(6,"div",14),e(7,` 1221 `),R(8,"input",15),I(9,"translate"),e(10,` 1222 `),n(11,"small",16),e(12,` 1223 `),n(13,"div",17),e(14,` 1224 CUSTOM_FIELD_LAYOUT.ERROR.NAME_REQUIRED 1225 `),a(),e(15,` 1226 `),n(16,"div",18),e(17,` 1227 CUSTOM_FIELD_LAYOUT.ERROR.NAME_LENGTH 1228 `),a(),e(18,` 1229 `),n(19,"div",19),e(20,` 1230 CUSTOM_FIELD_LAYOUT.ERROR.DUPLICATE_NAME 1231 `),a(),e(21,` 1232 `),a(),e(22,` 1233 `),_(23,tE,3,0),a(),e(24,` 1234 `),n(25,"div",20),e(26,` 1235 `),n(27,"div",21),e(28,` 1236 `),_(29,iE,7,0),n(30,"div",22),j("dragulaModelChange",function(u){return E(s),W(i.leftColumnFields,u)||(i.leftColumnFields=u),S(u)}),e(31,` 1237 `),G(32,oE,41,13,null,null,Ns),a(),e(34,` 1238 `),a(),e(35,` 1239 1240 `),n(36,"div",21),e(37,` 1241 `),_(38,lE,7,0),n(39,"div",23),j("dragulaModelChange",function(u){return E(s),W(i.rightColumnFields,u)||(i.rightColumnFields=u),S(u)}),e(40,` 1242 `),G(41,mE,41,13,null,null,Ns),a(),e(43,` 1243 `),a(),e(44,` 1244 `),n(45,"small",24),e(46,` 1245 `),n(47,"div",25),e(48,` 1246 SUBSCRIPTION.ERROR.CUSTOM_FIELD_LIMIT_REACHED 1247 `),a(),e(49,` 1248 `),a(),e(50,` 1249 `),a(),e(51,` 1250 1251 `),e(52,` 1252 `),n(53,"p-drawer",26),j("visibleChange",function(u){return E(s),W(i.showConfigSidebar,u)||(i.showConfigSidebar=u),S(u)}),h("onHide",function(){return E(s),S(i.clearConfig())}),e(54,` 1253 `),_(55,cE,8,4,"ng-template",null,0,A),e(57,` 1254 `),_(58,YE,200,93,"ng-template",null,1,A),e(60,` 1255 `),a(),e(61,` 1256 `),a(),e(62,` 1257 `),a(),e(63,` 1258`),a(),e(64,` 1259 1260`),e(65,` 1261`),n(66,"div",27,2),e(68,` 1262 `),n(69,"p-drawer",28,3),j("visibleChange",function(u){return E(s),W(i.showSidebar,u)||(i.showSidebar=u),S(u)}),h("onHide",function(){return E(s),S(i.userEnabledSidebar=!1)}),e(71,` 1263 `),_(72,zE,6,1,"ng-template",null,0,A),e(74,` 1264 `),n(75,"qware-spinner",29),e(76,` 1265 `),_(77,ZE,21,6)(78,JE,7,5),a(),e(79,` 1266 `),a(),e(80,` 1267`),a(),e(81,` 1268`)}if(o&2){let s=Ee(67);p("hidden",i.previewOption==="PREVIEW"),l(2),p("lockEditing",i.layout!==void 0&&i.layout.State==="DELETED"),l(2),p("formGroup",i.form),l(4),q("placeholder",y(9,32,"CUSTOM_FIELD_LAYOUT.LAYOUT_NAME")),p("fluid",!0)("qwareFocus",i.autoFocus),l(3),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.duplicateString)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?23:-1),l(6),f(i.leftColumnFields&&i.leftColumnFields.length===0?29:-1),l(),ve("drag-column-border",i.leftColumnFields&&i.leftColumnFields.length>0),H("dragulaModel",i.leftColumnFields),l(2),k(i.leftColumnFields),l(6),f(i.right
1268ColumnFields&&i.rightColumnFields.length===0?38:-1),l(),ve("drag-column-border",i.rightColumnFields&&i.rightColumnFields.length>0),H("dragulaModel",i.rightColumnFields),l(2),k(i.rightColumnFields),l(4),p("hidden",i.form.controls.Fields.valid||i.form.controls.Fields.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Fields.errors!=null&&i.form.controls.Fields.errors.maxlength))("translateParams",pe(34,J_,i.customFieldLimit)),l(6),H("visible",i.showConfigSidebar),p("closeOnEscape",!1),l(16),H("visible",i.showSidebar),p("modal",i.showMask)("transitionOptions",i.sidebarOptions)("closeOnEscape",!1)("appendTo",s),l(6),p("displaySpinner",i.displayDrawerSpinner())("isAbsolute",!0),l(2),f(i.drawerView===0?77:i.drawerView===1?78:-1)}},dependencies:[Pe,oe,yt,Qe,pn,Lt,Jt,Ne,je,Ae,se,ge,Pd,Le,pi,mi,bi,ye,ta,Gt,Ut,wt,me,Te,De,it,ht,ri,$,ie],styles:[`qware-custom-field-layout-details .header-inputfield input{padding-left:.75rem!important;font-weight:500}qware-custom-field-layout-details .layout-name-error>div{padding-left:.75rem}qware-custom-field-layout-details .drag-area{padding:1em}qware-custom-field-layout-details .drag-area .layout-column-container{position:relative}qware-custom-field-layout-details .drag-area .layout-column-container .empty-layout-column{pointer-events:none;position:absolute;width:calc(100% - 1rem);height:80px;color:var(--p-surface-700)}qware-custom-field-layout-details .drag-area .layout-column-container .empty-layout-column div{line-height:80px;text-align:center;vertical-align:middle}qware-custom-field-layout-details .drag-area .layout-column-container .drag-column{min-height:80px;border:1px dashed var(--p-surface-700);padding:0 .5rem}qware-custom-field-layout-details .drag-area .layout-column-container .drag-column-border{border:1px solid var(--p-surface-800);border-radius:4px}qware-custom-field-layout-details .desktop-sidebar-mask{display:none}qware-custom-field-layout-details .sidebar-content .cf-search,qware-custom-field-layout-details .sidebar-content .cf-search>.search-input{width:100%}qware-custom-field-layout-details .sidebar-content .cf-container{border-radius:4px}qware-custom-field-layout-details .sidebar-content .cf-container:last-of-type>.layout-custom-field{margin-bottom:0}qware-custom-field-layout-details .text-box-container .text-box{max-height:180px;overflow-y:auto!important}qware-custom-field-layout-details .layout-custom-field{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0);margin:.5rem 0;border-radius:4px}qware-custom-field-layout-details .layout-custom-field>div:nth-of-type(2){padding:.5rem .75rem}qware-custom-field-layout-details .layout-custom-field>div:nth-of-type(2)>div:first-child{flex:1 1 auto}qware-custom-field-layout-details .layout-custom-field>div:nth-of-type(2) .config-button,qware-custom-field-layout-details .layout-custom-field>div:nth-of-type(2) .delete-button{flex:0 0 auto;justify-items:flex-end}qware-custom-field-layout-details .layout-custom-field .secondary-text{color:var(--p-surface-800)}qware-custom-field-layout-details .layout-custom-field .primary-text{font-weight:500;margin-bottom:.25rem}qware-custom-field-layout-details .layout-custom-field .validation-error{margin-top:.5rem}qware-custom-field-layout-details #qware\\.custom-field-layout\\.create\\.content-drawer-container{z-index:1000}body>.gu-mirror .layout-custom-field{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0);margin:.75rem;border-radius:4px}body>.gu-mirror .layout-custom-field .flex-inline{padding:.5rem .75rem}body>.gu-mirror .layout-custom-field .flex-inline>div:first-of-type{flex:1 1 auto}body>.gu-mirror .layout-custom-field .secondary-text{color:var(--p-surface-800)}body>.gu-mirror .layout-custom-field .primary-text{font-weight:500} 1269`],encapsulation:2})}return r})();var tS=["details"],iS=["preview"],nS=()=>[];function aS(r,d){r&1&&(e(0,` 1270 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 1271 `))}function rS(r,d){if(r&1&&(e(0,` 1272 `),n(1,"a",29),e(2,` 1273 `),n(3,"span",30),e(4),a(),e(5,` 1274 `),n(6,"span",31),e(7),a(),e(8,` 1275 `),a(),e(9,` 1276 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}var Ep=(()=>{class r{authService;customFieldService;fb;responseService;route;router;toastService;translate;details;preview;actionItems=[];isActive=!1;displaySpinner=!0;form;layoutType;layoutTypes=[];moreItems=[];previewOptions=[];selectedPreviewOption="CREATE";submitted=!1;validationErrors;customFieldLimit=ar.customFieldsPerLayout;hasEventModule=!1;layoutCreateCard={colorScheme:{light:{bodyPadding:"0"}}};allLayoutNames=[];constructor(t,o,i,s,c,u,x,C){this.authService=t,this.customFieldService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.toastService=x,this.translate=C,this.hasEventModule=this.authService.tenant.EventsModule,_p.default.isNumber(this.authService.qwareSubscription?.customFieldsPerLayoutLimit)&&(this.customFieldLimit=this.authService.qwareSubscription?.customFieldsPerLayoutLimit??ar.customFieldsPerLayout)}ngOnInit(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Type:this.fb.control(null,T.required),Fields:this.fb.control([],[T.required,T.maxLength(this.customFieldLimit)])}),ue([this.translate.get(["SHARED.CREATE","SHARED.PREVIEW","CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"]).pipe(N()),this.customFieldService.getCustomFieldLayoutNames(this.authService.tenant.Id),this.customFieldService.getCustomFieldLayoutTypes()]).pipe(we(t=>{let o=t[0],i=t[1],s=t[2];this.moreItems=[{label:o["CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"],icon:"add",command:()=>this.details.toggleSidebar()}],this.previewOptions=[{label:o["SHARED.CREATE"],value:"CREATE"},{label:o["SHARED.PREVIEW"],value:"PREVIEW"}],this.allLayoutNames=i,this.form.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allLayoutNames)]);let c=s.filter(u=>u!=="UNKNOWN");return this.hasEventModule?this.customFieldLimit===0?(c=s.filter(u=>u==="EVENTS"),this.layoutType="EVENTS",this.typeChanged()):this.layoutType="WORKORDERS":c=c.filter(u=>u!=="EVENTS"),this.layoutTypes=c.map(u=>({label:u,value:u})),this.typeChanged(),this.translate.get(c.map(u=>"CUSTOM_FIELD_LAYOUT.TYPES."+u)).pipe(N())})).subscribe(t=>
1276{this.layoutTypes.forEach(o=>{o.label=t["CUSTOM_FIELD_LAYOUT.TYPES."+o.label]}),this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.router.navigate(["../../",P.customField,P.list],t)}configChanged(){this.preview.rebuildForm()}typeChanged(){this.form.get("Type")?.setValue(this.layoutType??null);let t=this.form.get("Fields");t?.clearValidators();let o=this.layoutType==="EVENTS"?ar.customFieldsPerLayout:this.customFieldLimit;t?.setValidators([T.required,T.maxLength(o)]),t?.updateValueAndValidity()}save(){if(!this.submitted)if(this.form.valid){let t=this.form.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomFieldLayout(t).subscribe({next:()=>{localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD_LAYOUT.SUCCESS.CREATE","../../"+P.customField+"/"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}static \u0275fac=function(o){return new(o||r)(g(de),g($t),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-layout-create"]],viewQuery:function(o,i){if(o&1&&(X(tS,7),X(iS,7)),o&2){let s;Y(s=Q())&&(i.details=s.first),Y(s=Q())&&(i.preview=s.first)}},standalone:!1,decls:83,vars:34,consts:[["dropdownicon",""],["moreMenu",""],["item",""],["preview",""],["details",""],[1,"grid"],[1,"col-12","lg:col-8","edit-data-container",3,"keydown.enter"],[1,"form-container"],["id","qware.custom-field-layout.create.spinner",3,"displaySpinner"],[1,"flex-inline","header-container"],[1,"flex-inline","align-items-center"],["translate","","id","qware.custom-field-layout.page-header",1,"page-header"],["id","qware.custom-field-layout.create.field-type",1,"layout-type"],["id","qware.custom-field-layout.dropdown.field-type",3,"ngModelChange","onChange","tabindex","options","ngModel"],[1,"flex-inline"],[1,"top-indent-large","flex-inline","align-right","preview-button-container"],[1,"preview-buttons"],[3,"ngModelChange","unselectable","options","ngModel","allowEmpty"],[1,"top-indent-large","more-container"],["id","qware.custom-field-layout.create.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],[3,"hidden"],[3,"fields","selectedView"],[3,"dt"],[3,"configChanged","previewOptionChange","form","submitted","validationErrors","previewOption","isCreate","layoutType","customFieldLimit"],[1,"flex-inline","align-right","action-bar",3,"hidden"],["tabindex","999","id","qware.custom-field-layout.button.cancel","severity","secondary","type","button",3,"onClick","text","label"],["tabindex","1000","id","qware.custom-field-layout.general.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"]],template:function(o,i){if(o&1){let s=b();n(0,"div",5),e(1,` 1277 `),e(2,` 1278 `),n(3,"div",6),h("keydown.enter",function(){return E(s),S(i.save())}),e(4,` 1279 `),n(5,"div",7),e(6,` 1280 `),n(7,"qware-spinner",8),e(8,` 1281 `),n(9,"div",9),e(10,` 1282 `),n(11,"div",10),e(12,` 1283 `),n(13,"h3",11),e(14,` 1284 CUSTOM_FIELD_LAYOUT.CREATE_CUSTOM_FIELD_LAYOUT 1285 `),a(),e(15,` 1286 `),n(16,"div",12),e(17,` 1287 `),n(18,"p-select",13),j("ngModelChange",function(u){return E(s),W(i.layoutType,u)||(i.layoutType=u),S(u)}),h("onChange",function(){return E(s),S(i.typeChanged())}),e(19,` 1288 `),_(20,aS,4,0,"ng-template",null,0,A),e(22,` 1289 `),a(),e(23,` 1290 `),a(),e(24,` 1291 `),a(),e(25,` 1292 `),n(26,"div",14),e(27,` 1293 `),n(28,"div",15),e(29,` 1294 `),n(30,"div",16),e(31,` 1295 `),n(32,"p-selectbutton",17),j("ngModelChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),e(33,` 1296 `),a(),e(34,` 1297 `),a(),e(35,` 1298 `),a(),e(36,` 1299 `),n(37,"div",18),e(38,` 1300 `),n(39,"p-menu",19,1),h("click",function(){E(s);let u=Ee(40);return S(u.hide())}),e(41,` 1301 `),_(42,rS,10,2,"ng-template",null,2,A),e(44,` 1302 `),a(),e(45,` 1303 `),n(46,"p-button",20),h("onClick",function(u){return E(s),Ee(40).toggle(u),S(i.isActive=!i.isActive)}),e(47,` 1304 `),n(48,"i",21),e(49,"more_vert"),a(),e(50,` 1305 `),a(),e(51,` 1306 `),a(),e(52,` 1307 `),a(),e(53,` 1308 `),a(),e(54,` 1309 `),n(55,"p-card",22),e(56,` 1310 `),R(57,"qware-custom-field-layout",23,3),e(59,` 1311 `),a(),e(60,` 1312 `),n(61,"p-card",24),e(62,` 1313 `),n(63,"qware-custom-field-layout-details",25,4),h("configChanged",function(){return E(s),S(i.configChanged())}),j("previewOptionChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),e(65,` 1314 `),a(),e(66,` 1315 `),n(67,"div",26),e(68,` 1316 `),n(69,"p-button",27),I(70,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(71,` 1317 `),a(),e(72,` 1318 `),n(73,"p-button",28),I(74,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(75,` 1319 `),a(),e(76,` 1320 `),a(),e(77,` 1321 `),a(),e(78,` 1322 `),a(),e(79,` 1323 `),a(),e(80,` 1324 `),a(),e(81,` 1325`),a(),e(82,` 1326`)}if(o&2){let s;l(7),p("displaySpinner",i.displaySpinner),l(11),p("tabindex",1)("options",i.layoutTypes),H("ngModel",i.layoutType),l(14),p("unselectable",!0)("options",i.previewOptions),H("ngModel",i.selectedPreviewOption),p("allowEmpty",!1),l(7),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(9),p("hidden",i.selectedPreviewOption!=="PREVIEW"),l(2),p("fields",(s=i.form.value.Fields)!==null&&s!==void 0?s:ne(33,nS))("selectedView",i.selectedPreviewOption),l(4),p("dt",i.layoutCreateCard),l(2),p("form",i.form)("submitted",i.submitted)("validationErrors",i.validationErrors),H("previewOption",i.selectedPreviewOption),p("isCreate",!0)("layoutType",i.layoutType||"")("customFieldLimit",i.customFieldLimit),l(4),p("hidden",i.selectedPreviewOption==="PREVIEW"),l(2),q("label",y(70,29,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(74,31,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}},dependencies:[oe,Ie,se,Le,lt,rl,me,ot,Ga,it,$,Rl,ie],styles:[".form-container[_ngcontent-%COMP%]{max-width:100%}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%]{display:block}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type{flex:1 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type > div[_ngcontent-%COMP%]{margin:.5rem 0}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .layout-type[_ngcontent-%COMP%]{margin:0 .5rem}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{flex:1 1 auto;height:36px;margin-bottom:.5rem}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{justify-content:flex-start}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%]{flex:0 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-bottom:0}}"]})}return r})();var Us=He(nt());var oS=["actionsMenu"],lS=["details"],sS=["preview"],dS=()=>[];function pS(r,d){r&1&&(e(0,` 1327 `),n(1,"span",24),e(2,"expand_more"),a(),e(3,` 1328 `))}function mS(r,d){if(r&1&&(e(0,` 1329 `),n(1,"a",33),e(2,` 1330 `),n(3,"span",34),e(4),a(),e(5,` 1331 `),n(6,"span",35),e(7),a(),e(8,` 1332 `),a(),e(9,` 1333 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function cS(r,d){r&1&&(e(0,` 1334 `),n(1,"span",37),e(2,"SHARED.ACTIONS"),a(),e(3,` 1335 `),n(4,"i",24),e(5,"expand_more"),a(),e(6,` 1336 `))}function uS(r,d){if(r&1){let t=b();e(0,` 1337 `),n(1,"p-button",36),h("onClick",function(i){E(t),m();let s=Ee(37);return S(s.toggle(i))}),e(2,` 1338 `),_(3,cS,7,0,"ng-template",null,6,A),e(5,` 1339 `),a(),e(6,` 1340 `)}r&2&&(l(),p("raised",!0))}function _S(r,d){if(r&1&&(e(0,` 1341 `),n(1,"a",33),e(2,` 1342 `),n(3,"span",34),e(4),a(),e(5,` 1343 `),n(6,"span",35),e(7),a(),e(8,` 1344 `),a(),e(9,` 1345 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}var Sp=(()=>{class r{authService;confirmationService;customFieldService;fb;responseService;route;router;toastService;translate;actionsMenu;details;preview;displaySpinner=D(!0);actionItems=[];form;isActive=!1;layout;layoutType;layoutTypes=[];moreItems=[];previewOptions=[];selectedPreviewOption="EDIT";submitted=!1;validationErrors;customFieldLimit=ar.customFieldsPerLayout;hasEventModule=!1;customFieldListRoute="../../../"+P.customField+"/"+P.list;assetCategoryListRoute="";layoutEditCard={colorScheme:{light:{bodyPadding:"0"}}};allLayoutNames=[];redirectPage;constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.confirmationService=o,this.customFieldService=i,this.fb=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O,this.hasEventModule=this.authService.tenant.EventsModule,Us.default.isNumber(this.authService.qwareSubscription?.customFieldsPerLayoutLimit)&&(this.customFieldLimit=this.authService.qwareSubscription?.customFieldsPerLayoutLimit??ar.customFieldsPerLayout),this.assetCategoryListRoute="../../../../../"+ua.asset+"/"+this.authService.tenant.Key+"/"+ua.asset+"/"+ua.list}
1345ngOnInit(){this.redirectPage=localStorage.getItem(Oe.REDIRECT_FROM_PAGE)??void 0,localStorage.removeItem(Oe.REDIRECT_FROM_PAGE),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.EDIT","SHARED.PREVIEW","SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"]).pipe(N()),this.customFieldService.getCustomFieldLayoutNames(this.authService.tenant.Id),this.customFieldService.getCustomFieldLayoutTypes(),this.customFieldService.getCustomFieldLayout(this.authService.tenant.Id,this.route.snapshot.params.id)]).pipe(we(t=>{let o=t[0],i=t[1],s=t[2];this.layout=t[3],this.moreItems=[{id:"custom.fields.action",label:o["CUSTOM_FIELD_LAYOUT.ADD_CUSTOM_FIELDS"],icon:"add",command:()=>this.details.toggleSidebar(0),disabled:this.layout?.State===M.DELETED},{id:"audit.log.action",label:o["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.details.toggleSidebar(1)}],this.previewOptions=[{label:o["SHARED.EDIT"],value:"EDIT"},{label:o["SHARED.PREVIEW"],value:"PREVIEW"}];let c=[{id:"disable.action",label:o["SHARED.DISABLE"],icon:"block",command:()=>this.disableCustomFieldLayout()},{id:"enable.action",label:o["SHARED.ENABLE"],icon:"check",command:()=>this.enableCustomFieldLayout()},{id:"delete.action",label:o["SHARED.DELETE"],icon:"delete",command:()=>this.deleteCustomFieldLayout()}];this.layout?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&c.push({id:"restore.action",label:o["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreCustomFieldLayout()}),this.actionItems=c.filter(x=>this.layout?.State===M.DISABLED?x.id!=="disable.action":this.layout?.State===M.DELETED?x.id!=="disable.action"&&x.id!=="enable.action"&&x.id!=="delete.action":x.id!=="enable.action");let u=s.filter(x=>x!=="UNKNOWN");return this.hasEventModule||(u=u.filter(x=>x!=="EVENTS")),this.layoutTypes=u.map(x=>({label:x,value:x})),this.typeChanged(),this.form.patchValue(Us.default.cloneDeep(this.layout)),this.allLayoutNames=i.filter(x=>this.layout&&x!==this.layout.Name),this.form.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allLayoutNames)]),this.layout.State==="DELETED"&&this.form.disable(),this.translate.get(u.map(x=>"CUSTOM_FIELD_LAYOUT.TYPES."+x)).pipe(N())})).subscribe({next:t=>{this.layoutType=this.layout?.Type,this.layoutTypes.forEach(o=>{o.label=t["CUSTOM_FIELD_LAYOUT.TYPES."+o.label]})},error:t=>{this.responseService.onDataError(t,this.customFieldListRoute,this.route)}})}createForm(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Type:this.fb.control({value:null,disabled:!0},T.required),Fields:this.fb.control([],[T.required,T.maxLength(this.customFieldLimit)])})}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};this.redirectPage||localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.router.navigate([this.customFieldListRoute],t)}configChanged(){this.preview.rebuildForm()}typeChanged(){this.form.get("Type")?.setValue(this.layoutType??null)}save(){if(!this.submitted)if(this.form.valid){let t=this.form.value;this.submitted=!0,this.displaySpinner.set(!0),t.TenantId=this.authService.tenant.Id,t.State=this.layout?.State??M.ACTIVE,t.Id=this.layout?.Id,t.Type=this.layout?.Type,this.customFieldService.createOrUpdateCustomFieldLayout(t).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.SAVE",{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner.set(!1),this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableCustomFieldLayout(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.layout?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.layout&&(this.displaySpinner.set(!0),this.submitted=!0,this.layout.State=M.DISABLED,this.customFieldService.createOrUpdateCustomFieldLayout(this.layout).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.DISABLE")},error:o=>{this.displaySpinner.set(!1),this.validationErrors=this.responseService.onError(o)}}))}})})}enableCustomFieldLayout(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.layout?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.layout&&(this.displaySpinner.set(!0),this.submitted=!0,this.layout.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomFieldLayout(this.layout).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.ENABLE")},error:o=>{this.displaySpinner.set(!1),this.validationErrors=this.responseService.onError(o)}}))}})})}deleteCustomFieldLayout(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.layout?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.layout&&(this.displaySpinner.set(!0),this.submitted=!0,this.layout.State=M.DELETED,this.customFieldService.createOrUpdateCustomFieldLayout(this.layout).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.DELETE")},error:o=>{this.displaySpinner.set(!1),this.validationErrors=this.responseService.onError(o)}}))}})})}restoreCustomFieldLayout(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.layout?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.layout&&(this.displaySpinner.set(!0),this.submitted=!0,this.layout.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomFieldLayout(this.layout).subscribe({next:()=>{this.successNavigation("CUSTOM_FIELD_LAYOUT.SUCCESS.RESTORE")},error:o=>{this.displaySpinner.set(!1),this.validationErrors=this.responseService.onError(o)}}))}})})}successNavigation(t,o){this.redirectPage||localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.displaySpinner.set(!1),this.responseService.onSuccess(t,this.redirectPage==="ASSET_CATEGORY"?this.assetCategoryListRoute:this.customFieldListRoute,this.route,o)}static \u0275fac=function(o){return new(o||r)(g(de),g(mt),g($t),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-layout-edit"]],viewQuery:function(o,i){if(o&1&&(X(oS,7),X(lS,7),X(sS,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.details=s.first),Y(s=Q())&&(i.preview=s.first)}},standalone:!1,decls:92,vars:38,consts:[["dropdownicon",""],["actionsMenu",""],["item",""],["moreMenu",""],["preview",""],["details",""],["content",""],[1,"grid"],[1,"col-12","lg:col-8","edit-data-container"],[1,"form-container"],[1,"flex-inline","header-container"],[1,"flex-inline","align-items-center"],["translate","","id","qware.custom-field-layout.page-header",1,"page-header"],["id","qware.custom-field-layout.edit.field-type",1,"layout-type"],["id","qware.custom-field-layout.dropdown.field-type",3,"ngModelChange","onChange","tabindex","options","ngModel","disabled"],[1,"flex-inline"],[1,"top-indent-large","flex-inline","align-right","preview-button-container"],[1,"preview-buttons"],[3,"ngModelChange","unselectable","options","ngModel","allowEmpty"],[1,"top-indent-large","actions-container"],["id","qware.custom-field-layout.edit.edit.actions-menu",3,"model","popup"],[1,"top-indent-large","more-container"],["id","qware.custom-field-layout.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],["id","qware.custom-field-layout.edit.spinner",3,"displaySpinner"],[3,"hidden"],[3,"fields","selectedView"],[3,"dt"],[3,"configChanged","previewOptionChange","allValuesLoaded","form","submitted","validationErrors","previewOption","layout","autoF
1345ocus","layoutType"],[1,"flex-inline","align-right","action-bar",3,"hidden"],["tabindex","999","id","qware.custom-field-layout.button.cancel","severity","secondary","type","button",3,"onClick","text","label"],["tabindex","1000","id","qware.custom-field-layout.general.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.custom-field-layout.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"]],template:function(o,i){if(o&1){let s=b();n(0,"div",7),e(1,` 1346 `),n(2,"div",8),e(3,` 1347 `),n(4,"div",9),e(5,` 1348 `),n(6,"div",10),e(7,` 1349 `),n(8,"div",11),e(9,` 1350 `),n(10,"h3",12),e(11,` 1351 CUSTOM_FIELD_LAYOUT.EDIT_CUSTOM_FIELD_LAYOUT 1352 `),a(),e(12,` 1353 `),n(13,"div",13),e(14,` 1354 `),n(15,"p-select",14),j("ngModelChange",function(u){return E(s),W(i.layoutType,u)||(i.layoutType=u),S(u)}),h("onChange",function(){return E(s),S(i.typeChanged())}),e(16,` 1355 `),_(17,pS,4,0,"ng-template",null,0,A),e(19,` 1356 `),a(),e(20,` 1357 `),a(),e(21,` 1358 `),a(),e(22,` 1359 `),n(23,"div",15),e(24,` 1360 `),n(25,"div",16),e(26,` 1361 `),n(27,"div",17),e(28,` 1362 `),n(29,"p-selectbutton",18),j("ngModelChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),e(30,` 1363 `),a(),e(31,` 1364 `),a(),e(32,` 1365 `),a(),e(33,` 1366 `),n(34,"div",19),e(35,` 1367 `),n(36,"p-menu",20,1),e(38,` 1368 `),_(39,mS,10,2,"ng-template",null,2,A),e(41,` 1369 `),a(),e(42,` 1370 `),_(43,uS,7,1),a(),e(44,` 1371 `),n(45,"div",21),e(46,` 1372 `),n(47,"p-menu",22,3),h("click",function(){E(s);let u=Ee(48);return S(u.hide())}),e(49,` 1373 `),_(50,_S,10,2,"ng-template",null,2,A),e(52,` 1374 `),a(),e(53,` 1375 `),n(54,"p-button",23),h("onClick",function(u){return E(s),Ee(48).toggle(u),S(i.isActive=!i.isActive)}),e(55,` 1376 `),n(56,"i",24),e(57,"more_vert"),a(),e(58,` 1377 `),a(),e(59,` 1378 `),a(),e(60,` 1379 `),a(),e(61,` 1380 `),a(),e(62,` 1381 `),n(63,"qware-spinner",25),e(64,` 1382 `),n(65,"p-card",26),e(66,` 1383 `),R(67,"qware-custom-field-layout",27,4),e(69,` 1384 `),a(),e(70,` 1385 `),n(71,"p-card",28),e(72,` 1386 `),n(73,"qware-custom-field-layout-details",29,5),h("configChanged",function(){return E(s),S(i.configChanged())}),j("previewOptionChange",function(u){return E(s),W(i.selectedPreviewOption,u)||(i.selectedPreviewOption=u),S(u)}),h("allValuesLoaded",function(){return E(s),S(i.displaySpinner.set(!1))}),e(75,` 1387 `),a(),e(76,` 1388 `),n(77,"div",30),e(78,` 1389 `),n(79,"p-button",31),I(80,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(81,` 1390 `),a(),e(82,` 1391 `),n(83,"p-button",32),I(84,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(85,` 1392 `),a(),e(86,` 1393 `),a(),e(87,` 1394 `),a(),e(88,` 1395 `),a(),e(89,` 1396 `),a(),e(90,` 1397 `),a(),e(91,` 1398`),a()}if(o&2){let s;l(15),p("tabindex",1)("options",i.layoutTypes),H("ngModel",i.layoutType),p("disabled",i.form.controls.Type.disabled),l(14),p("unselectable",!0)("options",i.previewOptions),H("ngModel",i.selectedPreviewOption),p("allowEmpty",!1),l(7),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?43:-1),l(4),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(9),p("displaySpinner",i.displaySpinner()),l(2),p("hidden",i.selectedPreviewOption!=="PREVIEW"),l(2),p("fields",(s=i.form.value.Fields)!==null&&s!==void 0?s:ne(37,dS))("selectedView",i.selectedPreviewOption),l(4),p("dt",i.layoutEditCard),l(2),p("form",i.form)("submitted",i.submitted)("validationErrors",i.validationErrors),H("previewOption",i.selectedPreviewOption),p("layout",i.layout)("autoFocus",!1)("layoutType",i.layoutType||""),l(4),p("hidden",i.selectedPreviewOption!=="EDIT"),l(2),q("label",y(80,33,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(84,35,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}},dependencies:[oe,Ie,se,Le,lt,rl,me,ot,Ga,it,$,Rl,ie],styles:[".form-container[_ngcontent-%COMP%]{max-width:100%}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%]{display:block}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type{flex:1 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:last-of-type > div[_ngcontent-%COMP%]{margin-top:.5rem}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .layout-type[_ngcontent-%COMP%]{margin:0 .5rem}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{flex:1 1 auto;height:36px;margin-bottom:.5rem;margin-right:.5rem}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .preview-button-container[_ngcontent-%COMP%]{justify-content:flex-start}}.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%]{flex:0 1 auto}@media screen and (max-width: 768px){.form-container[_ngcontent-%COMP%] .header-container[_ngcontent-%COMP%] .actions-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-bottom:0}}"]})}return r})();var ES=["selectionInput"],SS=()=>({standalone:!0});function xS(r,d){if(r&1&&(e(0,` 1399 `),n(1,"small",19),e(2,` 1400 `),n(3,"div",7),e(4),a(),e(5,` 1401 `),a(),e(6,` 1402 `)),r&2){let t=d.$implicit;l(4),v(t)}}function fS(r,d){if(r&1&&(e(0,` 1403 `),G(1,xS,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function hS(r,d){r&1&&(e(0,` 1404 `),n(1,"span",22),e(2,"expand_more"),a(),e(3,` 1405 `))}function CS(r,d){if(r&1&&(e(0,` 1406 `),n(1,"small",19),e(2,` 1407 `),n(3,"div",7),e(4),a(),e(5,` 1408 `),a(),e(6,` 1409 `)),r&2){let t=d.$implicit;l(4),v(t)}}function vS(r,d){if(r&1&&(e(0,` 1410 `),G(1,CS,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Type)}}function gS(r,d){if(r&1){let t=b();e(0,` 1411 `),n(1,"div",4),e(2,` 1412 `),n(3,"p-floatlabel"),e(4,` 1413 `),n(5,"p-select",20),h("onChange",function(i){E(t);let s=m();return S(s.typeChanged(i))}),e(6,` 1414 `),_(7,hS,4,0,"ng-template",null,0,A),e(9,` 1415 `),a(),e(10,` 1416 `),n(11,"label",21),e(12,` 1417 `),n(13,"span",7),e(14,"CUSTOM_FIELD.TYPE"),a(),e(15,`
1418 `),n(16,"span",8),e(17," *"),a(),e(18,` 1419 `),a(),e(19,` 1420 `),a(),e(20,` 1421 `),n(21,"small",9),e(22,` 1422 `),n(23,"div",18),e(24,` 1423 CUSTOM_FIELD.ERROR.FIELD_TYPE_REQUIRED 1424 `),a(),e(25,` 1425 `),a(),e(26,` 1426 `),_(27,vS,3,0),a(),e(28,` 1427 `)}if(r&2){let t=m();l(5),p("tabindex",2)("options",t.customFieldTypes)("fluid",!0),l(16),p("hidden",t.form.controls.Type.valid||t.form.controls.Type.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Type.errors!=null&&t.form.controls.Type.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.Type&&t.form.controls.Type.untouched?27:-1)}}function TS(r,d){if(r&1&&(e(0,` 1428 `),n(1,"small",19),e(2,` 1429 `),n(3,"div",7),e(4),a(),e(5,` 1430 `),a(),e(6,` 1431 `)),r&2){let t=d.$implicit;l(4),v(t)}}function IS(r,d){if(r&1&&(e(0,` 1432 `),G(1,TS,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Description)}}function bS(r,d){if(r&1){let t=b();e(0,` 1433 `),n(1,"div",3),e(2,` 1434 `),n(3,"div",23),e(4,` 1435 `),n(5,"p-floatlabel"),e(6,` 1436 `),n(7,"input",24,1),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectionName,i)||(s.selectionName=i),S(i)}),h("keydown.enter",function(){E(t);let i=m();return S(i.addSelectionOption())}),a(),e(9,` 1437 `),n(10,"label",25),e(11,` 1438 `),n(12,"span",7),e(13,"CUSTOM_FIELD.SELECTION_NAME"),a(),e(14,` 1439 `),a(),e(15,` 1440 `),a(),e(16,` 1441 `),a(),e(17,` 1442 `),a(),e(18,` 1443 `)}if(r&2){let t=m();l(7),H("ngModel",t.selectionName),p("ngModelOptions",ne(3,SS))("fluid",!0)}}function yS(r,d){if(r&1){let t=b();e(0,` 1444 `),n(1,"div",15),e(2,` 1445 `),n(3,"div",26),e(4,` 1446 `),n(5,"p-button",27),I(6,"translate"),h("onClick",function(){E(t);let i=m();return S(i.addSelectionOption())}),e(7,` 1447 `),a(),e(8,` 1448 `),n(9,"div",28),e(10,` 1449 `),n(11,"p-button",29),h("onClick",function(){E(t);let i=m();return S(i.sortSelectionsAlpha())}),e(12,` 1450 `),R(13,"img",30),e(14,` 1451 `),a(),e(15,` 1452 `),a(),e(16,` 1453 `),a(),e(17,` 1454 `),a(),e(18,` 1455 `)}if(r&2){let t,o=m();l(5),q("label",y(6,7,"CUSTOM_FIELD.ADD_SELECTION")),p("raised",!0),l(6),p("rounded",!0)("raised",!0)("text",!0)("hidden",((t=o.form.controls.Options.value==null?null:o.form.controls.Options.value.length)!==null&&t!==void 0?t:0)<2),l(2),p("src",o.sortOrder==="desc"?o.sortDe
1455scIcon:o.sortAscIcon,jt)}}function AS(r,d){if(r&1){let t=b();e(0,` 1456 `),n(1,"div"),e(2,` 1457 `),n(3,"div",33),e(4,` 1458 `),n(5,"div",34),e(6,` 1459 `),n(7,"i",35),e(8,"drag_handle"),a(),e(9,` 1460 `),a(),e(10,` 1461 `),n(11,"div",36),e(12,` 1462 `),n(13,"span"),e(14),a(),e(15,` 1463 `),n(16,"div",37),e(17,` 1464 `),n(18,"p-button",38),h("onClick",function(){let i=E(t).$index,s=m(2);return S(s.deleteSelection(i))}),e(19,` 1465 `),n(20,"i",22),e(21,"delete"),a(),e(22,` 1466 `),a(),e(23,` 1467 `),a(),e(24,` 1468 `),a(),e(25,` 1469 `),a(),e(26,` 1470 `),a(),e(27,` 1471 `)}if(r&2){let t=d.$implicit;l(14),v(t),l(4),p("text",!0)("rounded",!0)}}function RS(r,d){if(r&1&&(e(0,` 1472 `),n(1,"small",19),e(2,` 1473 `),n(3,"div",7),e(4),a(),e(5,` 1474 `),a(),e(6,` 1475 `)),r&2){let t=d.$implicit;l(4),v(t)}}function wS(r,d){if(r&1&&(e(0,` 1476 `),G(1,RS,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Options)}}function DS(r,d){if(r&1){let t=b();e(0,` 1477 `),n(1,"div",31),e(2,` 1478 `),n(3,"div",4),e(4,` 1479 `),n(5,"div",32),j("dragulaModelChange",function(i){E(t);let s=m();return W(s.selectionOptions,i)||(s.selectionOptions=i),S(i)}),e(6,` 1480 `),G(7,AS,28,3,null,null,Zi),a(),e(9,` 1481 `),a(),e(10,` 1482 `),n(11,"small",9),e(12,` 1483 `),n(13,"div",18),e(14,` 1484 CUSTOM_FIELD.ERROR.OPTION_REQUIRED 1485 `),a(),e(15,` 1486 `),a(),e(16,` 1487 `),_(17,wS,3,0),a(),e(18,` 1488 `)}if(r&2){let t=m();l(5),H("dragulaModel",t.selectionOptions),l(2),k(t.selectionOptions),l(4),p("hidden",t.form.controls.Options.valid||t.form.controls.Options.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Options.errors!=null&&t.form.controls.Options.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.Options&&t.form.controls.Options.untouched?17:-1)}}var wl=(()=>{class r{customFieldService;dragulaService;message;translate;selectionInput;autoFocus=!0;editMode=!1;form;submitted=!1;validationErrors;textareaFocusChange=new Yt;customFieldTypes=[];dragulaGroupName="SELECTIONOPTIONS";selectionName;selectionOptions=[];showSelectionOptions=!1;sortAscIcon="../../../../../assets/icons/actions/sort_asc.svg";sortDescIcon="../../../../../assets/icons/actions/sort_desc.svg";sortOrder;dragulaSubs=new Vi;constructor(t,o,i,s){this.customFieldService=t,this.dragulaService=o,this.message=i,this.translate=s,this.dragulaService.createGroup(this.dragulaGroupName,{moves:(c,u,x)=>x?x.className==="drag-handle":!1}),this.dragulaSubs.add(o.drop(this.dragulaGroupName).subscribe(()=>{this.sortOrder="custom",this.form.get("Options")?.setValue(this.selectionOptions),this.markFormDirty()}))}ngOnInit(){let t=[];this.customFieldService.getCustomFieldTypes().pipe(we(o=>(t=o.filter(i=>i!=="UNKNOWN"),this.translate.get(t.map(i=>"CUSTOM_FIELD.TYPES."+i)).pipe(N())))).subscribe(o=>{let i=o;if(t&&t.length>0){this.customFieldTypes=t.map(u=>({label:i["CUSTOM_FIELD.TYPES."+u],value:u})),this.selectionOptions=this.form.get("Options")?.value;let s=this.form.get("Type")?.value,c=this.customFieldTypes.find(u=>u.value===s);c&&this.typeChanged(c)}})}ngOnDestroy(){this.dragulaService.destroy("SELECTIONOPTIONS"),this.dragulaSubs&&!this.dragulaSubs.closed&&this.dragulaSubs.unsubscribe()}typeChanged(t){this.showSelectionOptions=t.value==="SINGLE_SELECT"||t.value==="MULTIPLE_SELECT",this.selectionName="",this.form.get("Options")?.setValidators(this.showSelectionOptions?T.required:[]),this.editMode||this.form.get("Options")?.setValue([])}addSelectionOption(){this.sortOrder="custom",this.selectionName&&(this.selectionOptions.indexOf(this.selectionName)>-1?this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"]).pipe(N()).subscribe(t=>{this.message.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"])}):this.selectionName.length>255?this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.OPTION_LENGTH"]).pipe(N()).subscribe(t=>{this.message.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.OPTION_LENGTH"])}):(this.selectionOptions.push(this.selectionName),this.form.get("Options")?.setValue(this.selectionOptions),this.selectionName=void 0,this.selectionInput.nativeElement.focus(),this.markFormDirty()))}sortSelectionsAlpha(){this.sortOrder==="desc"?(this.sortOrder="asc",this.form.get("Options")?.setValue((this.form.get("Options")?.value).sort((t,o)=>t.localeCompare(o)))):(this.sortOrder="desc",this.form.get("Options")?.setValue((this.form.get("Options")?.value).sort((t,o)=>t.localeCompare(o)).reverse())),this.markFormDirty()}deleteSelection(t){this.sortOrder="custom",this.selectionOptions.splice(t,1),this.form.get("Options")?.setValue(this.selectionOptions),this.markFormDirty()}textareaFocus(t){this.textareaFocusChange.emit(t)}markFormDirty(){this.form.markAsDirty(),this.form.markAsTouched()}static \u0275fac=function(o){return new(o||r)(g($t),g(Dn),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-detail
1488s"]],viewQuery:function(o,i){if(o&1&&X(ES,5),o&2){let s;Y(s=Q())&&(i.selectionInput=s.first)}},inputs:{autoFocus:"autoFocus",editMode:"editMode",form:"form",submitted:"submitted",validationErrors:"validationErrors"},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:75,vars:20,consts:[["dropdownicon",""],["selectionInput",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.custom-field.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"fluid","qwareFocus"],["id","qware.custom-field.details.label.name","for","qware.custom-field.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.custom-field.details.error.name-req","translate","",3,"hidden"],["id","qware.custom-field.details.error.name-length","translate","",3,"hidden"],["id","qware.custom-field.details.error.dup-name","translate","",3,"hidden"],[3,"hidden"],[1,"material-icons","warning-icon"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","3","id","qware.custom-field.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.custom-field.details.label.description","for","qware.custom-field.details.textarea.description"],["translate","",3,"hidden"],[1,"validation-error"],["id","qware.custom-field.details.dropdown.field-type","formControlName","Type","variant","filled",3,"onChange","tabindex","options","fluid"],["id","qware.custom-field.details.label.field-type","for","qware.custom-field.details.dropdown.field-type"],[1,"material-icons"],[1,"medium-input",2,"margin-bottom","0"],["id","qware.custom-field.details.input.selection-name","tabindex","4","type","text","pInputText","","name","Selection Name","variant","filled",3,"ngModelChange","keydown.enter","ngModel","ngModelOptions","fluid"],["id","qware.custom-field.details.label.selection-name","for","qware.custom-field.details.input.selection-name"],[1,"add-selection-container","flex-inline","flex-space-between"],["tabindex","5","id","qware.custom-field.button.add","type","button",1,"inline-button",3,"onClick","raised","label"],[1,"sort-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","raised","text","hidden"],[3,"src"],[1,"col-12"],["dragula","SELECTIONOPTIONS",3,"dragulaModelChange","dragulaModel"],[1,"selection-option"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline","flex-space-between"],[1,"delete-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded"]],template:function(o,i){o&1&&(n(0,"div",2),e(1,` 1489 `),e(2,` 1490 `),n(3,"div",3),e(4,` 1491 `),n(5,"div",4),e(6,` 1492 `),n(7,"p-floatlabel"),e(8,` 1493 `),R(9,"input",5),e(10,` 1494 `),n(11,"label",6),e(12,` 1495 `),n(13,"span",7),e(14,"CUSTOM_FIELD.NAME"),a(),e(15,` 1496 `),n(16,"span",8),e(17," *"),a(),e(18,` 1497 `),a(),e(19,` 1498 `),a(),e(20,` 1499 `),n(21,"small",9),e(22,` 1500 `),n(23,"div",10),e(24,` 1501 CUSTOM_FIELD.ERROR.NAME_REQUIRED 1502 `),a(),e(25,` 1503 `),n(26,"div",11),e(27,` 1504 CUSTOM_FIELD.ERROR.NAME_LENGTH 1505 `),a(),e(28,` 1506 `),n(29,"div",12),e(30,` 1507 CUSTOM_FIELD.ERROR.DUPLICATE_NAME 1508 `),a(),e(31,` 1509 `),a(),e(32,` 1510 `),_(33,fS,3,0),n(34,"small",13),e(35,` 1511 `),n(36,"span")(37,"i",14),e(38,"warning"),a(),n(39,"span",7),e(40,"CUSTOM_FIELD.NOTIFICATION_WARNING"),a()(),e(41,` 1512 `),a(),e(42,` 1513 `),a(),e(43,` 1514 1515 `),_(44,gS,29,6),a(),e(45,` 1516 1517 `),n(46,"div",15),e(47,` 1518 `),n(48,"div",4),e(49,` 1519 `),n(50,"p-floatlabel"),e(51,` 1520 `),n(52,"textarea",16),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(53," "),a(),e(54,` 1521 `),n(55,"label",17),e(56,` 1522 `),n(57,"span",7),e(58,"CUSTOM_FIELD.DESCRIPTION"),a(),e(59,` 1523 `),a(),e(60,` 1524 `),a(),e(61,` 1525 `),n(62,"small",9),e(63,` 1526 `),n(64,"div",18),e(65,` 1527 CUSTOM_FIELD.ERROR.DESCRIPTION_LENGTH 1528 `),a(),e(66,` 1529 `),a(),e(67,` 1530 `),_(68,IS,3,0),a(),e(69,` 1531 `),a(),e(70,` 1532 1533 `),e(71,` 1534 `),_(72,bS,19,4)(73,yS,19,9)(74,DS,19,4),a()),o&2&&(p("formGroup",i.form),l(9),p("fluid",!0)("qwareFocus",i.autoFocus),l(12),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.duplicateString)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?33:-1),l(),p("hidden",i.form.controls.Name.pristine||!i.editMode),l(10),f(i.customFieldTypes&&i.customFieldTypes.length>0?44:-1),l(8),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",i.form.controls.Description.valid||i.form.controls.Description.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Description.errors!=null&&i.form.controls.Description.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Description&&i.form.controls.Description.untouched?68:-1),l(4),f(i.showSelectionOptions?72:-1),l(),f(i.showSelectionOptions?73:-1),l(),f(i.showSelectionOptions?74:-1))},dependencies:[oe,pn,Ne,je,Ae,se,ge,Le,ye,Te,De,it,ri,$,ie],styles:[`qware-custom-field-detail
1534s .text-box{min-height:93px!important}qware-custom-field-details .add-selection-container{margin:0 1rem}qware-custom-field-details .inline-button{margin-top:-1px}qware-custom-field-details .delete-button{margin-top:-.75rem;pointer-events:none;flex:1 1 auto}qware-custom-field-details .delete-button button{float:right;pointer-events:initial}qware-custom-field-details .selection-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}body>.gu-mirror .selection-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}body>.gu-mirror .delete-button{margin-top:-.75rem;pointer-events:none;flex:1 1 auto}body>.gu-mirror .delete-button button{float:right;pointer-events:initial}.warning-icon{vertical-align:middle} 1535`],encapsulation:2})}return r})();var fp=(()=>{class r{authService;customFieldService;fb;responseService;route;router;toastService;translate;displaySpinner=!0;form;isLoaded=!1;submitted=!1;textareaFocused=!1;validationErrors;allCustomFieldNames=[];constructor(t,o,i,s,c,u,x,C){this.authService=t,this.customFieldService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.toastService=x,this.translate=C}ngOnInit(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",T.maxLength(ft)),Type:this.fb.control(null,T.required),Options:this.fb.control([])}),this.customFieldService.getCustomFields(this.authService.tenant.Id).subscribe(t=>{let o=t;this.allCustomFieldNames=o.filter(i=>i.Name).map(i=>i.Name),this.form.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allCustomFieldNames)]),this.isLoaded=!0,this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllCustomFields"),this.router.navigate(["../"+P.list],t)}save(){if(!this.submitted)if(this.form.valid){let t=this.form.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomField(t).subscribe({next:()=>{localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllCustomFields"),this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t.get("SHARED.ERROR_LABEL"),t.get("SHARED.ERROR.FAILED_VALIDATION"))})}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g($t),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-create"]],standalone:!1,decls:32,vars:13,consts:[[1,"col-12",3,"keydown.enter"],["id","qware.custom-field.create.spinner",3,"displaySpinner"],[1,"form-container"],["translate","","id","qware.custom-field.page-header",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.custom-field.create.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.custom-field.create.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"]],template:function(o,i){o&1&&(n(0,"div",0),h("keydown.enter",function(){return i.textareaFocused?void 0:i.save()}),e(1,` 1536 `),n(2,"qware-spinner",1),e(3,` 1537 `),n(4,"div",2),e(5,` 1538 `),n(6,"h3",3),e(7,` 1539 CUSTOM_FIELD.CREATE_CUSTOM_FIELD 1540 `),a(),e(8,` 1541 `),n(9,"p-card"),e(10,` 1542 `),n(11,"div"),e(12,` 1543 `),n(13,"qware-custom-field-details",4),h("textareaFocusChange",function(c){return i.updateTextAreaFocus(c)}),e(14,` 1544 `),a(),e(15,` 1545 `),a(),e(16,` 1546 `),n(17,"div",5),e(18,` 1547 `),n(19,"p-button",6),I(20,"translate"),h("onClick",function(){return i.goBack()}),e(21,` 1548 `),a(),e(22,` 1549 `),n(23,"p-button",7),I(24,"translate"),h("onClick",function(){return i.save()})("keydown.enter",function(c){return c.preventDefault()}),e(25,` 1550 `),a(),e(26,` 1551 `),a(),e(27,` 1552 `),a(),e(28,` 1553 `),a(),e(29,` 1554 `),a(),e(30,` 1555`),a(),e(31,` 1556`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(11),p("form",i.form)("submitted",i.submitted)("validationErrors",i.validationErrors),l(6),q("label",y(20,9,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(24,11,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty))},dependencies:[oe,Ie,me,$,wl,ie],encapsulation:2})}return r})();var Ps=He(nt());var LS=["actionsMenu"],NS=["drawer"],OS=r=>({"lg:col-8":r});function FS(r,d){if(r&1&&(e(0,` 1557 `),n(1,"a",17),e(2,` 1558 `),n(3,"span",18),e(4),a(),e(5,` 1559 `),n(6,"span",19),e(7),a(),e(8,` 1560 `),a(),e(9,` 1561 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function MS(r,d){r&1&&(e(0,` 1562 `),n(1,"span",21),e(2,"SHARED.ACTIONS"),a(),e(3,` 1563 `),n(4,"i",22),e(5,"expand_more"),a(),e(6,` 1564 `))}function US(r,d){if(r&1){let t=b();e(0,` 1565 `),n(1,"p-button",20),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 1566 `),_(3,MS,7,0,"ng-template",null,2,A),e(5,` 1567 `),a(),e(6,` 1568 `)}r&2&&(l(),p("raised",!0))}function PS(r,d){if(r&1&&(e(0,` 1569 `),n(1,"a",17),e(2,` 1570 `),n(3,"span",18),e(4),a(),e(5,` 1571 `),n(6,"span",19),e(7),a(),e(8,` 1572 `),a(),e(9,` 1573 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function GS(r,d){if(r&1){let t=b();e(0,` 1574 `),n(1,"div",23),e(2,` 1575 `),n(3,"p-menu",24,3),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 1576 `),_(6,PS,10,2,"ng-template",null,1,A),e(8,` 1577 `),a(),e(9,` 1578 `),n(10,"p-button",25),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 1579 `),n(12,"i",22),e(13,"more_vert"),a(),e(14,` 1580 `),a(),e(15,` 1581 `),a(),e(16,` 1582 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function kS(r,d){if(r&1){let t=b();e(0,` 1583 `),n(1,"p-button",26),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 1584 `),a(),e(4,` 1585 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function VS(r,d){r&1&&(e(0,` 1586 `),n(1,"div",29),e(2,` 1587 `),n(3,"span",30),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 1588 `),a(),e(6,` 1589 `))}function qS(r,d){if(r&1){let t=b();e(0,` 1590 `),n(1,"qware-spinner",31),e(2,` 1591 `),n(3,"div",32),e(4,` 1592 `),n(5,"qware-entity-history",33),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 1593 `),a(),e(7,` 1594 `),a(),e(8,` 1595 `),a(),e(9,` 1596 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function BS(r,d){if(r&1){let t=b();e(0,` 1597 `),n(1,"div",27),e(2,` 1598 `),n(3,"p-drawer",28,4),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 1599 `),_(6,VS,7,0,"ng-template",null,5,A),e(8,` 1600 `),_(9,qS,10,7,"ng-template",null,2,A),e(11,` 1601 `),a(),e(12,` 1602 `),a(),e(13,` 1603 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var hp=(()=>{class r{authService;confirmationService;customFieldService;fb;responseService;route;router;toastService;translate;actionsMenu;drawer;displayDrawerSpinner=D(!1);actionItems=[];customField;displaySpinner=!0;form;historyArrayProperties=["Options"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;validationErrors;auditLoggingDisabled=!0;customFieldListRoute="../../"+P.list;allCustomFieldNames=[];translations={};constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.confirmationService=o,this.customFieldService=i,this.fb=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.CUSTOM_FIELD"]).pipe(N()),this.customFieldService.getCustomFields(this.authService.tenant.Id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1];this.customField=o.find(s=>
1603s.Id===this.route.snapshot.params.id),this.form.patchValue(Ps.default.cloneDeep(this.customField)),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let i=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableCustomField()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableCustomField()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteCustomField()}];this.customField?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&i.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreCustomField()}),this.actionItems=i.filter(s=>this.customField?.State===M.DISABLED?s.id!=="disable.action":this.customField?.State===M.DELETED?s.id!=="disable.action"&&s.id!=="enable.action"&&s.id!=="delete.action":s.id!=="enable.action"),this.setHistoryParams(),this.customField?.State==="DELETED"&&this.form.disable(),this.allCustomFieldNames=o.filter(s=>s.Name&&s.Name!==this.customField?.Name).map(s=>s.Name),this.form.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allCustomFieldNames)]),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.customFieldListRoute,this.route)}})}createForm(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",T.maxLength(ft)),Type:this.fb.control({value:null,disabled:!0},T.required),Options:this.fb.control([])})}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.CUSTOM_FIELD"]+' "'+this.customField?.Name+'"',this.historyIdMap=new Map;let t=new Map;t.set("Name","CUSTOM_FIELD.NAME"),t.set("Description","CUSTOM_FIELD.DESCRIPTION"),this.historyNameMap=t}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllCustomFields"),this.router.navigate([this.customFieldListRoute],t)}save(){if(!this.submitted)if(this.form.valid){let t=this.form.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=this.customField?.State??M.ACTIVE,t.Id=this.customField?.Id,t.Type=this.customField?.Type,this.customFieldService.createOrUpdateCustomField(t).subscribe({next:()=>{localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllCustomFields"),this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.SAVE",this.customFieldListRoute,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableCustomField(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE","CUSTOM_FIELD.NOTIFICATION_WARNING"],{entity:this.customField?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"]+" "+t["CUSTOM_FIELD.NOTIFICATION_WARNING"],accept:()=>{this.customField&&(this.displaySpinner=!0,this.submitted=!0,this.customField.State=M.DISABLED,this.customFieldService.createOrUpdateCustomField(this.customField).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.DISABLE",this.customFieldListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableCustomField(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.customField?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.customField&&(this.displaySpinner=!0,this.submitted=!0,this.customField.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomField(this.customField).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.ENABLE",this.customFieldListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteCustomField(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE","CUSTOM_FIELD.NOTIFICATION_WARNING"],{entity:this.customField?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"]+" "+t["CUSTOM_FIELD.NOTIFICATION_WARNING"],accept:()=>{this.customField&&(this.displaySpinner=!0,this.submitted=!0,this.customField.State=M.DELETED,this.customFieldService.createOrUpdateCustomField(this.customField).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.DELETE",this.customFieldListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreCustomField(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE","CUSTOM_FIELD.NOTIFICATION_WARNING"],{entity:this.customField?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"]+" "+t["CUSTOM_FIELD.NOTIFICATION_WARNING"],accept:()=>{this.customField&&(this.displaySpinner=!0,this.submitted=!0,this.customField.State=M.ACTIVE,this.customFieldService.createOrUpdateCustomField(this.customField).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CUSTOM_FIELD.SUCCESS.RESTORE",this.customFieldListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Ps.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(mt),g($t),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-edit"]],viewQuery:function(o,i){if(o&1&&(X(LS,7),X(NS,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:45,vars:20,consts:[["actionsMenu",""],["item",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.custom-field.edit",1,"grid"],["id","qware.custom-field.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.custom-field.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.custom-field.edit.edit.actions-menu",3,"model","popup"],["id","qware.custom-field.edit.spinner",3,"displaySpinner"],[3,"lockEditing"],[3,"form","submitted","autoFocus","validationErrors","editMode"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.custom-field.edit.button.cancel",3,"onClick","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.custom-field.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.custom-field.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.custom-field.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.custom-field.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.custom-field.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.custom-field.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","customField",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",6),e(1,` 1604 `),n(2,"div",7),e(3,` 1605 `),n(4,"div",8),e(5,` 1606 `),n(6,"h3",9),e(7,` 1607 CUSTOM_FIELD.EDIT_CUSTOM_FIELD 1608 `),a(),e(8,` 1609 `),n(9,"div",10),e(10,` 1610 `),n(11,"p-menu",11,0),e(13,` 1611 `),_(14,FS,10,2,"ng-template",null,1,A),e(16,` 1612 `),a(),e(17,`
1613 `),_(18,US,7,1),a(),e(19,` 1614 `),_(20,GS,17,4),a(),e(21,` 1615 `),n(22,"qware-spinner",12),e(23,` 1616 `),n(24,"p-card"),e(25,` 1617 `),n(26,"qware-edit-lock",13),e(27,` 1618 `),n(28,"qware-custom-field-details",14),e(29,` 1619 `),a(),e(30,` 1620 `),a(),e(31,` 1621 `),n(32,"div",15),e(33,` 1622 `),n(34,"p-button",16),I(35,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(36,` 1623 `),a(),e(37,` 1624 `),_(38,kS,5,5),a(),e(39,` 1625 `),a(),e(40,` 1626 `),a(),e(41,` 1627 `),a(),e(42,` 1628 `),_(43,BS,14,6),a(),e(44,` 1629`)}o&2&&(l(2),p("ngClass",pe(18,OS,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(4),p("lockEditing",i.customField!==void 0&&i.customField.State==="DELETED"),l(2),p("form",i.form)("submitted",i.submitted)("autoFocus",!1)("validationErrors",i.validationErrors)("editMode",!0),l(6),q("label",y(35,16,"SHARED.CANCEL")),p("text",!0),l(4),f((i.customField==null?null:i.customField.State)!=="DELETED"?38:-1),l(5),f(i.auditLoggingDisabled?-1:43))},dependencies:[oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,$,wl,ie],encapsulation:2})}return r})();var Ht=He(nt());var HS=["actionsMenu"],WS=["dt"],jS=["listViewDropdown"],YS=()=>({raised:!0}),QS=r=>({"disabled-row":r}),KS=(r,d)=>d.id,$S=(r,d)=>d.field,zS=(r,d)=>d.Id,XS=(r,d)=>d.Id+d.Name;function ZS(r,d){if(r&1){let t=b();e(0,` 1630 `),n(1,"div",29),e(2,` 1631 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 1632 `),n(7,"p-toggleswitch",30),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 1633 `),a(),e(9,` 1634 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function JS(r,d){r&1&&(e(0,` 1635 `),n(1,"span",12),e(2,"expand_more"),a(),e(3,` 1636 `))}function ex(r,d){if(r&1&&(e(0,` 1637 `),n(1,"a",31),e(2,` 1638 `),n(3,"span",32),e(4),a(),e(5,` 1639 `),n(6,"span",33),e(7),a(),e(8,` 1640 `),a(),e(9,` 1641 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function tx(r,d){if(r&1&&(e(0,` 1642 `),R(1,"p-sortIcon",35),e(2,` 1643 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function ix(r,d){if(r&1&&(e(0,` 1644 `),n(1,"th",34),e(2,` 1645 `),n(3,"span",16),e(4),a(),e(5,` 1646 `),_(6,tx,3,1),a(),e(7,` 1647 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.pSortableColumnDisabled?void 0:t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function nx(r,d){if(r&1&&(e(0,` 1648 `),n(1,"tr"),e(2,` 1649 `),G(3,ix,8,3,null,null,KS),a(),e(5,` 1650 `)),r&2){let t=d.$implicit;l(3),k(t)}}function ax(r,d){if(r&1&&(e(0,` 1651 `),n(1,"a",39),e(2),a(),e(3,` 1652 `)),r&2){let t=m(2).$implicit,o=m().$implicit,i=m();l(),gt("routerLink","",i.customFieldEditRoute,"/",o.Id,""),l(),K(` 1653 `,o[t.field],` 1654 `)}}function rx(r,d){if(r&1&&(e(0,` 1655 `),n(1,"a",39),e(2),a(),e(3,` 1656 `)),r&2){let t=m(2).$implicit,o=m().$implicit,i=m();l(),gt("routerLink","",i.customFieldLayoutEditRoute,"/",o.Id,""),l(),K(` 1657 `,o[t.field],` 1658 `)}}function ox(r,d){r&1&&(e(0,` 1659 `),n(1,"span",40),e(2,"SHARED.DISABLED"),a(),e(3,` 1660 `))}function lx(r,d){r&1&&(e(0,` 1661 `),n(1,"span",40),e(2,"SHARED.DELETED"),a(),e(3,` 1662 `))}function sx(r,d){if(r&1&&(e(0,` 1663 `),n(1,"span"),e(2,` 1664 `),_(3,ax,4,4)(4,rx,4,4)(5,ox,4,0)(6,lx,4,0),a(),e(7,` 1665 `)),r&2){let t=m(2).$implicit,o=m();l(3),f(o.selectedViewOption==="AllCustomFields"?3:o.selectedViewOption==="AllLayouts"?4:-1),l(2),f(t.State==="DISABLED"?5:t.State==="DELETED"?6:-1)}}function dx(r,d){if(r&1){let t=b();e(0,` 1666 `),n(1,"a",41),h("click",function(){E(t);let i=m(7);return S(i.navClick())}),e(2),a(),e(3,` 1667 `)}if(r&2){let t=m().$implicit,o=m(6);l(),gt("routerLink","",o.customFieldLayoutEditRoute,"/",t.Id,""),l(),v(t.Name)}}function px(r,d){if(r&1){let t=b();e(0,` 1668 `),n(1,"a",41),h("click",function(){E(t);let i=m(7);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1669 `)}if(r&2){let t=m().$implicit,o=m(6);l(),gt("routerLink","",o.customFieldLayoutEditRoute,"/",t.Id,""),l(),v(t.Name)}}function mx(r,d){if(r&1&&(e(0,` 1670 `),_(1,dx,4,4)(2,px,7,4)),r&2){let t=d.$index,o=d.$count;l(),f(t===o-1?1:2)}}function cx(r,d){if(r&1&&(e(0,` 1671 `),n(1,"span"),e(2,` 1672 `),G(3,mx,3,1,null,null,zS),a(),e(5,` 1673 `)),r&2){let t=m(4).$implicit;l(3),k(t.Layouts)}}function ux(r,d){if(r&1){let t=b();e(0,` 1674 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),a(),e(3,` 1675 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.statusEditRoute,"/",t.Id,""),l(),v(t.Name)}}function _x(r,d){if(r&1){let t=b();e(0,` 1676 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1677 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.statusEditRoute,"/",t.Id,""),l(),v(t.Name)}}function Ex(r,d){if(r&1&&(e(0,` 1678 `),_(1,ux,4,4)(2,_x,7,4)),r&2){let t=m(),o=t.$index,i=t.$count;l(),f(o===i-1?1:2)}}function Sx(r,d){if(r&1){let t=b();e(0,` 1679 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),a(),e(3,` 1680 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.assetCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function xx(r,d){if(r&1){let t=b();e(0,` 1681 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1682 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.assetCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function fx(r,d){if(r&1&&(e(0,` 1683 `),_(1,Sx,4,4)(2,xx,7,4)),r&2){let t=m(),o=t.$index,i=t.$count;l(),f(o===i-1?1:2)}}function hx(r,d){if(r&1){let t=b();e(0,` 1684 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),a(),e(3,` 1685 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.inventoryCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function Cx(r,d){if(r&1){let t=b();e(0,` 1686 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1687 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.inventoryCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function vx(r,d){if(r&1&&(e(0,` 1688 `),_(1,hx,4,4)(2,Cx,7,4)),r&2){let t=m(),o=t.$index,i=t.$count;l(),f(o===i-1?1:2)}}function gx(r,d){if(r&1){let t=b();e(0,` 1689 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),a(),e(3,` 1690 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.eventCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function Tx(r,d){if(r&1){let t=b();e(0,` 1691 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1692 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.eventCategoryEditRoute,"/",t.Id,""),l(),v(t.Name)}}function Ix(r,d){if(r&1&&(e(0,` 1693 `),_(1,gx,4,4)(2,Tx,7,4)),r&2){let t=m(),o=t.$index,i=t.$count;l(),f(o===i-1?1:2)}}function bx(r,d){if(r&1){let t=b();e(0,` 1694 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),a(),e(3,` 1695 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.eventCalendarEditRoute,"/",t.Id,""),l(),v(t.Name)}}function yx(r,d){if(r&1){let t=b();e(0,` 1696 `),n(1,"a",41),h("click",function(){E(t);let i=m(8);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 1697 `)}if(r&2){let t=m(2).$implicit,o=m(6);l(),gt("routerLink","",o.eventCalendarEditRoute,"/",t.Id,""),l(),v(t.Name)}}function Ax(r,d){if(r&1&&(e(0,` 1698 `),_(1,bx,4,4)(2,yx,7,4)),r&2){let t=m(),o=t.$index,i=t.$count;l(),f(o===i-1?1:2)}}function Rx(r,d){if(r&1&&(e(0,` 1699 `),_(1,Ex,3,1)(2,fx,3,1)(3,vx,3,1)(4,Ix,3,1)(5,Ax,3,1),e(6,` 1700 `)),r&2){let t,o=d.$implicit;l(),f((t=o.Type)==="WorkOrder"?1:t==="Asset"?2:t==="Inventory"?3:t==="EventCategory"?4:t==="EventCalendar"?5:-1)}}function wx(r,d){if(r&1&&(e(0,` 1701 `),n(1,"span"),e(2,` 1702 `),G(3,Rx,7,1,null,null,XS),a(),e(5,` 1703 `)),r&2){let t=m(4).$implicit;l(3),k(t.AssociatedEntities)}}function Dx(r,d){if(r&1&&(e(0,` 1704 `),_(1,cx,6,0)(2,wx,6,0)),r&2){let t=m(4);l(),f(t.selectedViewOption==="AllCustomFields"?1:t.selectedViewOption==="AllLayouts"?2:-1)}}function Lx(r,d){if(r&1&&(e(0,` 1705 `),n(1,"span"),e(2),a(),e(3,` 1706 `)),r&2){let t=m(2).$implicit,o=m().$implicit;l(2),v(o[t.field])}}function Nx(r,d){if(r&1&&(e(0,` 1707 `),_(1,Dx,3,1)(2,Lx,4,1)),r&2){let t=m().$implicit;l(),f(t.header?1:2)}}function Ox(r,d){if(r&1&&(e(0,` 1708 `),n(1,"span"),e(2),a(),e(3,` 1709 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function Fx(r,d){if(r&1&&(e(0,` 1710 `),n(1,"td"),e(2,` 1711 `),n(3,"span",37),e(4),a(),e(5,` 1712 `),n(6,"div",38),e(7,` 1713 `),n(8,"span"),e(9,` 1714 `),_(10,sx,8,2)(11,Nx,3,1)(12,Ox,4,1),e(13,` 1715 `),a(),e(14,` 1716 `),a(),e(15,` 1717 `),a(),e(16,` 1718 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:t==="AssociatedNames"?11:12)}}function Mx(r,d){if(r&1&&(e(0,` 1719 `),n(1,"tr",36),e(2,` 1720 `),G(3,Fx,17,2,null,null,$S),a(),e(5,` 1721 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,QS,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function Ux(r,d){r&1&&(e(0,` 1722 `),n(1,"div",42),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 1723 `))}function Px(r,d){r&1&&(e(0,` 1724 `),n(1,"div",42),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 1725 `))}function Gx(r,d){if(r&1&&(e(0,` 1726 `),n(1,"tr"),e(2,` 1727 `),n(3,"td"),e(4,` 1728 `),_(5,Ux,4,0)(6,Px,4,0),a(),e(7,` 1729 `),a(),e(8,` 1730 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:6)}}function kx(r,d){r&1&&(e(0,` 1731 `),n(1,"i",12),e(2,"add"),a(),e(3,` 1732 `))}function Vx(r,d){if(r&1&&(e(0,` 1733 `),n(1,"i",12),e(2),a(),e(3,` 1734 `)),r&2){let t,o=m().$implicit;l(),Bt((t=o.rotateClass)!==null&&t!==void 0?t:""),l(),v(o.icon)}}function qx(r,d){if(r&1&&(e(0,` 1735 `),R(1,"img",46),e(2,` 1736 `)),r&2){let t,o=m().$implicit;l(),Bt((t=o.rotateClass)!==null&&t!==void 0?t:""),p("src",o.svg,jt)}}function Bx(r,d){if(r&1&&(e(0,` 1737 `),n(1,"div",43),e(2,` 1738 `),R(3,"p-badge",44),e(4,` 1739 `),n(5,"p-button",45),e(6,` 1740 `),_(7,Vx,4,3)(8,qx,3,3),a(),e(9,` 1741 `),a(),e(10,` 1742 `)),r&2){let t=d.$implicit;l(3),p("value",t.label),l(2),q("routerLink",t.routerLink),p("text",!0)("rounded",!0)("raised",!0),l(2),f(t.icon?7:-1),l(),f(t.svg?8:-1)}}var vp=(()=>{class r{assetService;authService;customFieldService;eventService;inventoryService;serviceAreaService;statusService;translate;actionsMenu;dt;listViewDropdown;addMenuItems=[];allCustomFields=[];allLayouts=[];customFieldColumns=[];displaySpinner=!0;generalFilter="";isActive=!1;layoutColumns=[];listViewOptions=[];moreItems=[];searchEnabled=!1;searchResults=!1;selectedViewOption;showDeleted=!1;tableColumns=[];tableData=[];translations={};customFieldLimit;inventoryManagementDisabled=!0;hasEventModule=!0;canViewDeleted=!1;assetCategoryEditRoute;customFieldCreateRoute="../"+P.create;customFieldEditRoute="../../"+P.customField+"/"+P.edit;customFieldLayoutCreateRoute="../../"+P.customFieldLayout+"/"+P.create;customFieldLayoutEditRoute="../../"+P.customFieldLayout+"/"+P.edit;eventCalendarEditRoute;eventCategoryEditRoute;inventoryCategoryEditRoute;statusEditRoute="../../"+P.status+"/"+P.edit;constructor(t,o,i,s,c,u,x,C){this.assetService=t,this.authService=o,this.customFieldService=i,this.eventService=s,this.inventoryService=c,this.serviceAreaService=u,this.statusService=x,this.translate=C,this.customFieldLimit=this.authService.qwareSubscription?.customFieldsPerLayoutLimit,this.inventoryManagementDisabled=!this.authService.qwareSubscription?.inventoryManagement,this.hasEventModule=this.authService.tenant.EventsModule,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED),this.assetCategoryEditRoute="../../../../"+ua.asset+"/"+this.authService.tenant.Key+"/"+ua.assetCategory+"/"+ua.edit,this.inventoryCategoryEditRoute="../../../../"+vs.inventory+"/"+this.authService.tenant.Key+"/"+vs.inventoryCategory+"/"+ua.edit,this.eventCalendarEditRoute="../../../../"+Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.calendar+"/"+Ti.edit,this.eventCategoryEditRoute="../../../../"+Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.category+"/"+Ti.edit}ngOnInit(){ue([this.translate.get(["CUSTOM_FIELD_LAYOUT.ASSET_CATEGORY","CUSTOM_FIELD_LAYOUT.STATUS","CUSTOM_FIELD.TYPES.BOOLEAN","CUSTOM_FIELD.TYPES.DATE","CUSTOM_FIELD.TYPES.FILE","CUSTOM_FIELD.TYPES.INPUT","CUSTOM_FIELD.TYPES.MULTIPLE_SELECT","CUSTOM_FIELD.TYPES.SINGLE_SELECT","CUSTOM_FIELD.TYPES.NUMBER","CUSTOM_FIELD.TYPES.UNKNOWN","CUSTOM_FIELD_LAYOUT.TYPES.WORKORDERS","CUSTOM_FIELD_LAYOUT.TYPES.ASSETS","CUSTOM_FIELD_LAYOUT.TYPES.EVENTS","CUSTOM_FIELD_LAYOUT.CATEGORY","CUSTOM_FIELD_LAYOUT.TYPES.INVENTORY","CUSTOM_FIELD.TYPES.CURRENCY","CUSTOM_FIELD_LAYOUT.EVENT_CALENDAR","CUSTOM_FIELD_LAYOUT.EVENT_CATEGORY","CUSTOM_FIELD.CREATE_CUSTOM_FIELD","CUSTOM_FIELD_LAYOUT.CREATE_LAYOUT","CUSTOM_FIELD.ALL_CUSTOM_FIELDS","CUSTOM_FIELD_LAYOUT.ALL_LAYOUTS","SHARED.SEARCH"]).pipe(N()),this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id),this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.statusService.getStatuses(this.authService.tenant.Id),this.customFieldService.getCustomFields(this.authService.tenant.Id),this.assetService.getAssetCategories(!1,!1),this.hasEventModule?this.eventService.getCategories(!1,!0):Fe([]),this.hasEventModule?this.eventService.getCalendars(!1,!0):Fe([]),this.inventoryManagementDisabled?Fe([]):this.inventoryService.getInventoryCategories(!0)]).subscribe(t=>{this.translations=t[0],this.allLayouts=t[1];let o=t[2].filter(w=>w.State===M.ACTIVE),i=t[3].filter(w=>w.State===M.ACTIVE);this.allCustomFields=t[4];let s=t[5],c
1742=t[6],u=t[7],x=t[8];if(this.inventoryManagementDisabled&&(this.allLayouts=this.allLayouts.filter(w=>w.Type!=="INVENTORY")),this.allLayouts.forEach(w=>{w.Type=this.translations["CUSTOM_FIELD_LAYOUT.TYPES."+w.Type]}),this.customFieldColumns=[{field:"Name",header:"CUSTOM_FIELD.NAME",id:1},{field:"Type",header:"CUSTOM_FIELD.TYPE",id:2},{field:"Description",header:"CUSTOM_FIELD.DESCRIPTION",id:3},{field:"AssociatedNames",header:"CUSTOM_FIELD.ASSOCIATED_LAYOUTS",pSortableColumnDisabled:!0,id:4}],this.layoutColumns=[{field:"Name",header:"CUSTOM_FIELD_LAYOUT.NAME",id:5},{field:"Type",header:"CUSTOM_FIELD_LAYOUT.TYPE",id:6},{field:"AssociatedNames",header:"CUSTOM_FIELD_LAYOUT.ASSOCIATED_ENTITIES",pSortableColumnDisabled:!0,id:7}],this.addMenuItems=[{id:"createCustomField",label:this.translations["CUSTOM_FIELD.CREATE_CUSTOM_FIELD"],svg:"assets/icons/actions/custom_field_add.svg",routerLink:this.customFieldCreateRoute},{id:"createCustomFieldLayout",label:this.translations["CUSTOM_FIELD_LAYOUT.CREATE_LAYOUT"],icon:"view_agenda",rotateClass:"rotate90",routerLink:this.customFieldLayoutCreateRoute}],this.listViewOptions=[{label:this.translations["CUSTOM_FIELD.ALL_CUSTOM_FIELDS"],value:"AllCustomFields"},{label:this.translations["CUSTOM_FIELD_LAYOUT.ALL_LAYOUTS"],value:"AllLayouts"}],this.moreItems=[{label:this.translations["SHARED.SEARCH"],icon:"search",command:()=>this.enableSearch()}],Ht.default.each(o,w=>{let F=Ht.default.keys(w.CustomLayouts);F.length>0&&Ht.default.each(F,L=>{let U=w.CustomLayouts?w.CustomLayouts[L]:void 0,V=Ht.default.find(i,{Id:L}),z=new Jo;if(U?.Id&&(z=Ht.default.find(this.allLayouts,{Id:U.Id})),z&&V){let ce=w.Name+" - "+this.translations["CUSTOM_FIELD_LAYOUT.STATUS"]+": "+V.Name;z.AssociatedEntities=Ht.default.compact(Ht.default.concat(z.AssociatedEntities,{Id:L,Type:"WorkOrder",Name:ce})),z.AssociatedNames=Ht.default.join(z.AssociatedEntities.map(Z=>Z.Name),` 1743`)}})}),this.allCustomFields.forEach(w=>{w.Layouts=this.allLayouts.filter(F=>F.Fields&&F.Fields.findIndex(L=>L.Name===w.Name)>-1),w.AssociatedNames=Ht.default.join(w.Layouts.map(F=>F.Name),` 1744`),w.Type=this.translations["CUSTOM_FIELD.TYPES."+w.Type]}),s&&s.length>0){this.assetService.mapCategories(s,o,this.allLayouts);let w=s.filter(F=>F.State===M.ACTIVE);Ht.default.each(w,F=>{let L=F.CustomLayouts[0]?F.CustomLayouts[0].Id:void 0;if(L){let U=Ht.default.find(this.allLayouts,{Id:L});if(U&&F.Id){let V=this.translations["CUSTOM_FIELD_LAYOUT.CATEGORY"]+": "+F.Name;U.AssociatedEntities=Ht.default.compact(Ht.default.concat(U.AssociatedEntities,{Id:F.Id,Type:"Asset",Name:V})),U.AssociatedNames=Ht.default.join(U.AssociatedEntities.map(z=>z.Name))}}})}if(x&&x.length>0){this.inventoryService.mapInventoryCategoryList(x,this.allLayouts);let w=x.filter(F=>F.State===M.ACTIVE);Ht.default.each(w,F=>{let L=F.CustomLayouts[0]?F.CustomLayouts[0].Id:void 0;if(L){let U=Ht.default.find(this.allLayouts,{Id:L});if(U&&F.Id){let V=this.translations["CUSTOM_FIELD_LAYOUT.CATEGORY"]+": "+F.Name;U.AssociatedEntities=Ht.default.compact(Ht.default.concat(U.AssociatedEntities,{Id:F.Id,Type:"Inventory",Name:V})),U.AssociatedNames=Ht.default.join(U.AssociatedEntities.map(z=>z.Name))}}})}if(this.hasEventModule){let w=i.filter(F=>F.Type==="EVENTS"&&F.State===M.ACTIVE);c.forEach(F=>{F.CustomFieldLayoutPairs&&w.forEach(L=>{let U=new Jo;if(L&&L.Id&&F.CustomFieldLayoutPairs&&(U=F.CustomFieldLayoutPairs[L.Id],U&&U.Id&&(U=Ht.default.find(this.allLayouts,{Id:U.Id}),U&&F.Id))){let V=this.translations["CUSTOM_FIELD_LAYOUT.EVENT_CATEGORY"]+": "+F.Name+" - "+this.translations["CUSTOM_FIELD_LAYOUT.STATUS"]+": "+L.Name;U.AssociatedEntities=Ht.default.compact(Ht.default.concat(U.AssociatedEntities,{Id:F.Id,Type:"EventCategory",Name:V})),U.AssociatedNames=Ht.default.join(U.AssociatedEntities.map(z=>z.Name),` 1745`)}})}),u.forEach(F=>{F.CustomFieldLayoutPairs&&w.forEach(L=>{let U=new Jo;if(L&&L.Id&&F.CustomFieldLayoutPairs&&(U=F.CustomFieldLayoutPairs[L.Id],U&&U.Id&&(U=Ht.default.find(this.allLayouts,{Id:U.Id}),U&&F.Id))){let V=this.translations["CUSTOM_FIELD_LAYOUT.EVENT_CALENDAR"]+": "+F.Name+" - "+this.translations["CUSTOM_FIELD_LAYOUT.STATUS"]+": "+L.Name;U.AssociatedEntities=Ht.default.compact(Ht.default.concat(U.AssociatedEntities,{Id:F.Id,Type:"EventCalendar",Name:V})),U.AssociatedNames=Ht.default.join(U.AssociatedEntities.map(z=>z.Name),` 1746`)}})})}let C=localStorage.getItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY);C?this.selectedViewOption=C:this.selectedViewOption="AllCustomFields",this.tableColumns=this.selectedViewOption==="AllLayouts"?this.layoutColumns:this.customFieldColumns;let O=localStorage.getItem(Oe.CUSTOM_FIELD_STORAGE_KEY);O&&(this.generalFilter=O),this.listViewOnChange(!1)})}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}generalFilterOnChange(){localStorage.setItem(Oe.CUSTOM_FIELD_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt.filterGlobal(this.generalFilter,"contains")}enableSearch(){this.searchEnabled=!this.searchEnabled,this.searchEnabled===!1&&(this.generalFilter="",this.generalFilterOnChange())}listViewOnChange(t){switch(this.displaySpinner=!0,this.searchResults=!1,this.selectedViewOption){case"AllLayouts":localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllLayouts"),this.tableColumns=this.layoutColumns,this.tableData=this.filterCustomLayouts(this.allLayouts);break;case"AllCustomFields":default:localStorage.setItem(Oe.CUSTOM_FIELD_LIST_VIEW_STORAGE_KEY,"AllCustomFields"),this.tableColumns=this.customFieldColumns,this.tableData=this.filterCustomFields(this.allCustomFields);break}t&&(this.generalFilter=""),this.generalFilterOnChange(),this.displaySpinner=!1}filterCustomLayouts(t){return t.filter(o=>{let i=this.customFieldLimit===0&&o.Type!==this.translations["CUSTOM_FIELD_LAYOUT.TYPES.EVENTS"];return(o.State!==M.DELETED||this.showDeleted)&&!i})}filterCustomFields(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}toggleShowDeleted(){let t=this.selectedViewOption==="AllLayouts";this.tableData=t?this.filterCustomLayouts(this.allLayouts):this.filterCustomFields(this.allCustomFields)}
1746navClick(){localStorage.setItem(Oe.REDIRECT_FROM_PAGE,"CUSTOM_FIELD")}static \u0275fac=function(o){return new(o||r)(g(Pa),g(de),g($t),g(oi),g(Wi),g(_i),g(Oi),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-custom-field-list"]],viewQuery:function(o,i){if(o&1&&(X(HS,5),X(WS,7),X(jS,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.dt=s.first),Y(s=Q())&&(i.listViewDropdown=s.first)}},standalone:!1,decls:88,vars:26,consts:[["listViewDropdown",""],["dropdownicon",""],["moreMenu",""],["item",""],["dt",""],["icon",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.custom-field.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.custom-field.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"flex-inline","list-view-control-container"],[1,"list-view-label"],["translate",""],["id","qware.custom-field.list.list-view-ddl",1,"list-view-dropdown",3,"ngModelChange","onChange","options","ngModel"],[1,"more-container"],["id","qware.custom-field.list.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"col-12","data-grid"],["id","qware.custom-field.list.spinner",3,"displaySpinner"],["id","qware.custom-field.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"onFilter","columns","value","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"bottom-right-button"],["direction","up","buttonClassName","fab-button","id","qware.component.multiaction-fab",3,"model","buttonProps","mask"],[1,"show-deleted-switch"],["id","qware.custom-field-list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],[3,"pSortableColumn"],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.custom-field.list.table.custom-field-name",3,"routerLink"],["translate","",1,"badge"],[3,"click","routerLink"],["translate","",1,"no-results"],[1,"create-navigation"],[1,"raised",3,"value"],["type","button","severity","secondary","styleClass","icon-only-button p-speeddial-action",3,"text","rounded","raised","routerLink"],[3,"src"]],template:function(o,i){if(o&1){let s=b();n(0,"div",6),e(1,` 1747 `),n(2,"div",7),e(3,` 1748 `),n(4,"h3",8),e(5,` 1749 CUSTOM_FIELD.CUSTOM_FIELD_MANAGEMENT 1750 `),a(),e(6,` 1751 `),_(7,ZS,10,4),a(),e(8,` 1752 `),n(9,"div",9),e(10,` 1753 `),n(11,"div",10),e(12,` 1754 `),n(13,"p-iconfield",11),e(14,` 1755 `),n(15,"p-inputicon"),e(16,` 1756 `),n(17,"span",12),e(18,"search"),a(),e(19,` 1757 `),a(),e(20,` 1758 `),n(21,"input",13),I(22,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 1759 `),a(),e(24,` 1760 `),a(),e(25,` 1761 `),n(26,"div",14),e(27,` 1762 `),n(28,"div",15),e(29,` 1763 `),n(30,"span",16),e(31,"SHARED.LIST_VIEW"),a(),e(32,` 1764 `),a(),e(33,` 1765 `),n(34,"p-select",17,0),j("ngModelChange",function(u){return E(s),W(i.selectedViewOption,u)||(i.selectedViewOption=u),S(u)}),h("onChange",function(){return E(s),S(i.listViewOnChange(!0))}),e(36,` 1766 `),_(37,JS,4,0,"ng-template",null,1,A),e(39,` 1767 `),a(),e(40,` 1768 `),a(),e(41,` 1769 `),n(42,"div",18),e(43,` 1770 `),n(44,"p-menu",19,2),h("click",function(){E(s);let u=Ee(45);return S(u.hide())}),e(46,` 1771 `),_(47,ex,10,2,"ng-template",null,3,A),e(49,` 1772 `),a(),e(50,` 1773 `),n(51,"p-button",20),h("onClick",function(u){return E(s),Ee(45).toggle(u),S(i.isActive=!i.isActive)}),e(52,` 1774 `),n(53,"i",12),e(54,"more_vert"),a(),e(55,` 1775 `),a(),e(56,` 1776 `),a(),e(57,` 1777 `),a(),e(58,` 1778 `),n(59,"div",21),e(60,` 1779 `),n(61,"qware-spinner",22),e(62,` 1780 `),n(63,"p-table",23,4),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(65,` 1781 `),_(66,nx,6,0,"ng-template",24),e(67,` 1782 `),_(68,Mx,6,4,"ng-template",25),e(69,` 1783 `),_(70,Gx,9,2,"ng-template",26),e(71,` 1784 `),a(),e(72,` 1785 `),a(),e(73,` 1786 `),a(),e(74,` 1787 `),n(75,"div",27),e(76,` 1788 `),n(77,"p-speeddial",28),e(78,` 1789 `),_(79,kx,4,0,"ng-template",null,5,A),e(81,` 1790 `),_(82,Bx,11,7,"ng-template",null,3,A),e(84,` 1791 `),a(),e(85,` 1792 `),a(),e(86,` 1793 `),a(),e(87,` 1794`)}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(12),q("placeholder",y(22,23,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(13),p("options",i.listViewOptions),H("ngModel",i.selectedViewOption),l(10),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(10),p("displaySpinner",i.displaySpinner),l(2),p("columns",i.tableColumns)("value",i.tableData)("sortOrder",1)("paginator",!0)("pageLinks",5)("rows",15)("scrollable",!0),l(14),p("model",i.addMenuItems)("buttonProps",ne(25,YS))("mask",!0))},dependencies:[Pe,Da,oe,Qe,je,Ae,se,Le,pi,mi,ye,lt,me,kt,ot,it,qa,et,ht,ji,Yi,cn,Ai,$,ie],encapsulation:2})}return r})();var Hx=()=>({margin:"1rem 1rem 0.5rem"}),gp=r=>({opacity:r,display:"inline-flex"});function Wx(r,d){r&1&&(e(0,` 1795 `),n(1,"i",10),e(2,"check"),a(),e(3,` 1796 `))}function jx(r,d){r&1&&(e(0,` 1797 `),n(1,"i",10),e(2,"check"),a(),e(3,` 1798 `))}var Tp=(()=>{class r{authService;route;router;copiedText=D("Copied to Clipboard");displaySpinner=D(!0);showCopyIdMessage=D(!1);showCopyKeyMessage=D(!1);tenantId=D(void 0);tenantKey=D(void 0);idTimeout;keyTimeout;copyMessage={colorScheme:{light:{contentPadding:"0.5rem"}}};constructor(t,o,i){this.authService=t,this.route=o,this.router=i,this.tenantId.set(this.authService.tenant.Id),this.tenantKey.set(this.authService.tenant.Key)}ngOnDestroy(){this.idTimeout&&clearTimeout(this.idTimeout),this.keyTimeout&&clearTimeout(this.keyTimeout)}navigateToDeveloperPortal(){window.open(a0,"_blank")}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}showIdMessage(){this.showCopyIdMessage.set(!0),this.idTimeout=setTimeout(()=>{this.showCopyIdMessage.set(!1)},2e3)}showKeyMessage(){this.showCopyKeyMessage.set(!0),this.keyTimeout=setTimeout(()=>{this.showCopyKeyMessage.set(!1)},2e3)}static \u0275fac=function(o){return new(o||r)(g(de),g(he),g(Be))};static \u0275cmp=B({type:r,selectors:[["qware-developer-settings"]],decls:77,vars:25,consts:[["icon",""],[1,"col-12"],[1,"form-container"],["translate","","id","qware.app-settings.page-header",1,"page-header"],["id","qware.app-settings.developer-portal.button","severity","secondary","type","button",3,"onClick","raised","label"],[1,"medium-input","flex","align-items-center"],[1,"developer-inputs"],["id","qware.app-settings.developer.input.tenant-id","type","text","pInputText","",3,"ngModel","disabled"],["id","qware.app-settings.developer.label.tenant-id","for","qware.app-settings.developer.input.tenant-id","translate",""],[1,"copy-button",3,"click","qwareCopyToClipboard"],[1,"material-icons"],["severity","success",3,"ngStyle","dt"],["translate",""],["id","qware.app-settings.developer.input.tenant-key","type","text","pInputText","",3,"ngModel","disabled"],["id","qware.app-settings.developer.label.tenant-key","for","qware.app-settings.developer.input.tenant-key","translate",""],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.develper.button.cancel","type","button","severity","secondary",3,"onClick","text","label"]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 1799 `),n(2,"div",2),e(3,` 1800 `),n(4,"h3",3),e(5,` 1801 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.DEVELOPER.DEVELOPER 1802 `),a(),e(9,` 1803 `),n(10,"p-card"),e(11,` 1804 `),n(12,"p-button",4),I(13,"translate"),h("onClick",function(){return E(s),S(i.navigateToDeveloperPortal()
1804)}),e(14,` 1805 `),a(),e(15,` 1806 `),n(16,"div",5),e(17,` 1807 `),n(18,"p-floatlabel",6),e(19,` 1808 `),R(20,"input",7),e(21,` 1809 `),n(22,"label",8),e(23,` 1810 APP_SETTINGS.DEVELOPER.TENANT_ID 1811 `),a(),e(24,` 1812 `),a(),e(25,` 1813 `),n(26,"a",9),h("click",function(){return E(s),S(i.showIdMessage())}),e(27,` 1814 `),n(28,"i",10),e(29,"content_copy"),a(),e(30,` 1815 `),a(),e(31,` 1816 `),n(32,"p-message",11),e(33,` 1817 `),_(34,Wx,4,0,"ng-template",null,0,A),e(36,` 1818 `),n(37,"span",12),e(38,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(39,` 1819 `),a(),e(40,` 1820 `),a(),e(41,` 1821 `),n(42,"div",5),e(43,` 1822 `),n(44,"p-floatlabel",6),e(45,` 1823 `),R(46,"input",13),e(47,` 1824 `),n(48,"label",14),e(49,` 1825 APP_SETTINGS.DEVELOPER.TENANT_KEY 1826 `),a(),e(50,` 1827 `),a(),e(51,` 1828 `),n(52,"a",9),h("click",function(){return E(s),S(i.showKeyMessage())}),e(53,` 1829 `),n(54,"i",10),e(55,"content_copy"),a(),e(56,` 1830 `),a(),e(57,` 1831 `),n(58,"p-message",11),e(59,` 1832 `),_(60,jx,4,0,"ng-template",null,0,A),e(62,` 1833 `),n(63,"span",12),e(64,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(65,` 1834 `),a(),e(66,` 1835 `),a(),e(67,` 1836 `),n(68,"div",15),e(69,` 1837 `),n(70,"p-button",16),I(71,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(72,` 1838 `),a(),e(73,` 1839 `),a(),e(74,` 1840 `),a(),e(75,` 1841 `),a(),e(76,` 1842`),a()}o&2&&(l(12),Pt(ne(20,Hx)),q("label",y(13,16,"APP_SETTINGS.DEVELOPER.DEVELOPER_PORTAL")),p("raised",!0),l(8),p("ngModel",i.tenantId())("disabled",!0),l(6),p("qwareCopyToClipboard",i.tenantId()),l(6),p("ngStyle",pe(21,gp,i.showCopyIdMessage()?1:0))("dt",i.copyMessage),l(14),p("ngModel",i.tenantKey())("disabled",!0),l(6),p("qwareCopyToClipboard",i.tenantKey()),l(6),p("ngStyle",pe(23,gp,i.showCopyKeyMessage()?1:0))("dt",i.copyMessage),l(12),q("label",y(71,18,"SHARED.CANCEL")),p("text",!0))},dependencies:[vi,oe,Mn,Ie,Zt,$n,_n,Ii,Ne,An,Ae,se,Le,Hi,ye,Bi,gi,Qt,ie,$],styles:[".developer-inputs[_ngcontent-%COMP%]{width:100%;margin-right:.5rem}.developer-inputs[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%;opacity:1!important}.copy-button[_ngcontent-%COMP%]{margin-right:.5rem}"],changeDetection:0})}return r})();var bp=He(S0()),So=He(Hn()),yp=He(nt());var Ip=He(S0());var Qx=["attachments"],Kx=()=>({width:"50vw"}),$x=()=>({padding:"0 1.25rem 1.25rem"});function zx(r,d){if(r&1){let t=b();e(0,` 1843 `),n(1,"div",8),e(2,` 1844 `),n(3,"div",9),e(4,` 1845 `),n(5,"qware-attachments",10,0),h("filesChanged",function(i){E(t);let s=m();return S(s.filesChanged(i))}),e(7,` 1846 `),a(),e(8,` 1847 `),a(),e(9,` 1848 `),a(),e(10,` 1849 `)}if(r&2){let t=m();l(5),p("saveToLibraryOption",t.LibraryOptionEnum.AUTO_ADD)}}function Xx(r,d){if(r&1&&(e(0,` 1850 `),R(1,"img",18),e(2,` 1851 `)),r&2){let t=m(2);l(),p("src",t.document.DocumentURL,jt)("width",150)}}function Zx(r,d){if(r&1&&(e(0,` 1852 `),n(1,"div",19),e(2,` 1853 `),n(3,"span"),e(4),a(),e(5,` 1854 `),a(),e(6,` 1855 `)),r&2){let t=m(2);l(4),v(t.document.DocType)}}function Jx(r,d){if(r&1){let t=b();e(0,` 1856 `),n(1,"div",20),e(2,` 1857 `),n(3,"div",20),e(4,` 1858 `),n(5,"p-floatlabel"),e(6,` 1859 `),n(7,"input",21),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.newName,i)||(s.newName=i),S(i)}),a(),e(8,` 1860 `),n(9,"label",22),e(10,` 1861 `),n(11,"span",15),e(12,"DOCUMENT_LIBRARY.NAME"),a(),e(13,` 1862 `),a(),e(14,` 1863 `),a(),e(15,` 1864 `),n(16,"small",23),e(17,` 1865 `),n(18,"div",24),e(19,"DOCUMENT_LIBRARY.ERROR.RENAME_LENGTH"),a(),e(20,` 1866 `),a(),e(21,` 1867 `),a(),e(22,` 1868 `),a(),e(23,` 1869 `)}if(r&2){let t=m(2);l(7),p("qwareFocus",!0)("fluid",!0),H("ngModel",t.newName),l(9),p("hidden",!t.newName||t.newName&&t.newName.length<256)}}function e1(r,d){if(r&1&&(e(0,` 1870 `),n(1,"span"),e(2),a(),e(3,` 1871 `)),r&2){let t=m(2);l(2),v(t.document.Name)}}function t1(r,d){if(r&1){let t=b();e(0,` 1872 `),n(1,"div",8),e(2,` 1873 `),n(3,"div",11),e(4,` 1874 `),n(5,"div",12),e(6,` 1875 `),_(7,Xx,3,2),I(8,"displayableFile"),_(9,Zx,7,1),a(),e(10,` 1876 `),n(11,"div",13),e(12,` 1877 `),n(13,"div",14)(14,"span",15),e(15,"DOCUMENT_LIBRARY.NAME"),a(),e(16,`: 1878 `),_(17,Jx,24,4)(18,e1,4,1),a(),e(19,` 1879 `),n(20,"div",14)(21,"span",15),e(22,"DOCUMENT_LIBRARY.FILE_NAME"),a(),e(23),a(),e(24,` 1880 `),n(25,"div",14)(26,"span",15),e(27,"DOCUMENT_LIBRARY.FILE_TYPE"),a(),e(28),a(),e(29,` 1881 `),n(30,"div",14)(31,"span",15),e(32,"DOCUMENT_LIBRARY.SIZE"),a(),e(33),a(),e(34,` 1882 `),n(35,"div",14)(36,"span",15),e(37,"DOCUMENT_LIBRARY.CREATED_BY"),a(),e(38),a(),e(39,` 1883 `),n(40,"div",14)(41,"span",15),e(42,"DOCUMENT_LIBRARY.CREATED_ON"),a(),e(43),a(),e(44,` 1884 `),n(45,"div",14)(46,"span",15),e(47,"DOCUMENT_LIBRARY.MODIFIED_BY"),a(),e(48),a(),e(49,` 1885 `),n(50,"div",14)(51,"span",15),e(52,"DOCUMENT_LIBRARY.MODIFIED_ON"),a(),e(53),a(),e(54,` 1886 `),a(),e(55,` 1887 `),a(),e(56,` 1888 `),n(57,"div",16),e(58,` 1889 `),n(59,"qware-attachments",17,0),h("filesChanged",function(i){E(t);let s=m();return S(s.filesChanged(i))}),e(61,` 1890 `),a(),e(62,` 1891 `),a(),e(63,` 1892 `),a(),e(64,` 1893 `)}if(r&2){let t=m();l(7),f(y(8,14,t.document.DocType)?7:9),l(10),f(t.rename?17:18),l(6),K(": ",t.document.UploadedName,""),l(5),K(": ",t.document.DocType,""),l(5),K(": ",t.document.FileSizeString,""),l(5),K(": ",t.document.UploadedByUser,""),l(5),K(": ",t.document.UploadedOnUTC,""),l(5),K(": ",t.document.EditedByUser,""),l(5),K(": ",t.document.UpdatedOnUTC,""),l(4),p("hidden",!t.replace),l(2),p("saveToLibraryOption",t.LibraryOptionEnum.AUTO_ADD)("existingAlias",t.document.Name)("multiple",!1)("existingDtoToReplace",t.document)}}function i1(r,d){if(r&1){let t=b();e(0,` 1894 `),n(1,"p-button",25),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.upload())}),e(3,` 1895 `),a(),e(4,` 1896 `)}if(r&2){let t=m();l(),q("label",y(2,3,"DOCUMENT_LIBRARY.UPLOAD")),p("text",!0)("disabled",!t.docsToUpload)}}function n1(r,d){if(r&1){let t=b();e(0,` 1897 `),n(1,"p-button",26),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 1898 `),a(),e(4,` 1899 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",t.newName&&t.newName.length>255)}}function a1(r,d){if(r&1){let t=b();e(0,` 1900 `),n(1,"p-button",27),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.rename=!0)}),e(3,` 1901 `),a(),e(4,` 1902 `),n(5,"p-button",27),I(6,"translate"),h("onClick",function(){E(t);let i=m();return S(i.replace=!0)}),e(7,` 1903 `),a(),e(8,` 1904 `),n(9,"p-button",27),I(10,"translate"),h("onClick",function(){E(t);let i=m();return S(i.removeFromLibrary())}),e(11,` 1905 `),a(),e(12,` 1906 `),n(13,"p-button",27),I(14,"translate"),h("onClick",function(){E(t);let i=m();return S(i.downloadFile())}),e(15,` 1907 `),a(),e(16,` 1908 `)}r&2&&(l(),q("label",y(2,8,"DOCUMENT_LIBRARY.RENAME")),p("text",!0),l(4),q("label",y(6,10,"DOCUMENT_LIBRARY.REPLACE")),p("text",!0),l(4),q("label",y(10,12,"DOCUMENT_LIBRARY.REMOVE")),p("text",!0),l(4),q("label",y(14,14,"DOCUMENT_LIBRARY.DOWNLOAD")),p("text",!0))}var qs=(()=>{class r{attachmentService;config;confirmationService;documentService;domService;ref;responseHandlerService;toastService;translate;attachments;downloadProgress=D(0);showDownloadProgress=D(!1);dialogBreaks=Fn;displaySpinner=!1;docsToUpload=!1;document;isUpload=!1;LibraryOptionEnum=Yo;newName;rename=!1;replace=!1;downloadSubscription;constructor(t,o,i,s,c,u,x,C,O){this.attachmentService=t,this.config=o,this.confirmationService=i,this.documentService=s,this.domService=c,this.ref=u,this.responseHandlerService=x,this.toastService=C,this.translate=O}ngOnInit(){this.isUpload=this.config.data.upload,this.isUpload||
1908(this.document=this.config.data.document)}upload(){this.displaySpinner=!0,this.attachmentService.upload().pipe(N()).subscribe({next:()=>{this.displaySpinner=!1,this.responseHandlerService.onSuccess("DOCUMENT_LIBRARY.SUCCESS.UPLOAD"),this.ref.close({refresh:!0})},error:t=>{this.displaySpinner=!1,this.responseHandlerService.onError(t)}}),this.attachments.fileup.uploader()}save(){this.document&&(this.displaySpinner=!0,this.document.Name=this.newName,this.documentService.updateDocuments([this.document]).pipe(N()).subscribe({next:()=>{this.displaySpinner=!1,this.responseHandlerService.onSuccess("DOCUMENT_LIBRARY.SUCCESS.SAVED"),this.ref.close({refresh:!0})},error:t=>{this.displaySpinner=!1,this.responseHandlerService.onError(t)}}))}cancel(){this.newName=void 0,this.replace||this.rename?(this.replace=!1,this.rename=!1):this.ref.close({refresh:!1})}filesChanged(t){this.docsToUpload=t.files.newFiles&&t.files.newFiles.length>0}removeFromLibrary(){this.translate.get(["DOCUMENT_LIBRARY.REMOVE_CONFIRM","DOCUMENT_LIBRARY.REMOVE_CONFIRM_MESSAGE_SINGLE","DOCUMENT_LIBRARY.UNKNOWN"]).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"savePromptDialog",header:t["DOCUMENT_LIBRARY.REMOVE_CONFIRM"],message:t["DOCUMENT_LIBRARY.REMOVE_CONFIRM_MESSAGE_SINGLE"],accept:()=>{this.document&&(this.displaySpinner=!0,this.document.InLibrary=!1,this.documentService.updateDocuments([this.document]).subscribe({next:()=>{this.displaySpinner=!1,this.responseHandlerService.onSuccess("DOCUMENT_LIBRARY.SUCCESS.REMOVED"),this.ref.close({refresh:!0})},error:o=>{this.displaySpinner=!1,this.responseHandlerService.onError(o)}}))}})})}downloadFile(){this.document&&(this.showDownloadProgress.set(!0),this.downloadProgress.set(0),this.downloadSubscription=this.documentService.downloadFile(this.document,!1).subscribe({next:t=>{typeof t=="number"?this.downloadProgress.set(t):t instanceof Blob&&(Ip.default.saveAs(t,this.document.Name+"."+this.document.DocType),this.resetDownloadState())},error:()=>{this.resetDownloadState(),this.translate.get(["SHARED.DOWNLOAD_ERROR","SHARED.DOWNLOAD_ERROR_MESSAGE"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.DOWNLOAD_ERROR"],t["SHARED.DOWNLOAD_ERROR_MESSAGE"])})}}))}cancelDownload(){this.downloadSubscription&&!this.downloadSubscription.closed&&this.downloadSubscription.unsubscribe(),this.resetDownloadState()}resetDownloadState(){this.showDownloadProgress.set(!1),this.downloadProgress.set(0)}ngOnDestroy(){this.domService.removeDOMElements([".p-menu"]),this.cancelDownload()}static \u0275fac=function(o){return new(o||r)(g(ui),g(sl),g(mt),g(mn),g(q0),g(dl),g(Re),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-document-popup"]],viewQuery:function(o,i){if(o&1&&X(Qx,5),o&2){let s;Y(s=Q())&&(i.attachments=s.first)}},standalone:!1,decls:27,vars:27,consts:[["attachments",""],["id","qware.document-library-popup.spinner",3,"displaySpinner"],[1,"grid","popup-container"],[1,"align-right","flex-inline","button-container"],["severity","secondary",3,"onClick","text","label"],["id","qware.document-library-popup.download-progress-dialog",3,"visibleChange","onHide","header","visible","modal","closeOnEscape","closable","draggable","resizable","breakpoints","contentStyle"],[1,"download-name"],[3,"value"],[2,"width","100%"],[1,"relative"],[3,"filesChanged","saveToLibraryOption"],[1,"document-container"],[1,"document-icon"],[1,"document-info"],[1,"document-item"],["translate",""],[1,"file-upload",3,"hidden"],[3,"filesChanged","saveToLibraryOption","existingAlias","multiple","existingDtoToReplace"],[3,"src","width"],[1,"file-type-icon","large-file-icon"],[1,"rename-input"],["id","rename-input","type","text","pInputText","",3,"ngModelChange","qwareFocus","fluid","ngModel"],["for","rename-input"],[1,"validation-error",3,"hidden"],["id","qware.document-library-popup.rename.input.error.length","translate",""],[3,"onClick","text","disabled","label"],[1,"p-button-text",3,"onClick","text","disabled","label"],[1,"p-button-text",3,"onClick","text","label"]],template:function(o,i){o&1&&(n(0,"qware-spinner",1),e(1,` 1909 `),n(2,"div",2),e(3,` 1910 `),_(4,zx,11,1)(5,t1,65,16),a(),e(6,` 1911 `),n(7,"div",3),e(8,` 1912 `),n(9,"p-button",4),I(10,"translate"),h("onClick",function(){return i.cancel()}),e(11,` 1913 `),a(),e(12,` 1914 `),_(13,i1,5,5)(14,n1,5,5)(15,a1,17,16),a(),e(16,` 1915`),a(),e(17,` 1916`),e(18,` 1917`),n(19,"p-dialog",5),I(20,"translate"),j("visibleChange",function(c){return W(i.showDownloadProgress,c)||(i.showDownloadProgress=c),c}),h("onHide",function(){return i.showDownloadProgress.set(!1)})("onHide",function(){return i.cancelDownload()}),e(21,` 1918 `),n(22,"span",6),e(23),a(),e(24,` 1919 `),R(25,"p-progressBar",7),e(26,` 1920`),a()),o&2&&(p("displaySpinner",i.displaySpinner),l(4),f(i.isUpload?4:-1),l(),f(!i.isUpload&&i.document?5:-1),l(4),q("label",y(10,21,"SHARED.CANCEL")),p("text",!0),l(4),f(i.replace&&!i.rename||i.isUpload?13:-1),l(),f(i.rename&&!i.replace&&!i.isUpload?14:-1),l(),f(!i.replace&&!i.rename&&!i.isUpload?15:-1),l(4),Pt(ne(25,Kx)),q("header",y(20,23,"SHARED.DOWNLOADING")),H("visible",i.showDownloadProgress),p("modal",!0)("closeOnEscape",!1)("closable",!0)("draggable",!1)("resizable",!1)("breakpoints",i.dialogBreaks)("contentStyle",ne(26,$x)),l(4),v(i.document==null?null:i.document.Name),l(2),p("value",i.downloadProgress()))},dependencies:[oe,wn,Ne,je,Ae,se,Le,ye,La,ta,me,$,e0,ie],styles:[".popup-container[_ngcontent-%COMP%]{padding:.5rem 1.25rem}.document-container[_ngcontent-%COMP%]{display:flex}@media screen and (max-width: 768px){.document-container[_ngcontent-%COMP%]{flex-wrap:wrap}}.document-container[_ngcontent-%COMP%] .document-icon[_ngcontent-%COMP%]{padding-right:1.5rem}.document-container[_ngcontent-%COMP%] .document-info[_ngcontent-%COMP%]{width:100%}.document-container[_ngcontent-%COMP%] .document-info[_ngcontent-%COMP%] .document-item[_ngcontent-%COMP%]{line-height:1.5}.document-container[_ngcontent-%COMP%] .document-info[_ngcontent-%COMP%] .document-item[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:first-of-type{font-weight:700}.document-container[_ngcontent-%COMP%] .document-info[_ngcontent-%COMP%] .document-item[_ngcontent-%COMP%] .rename-input[_ngcontent-%COMP%]{margin:1.5rem 0 1rem;min-width:150px}.file-upload[_ngcontent-%COMP%]{margin-top:.5rem}
1920.download-name[_ngcontent-%COMP%]{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.button-container[_ngcontent-%COMP%]{padding:var(--p-overlay-modal-padding);flex-wrap:wrap}"]})}return r})();var r1=["actionsMenu"],o1=["dt"],l1=()=>({width:"50vw"}),s1=()=>({padding:"0 0.75rem 0.75rem"}),d1=()=>({height:"15px"}),p1=()=>({padding:"0"}),m1=(r,d)=>d.id,Ap=(r,d)=>d.field;function c1(r,d){if(r&1){let t=b();e(0,` 1921 `),n(1,"p-button",28),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.selectAll())}),e(3,` 1922 `),a(),e(4,` 1923 `)}r&2&&(l(),q("label",y(2,2,"SHARED.SELECT_ALL")),p("raised",!0))}function u1(r,d){if(r&1){let t=b();e(0,` 1924 `),n(1,"p-button",28),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.deselectAll())}),e(3,` 1925 `),a(),e(4,` 1926 `)}r&2&&(l(),q("label",y(2,2,"SHARED.DESELECT_ALL")),p("raised",!0))}function _1(r,d){if(r&1&&(e(0,` 1927 `),n(1,"a",29),e(2,` 1928 `),n(3,"span",30),e(4),a(),e(5,` 1929 `),n(6,"span",31),e(7),a(),e(8,` 1930 `),a(),e(9,` 1931 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function E1(r,d){r&1&&(e(0,` 1932 `),n(1,"span",33),e(2,"SHARED.ACTIONS"),a(),e(3,` 1933 `),n(4,"i",12),e(5,"expand_more"),a(),e(6,` 1934 `))}function S1(r,d){if(r&1){let t=b();e(0,` 1935 `),n(1,"p-button",32),h("onClick",function(i){E(t),m();let s=Ee(15);return S(s.toggle(i))}),e(2,` 1936 `),_(3,E1,7,0,"ng-template",null,4,A),e(5,` 1937 `),a(),e(6,` 1938 `)}r&2&&(l(),p("raised",!0))}function x1(r,d){if(r&1&&(e(0,` 1939 `),n(1,"a",29),e(2,` 1940 `),n(3,"span",30),e(4),a(),e(5,` 1941 `),n(6,"span",31),e(7),a(),e(8,` 1942 `),a(),e(9,` 1943 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function f1(r,d){if(r&1&&(e(0,` 1944 `),R(1,"p-sortIcon",37),e(2,` 1945 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function h1(r,d){if(r&1&&(e(0,` 1946 `),n(1,"th",35),e(2,` 1947 `),n(3,"span",36),e(4),a(),e(5,` 1948 `),_(6,f1,3,1),a(),e(7,` 1949 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.pSortableColumnDisabled?void 0:t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function C1(r,d){if(r&1&&(e(0,` 1950 `),n(1,"tr"),e(2,` 1951 `),n(3,"th",34),e(4,` 1952 `),R(5,"p-tableHeaderCheckbox"),e(6,` 1953 `),a(),e(7,` 1954 `),G(8,h1,8,3,null,null,Ap),a(),e(10,` 1955 `)),r&2){let t=d.$implicit;l(8),k(t)}}function v1(r,d){if(r&1){let t=b();e(0,` 1956 `),n(1,"a",42),h("click",function(){E(t);let i=m(2).$implicit,s=m();return S(s.openDocument(i))}),e(2),a(),e(3,` 1957 `)}if(r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function g1(r,d){if(r&1&&(e(0,` 1958 `),n(1,"span"),e(2),a(),e(3,` 1959 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),K("",o[t.field]," ")}}function T1(r,d){if(r&1&&(e(0,` 1960 `),n(1,"td"),e(2,` 1961 `),n(3,"span",40),e(4),a(),e(5,` 1962 `),n(6,"div",41),e(7,` 1963 `),n(8,"span"),e(9,` 1964 `),_(10,v1,4,1)(11,g1,4,1),e(12,` 1965 `),a(),e(13,` 1966 `),a(),e(14,` 1967 `),a(),e(15,` 1968 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:11)}}function I1(r,d){if(r&1&&(e(0,` 1969 `),n(1,"tr",38),e(2,` 1970 `),n(3,"td"),e(4,` 1971 `),R(5,"p-tableCheckbox",39),e(6,` 1972 `),a(),e(7,` 1973 `),G(8,T1,16,2,null,null,Ap),a(),e(10,` 1974 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("pSelectableRow",t),l(4),p("value",t),l(3),k(o)}}function b1(r,d){r&1&&(e(0,` 1975 `),n(1,"div",43),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 1976 `))}function y1(r,d){r&1&&(e(0,` 1977 `),n(1,"div",43),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 1978 `))}function A1(r,d){if(r&1&&(e(0,` 1979 `),n(1,"tr"),e(2,` 1980 `),n(3,"td"),e(4,` 1981 `),_(5,b1,4,0)(6,y1,4,0),a(),e(7,` 1982 `),a(),e(8,` 1983 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter()?5:6)}}function R1(r,d){if(r&1&&(e(0,` 1984 `),n(1,"div",44),e(2),I(3,"translate"),a(),e(4,` 1985 `)),r&2){let t=m();l(2),fd(` 1986 `,y(3,3,"SHARED.COMPLETED_DOWNLOADS"),": ",t.completedDownloads()," / ",t.totalDownloads(),` 1987 `)}}function w1(r,d){if(r&1){let t=b();e(0,` 1988 `),n(1,"p-button",48),h("onClick",function(){E(t);let i=m().$implicit,s=m();return S(s.cancelDownloads(i.id))}),e(2,` 1989 `),n(3,"span",49),e(4,"close"),a(),e(5,` 1990 `),a(),e(6,` 1991 `)}r&2&&(l(),Pt(ne(3,p1)),p("text",!0))}function D1(r,d){if(r&1&&(e(0,` 1992 `),n(1,"div",45),e(2,` 1993 `),n(3,"div",46),e(4,` 1994 `),n(5,"span",47),e(6),a(),e(7,` 1995 `),_(8,w1,7,4),a(),e(9,` 1996 `),R(10,"p-progressbar",39),e(11,` 1997 `),a(),e(12,` 1998 `)),r&2){let t=d.$implicit,o=m();l(6),v(t.name),l(2),f(o.totalDownloads()>1?8:-1),l(2),Pt(ne(5,d1)),p("value",t.progress)}}var Rp=(()=>{class r{actionsMenu;dt;
1998appSettingsService=te(dt);authService=te(de);confirmationService=te(mt);dialogService=te(Va);documentService=te(mn);responseHandlerService=te(Re);toastService=te(Se);translate=te(le);userService=te(ct);actionItems=D([]);activeDownloadsList=Ye(()=>Array.from(this.activeDownloadsMap().values()));completedDownloads=D(0);displaySpinner=D(!0);documents=D([]);generalFilter=D("");isActive=D(!1);moreItems=D([]);searchEnabled=D(!1);searchResults=D(!1);selectedDocuments=D([]);tableColumns=D([]);showDownloadProgress=D(!1);totalDownloads=D(0);activeDownloadsMap=D(new Map);dialogBreaks=Fn;allUsers=[];downloadQueue=[];downloadSubscriptionMap=new Map;isMobileSize=!1;timezone;translations={};onResize(){this.isMobileSize=window.innerWidth<=Je.lgbreak}ngOnInit(){ue([this.translate.get(["SHARED.SEARCH","DOCUMENT_LIBRARY.UNKNOWN","DOCUMENT_LIBRARY.UPLOAD_DOCUMENTS","DOCUMENT_LIBRARY.REMOVE","DOCUMENT_LIBRARY.DOWNLOAD"]).pipe(N()),this.documentService.getAllDocuments(this.authService.tenant.Id,!0),this.appSettingsService.getAppSettings().pipe(N()),this.userService.getUsers(this.authService.tenant.Id)]).subscribe(t=>{this.translations=t[0];let o=t[1],i=t[2];this.allUsers=t[3],this.timezone=i.Timezone??"",this.moreItems.set([{label:this.translations["SHARED.SEARCH"],icon:"search",command:()=>this.enableSearch()},{label:this.translations["DOCUMENT_LIBRARY.REMOVE"],icon:"delete",command:()=>this.delete()},{label:this.translations["DOCUMENT_LIBRARY.DOWNLOAD"],icon:"download",command:()=>this.download()}]),this.actionItems.set([{label:this.translations["DOCUMENT_LIBRARY.REMOVE"],icon:"delete",command:()=>this.delete()},{label:this.translations["DOCUMENT_LIBRARY.DOWNLOAD"],icon:"download",command:()=>this.download()}]),this.tableColumns.set([{field:"Name",header:"DOCUMENT_LIBRARY.NAME"},{field:"UploadedName",header:"DOCUMENT_LIBRARY.FILE_NAME"},{field:"DocType",header:"DOCUMENT_LIBRARY.FILE_TYPE"},{field:"FileSizeString",header:"DOCUMENT_LIBRARY.SIZE"},{field:"EditedByUser",header:"DOCUMENT_LIBRARY.MODIFIED_BY"},{field:"UpdatedOnUTC",header:"DOCUMENT_LIBRARY.MODIFIED_ON"},{field:"UploadedByUser",header:"DOCUMENT_LIBRARY.CREATED_BY"},{field:"UploadedOnUTC",header:"DOCUMENT_LIBRARY.CREATED_ON"}]);let s=window.localStorage.getItem(Oe.DOCUMENT_LIBRARY_GENERAL_STORAGE_KEY);s&&(this.generalFilter.set(s),this.generalFilterOnChange()),this.documents.set(this.formatDocuments(o)),this.detectFilter(),this.onResize(),this.displaySpinner.set(!1)})}ngOnDestroy(){this.cancelDownloads()}refreshData(){this.documentService.getAllDocuments(this.authService.tenant.Id,!0).subscribe(t=>{let o=t;this.documents.set(this.formatDocuments(o)),this.displaySpinner.set(!1)})}formatDocuments(t){let o=new Wo;return t.map(i=>{i.DocumentURL=i.DocumentURL+"?t="+Date.now(),i.UpdatedOnUTC=(0,So.default)(Vt.convertToAppTimezone(this.timezone??"",!0,i.UpdatedOnUTC)).format("lll"),i.UploadedOnUTC=(0,So.default)(Vt.convertToAppTimezone(this.timezone??"",!0,i.UploadedOnUTC)).format("lll");let s=this.allUsers.find(u=>u.UserName===i.EditedByUser);s&&(i.EditedByUser=s.fullName());let c=this.allUsers.find(u=>u.UserName===i.UploadedByUser);return c&&(i.UploadedByUser=c.fullName()),i.FileSizeString=i.FileSize&&i.FileSize>0?o.transform(i.FileSize):this.translations["DOCUMENT_LIBRARY.UNKNOWN"],i})}generalFilterOnChange(){let t=this.generalFilter();localStorage.setItem(Oe.STATUS_FILTER_STORAGE_KEY,t),t.length>0&&this.searchEnabled.set(!0),this.dt.filterGlobal(t,"contains")}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults.set(!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0):this.searchResults.set(!0)},0)}selectAll(){this.selectedDocuments.set(yp.default.clone(this.dt.filteredValue??this.dt.value))}deselectAll(){this.selectedDocuments.set([])}enableSearch(){this.searchEnabled.set(!this.searchEnabled()),this.searchEnabled()===!1&&(this.generalFilter.set(""),this.generalFilterOnChange())}addDocuments(){this.dialogService.open(qs,{closable:!0,data:{upload:!0},dismissableMask:!0,focusOnShow:!1,header:this.translations["DOCUMENT_LIBRARY.UPLOAD_DOCUMENTS"],modal:!0,width:this.isMobileSize?"95%":"50%"}).onClose.pipe(N()).subscribe(t=>{t&&t.refresh&&(this.displaySpinner.set(!0),this.refreshData())})}openDocument(t){this.dialogService.open(qs,{closable:!0,data:{upload:!1,document:t},dismissableMask:!0,focusOnShow:!1,header:t.Name,modal:!0,width:this.isMobileSize?"95%":"50%"}).onClose.pipe(N()).subscribe(o=>{o&&o.refresh&&(this.displaySpinner.set(!0),this.refreshData())})}delete(){this.actionsMenu&&this.actionsMenu.hide();let t=this.selectedDocuments();t&&t.length>0?this.translate.get(["DOCUMENT_LIBRARY.REMOVE_CONFIRM","DOCUMENT_LIBRARY.REMOVE_CONFIRM_MESSAGE_MULTIPLE"]).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"savePromptDialog",header:o["DOCUMENT_LIBRARY.REMOVE_CONFIRM"],message:o["DOCUMENT_LIBRARY.REMOVE_CONFIRM_MESSAGE_MULTIPLE"],accept:()=>{this.displaySpinner.set(!0),t.forEach(i=>
1998{i.InLibrary=!1}),this.documentService.updateDocuments(t).subscribe({next:()=>{this.displaySpinner.set(!1),this.responseHandlerService.onSuccess("DOCUMENT_LIBRARY.SUCCESS.REMOVED"),this.refreshData()},error:i=>{this.displaySpinner.set(!1),this.responseHandlerService.onError(i),this.refreshData()}})}})}):this.translate.get(["SHARED.ERROR_LABEL","DOCUMENT_LIBRARY.ERROR.AT_LEAST_ONE_SELECTED"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["DOCUMENT_LIBRARY.ERROR.AT_LEAST_ONE_SELECTED"])})}download(){this.actionsMenu&&this.actionsMenu.hide();let t=this.selectedDocuments();t&&t.length>0?(this.activeDownloadsMap.set(new Map),this.completedDownloads.set(0),this.downloadQueue=[...t],this.showDownloadProgress.set(!0),this.totalDownloads.set(t.length),this.startParallelDownloads()):this.translate.get(["SHARED.ERROR_LABEL","DOCUMENT_LIBRARY.ERROR.AT_LEAST_ONE_SELECTED"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["DOCUMENT_LIBRARY.ERROR.AT_LEAST_ONE_SELECTED"])})}startParallelDownloads(){for(;this.downloadQueue.length>0&&this.activeDownloadsMap().size<m0;){let t=this.downloadQueue.shift();t&&this.downloadSingleFile(t)}}downloadSingleFile(t){if(!t.Id)return;let o=new Map(this.activeDownloadsMap()),i=t.Name+"."+t.DocType;o.set(t.Id,{id:t.Id,name:i,progress:0}),this.activeDownloadsMap.set(o);let s=this.documentService.downloadFile(t,!1).subscribe({next:c=>{if(typeof c=="number"&&t.Id){let u=new Map(this.activeDownloadsMap()),x=u.get(t.Id);x&&(u.set(t.Id,ki(Di({},x),{progress:c})),this.activeDownloadsMap.set(u))}else if(c instanceof Blob){if(bp.default.saveAs(c,t.Name+"."+t.DocType),t.Id){let u=new Map(this.activeDownloadsMap());u.delete(t.Id),this.activeDownloadsMap.set(u),this.downloadSubscriptionMap.delete(t.Id)}this.completedDownloads.update(u=>u+1),this.completedDownloads()===this.totalDownloads()?this.resetDownloadState():this.startParallelDownloads()}},error:()=>{if(t.Id){let c=new Map(this.activeDownloadsMap());c.delete(t.Id),this.activeDownloadsMap.set(c),this.downloadSubscriptionMap.delete(t.Id)}this.completedDownloads.update(c=>c+1),this.translate.get(["SHARED.DOWNLOAD_ERROR","SHARED.DOWNLOAD_ERROR_MESSAGE"]).pipe(N()).subscribe(c=>{this.toastService.error(c["SHARED.DOWNLOAD_ERROR"],c["SHARED.DOWNLOAD_ERROR_MESSAGE"]+": "+t.Name)}),this.completedDownloads()===this.totalDownloads()?this.resetDownloadState():this.startParallelDownloads()}});this.downloadSubscriptionMap.set(t.Id,s)}cancelDownloads(t){if(t){let o=new Map(this.activeDownloadsMap());o.delete(t),this.activeDownloadsMap.set(o),this.completedDownloads.update(s=>s+1);let i=this.downloadSubscriptionMap.get(t);i&&!i.closed&&i.unsubscribe(),this.downloadSubscriptionMap.delete(t),this.startParallelDownloads(),this.completedDownloads()===this.totalDownloads()&&this.resetDownloadState()}else this.unsubscribeFromDownloads(),this.downloadSubscriptionMap.clear(),this.resetDownloadState()}unsubscribeFromDownloads(){Array.from(this.downloadSubscriptionMap.values()).forEach(o=>{o.closed||o.unsubscribe()})}resetDownloadState(){this.showDownloadProgress.set(!1),this.totalDownloads.set(0),this.activeDownloadsMap.set(new Map),this.completedDownloads.set(0),this.downloadQueue=[]}documentSort(t){t.data&&t.field&&t.order&&t.data.sort((o,i)=>{let s=t.field,c=t.order,u=o[s],x=i[s],C;return!u&&x!==void 0?C=-1:u!==void 0&&!x?C=1:!u&&!x?C=0:s.includes("UTC")?(u=(0,So.default)(u,"lll").toDate(),x=(0,So.default)(x,"lll").toDate(),C=u<x?-1:u>x?1:0):s==="FileSizeString"?(u=o.FileSize,x=i.FileSize,C=u<x?-1:u>x?1:0):C=u.localeCompare(x),c*C})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-document-library"]],viewQuery:function(o,i){if(o&1&&(X(r1,7),X(o1,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.dt=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.onResize()},!1,vt)},standalone:!1,decls:94,vars:42,consts:[["actionsMenu",""],["item",""],["moreMenu",""],["dt",""],["content",""],[1,"col-12"],["translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"action-button-container"],[3,"model","popup"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.document-library.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"more-container"],["id","qware.document-library.list.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"col-12","data-grid"],["id","qware.document-library.spinner",3,"displaySpinner"],["sortField","Name","dataKey","Id","responsiveLayout","stack",3,"sortFunction","selectionChange","onFilter","columns","value","selection","sortOrder","paginator","pageLinks","customSort","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button",3,"onClick","raised"],["
1998id","qware.document-library.download-progress-dialog",3,"visibleChange","onHide","header","visible","modal","closeOnEscape","closable","draggable","resizable","breakpoints","contentStyle"],[1,"individual-progress"],[1,"active-download-container"],["severity","secondary",1,"select-all-data-grid-button",3,"onClick","raised","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.document-library.list.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[2,"width","40px"],["pReorderableColumn","",3,"pSortableColumn"],["translate",""],[3,"field"],[3,"pSelectableRow"],[3,"value"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],[3,"click"],["translate","",1,"no-results"],[1,"total-files-label"],[1,"active-download"],[1,"download-header"],[1,"download-name"],["type","button","severity","secondary",3,"onClick","text"],[1,"cancel-button-icon","material-icons"]],template:function(o,i){if(o&1){let s=b();n(0,"div"),e(1,` 1999 `),n(2,"div",5),e(3,` 2000 `),n(4,"h3",6),e(5,` 2001 DOCUMENT_LIBRARY.DOCUMENT_LIBRARY 2002 `),a(),e(6,` 2003 `),a(),e(7,` 2004 `),n(8,"div",7),e(9,` 2005 `),_(10,c1,5,4)(11,u1,5,4),n(12,"div",8),e(13,` 2006 `),n(14,"p-menu",9,0),e(16,` 2007 `),_(17,_1,10,2,"ng-template",null,1,A),e(19,` 2008 `),a(),e(20,` 2009 `),_(21,S1,7,1),a(),e(22,` 2010 `),n(23,"div",10),e(24,` 2011 `),n(25,"p-iconfield",11),e(26,` 2012 `),n(27,"p-inputicon"),e(28,` 2013 `),n(29,"span",12),e(30,"search"),a(),e(31,` 2014 `),a(),e(32,` 2015 `),n(33,"input",13),I(34,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(35,` 2016 `),a(),e(36,` 2017 `),a(),e(37,` 2018 `),n(38,"div",14),e(39,` 2019 `),n(40,"p-menu",15,2),h("click",function(){E(s);let u=Ee(41);return S(u.hide())}),e(42,` 2020 `),_(43,x1,10,2,"ng-template",null,1,A),e(45,` 2021 `),a(),e(46,` 2022 `),n(47,"p-button",16),h("onClick",function(u){return E(s),Ee(41).toggle(u),S(i.isActive.set(!i.isActive()))}),e(48,` 2023 `),n(49,"i",12),e(50,"more_vert"),a(),e(51,` 2024 `),a(),e(52,` 2025 `),a(),e(53,` 2026 `),a(),e(54,` 2027 `),n(55,"div",17),e(56,` 2028 `),n(57,"qware-spinner",18),e(58,` 2029 `),n(59,"p-table",19,3),h("sortFunction",function(u){return E(s),S(i.documentSort(u))}),j("selectionChange",function(u){return E(s),W(i.selectedDocuments,u)||(i.selectedDocuments=u),S(u)}),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(61,` 2030 `),_(62,C1,11,0,"ng-template",20),e(63,` 2031 `),_(64,I1,11,2,"ng-template",21),e(65,` 2032 `),_(66,A1,9,2,"ng-template",22),e(67,` 2033 `),a(),e(68,` 2034 `),a(),e(69,` 2035 `),a(),e(70,` 2036 `),n(71,"div",23),e(72,` 2037 `),n(73,"p-button",24),h("onClick",function(){return E(s),S(i.addDocuments())}),e(74,` 2038 `),n(75,"i",12),e(76,"add"),a(),e(77,` 2039 `),a(),e(78,` 2040 `),a(),e(79,` 2041`),a(),e(80,` 2042`),e(81,` 2043`),n(82,"p-dialog",25),I(83,"translate"),j("visibleChange",function(u){return E(s),W(i.showDownloadProgress,u)||(i.showDownloadProgress=u),S(u)}),h("onHide",function(){return E(s),S(i.cancelDownloads())}),e(84,` 2044 `),n(85,"div",26),e(86,` 2045 `),_(87,R1,5,5),n(88,"div",27),e(89,` 2046 `),G(90,D1,13,6,null,null,m1),a(),e(92,` 2047 `),a(),e(93,` 2048`),a()}if(o&2){let s=Ee(60);l(8),ve("search-active",i.searchEnabled()),l(2),f(i.searchResults()&&i.selectedDocuments().length<(s.filteredValue?s.filteredValue.length:s.value.length)?10:11),l(4),p("model",i.actionItems())("popup",!0),l(7),f(i.actionItems()&&i.actionItems().length>0?21:-1),l(12),q("placeholder",y(34,36,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter()!==""),l(7),p("model",i.moreItems())("popup",!0),l(7),p("rounded",!0)("text",!0),l(10),p("displaySpinner",i.displaySpinner()),l(2),p("columns",i.tableColumns())("value",i.documents()),H("selection",i.selectedDocuments),p("sortOrder",1)("paginator",!0)("pageLinks",5)("customSort",!0)("rows",15)("scrollable",!0),l(14),p("raised",!0),l(9),Pt(ne(40,l1)),q("header",y(83,38,i.totalDownloads()>1?"SHARED.DOWNLOADING_ATTACHMENTS":"SHARED.DOWNLOADING")),H("visible",i.showDownloadProgress),p("modal",!0)("closeOnEscape",!1)("closable",!0)("draggable",!1)("resizable",!1)("breakpoints",i.dialogBreaks)("contentStyle",ne(41,s1)),l(5),f(i.totalDownloads()>1?87:-1),l(3),k(i.activeDownloadsList())}},dependencies:[Pe,oe,wn,je,Ae,se,Le,pi,mi,ye,lt,La,me,kt,ot,ht,ji,Yi,b0,cn,ol,ll,$,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0}@media screen and (max-width: 992px){.actions.search-active[_ngcontent-%COMP%]{margin-bottom:48px}}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{margin-right:0}.more-container[_ngcontent-%COMP%]{flex:1 1 auto!important}.total-files-label[_ngcontent-%COMP%]{margin:0 .5rem .5rem;font-size:var(--p-font-size-body3);font-weight:700}.active-download-container[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}.active-download-container[_ngcontent-%COMP%] .active-download[_ngcontent-%COMP%]{padding:.5rem}.active-download-container[_ngcontent-%COMP%] .active-download[_ngcontent-%COMP%] .download-header[_ngcontent-%COMP%]{margin-bottom:.25rem;font-size:var(--p-font-size-body3);display:flex;align-items:center;justify-content:space-between}.active-download-container[_ngcontent-%COMP%] .active-download[_ngcontent-%COMP%] .download-header[_ngcontent-%COMP%] .download-name[_ng
2048content-%COMP%]{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.active-download-container[_ngcontent-%COMP%] .active-download[_ngcontent-%COMP%] .download-header[_ngcontent-%COMP%] .cancel-button-icon[_ngcontent-%COMP%]{font-size:18px;line-height:18px}"]})}return r})();var L1=()=>({width:"35vw"});function N1(r,d){r&1&&(e(0,` 2049 `),n(1,"i",11),e(2,"warning"),a(),e(3,` 2050 `))}function O1(r,d){r&1&&(e(0,` 2051 `),n(1,"i",11),e(2,"check"),a(),e(3,` 2052 `))}function F1(r,d){if(r&1&&(e(0,` 2053 `),n(1,"p-message",13),e(2,` 2054 `),_(3,O1,4,0,"ng-template",null,0,A),e(5,` 2055 `),n(6,"span",5),e(7,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(8,` 2056 `),a(),e(9,` 2057 `)),r&2){let t=m();l(),p("dt",t.copyMessage)}}function M1(r,d){if(r&1){let t=b();e(0,` 2058 `),n(1,"p-button",14),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.close())}),e(3,` 2059 `),a(),e(4,` 2060 `)}r&2&&(l(),p("text",!0)("label",y(2,2,"SHARED.CLOSE")))}var wp=(()=>{class r{tokenValue=ee.required();visible=bn.required();showCopyMessage=D(!1);copyMessage={colorScheme:{light:{contentPadding:"0.5rem"}}};copyTimeout;dialogBreaks=Fn;onCopyClicked(){this.showCopyMessage.set(!0),this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.showCopyMessage.set(!1)},2e3)}close(){this.visible.set(!1),this.showCopyMessage.set(!1)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-agent-token-display-modal"]],inputs:{tokenValue:[1,"tokenValue"],visible:[1,"visible"]},outputs:{visible:"visibleChange"},decls:40,vars:16,consts:[["icon",""],["footer",""],[3,"visibleChange","header","visible","breakpoints","modal","closable","draggable","resizable"],[1,"agent-warning-message"],["severity","warn"],["translate",""],[1,"medium-input","flex","align-items-center","agent-token-value-row"],[2,"width","100%"],["id","qware.app-settings.integrations.bas-agent-token.display.input","type","text","pInputText","","variant","filled",2,"width","100%",3,"ngModel","disabled"],["for","qware.app-settings.integrations.bas-agent-token.display.input","translate",""],[1,"copy-button",3,"click","qwareCopyToClipboard"],[1,"material-icons"],[1,"agent-copy-message"],["severity","success",3,"dt"],["type","button","id","qware.app-settings.integrations.bas-agent-token.display.confirm","severity","secondary",3,"onClick","text","label"]],template:function(o,i){if(o&1){let s=b();n(0,"p-dialog",2),I(1,"translate"),h("visibleChange",function(u){return E(s),S(i.visible.set(u))}),e(2,` 2061 `),n(3,"div",3),e(4,` 2062 `),n(5,"p-message",4),e(6,` 2063 `),_(7,N1,4,0,"ng-template",null,0,A),e(9,` 2064 `),n(10,"span",5),e(11,` 2065 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.DISPLAY_MODAL_WARNING 2066 `),a(),e(12,` 2067 `),a(),e(13,` 2068 `),a(),e(14,` 2069 `),n(15,"div",6),e(16,` 2070 `),n(17,"p-floatlabel",7),e(18,` 2071 `),R(19,"input",8),e(20,` 2072 `),n(21,"label",9),e(22,` 2073 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.TITLE 2074 `),a(),e(23,` 2075 `),a(),e(24,` 2076 `),n(25,"a",10),h("click",function(){return E(s),S(i.onCopyClicked())}),e(26,` 2077 `),n(27,"i",11),e(28,"content_copy"),a(),e(29,` 2078 `),a(),e(30,` 2079 `),a(),e(31,` 2080 `),n(32,"div",12),e(33,` 2081 `),_(34,F1,10,1),a(),e(35,` 2082 `),_(36,M1,5,4,"ng-template",null,1,A),e(38,` 2083`),a(),e(39,` 2084`)}o&2&&(Pt(ne(15,L1)),p("header",y(1,13,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.DISPLAY_MODAL_TITLE"))("visible",i.visible())("breakpoints",i.dialogBreaks)("modal",!0)("closable",!1)("draggable",!1)("resizable",!1),l(19),p("ngModel",i.tokenValue())("disabled",!0),l(6),p("qwareCopyToClipboard",i.tokenValue()),l(9),f(i.showCopyMessage()?34:-1))},dependencies:[vi,oe,Zt,_n,Bo,wn,Ii,Ne,An,Ae,se,Le,Hi,ye,Bi,gi,Qt,ie,$],styles:[".agent-warning-message[_ngcontent-%COMP%]{margin:0 .25rem}.agent-copy-message[_ngcontent-%COMP%]{margin:0 1.25rem 1rem}.medium-input[_ngcontent-%COMP%]{margin:1rem 1.25rem 0}.agent-token-value-row[_ngcontent-%COMP%] .copy-button[_ngcontent-%COMP%]{margin-left:.5rem}"],changeDetection:0})}return r})();function U1(r,d){if(r&1&&(e(0,` 2085 `),n(1,"div",5),e(2,` 2086 `),n(3,"div"),e(4,` 2087 `),n(5,"span",6),e(6,` 2088 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ISSUED_LABEL 2089 `),a(),e(7,` 2090 `),n(8,"span"),e(9),I(10,"date"),a(),e(11,` 2091 `),a(),e(12,` 2092 `),a(),e(13,` 2093 `),n(14,"div",5),e(15,` 2094 `),n(16,"div"),e(17,` 2095 `),n(18,"span",6),e(19,` 2096 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.EXPIRES_LABEL 2097 `),a(),e(20,` 2098 `),n(21,"span"),e(22),I(23,"date"),a(),e(24,` 2099 `),a(),e(25,` 2100 `),a(),e(26,` 2101 `)),r&2){let t=m();l(9),v($e(10,2,t.token().IssuedUtc,"medium")),l(13),v($e(23,5,t.token().ExpiresUtc,"medium"))}}function P1(r,d){if(r&1){let t=b();e(0,` 2102 `),n(1,"p-button",11),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.revoke())}),e(3,` 2103 `),a(),e(4,` 2104 `)}if(r&2){let t=m();l(),p("text",!0)("label",y(2,3,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_BUTTON"))("disabled",!t.canRevoke())}}var Dp=(()=>{class r{isLoading=Dt();token=D(null);loading=D(!0);busy=D(!1);displayModalVisible=D(!1);displayModalValue=D("");canRevoke=Ye(()=>{let t=this.busy(),o=this.displayStatus();return t?!1:o==="Active"||o==="Expiring"});canRotate=Ye(()=>!this.busy());displayStatus=Ye(()=>this.token()?.Status??"None");hasToken=Ye(()=>this.token()!==null);statusLabelKey=Ye(()=>"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.STATUS_"+this.displayStatus().toUpperCase());statusLabelParams=Ye(()=>{let t=this.token()?.GraceExpiresUtc;
2104return t?{when:new Date(t).toLocaleString()}:{}});statusSeverity=Ye(()=>{switch(this.displayStatus()){case"Active":return"success";case"Expiring":return"warning";case"Replaced":return"warning";case"Revoked":return"danger";case"None":default:return"secondary"}});basConnectService=te(Sn);confirmationService=te(mt);toastService=te(Se);translate=te(le);constructor(){Bn(()=>{let t=this.loading();this.isLoading.emit(t)})}ngOnInit(){this.refresh()}refresh(){this.loading.set(!0),this.basConnectService.getAgentToken().pipe(N()).subscribe({next:t=>{this.token.set(t??null),this.loading.set(!1)},error:()=>{this.token.set(null),this.loading.set(!1)}})}rotate(){this.canRotate()&&this.translate.get(["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_CONFIRM_TITLE","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_CONFIRM_MESSAGE","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_SUCCESS","SHARED.SUCCESS"]).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"yesNoDialog",header:t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_CONFIRM_TITLE"],message:t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_CONFIRM_MESSAGE"],accept:()=>{this.busy.set(!0),this.basConnectService.rotateAgentToken().pipe(N()).subscribe({next:o=>{this.busy.set(!1),o?.Value&&(this.displayModalValue.set(o.Value),this.displayModalVisible.set(!0)),this.toastService.success(t["SHARED.SUCCESS"],t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_SUCCESS"]),this.refresh()},error:()=>{this.busy.set(!1)}})}})})}revoke(){this.canRevoke()&&this.translate.get(["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_CONFIRM_TITLE","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_CONFIRM_MESSAGE","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_SUCCESS","SHARED.SUCCESS"]).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"yesNoDialog",header:t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_CONFIRM_TITLE"],message:t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_CONFIRM_MESSAGE"],accept:()=>{this.busy.set(!0),this.basConnectService.revokeAgentToken().pipe(N()).subscribe({next:()=>{this.busy.set(!1),this.toastService.success(t["SHARED.SUCCESS"],t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.REVOKE_SUCCESS"]),this.refresh()},error:()=>{this.busy.set(!1)}})}})})}onModalVisibleChange(t){this.displayModalVisible.set(t),t||this.displayModalValue.set("")}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-agent-token-panel"]],outputs:{isLoading:"isLoading"},decls:40,vars:14,consts:[[1,"bas-agent-token-panel"],[1,"col-12"],[1,"medium-input"],["translate","",1,"agent-token-description"],[1,"grid","flex-inline"],[1,"col-12","lg:col-4","md:col-4"],["translate","",1,"agent-token-label"],["styleClass","bas-agent-token-status",3,"severity","value"],[1,"flex-inline","align-right"],["type","button","id","qware.app-settings.integrations.bas-agent-token.button.rotate",3,"onClick","text","label","disabled"],[3,"visibleChange","tokenValue","visible"],["type","button","id","qware.app-settings.integrations.bas-agent-token.button.revoke",3,"onClick","text","label","disabled"]],template:function(o,i){o&1&&(n(0,"section",0),e(1,` 2105 `),n(2,"div",1),e(3,` 2106 `),n(4,"div",2),e(5,` 2107 `),n(6,"p",3),e(7,` 2108 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.DESCRIPTION 2109 `),a(),e(8,` 2110 2111 `),n(9,"div",4),e(10,` 2112 `),n(11,"div",5),e(12,` 2113 `),n(13,"span",6),e(14,` 2114 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.STATUS_LABEL 2115 `),a(),e(15,` 2116 `),n(16,"p-tag",7),I(17,"translate"),e(18,` 2117 `),a(),e(19,` 2118 `),a(),e(20,` 2119 2120 `),_(21,U1,27,8),a(),e(22,` 2121 `),a(),e(23,` 2122 `),a(),e(24,` 2123 2124 `),n(25,"div",1),e(26,` 2125 `),n(27,"div",8),e(28,` 2126 `),_(29,P1,5,5),n(30,"p-button",9),I(31,"translate"),h("onClick",function(){return i.rotate()}),e(32,` 2127 `),a(),e(33,` 2128 `),a(),e(34,` 2129 `),a(),e(35,` 2130 2131 `),n(36,"qware-bas-agent-token-display-modal",10),h("visibleChange",function(c){return i.onModalVisibleChange(c)}),e(37,` 2132 `),a(),e(38,` 2133`),a(),e(39,` 2134`)),o&2&&(l(16),p("severity",i.statusSeverity())("value",$e(17,9,i.statusLabelKey(),i.statusLabelParams())),l(5),f(i.hasToken()?21:-1),l(8),f(i.canRevoke()?29:-1),l(),p("text",!0)("label",y(31,12,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.ROTATE_BUTTON"))("disabled",!i.canRotate()),l(6),p("tokenValue",i.displayModalValue())("visible",i.displayModalVisible()))},dependencies:[wp,vi,oe,Zt,Aa,Bi,Qa,lr,Qt,ie,$],styles:[".bas-agent-token-panel[_ngcontent-%COMP%]{display:block}.bas-agent-token-panel[_ngcontent-%COMP%] .agent-token-description[_ngcontent-%COMP%]{color:var(--text-color-secondary);margin:0 0 .75rem}.bas-agent-token-panel[_ngcontent-%COMP%] .agent-token-label[_ngcontent-%COMP%]{display:block;font-size:.75rem;color:var(--text-color-secondary);margin-bottom:.25rem}.bas-agent-token-panel[_ngcontent-%COMP%] .bas-agent-token-status[_ngcontent-%COMP%]{display:inline-flex}
2134.bas-agent-token-panel[_ngcontent-%COMP%] .action-bar[_ngcontent-%COMP%]{margin-top:1rem}"],changeDetection:0})}return r})();function k1(r,d){r&1&&(e(0,` 2135 `),n(1,"span",34),e(2,"expand_less"),a(),e(3,` 2136 `))}function V1(r,d){r&1&&(e(0,` 2137 `),n(1,"span",34),e(2,"expand_more"),a(),e(3,` 2138 `))}function q1(r,d){r&1&&(e(0,` 2139 `),n(1,"span",34),e(2,"expand_less"),a(),e(3,` 2140 `))}function B1(r,d){r&1&&(e(0,` 2141 `),n(1,"span",34),e(2,"expand_more"),a(),e(3,` 2142 `))}function H1(r,d){r&1&&(e(0,` 2143 `),n(1,"span",34),e(2,"expand_less"),a(),e(3,` 2144 `))}function W1(r,d){r&1&&(e(0,` 2145 `),n(1,"span",34),e(2,"expand_more"),a(),e(3,` 2146 `))}function j1(r,d){r&1&&(e(0,` 2147 `),n(1,"small",35),e(2,` 2148 `),n(3,"div",36),e(4,` 2149 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.RESERVED_EXCEEDS_MAX 2150 `),a(),e(5,` 2151 `),a(),e(6,` 2152 `))}function Y1(r,d){r&1&&(e(0,` 2153 `),n(1,"span",34),e(2,"expand_less"),a(),e(3,` 2154 `))}function Q1(r,d){r&1&&(e(0,` 2155 `),n(1,"span",34),e(2,"expand_more"),a(),e(3,` 2156 `))}function K1(r,d){r&1&&(e(0,` 2157 `),n(1,"span",34),e(2,"expand_more"),a(),e(3,` 2158 `))}function $1(r,d){r&1&&(e(0,` 2159 `),n(1,"span",34),e(2,"search"),a(),e(3,` 2160 `))}var Bs=(()=>{class r{form=ee.required();users=ee([]);recipientOptions=Ye(()=>this.users().filter(t=>!!t.Id&&!!t.Email).map(t=>({id:t.Id,label:this.formatLabel(t)})).sort((t,o)=>t.label.localeCompare(o.label)));formatLabel(t){let o=`${t.FirstName??""} ${t.LastName??""}`.trim(),i=t.Email??"";return o&&i?`${o} (${i})`:o||i||(t.Id??"")}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-connect-capacity-step"]],inputs:{form:[1,"form"],users:[1,"users"]},decls:253,vars:37,consts:[["incrementbuttonicon",""],["decrementbuttonicon",""],["maxSlotsInfo",""],["dispatchHorizonInfo",""],["reservedSlotsInfo",""],["maxUtilizationInfo",""],["dropdownicon",""],["filtericon",""],["notificationUsersInfo",""],[1,"grid","zipper","flex-inline",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.app-settings.integrations.bas.connect.capacity.input.max-slots","formControlName","ConfiguredMaxSlots","variant","filled",1,"is-filled",3,"useGrouping","min","max","showButtons","fluid"],["for","qware.app-settings.integrations.bas.connect.capacity.input.max-slots","id","qware.app-settings.integrations.bas.connect.capacity.label.max-slots"],["translate",""],[1,"required-mark"],[1,"info-icon","material-icons-outlined",3,"click"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.capacity.error.max-slots","translate","",3,"hidden"],[1,"popover-width"],["translate","",1,"info-text"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.app-settings.integrations.bas.connect.capacity.input.dispatch-horizon","formControlName","DispatchHorizonHours","variant","filled",1,"is-filled",3,"useGrouping","min","max","showButtons","fluid"],["for","qware.app-settings.integrations.bas.connect.capacity.input.dispatch-horizon","id","qware.app-settings.integrations.bas.connect.capacity.label.dispatch-horizon"],["id","qware.app-settings.integrations.bas.connect.capacity.error.dispatch-horizon","translate","",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.capacity.input.reserved-slots","formControlName","ReservedSlots","variant","filled",1,"is-filled",3,"useGrouping","min","showButtons","fluid"],["for","qware.app-settings.integrations.bas.connect.capacity.input.reserved-slots","id","qware.app-settings.integrations.bas.connect.capacity.label.reserved-slots"],["id","qware.app-settings.integrations.bas.connect.capacity.error.reserved-slots","translate","",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.capacity.input.max-utilization","formControlName","MaxUtilizationPct","variant","filled",1,"is-filled",3,"useGrouping","min","max","suffix","showButtons","fluid"],["for","qware.app-settings.integrations.bas.connect.capacity.input.max-utilization","id","qware.app-settings.integrations.bas.connect.capacity.label.max-utilization"],["id","qware.app-settings.integrations.bas.connect.capacity.error.max-utilization","translate","",3,"hidden"],[1,"col-12","field-container"],["id","qware.app-settings.integrations.bas.connect.capacity.input.notification-users","formControlName","NotificationUserIds","optionLabel","label","optionValue","id","display","chip","variant","filled",1,"is-filled",3,"options","filter","fluid","showClear","showHeader","virtualScroll","virtualScrollItemSize"],["for","qware.app-settings.integrations.bas.connect.capacity.input.notification-users","id","qware.app-settings.integrations.bas.connect.capacity.label.notification-users","translate",""],[1,"material-icons"],[1,"validation-error"],["id","qware.app-settings.integrations.bas.connect.capacity.error.reserved-exceeds-max","translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"form",9),e(1,` 2161 `),e(2,` 2162 `),n(3,"div",10),e(4,` 2163 `),n(5,"div",11),e(6,` 2164 `),n(7,"p-inputgroup"),e(8,` 2165 `),n(9,"p-floatlabel"),e(10,` 2166 `),n(11,"p-inputNumber",12),e(12,` 2167 `),_(13,k1,4,0,"ng-template",null,0,A),e(15,` 2168 `),_(16,V1,4,0,"ng-template",null,1,A),e(18,` 2169 `),a(),e(19,` 2170 `),n(20,"label",13),e(21,` 2171 `),n(22,"span",14),e(23,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIGURED_MAX_SLOTS_LABEL"),a(),n(24,"span",15),e(25,"*"),a(),e(26,` 2172 `),a(),e(27,` 2173 `),a(),e(28,` 2174 `),n(29,"p-inputgroup-addon"),e(30,` 2175 `),n(31,"i",16),h("click",function(u){E(s);let x=Ee(44);return S(x.toggle(u))}),e(32,"info"),a(),e(33,` 2176 `),a(),e(34,` 2177 `),a(),e(35,` 2178 `),n(36,"small",17),e(37,` 2179 `),n(38,"div",18),e(39,` 2180 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.CONFIGURED_MAX_SLOTS_INVALID 2181 `),a(),e(40,` 2182 `),a(),e(41,` 2183 `),a(),e(42,` 2184 `),n(43,"p-popover",null,2),e(45,` 2185 `),n(46,"div",19),e(47,` 2186 `),n(48,"span",20),e(49,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIGURED_MAX_SLOTS_HELP"),a(),e(50,` 2187 `),a(),e(51,` 2188 `),a(),e(52,` 2189 `),a(),e(53,` 2190 2191 `),e(54,` 2192 `),n(55,"div",21),e(56,` 2193 `),n(57,"div",11),e(58,` 2194 `),n(59,"p-inputgroup"),e(60,` 2195 `),n(61,"p-floatlabel"),e(62,` 2196 `),n(63,"p-inputNumber",22),e(64,` 2197 `),_(65,q1,4,0,"ng-template",null,0,A),e(67,` 2198 `),_(68,B1,4,0,"ng-template",null,1,A),e(70,` 2199 `),a(),e(71,` 2200 `),n(72,"label",23),e(73,` 2201 `),n(74,"span",14),e(75,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DISPATCH_HORIZON_LABEL"),a(),n(76,"span",15),e(77,"*"),a(),e(78,` 2202 `),a(),e(79,` 2203 `),a(),e(80,` 2204 `),n(81,"p-inputgroup-addon"),e(82,` 2205 `),n(83,"i",16),h("click",function(u){E(s);let x=Ee(96);return S(x.toggle(u))}),e(84,"info"),a(),e(85,` 2206 `),a(),e(86,` 2207 `),a(),e(87,` 2208 `),n(88,"small",17),e(89,` 2209 `),n(90,"div",24),e(91,` 2210 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.DISPATCH_HORIZON_INVALID 2211 `),a(),e(92,` 2212 `),a(),e(93,` 2213 `),a(),e(94,` 2214 `),n(95,"p-popover",null,3),e(97,` 2215 `),n(98,"div",19),e(99,` 2216 `),n(100,"span",20),e(101,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DISPATCH_HORIZON_HELP"),a(),e(102,` 2217 `),a(),e(103,` 2218 `),a(),e(104,` 2219 `),a(),e(105,` 2220 2221 `),e(106,` 2222 `),n(107,"div",10),e(108,` 2223 `),n(109,"div",11),e(110,` 2224 `),n(111,"p-inputgroup"),e(112,` 2225 `),n(113,"p-floatlabel"),e(114,` 2226 `),n(115,"p-inputNumber",25),e(116,` 2227 `),_(117,H1,4,0,"ng-template",null,0,A),e(119,` 2228 `),_(120,W1,4,0,"ng-template",null,1,A),e(122,` 2229 `),a(),e(123,` 2230 `),n(124,"label",26),e(125,` 2231 `),n(126,"span",14),e(127,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.RESERVED_SLOTS_LABEL"),a(),n(128,"span",15),e(129,"*"),a(),e(130,` 2232 `),a(),e(131,` 2233 `),a(),e(132,` 2234 `),n(133,"p-inputgroup-addon"),e(134,` 2235 `),n(135,"i",16),h("click",function(u){E(s);let x=Ee(149);return S(x.toggle(u))}),e(136,"info"),a(),e(137,` 2236 `),a(),e(138,` 2237 `),a(),e(139,` 2238 `),n(140,"small",17),e(141,` 2239 `),n(142,"div",27),e(143,` 2240 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.RESERVED_SLOTS_INVALID 2241 `),a(),e(144,` 2242 `),a(),e(145,` 2243 `),_(146,j1,7,0),a(),e(147,` 2244 `),n(148,"p-popover",null,4),e(150,` 2245 `),n(151,"div",19),e(152,` 2246 `),n(153,"span",20),e(154,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.RESERVED_SLOTS_HELP"),a(),e(155,` 2247 `),a(),e(156,` 2248 `),a(),e(157,` 2249 `),a(),e(158,` 2250 2251 `),e(159,` 2252 `),n(160,"div",21),e(161,` 2253 `),n(162,"div",11),e(163,` 2254 `),n(164,"p-inputgroup"),e(165,` 2255 `),n(166,"p-floatlabel"),e(167,` 2256 `),n(168,"p-inputNumber",28),e(169,` 2257 `),_(170,Y1,4,0,"ng-template",null,0,A),e(172,` 2258 `),_(173,Q1,4,0,"ng-template",null,1,A),e(175,` 2259 `),a(),e(176,` 2260 `),n(177,"label",29),e(178,` 2261 `),n(179,"span",14),e(180,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.MAX_UTILIZATION_PCT_LABEL"),a(),n(181,"span",15),e(182,"*"),a(),e(183,` 2262 `),a(),e(184,` 2263 `),a(),e(185,` 2264 `),n(186,"p-inputgroup-addon"),e(187,` 2265 `),n(188,"i",16),h("click",function(u){E(s);let x=Ee(201);return S(x.toggle(u))}),e(189,"info"),a(),e(190,` 2266 `),a(),e(191,` 2267 `),a(),e(192,` 2268 `),n(193,"small",17),e(194,` 2269 `),n(195,"div",30),e(196,` 2270 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.MAX_UTILIZATION_PCT_INVALID 2271 `),a(),e(197,` 2272 `),a(),e(198,` 2273 `),a(),e(199,` 2274 `),n(200,"p-popover",null,5),e(202,` 2275 `),n(203,"div",19),e(204,` 2276 `),n(205,"span",20),e(206,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.MAX_UTILIZATION_PCT_HELP"),a(),e(207,` 2277 `),a(),e(208,` 2278 `),a(),e(209,` 2279 `),a(),e(210,` 2280 2281 `),e(211,` 2282 `),n(212,"div",31),e(213,` 2283 `),n(214,"div",11),e(215,` 2284 `),n(216,"p-inputgroup"),e(217,` 2285 `),n(218,"p-floatlabel"),e(219,` 2286 `),n(220,"p-multiselect",32),e(221,` 2287 `),_(222,K1,4,0,"ng-template",null,6,A),e(224,` 2288 `),_(225,$1,4,0,"ng-template",null,7,A),e(227,` 2289 `),a(),e(228,` 2290 `),n(229,"label",33),e(230,` 2291 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.NOTIFICATION_USERS_LABEL 2292 `),a(),e(231,` 2293 `),a(),e(232,` 2294 `),n(233,"p-inputgroup-addon"),e(234,` 2295 `),n(235,"i",16),h("click",function(u){E(s);let x=Ee(242);return S(x.toggle(u))}),e(236,"info"),a(),e(237,` 2296 `),a(),e(238,` 2297 `),a(),e(239,` 2298 `),a(),e(240,` 2299 `),n(241,"p-popover",null,8),e(243,` 2300 `),n(244,"div",19),e(245,` 2301 `),n(246,"span",20),e(247,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.NOTIFICATION_USERS_HELP"),a(),e(248,` 2302 `),a(),e(249,` 2303 `),a(),e(250,` 2304 `),a(),e(251,` 2305`),a(),e(252,` 2306`)}if(o&2){let s,c,u,x,C;p("formGroup",i.form()),l(11),p("useGrouping",!1)("min",1)("max",500)("showButtons",!0)("fluid",!0),l(25),p("hidden",i.form().controls.ConfiguredMaxSlots.val
2306id||i.form().controls.ConfiguredMaxSlots.pristine),l(2),p("hidden",!((s=i.form().controls.ConfiguredMaxSlots.errors)!=null&&s.min)&&!((s=i.form().controls.ConfiguredMaxSlots.errors)!=null&&s.max)&&!((s=i.form().controls.ConfiguredMaxSlots.errors)!=null&&s.required)),l(25),p("useGrouping",!1)("min",25)("max",168)("showButtons",!0)("fluid",!0),l(25),p("hidden",i.form().controls.DispatchHorizonHours.valid||i.form().controls.DispatchHorizonHours.pristine),l(2),p("hidden",!((c=i.form().controls.DispatchHorizonHours.errors)!=null&&c.min)&&!((c=i.form().controls.DispatchHorizonHours.errors)!=null&&c.max)&&!((c=i.form().controls.DispatchHorizonHours.errors)!=null&&c.required)),l(25),p("useGrouping",!1)("min",0)("showButtons",!0)("fluid",!0),l(25),p("hidden",i.form().controls.ReservedSlots.valid||i.form().controls.ReservedSlots.pristine),l(2),p("hidden",!((u=i.form().controls.ReservedSlots.errors)!=null&&u.min)&&!((u=i.form().controls.ReservedSlots.errors)!=null&&u.required)),l(4),f((x=i.form().errors)!=null&&x.reservedExceedsMax&&(i.form().controls.ReservedSlots.dirty||i.form().controls.ConfiguredMaxSlots.dirty)?146:-1),l(22),p("useGrouping",!1)("min",50)("max",100)("suffix"," %")("showButtons",!0)("fluid",!0),l(25),p("hidden",i.form().controls.MaxUtilizationPct.valid||i.form().controls.MaxUtilizationPct.pristine),l(2),p("hidden",!((C=i.form().controls.MaxUtilizationPct.errors)!=null&&C.min)&&!((C=i.form().controls.MaxUtilizationPct.errors)!=null&&C.max)&&!((C=i.form().controls.MaxUtilizationPct.errors)!=null&&C.required)),l(25),p("options",i.recipientOptions())("filter",!0)("fluid",!0)("showClear",!0)("showHeader",!0)("virtualScroll",!0)("virtualScrollItemSize",38)}},dependencies:[Ii,Ne,Il,co,Tl,mo,Ua,bi,Dr,Ni,hl,fl,Rn,hr,se,ge,Te,De,Qt,$],styles:[".info-icon[_ngcontent-%COMP%]{display:block;margin-top:3px;cursor:pointer}.info-text[_ngcontent-%COMP%]{font-size:var(--p-font-size-body2)}"],changeDetection:0})}return r})();var z1=r=>({version:r});function X1(r,d){if(r&1&&(e(0,` 2307 `),n(1,"span",15),e(2),I(3,"translate"),a(),e(4,` 2308 `)),r&2){let t=m();l(2),K(` 2309 `,$e(3,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.DOWNLOAD_VERSION",pe(4,z1,t.installerVersion())),` 2310 `)}}function Z1(r,d){if(r&1){let t=b();e(0,` 2311 `),n(1,"div",16),e(2,` 2312 `),n(3,"p-button",17),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.generateToken())}),e(5,` 2313 `),a(),e(6,` 2314 `),a(),e(7,` 2315 `)}if(r&2){let t=m();l(3),p("raised",!0)("loading",t.generating())("label",y(4,3,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.GENERATE_TOKEN_BUTTON"))}}function J1(r,d){r&1&&(e(0,` 2316 `),n(1,"i",11),e(2,"warning"),a(),e(3,` 2317 `))}function ef(r,d){r&1&&(e(0,` 2318 `),n(1,"i",11),e(2,"check"),a(),e(3,` 2319 `))}function tf(r,d){r&1&&(e(0,` 2320 `),n(1,"p-message",21),e(2,` 2321 `),_(3,ef,4,0,"ng-template",null,0,A),e(5,` 2322 `),n(6,"span",4),e(7,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(8,` 2323 `),a(),e(9,` 2324 `))}function nf(r,d){if(r&1){let t=b();e(0,` 2325 `),n(1,"p-message",18),e(2,` 2326 `),_(3,J1,4,0,"ng-template",null,0,A),e(5,` 2327 `),n(6,"span",4),e(7,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.TOKEN_WARNING"),a(),e(8,` 2328 `),a(),e(9,` 2329 2330 `),n(10,"div",7),e(11,` 2331 `),n(12,"p-floatlabel"),e(13,` 2332 `),R(14,"input",19),e(15,` 2333 `),n(16,"label",20),e(17,` 2334 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.TOKEN_LABEL 2335 `),a(),e(18,` 2336 `),a(),e(19,` 2337 `),n(20,"a",10),h("click",function(){E(t);let i=m();return S(i.onCopied("token"))}),e(21,` 2338 `),n(22,"i",11),e(23,"content_copy"),a(),e(24,` 2339 `),a(),e(25,` 2340 `),a(),e(26,` 2341 2342 `),n(27,"div",12),e(28,` 2343 `),_(29,tf,10,0),a(),e(30,` 2344 `)}if(r&2){let t=m();l(14),p("value",t.tokenPlaintext())("disabled",!0)("fluid",!0),l(6),p("qwareCopyToClipboard",t.tokenPlaintext()),l(9),f(t.copiedField()==="token"?29:-1)}}function af(r,d){r&1&&(e(0,` 2345 `),n(1,"i",11),e(2,"check"),a(),e(3,` 2346 `))}function rf(r,d){r&1&&(e(0,` 2347 `),n(1,"p-message",21),e(2,` 2348 `),_(3,af,4,0,"ng-template",null,0,A),e(5,` 2349 `),n(6,"span",4),e(7,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(8,` 2350 `),a(),e(9,` 2351 `))}function of(r,d){r&1&&(e(0,` 2352 `),n(1,"i",11),e(2,"check"),a(),e(3,` 2353 `))}function lf(r,d){r&1&&(e(0,` 2354 `),n(1,"p-message",21),e(2,` 2355 `),_(3,of,4,0,"ng-template",null,0,A),e(5,` 2356 `),n(6,"span",4),e(7,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(8,` 2357 `),a(),e(9,` 2358 `))}var Lp=(()=>{class r{authService=te(de);basConnectService=te(Sn);toastService=te(Se);translate=te(le);onTokenGenerated=ee(void 0);tokenPlaintext=D(null);downloading=D(!1);generating=D(!1);installerVersion=D(null);copiedField=D(null);copyTimeout;get tenantId(){return this.authService.tenant?.Id??""}get timezone(){return this.authService.authToken?.Timezone??""}download(){this.downloading()||(this.downloading.set(!0),this.basConnectService.getAgentInstallerDownload().pipe(N()).subscribe({next:t=>{this.downloading.set(!1),this.installerVersion.set(t.Version);let o=document.createElement("a");o.href=t.Url,o.rel="noopener noreferrer",o.click()},error:()=>{this.downloading.set(!1),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.DOWNLOAD_ERROR"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.DOWNLOAD_ERROR"])})}}))}
2358generateToken(){this.generating()||(this.generating.set(!0),this.basConnectService.revokeAgentToken().pipe(Zr(t=>t.status===404?Fe(void 0):wi(()=>t)),cd(()=>this.basConnectService.rotateAgentToken()),N()).subscribe({next:t=>{this.generating.set(!1),t?.Value&&(this.tokenPlaintext.set(t.Value),this.onTokenGenerated()?.())},error:()=>{this.generating.set(!1),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.GENERATE_ERROR"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.GENERATE_ERROR"])})}}))}onCopied(t){this.copiedField.set(t),this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.copiedField.set(null)},2e3)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-connect-agent-setup-step"]],inputs:{onTokenGenerated:[1,"onTokenGenerated"]},decls:73,vars:18,consts:[["icon",""],[1,"bas-agent-setup"],["translate","",1,"agent-setup-title"],[1,"agent-setup-intro"],["translate",""],[1,"agent-setup-button"],["type","button","id","qware.app-settings.integrations.bas-agent-setup.download",3,"onClick","raised","loading","label"],[1,"medium-input","flex","align-items-center"],["id","qware.app-settings.integrations.bas-agent-setup.tenant.input","type","text","pInputText","","variant","filled","readonly","",3,"value","disabled","fluid"],["for","qware.app-settings.integrations.bas-agent-setup.tenant.input","translate",""],[1,"copy-button",3,"click","qwareCopyToClipboard"],[1,"material-icons"],[1,"agent-setup-copy-message"],["id","qware.app-settings.integrations.bas-agent-setup.timezone.input","type","text","pInputText","","variant","filled","readonly","",3,"value","disabled","fluid"],["for","qware.app-settings.integrations.bas-agent-setup.timezone.input","translate",""],[1,"agent-setup-version"],[1,"agent-setup-button",2,"margin-bottom","2rem"],["type","button","id","qware.app-settings.integrations.bas-agent-setup.generate-token",3,"onClick","raised","loading","label"],["severity","warn"],["id","qware.app-settings.integrations.bas-agent-setup.token.input","type","text","pInputText","","variant","filled","readonly","",3,"value","disabled","fluid"],["for","qware.app-settings.integrations.bas-agent-setup.token.input","translate",""],["severity","success"]],template:function(o,i){o&1&&(n(0,"section",1),e(1,` 2359 `),n(2,"h5",2),e(3,` 2360 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.TITLE 2361 `),a(),e(4,` 2362 2363 `),e(5,` 2364 `),n(6,"p",3),e(7,` 2365 1. `),n(8,"span",4),e(9,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.STEP_1_INST"),a(),e(10,` 2366 `),a(),e(11,` 2367 2368 `),n(12,"div",5),e(13,` 2369 `),n(14,"p-button",6),I(15,"translate"),h("onClick",function(){return i.download()}),e(16,` 2370 `),a(),e(17,` 2371 `),_(18,X1,5,6),a(),e(19,` 2372 2373 `),n(20,"p",3),e(21,` 2374 2. `),n(22,"span",4),e(23,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.STEP_2_INST"),a(),e(24,` 2375 `),a(),e(25,` 2376 2377 `),e(26,` 2378 `),_(27,Z1,8,5)(28,nf,31,5),n(29,"div",7),e(30,` 2379 `),n(31,"p-floatlabel"),e(32,` 2380 `),R(33,"input",8),e(34,` 2381 `),n(35,"label",9),e(36,` 2382 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.TENANT_ID_LABEL 2383 `),a(),e(37,` 2384 `),a(),e(38,` 2385 `),n(39,"a",10),h("click",function(){return i.onCopied("tenant")}),e(40,` 2386 `),n(41,"i",11),e(42,"content_copy"),a(),e(43,` 2387 `),a(),e(44,` 2388 `),a(),e(45,` 2389 2390 `),n(46,"div",12),e(47,` 2391 `),_(48,rf,10,0),a(),e(49,` 2392 2393 `),e(50,` 2394 `),n(51,"div",7),e(52,` 2395 `),n(53,"p-floatlabel"),e(54,` 2396 `),R(55,"input",13),e(56,` 2397 `),n(57,"label",14),e(58,` 2398 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.TIMEZONE_LABEL 2399 `),a(),e(59,` 2400 `),a(),e(60,` 2401 `),n(61,"a",10),h("click",function(){return i.onCopied("timezone")}),e(62,` 2402 `),n(63,"i",11),e(64,"content_copy"),a(),e(65,` 2403 `),a(),e(66,` 2404 `),a(),e(67,` 2405 2406 `),n(68,"div",12),e(69,` 2407 `),_(70,lf,10,0),a(),e(71,` 2408`),a(),e(72,` 2409`)),o&2&&(l(14),p("raised",!0)("loading",i.downloading())("label",y(15,16,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_SETUP.DOWNLOAD_BUTTON")),l(4),f(i.installerVersion()?18:-1),l(9),f(i.tokenPlaintext()?-1:27),l(),f(i.tokenPlaintext()?28:-1),l(5),p("value",i.tenantId)("disabled",!0)("fluid",!0),l(6),p("qwareCopyToClipboard",i.tenantId),l(9),f(i.copiedField()==="tenant"?48:-1),l(7),p("value",i.timezone)("disabled",!0)("fluid",!0),l(6),p("qwareCopyToClipboard",i.timezone),l(9),f(i.copiedField()==="timezone"?70:-1))},dependencies:[vi,oe,Zt,_n,Ii,Ne,Hi,ye,Bi,gi,Qt,ie,$],styles:[".bas-agent-setup[_ngcontent-%COMP%]{display:block;padding:1rem 1.5rem 1.5rem}.bas-agent-setup[_ngcontent-%COMP%] .agent-setup-button[_ngcontent-%COMP%]{margin:1rem 0 1.5rem}.bas-agent-setup[_ngcontent-%COMP%] .medium-input[_ngcontent-%COMP%]{margin:1rem 0 0}.bas-agent-setup[_ngcontent-%COMP%] .medium-input[_ngcontent-%COMP%] .p-floatlabel[_ngcontent-%COMP%]{width:100%}.agent-setup-download[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:1.5rem}"],changeDetection:0})}return r})();var sf=r=>({deviceName:r});function df(r,d){if(r&1&&(e(0,` 2410 `),n(1,"p-message",19),I(2,"translate"),e(3,` 2411 `),a(),e(4,` 2412 `)),r&2){let t,o=m();l(),p("text",$e(2,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONNECTED",pe(4,
2412sf,(t=o.testResult().DeviceName)!==null&&t!==void 0?t:"")))}}function pf(r,d){if(r&1&&(e(0,` 2413 `),n(1,"p-message",20),I(2,"translate"),e(3,` 2414 `),a(),e(4,` 2415 `)),r&2){let t,o=m();l(),p("severity",o.testResult().Status==="Unreachable"?"warn":"error")("text",(t=o.testResult().Reason)!==null&&t!==void 0?t:y(2,2,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.ERROR_GENERIC"))}}var Hs=(()=>{class r{basConnectService=te(Sn);form=ee.required();testCompleted=Dt();testStatus=D("idle");testResult=D(null);isTesting=Ye(()=>this.testStatus()==="testing");showConnected=Ye(()=>{let t=this.testStatus(),o=this.testResult();return t==="connected"&&o!==null});showFailed=Ye(()=>{let t=this.testStatus(),o=this.testResult();return t==="failed"&&o!==null});subs=new Vi;ngOnInit(){this.subs.add(this.form().valueChanges.subscribe(()=>{let t=this.testStatus();t!=="idle"&&t!=="testing"&&(this.testStatus.set("idle"),this.testResult.set(null),this.form().controls.ConnectionVerified?.setValue(!1,{emitEvent:!1}))}))}ngOnDestroy(){this.subs&&!this.subs.closed&&this.subs.unsubscribe()}fieldsInvalid(){let t=this.form();return t.controls.Host.invalid||t.controls.Port.invalid||t.controls.DeviceInstance.invalid}testConnection(){let t=this.form();if(!t||this.fieldsInvalid()||this.isTesting())return;this.testStatus.set("testing"),this.testResult.set(null),t.disable({emitEvent:!1}),t.controls.ConnectionVerified?.enable({emitEvent:!1}),t.controls.ConnectionVerified?.setValue(!1,{emitEvent:!1});let o=t.getRawValue();this.basConnectService.testConnection(o).pipe(N()).subscribe({next:i=>{let s=i.Status==="Connected";this.testResult.set(i),this.testStatus.set(s?"connected":"failed"),t.enable({emitEvent:!1}),t.controls.ConnectionVerified?.setValue(s,{emitEvent:!1}),this.testCompleted.emit(i)},error:()=>{let i={Status:"Error"};this.testResult.set(i),this.testStatus.set("failed"),t.enable({emitEvent:!1}),t.controls.ConnectionVerified?.setValue(!1,{emitEvent:!1}),this.testCompleted.emit(i)}})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-connect-connection-step"]],inputs:{form:[1,"form"]},outputs:{testCompleted:"testCompleted"},decls:102,vars:24,consts:[[1,"grid","zipper","flex-inline",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["pInputText","","id","qware.app-settings.integrations.bas.connect.input.host","formControlName","Host","variant","filled",3,"fluid"],["for","qware.app-settings.integrations.bas.connect.input.host","id","qware.app-settings.integrations.bas.connect.label.host"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.error.host-req","translate","",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.error.host-length","translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.app-settings.integrations.bas.connect.input.port","formControlName","Port","variant","filled",1,"is-filled",3,"useGrouping","min","max","fluid"],["for","qware.app-settings.integrations.bas.connect.input.port","id","qware.app-settings.integrations.bas.connect.label.port"],["id","qware.app-settings.integrations.bas.connect.error.port-invalid","translate","",3,"hidden"],["id","qware.app-settings.integrations.bas.connect.input.device","formControlName","DeviceInstance","variant","filled",1,"is-filled",3,"useGrouping","min","max","fluid"],["for","qware.app-settings.integrations.bas.connect.input.device","id","qware.app-settings.integrations.bas.connect.label.device"],["id","qware.app-settings.integrations.bas.connect.error.device-invalid","translate","",3,"hidden"],[3,"onClick","disabled","raised","label","loading"],[2,"margin-top","0.5rem"],["severity","success",3,"text"],[3,"severity","text"]],template:function(o,i){if(o&1&&(n(0,"form",0),e(1,` 2416 `),e(2,` 2417 `),n(3,"div",1),e(4,` 2418 `),n(5,"div",2),e(6,` 2419 `),n(7,"p-floatlabel"),e(8,` 2420 `),R(9,"input",3),e(10,` 2421 `),n(11,"label",4),e(12,` 2422 `),n(13,"span",5),e(14,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.HOST_LABEL"),a(),n(15,"span",6),e(16,"*"),a(),e(17,` 2423 `),a(),e(18,` 2424 `),a(),e(19,` 2425 `),n(20,"small",7),e(21,` 2426 `),n(22,"div",8),e(23,` 2427 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.HOST_REQUIRED 2428 `),a(),e(24,` 2429 `),n(25,"div",9),e(26,` 2430 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.HOST_LENGTH 2431 `),a(),e(27,` 2432 `),a(),e(28,` 2433 `),a(),e(29,` 2434 `),a(),e(30,` 2435 `),e(31,` 2436 `),n(32,"div",10),e(33,` 2437 `),n(34,"div",2),e(35,` 2438 `),n(36,"p-floatlabel"),e(37,` 2439 `),n(38,"p-inputNumber",11),e(39,` 2440 `),a(),e(40,` 2441 `),n(41,"label",12),e(42,`
2442 `),n(43,"span",5),e(44,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.PORT_LABEL"),a(),n(45,"span",6),e(46,"*"),a(),e(47,` 2443 `),a(),e(48,` 2444 `),a(),e(49,` 2445 `),n(50,"small",7),e(51,` 2446 `),n(52,"div",13),e(53,` 2447 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.PORT_INVALID 2448 `),a(),e(54,` 2449 `),a(),e(55,` 2450 `),a(),e(56,` 2451 `),a(),e(57,` 2452 `),e(58,` 2453 `),n(59,"div",1),e(60,` 2454 `),n(61,"div",2),e(62,` 2455 `),n(63,"p-floatlabel"),e(64,` 2456 `),n(65,"p-inputNumber",14),e(66,` 2457 `),a(),e(67,` 2458 `),n(68,"label",15),e(69,` 2459 `),n(70,"span",5),e(71,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DEVICE_INSTANCE_LABEL"),a(),n(72,"span",6),e(73,"*"),a(),e(74,` 2460 `),a(),e(75,` 2461 `),a(),e(76,` 2462 `),n(77,"small",7),e(78,` 2463 `),n(79,"div",16),e(80,` 2464 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.DEVICE_INSTANCE_INVALID 2465 `),a(),e(81,` 2466 `),a(),e(82,` 2467 `),a(),e(83,` 2468 `),a(),e(84,` 2469 `),e(85,` 2470 `),n(86,"div",10),e(87,` 2471 `),n(88,"div",2),e(89,` 2472 `),n(90,"p-button",17),I(91,"translate"),h("onClick",function(){return i.testConnection()}),e(92,` 2473 `),a(),e(93,` 2474 `),n(94,"div",18),e(95,` 2475 `),_(96,df,5,6)(97,pf,5,4),a(),e(98,` 2476 `),a(),e(99,` 2477 `),a(),e(100,` 2478`),a(),e(101,` 2479`)),o&2){let s,c,u,x;p("formGroup",i.form()),l(9),p("fluid",!0),l(11),p("hidden",i.form().controls.Host.valid||i.form().controls.Host.untouched),l(2),p("hidden",!((s=i.form().controls.Host.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.Host.errors)!=null&&c.maxlength)||!!((c=i.form().controls.Host.errors)!=null&&c.required)),l(13),p("useGrouping",!1)("min",1)("max",65535)("fluid",!0),l(12),p("hidden",i.form().controls.Port.valid||i.form().controls.Port.untouched),l(2),p("hidden",!((u=i.form().controls.Port.errors)!=null&&u.min)&&!((u=i.form().controls.Port.errors)!=null&&u.max)&&!((u=i.form().controls.Port.errors)!=null&&u.required)),l(13),p("useGrouping",!1)("min",0)("max",4194302)("fluid",!0),l(12),p("hidden",i.form().controls.DeviceInstance.valid||i.form().controls.DeviceInstance.untouched),l(2),p("hidden",!((x=i.form().controls.DeviceInstance.errors)!=null&&x.min)&&!((x=i.form().controls.DeviceInstance.errors)!=null&&x.max)&&!((x=i.form().controls.DeviceInstance.errors)!=null&&x.required)),l(11),p("disabled",i.fieldsInvalid()||i.isTesting())("raised",!0)("label",y(91,22,i.isTesting()?"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.TESTING":"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.TEST_CONNECTION"))("loading",i.isTesting()),l(6),f(i.showConnected()?96:i.showFailed()?97:-1)}},dependencies:[vi,oe,Ii,Ne,Ua,bi,Hi,ye,Bi,gi,wr,Rn,hr,Ae,se,ge,Te,De,Qt,ie,$],encapsulation:2,changeDetection:0})}return r})();var mf=()=>[Ne,se,Le,bi,wt,$],cf=(r,d)=>d.ZoneObjectId;function uf(r,d){r&1&&(e(0,` 2480 `),n(1,"p",5),e(2,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ZONE_MAPPING_HINT"),a(),e(3,` 2481 `))}function _f(r,d){r&1&&(e(0,` 2482 `),R(1,"p-skeleton",6),e(2,` 2483 `),R(3,"p-skeleton",6),e(4,` 2484 `),R(5,"p-skeleton",6),e(6,` 2485 `))}function Ef(r,d){if(r&1&&(e(0,` 2486 `),n(1,"p-message",7),e(2),I(3,"translate"),a(),e(4,` 2487 `)),r&2){let t=m();l(2),K(` 2488 `,t.discoverReason()||y(3,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DISCOVER_ERROR"),` 2489 `)}}function Sf(r,d){r&1&&(e(0,` 2490 `),n(1,"p-message",8),I(2,"translate"),e(3,` 2491 `),a(),e(4,` 2492 `)),r&2&&(l(),p("text",y(2,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.NO_ZONES_FOUND")))}function xf(r,d){r&1&&(e(0,` 2493 `),n(1,"span",21),e(2,"expand_less"),a(),e(3,` 2494 `))}function ff(r,d){r&1&&(e(0,` 2495 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 2496 `))}function hf(r,d){r&1&&(e(0,` 2497 `),n(1,"span",21),e(2,"expand_less"),a(),e(3,` 2498 `))}function Cf(r,d){r&1&&(e(0,` 2499 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 2500 `))}function vf(r,d){if(r&1){let t=b();e(0,` 2501 `),n(1,"div",10),e(2,` 2502 `),n(3,"p",11),e(4),a(),e(5,` 2503 `),n(6,"div",12),e(7,` 2504 `),n(8,"div",13),e(9,` 2505 `),n(10,"div",14),e(11,` 2506 `),n(12,"qware-autocomplete",15),h("selectChange",function(i){E(t);let s=m().$index,c=m(3);return S(c.updateLocations(s,i))}),e(13,` 2507 `),a(),e(14,` 2508 `),a(),e(15,` 2509 `),a(),e(16,` 2510 `),n(17,"div",16),e(18,` 2511 `),n(19,"div",14),e(20,` 2512 `),n(21,"p-floatlabel"),e(22,` 2513 `),n(23,"p-inputnumber",17),h("ngModelChange",function(i){E(t);let s=m().$index,c=m(3);return S(c.updateLeadTime(s,i))}),e(24,` 2514 `),_(25,xf,4,0,"ng-template",null,0,A),e(27,` 2515 `),_(28,ff,4,0,"ng-template",null,1,A),e(30,` 2516 `),a(),e(31,` 2517 `),n(32,"label",18),e(33,` 2518 `),n(34,"span",19),e(35,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.LEAD_TIME"),a(),e(36,` 2519 `),a(),e(37,` 2520 `),a(),e(38,` 2521 `),a(),e(39,` 2522 `),a(),e(40,` 2523 `),n(41,"div",20),e(42,` 2524 `),n(43,"div",14),e(44,` 2525 `),n(45,"p-floatlabel"),e(46,` 2526 `),n(47,"p-inputnumber",17),h("ngModelChange",function(i){E(t);let s=m().$index,c=m(3);return S(c.updateSetback(s,i))}),e(48,` 2527 `),_(49,hf,4,0,"ng-template",null,0,A),e(51,` 2528 `),_(52,Cf,4,0,"ng-template",null,1,A),e(54,` 2529 `),a(),e(55,` 2530 `),n(56,"label",18),e(57,` 2531 `),n(58,"span",19),e(59,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.SETBACK"),a(),e(60,` 2532 `),a(),e(61,` 2533 `),a(),e(62,` 2534 `),a(),e(63,` 2535 `),a(),e(64,` 2536 `),a(),e(65,` 2537 `),a(),e(66,` 2538 `)}if(r&2){let t=m(),o=t.$implicit,i=t.$index,s=m(3);l(4),K(` 2539 `,o.ZoneName,` 2540 `),l(8),p("enablePicker",!0)("nodeIds",s.allEventLocationIds())("allLocations",s.allLocations())("selectedOption",s.getSelectedOptions(i))("forceSelection",!1)("filterByUserAccess",!1)("matchFilterOnParents",!0)("showHierarchyModeSwitch",!0)("elementId","qware.app-settings.integrations.bas-connect.input.zone-location"+i)("labelId","qware.app-settings.integrations.bas-connect.label.zone-location"+i),l(11),p("ngModel",o.LeadTimeMinutes)("min",0)("max",480)("showButtons",!0)("fluid",!0)("id","qware.app-settings.integrations.bas-connect.input.zone-leadtime"+i),l(9),p("id","qware.app-settings.integrations.bas-connect.label.zone-leadtime"+i)("for","qware.app-settings.integrations.bas-connect.input.zone-leadtime"+i),l(15),p("ngModel",o.SetbackMinutes)("min",0)("max",480)("showButtons",!0)("fluid",!0)("id","qware.app-settings.integrations.bas-connect.input.zone-setback"+i),l(9),p("id","qware.app-settings.integrations.bas-connect.label.zone-setback"+i)("for","qware.app-settings.integrations.bas-connect.input.zone-setback"+i)}}function gf(r,d){r&1&&(n(0,"div",22),R(1,"p-skeleton",23),a())}function Tf(r,d){r&1&&(e(0,` 2541 `),_(1,vf,67,27)(2,gf,2,0),Oo(3,1,mf,null,2),Fo(0,-1))}function If(r,d){if(r&1&&(e(0,` 2542 `),n(1,"div",9),e(2,` 2543 `),G(3,Tf,5,0,null,null,cf),a(),e(5,` 2544 `)),r&2){let t=m(2);l(3),k(t.zones())}}
2544function bf(r,d){if(r&1&&(e(0,` 2545 `),_(1,Sf,5,3)(2,If,6,0)),r&2){let t=m();l(),f(t.zones().length===0?1:2)}}var Ws=(()=>{class r{basConnectService=te(Sn);locationService=te(zt);allLocations=ee([]);connectionForm=ee.required();form=ee.required();isLoading=Dt();discoverReason=D("");discoverStatus=D("idle");zones=D([]);allEventLocations=Ye(()=>this.allLocations().filter(o=>o.EventScheduling&&o.Id));allEventLocationIds=Ye(()=>this.allEventLocations().map(o=>o.Id));allEventLocationOptions=Ye(()=>{let t=this.allLocations();return this.allEventLocations().map(o=>({label:this.locationService.getLocationName(o,t),value:o.Id}))});loading=Ye(()=>this.discoverStatus()==="loading");_selectedOptionsCache=new Map;_emptySelectedOptions=[];constructor(){Bn(()=>{let t=this.loading();this.isLoading.emit(t)})}ngOnInit(){let t=this.form();t&&t.length>0&&(this.zones.set(t.controls.map(o=>this.controlToZoneMapping(o))),this.discoverStatus.set("success"))}controlToZoneMapping(t){let o=t.getRawValue(),i=(o.LocationIds??[]).map(s=>(s??"").trim()).filter(s=>s.length>0);return{ZoneObjectId:o.ZoneObjectId??"",ZoneName:o.ZoneName??"",LocationIds:i.join(","),LeadTimeMinutes:o.LeadTimeMinutes??0,SetbackMinutes:o.SetbackMinutes??0}}discoverZones(){let t=this.connectionForm();if(!t||this.loading())return;this.discoverStatus.set("loading"),this.discoverReason.set(""),this.zones.set([]);let o=t.get("Host")?.value,i=t.get("Port")?.value,s=t.get("DeviceInstance")?.value;o&&i&&s&&this.basConnectService.discoverZones(o,i,s).subscribe({next:c=>{if(c.Status==="Success"||c.Zones&&c.Zones.length>0){let u=c.Zones.map(C=>({Id:void 0,ZoneObjectId:C.ZoneObjectId,ZoneName:C.ZoneName,LocationIds:void 0,LeadTimeMinutes:45,SetbackMinutes:15})).sort((C,O)=>(C.ZoneName??"").localeCompare(O.ZoneName??"")),x=this.form();if(x){let C=new Map;x.controls.forEach(F=>{let L=F.get("ZoneObjectId")?.value;L&&C.set(L,F)});let O=[],w=u.map(F=>{if(F.ZoneObjectId&&C.has(F.ZoneObjectId)){let L=C.get(F.ZoneObjectId);return O.push(this.controlToZoneMapping(L)),L}return O.push(F),this.createZoneMappingEntryForm(F)});x.clear({emitEvent:!1}),w.forEach(F=>x.push(F,{emitEvent:!1})),this._selectedOptionsCache.clear(),this.zones.set(O)}this.discoverStatus.set("success")}else this.discoverStatus.set("error"),this.discoverReason.set(c.Reason??c.Status)},error:()=>{this.discoverStatus.set("error"),this.discoverReason.set("An unexpected error occurred.")}})}getSelectedOptions(t){let o=this.form().at(t)?.get("LocationIds")?.value??[],i=this.allEventLocationOptions(),s=[...o].sort().join(` 2546`),c=this._selectedOptionsCache.get(t);if(c&&c.idsKey===s&&c.optionsRef===i)return c.result;if(o.length===0||i.length===0)return this._selectedOptionsCache.set(t,{idsKey:s,optionsRef:i,result:this._emptySelectedOptions}),this._emptySelectedOptions;let u=new Map(i.map(C=>[C.value,C])),x=[];for(let C of o){let O=u.get(C);O&&x.push(O)}return this._selectedOptionsCache.set(t,{idsKey:s,optionsRef:i,result:x}),x}updateLocations(t,o){let i=this.form().at(t).get("LocationIds");if(!i)return;let s=this.extractLocationIds(o),c=i.value??[];this.idsEqual(c,s)||(i.setValue(s),i.markAsDirty())}extractLocationIds(t){return Array.isArray(t)?t.map(o=>o?.value??o?.data?.id??o?.id??"").filter(o=>o.length>0):t&&Array.isArray(t.ids)?t.ids.filter(o=>!!o):t&&typeof t.ids=="string"?t.ids.length>0?[t.ids]:[]:t?.data?.id?[t.data.id]:[]}idsEqual(t,o){if(t.length!==o.length)return!1;let i=[...t].sort(),s=[...o].sort();for(let c=0;c<i.length;c++)if(i[c]!==s[c])return!1;return!0}updateLeadTime(t,o){let i=o??0,s=this.form().at(t).get("LeadTimeMinutes");s?.setValue(i,{emitEvent:!1}),s?.markAsDirty(),this.zones.update(c=>{let u=[...c];return u[t]=ki(Di({},u[t]),{LeadTimeMinutes:i}),u})}updateSetback(t,o){let i=o??0,s=this.form().at(t).get("SetbackMinutes");s?.setValue(i,{emitEvent:!1}),s?.markAsDirty(),this.zones.update(c=>{let u=[...c];return u[t]=ki(Di({},u[t]),{SetbackMinutes:i}),u})}createZoneMappingEntryForm(t){let o=(t?.LocationIds??"").split(",").map(i=>i.trim()).filter(i=>i.length>0);return new ir({ZoneObjectId:new wa(t?.ZoneObjectId??""),ZoneName:new wa(t?.ZoneName??""),LocationIds:new wa(o),LeadTimeMinutes:new wa(t?.LeadTimeMinutes??45),SetbackMinutes:new wa(t?.SetbackMinutes??15)})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-bas-connect-zone-mapping-step"]],inputs:{allLocations:[1,"allLocations"],connectionForm:[1,"connectionForm"],form:[1,"form"]},outputs:{isLoading:"isLoading"},decls:15,vars:7,consts:[["incrementbuttonicon",""],["decrementbuttonicon",""],[1,"bas-zone-mapping-step"],[1,"discover-action"],[3,"onClick","raised","loading","disabled","label"],["translate","",1,"bas-step-hint"],["width","100%","height","10rem"],["severity","error","styleClass","bas-discover-message"],["severity","info","styleClass","bas-discover-message",3,"text"],[1,"zone-list"],[1,"zone-card"],[1,"zone-name"],[1,"grid","zipper",2,"padding","0"],[1,"col-12","field-container"],[1,"medium-input"],["appendTo","body","hierarchySelectionType","hierarchy","label","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.Q_WARE_LOCATIONS",3,"selectChange","enablePicker","nodeIds","allLocations","selectedOption","forceSelection","filterByUserAccess","matchFilterOnParents","showHierarchyModeSwitch","elementId","labelId"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],["suffix"," min","variant","filled",1,"is-filled",3,"ngModelChange","ngModel","min","max","showButtons","fluid","id"],[3,"id","for"],["translate",""],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],[1,"material-icons"],[1,"col-12","lg:col-6","md:col-6"],["height","4rem"]],template:function(o,i){if(o&1&&(n(0,"div",2),e(1,` 2547 `),n(2,"div",3),e(3,`
2548 `),n(4,"p-button",4),I(5,"translate"),h("onClick",function(){return i.discoverZones()}),e(6,` 2549 `),a(),e(7,` 2550 `),a(),e(8,` 2551 2552 `),_(9,uf,4,0)(10,_f,7,0)(11,Ef,5,3)(12,bf,3,1),e(13,` 2553`),a(),e(14,` 2554`)),o&2){let s;l(4),p("raised",!0)("loading",i.loading())("disabled",!i.connectionForm()||i.loading())("label",y(5,5,i.loading()?"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DISCOVERING_ZONES":"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.DISCOVER_ZONES")),l(5),f((s=i.discoverStatus())==="idle"?9:s==="loading"?10:s==="error"?11:s==="success"?12:-1)}},dependencies:[vi,oe,Ii,An,Ua,Bi,gi,wr,Mr,Fr,Wa,Qt,ie,$],styles:[".bas-zone-mapping-step[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:1rem 1.5rem}.bas-zone-mapping-step[_ngcontent-%COMP%] .bas-step-hint[_ngcontent-%COMP%], .bas-zone-mapping-step[_ngcontent-%COMP%] .bas-discover-message[_ngcontent-%COMP%]{margin:0}.bas-zone-mapping-step[_ngcontent-%COMP%] .zone-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.bas-zone-mapping-step[_ngcontent-%COMP%] .zone-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;padding:.75rem;border-radius:var(--p-card-border-radius);border:1px solid var(--p-surface-400)}.bas-zone-mapping-step[_ngcontent-%COMP%] .zone-card[_ngcontent-%COMP%] .zone-name[_ngcontent-%COMP%]{font-weight:500;font-size:var(--p-font-size-header5)}.bas-zone-mapping-step[_ngcontent-%COMP%] .zone-card.zone-card-placeholder[_ngcontent-%COMP%]{min-height:12rem}"],changeDetection:0})}return r})();function yf(r,d){r&1&&(e(0,` 2555 `),n(1,"i",27),e(2,"expand_more"),a(),e(3,` 2556 `))}function Af(r,d){r&1&&(e(0,` 2557 `),n(1,"i",27),e(2,"expand_more"),a(),e(3,` 2558 `))}function Rf(r,d){r&1&&(e(0,` 2559 `),n(1,"i",27),e(2,"expand_more"),a(),e(3,` 2560 `))}var js=(()=>{class r{categoryOptions=ee([]);calendarOptionsMap=ee(new Map);form=ee.required();
2560intervalOptions=ee([]);subscription=ee(null);calendarOptions=D([]);subs=new Vi;urlPattern=/^https?:\/\/.+/;ngOnInit(){let t=this.form();if(!t)return;let o=t.controls.CategoryId.value;o&&this.calendarOptions.set(this.calendarOptionsMap().get(o)??[]),this.subs.add(t.controls.CategoryId.valueChanges.subscribe(i=>{let s=i?this.calendarOptionsMap().get(i)??[]:[];this.calendarOptions.set(s);let c=t.controls.CalendarId;c.setValue(s.length===1?s[0].value??null:null),i?c.enable():c.disable()}))}ngOnDestroy(){this.subs.unsubscribe()}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-ical-config-step"]],inputs:{categoryOptions:[1,"categoryOptions"],calendarOptionsMap:[1,"calendarOptionsMap"],form:[1,"form"],intervalOptions:[1,"intervalOptions"],subscription:[1,"subscription"]},decls:168,vars:65,consts:[[1,"grid","zipper","flex-inline",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["pInputText","","id","qware.app-settings.integrations.ical.config.input.name","formControlName","Name","variant","filled",3,"fluid"],["for","qware.app-settings.integrations.ical.config.input.name"],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.integrations.ical.config.input.name.error-required",3,"hidden"],["id","qware.app-settings.integrations.ical.config.input.name.error-maxlength",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["pInputText","","id","qware.app-settings.integrations.ical.config.input.url","formControlName","Url","variant","filled",3,"fluid"],["for","qware.app-settings.integrations.ical.config.input.url"],["id","qware.app-settings.integrations.ical.config.input.url.error-required",3,"hidden"],["id","qware.app-settings.integrations.ical.config.input.url.error-maxlength",3,"hidden"],["id","qware.app-settings.integrations.ical.config.input.url.error-pattern",3,"hidden"],["id","qware.app-settings.integrations.ical.config.dropdown.category","formControlName","CategoryId","variant","filled",3,"options","fluid"],["pTemplate","dropdownicon"],["for","qware.app-settings.integrations.ical.config.dropdown.category"],["id","qware.app-settings.integrations.ical.config.dropdown.category.error-required",3,"hidden"],["id","qware.app-settings.integrations.ical.config.dropdown.calendar","formControlName","CalendarId","variant","filled",3,"options","fluid"],["for","qware.app-settings.integrations.ical.config.dropdown.calendar"],["id","qware.app-settings.integrations.ical.config.dropdown.calendar.error-required",3,"hidden"],["id","qware.app-settings.integrations.ical.config.dropdown.interval","formControlName","Interval","variant","filled",3,"options","fluid"],["for","qware.app-settings.integrations.ical.config.dropdown.interval"],["id","qware.app-settings.integrations.ical.config.dropdown.interval.error-required",3,"hidden"],[1,"medium-input","flex-inline","flex-space-between"],["formControlName","IncludeWhenConflictChecking","id","qware.app-settings.integrations.ical.config.checkbox.conflict-checking",3,"binary"],[1,"material-icons"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 2561 `),e(2,` 2562 `),n(3,"div",1),e(4,` 2563 `),n(5,"div",2),e(6,` 2564 `),n(7,"p-floatlabel"),e(8,` 2565 `),R(9,"input",3),e(10,` 2566 `),n(11,"label",4),e(12),I(13,"translate"),n(14,"span",5),e(15,"*"),a(),e(16,` 2567 `),a(),e(17,` 2568 `),a(),e(18,` 2569 `),n(19,"small",6),e(20,` 2570 `),n(21,"div",7),e(22),I(23,"translate"),a(),e(24,` 2571 `),n(25,"div",8),e(26),I(27,"translate"),a(),e(28,` 2572 `),a(),e(29,` 2573 `),a(),e(30,` 2574 `),a(),e(31,` 2575 `),e(32,` 2576 `),n(33,"div",9),e(34,` 2577 `),n(35,"div",2),e(36,` 2578 `),n(37,"p-floatlabel"),e(38,` 2579 `),R(39,"input",10),e(40,` 2580 `),n(41,"label",11),e(42),I(43,"translate"),n(44,"span",5),e(45,"*"),a(),e(46,` 2581 `),a(),e(47,` 2582 `),a(),e(48,` 2583 `),n(49,"small",6),e(50,` 2584 `),n(51,"div",12),e(52),I(53,"translate"),a(),e(54,` 2585 `),n(55,"div",13),e(56),I(57,"translate"),a(),e(58,` 2586 `),n(59,"div",14),e(60),I(61,"translate"),a(),e(62,` 2587 `),a(),e(63,` 2588 `),a(),e(64,` 2589 `),a(),e(65,` 2590 `),e(66,` 2591 `),n(67,"div",1),e(68,` 2592 `),n(69,"div",2),e(70,` 2593 `),n(71,"p-floatlabel"),e(72,` 2594 `),n(73,"p-select",15),e(74,` 2595 `),_(75,yf,4,0,"ng-template",16),e(76,` 2596 `),a(),e(77,` 2597 `),n(78,"label",17),e(79),I(80,"translate"),n(81,"span",5),e(82,"*"),a(),e(83,` 2598 `),a(),e(84,` 2599 `),a(),e(85,` 2600 `),n(86,"small",6),e(87,` 2601 `),n(88,"div",18),e(89),I(90,"translate"),a(),e(91,` 2602 `),a(),e(92,` 2603 `),a(),e(93,` 2604 `),a(),e(94,` 2605 `),e(95,` 2606 `),n(96,"div",9),e(97,` 2607 `),n(98,"div",2),e(99,` 2608 `),n(100,"p-floatlabel"),e(101,` 2609 `),n(102,"p-select",19),e(103,` 2610 `),_(104,Af,4,0,"ng-template",16),e(105,` 2611 `),a(),e(106,` 2612 `),n(107,"label",20),e(108),I(109,"translate"),n(110,"span",5),e(111,"*"),a(),e(112,` 2613 `),a(),e(113,` 2614 `),a(),e(114,` 2615 `),n(115,"small",6),e(116,` 2616 `),n(117,"div",21),e(118),I(119,"translate"),a(),e(120,` 2617 `),a(),e(121,` 2618 `),a(),e(122,` 2619 `),a(),e(123,` 2620 `),e(124,` 2621 `),n(125,"div",1),e(126,` 2622 `),n(127,"div",2),e(128,` 2623 `),n(129,"p-floatlabel"),e(130,` 2624 `),n(131,"p-select",22),e(132,` 2625 `),_(133,Rf,4,0,"ng-template",16),e(134,` 2626 `),a(),e(135,` 2627 `),n(136,"label",23),e(137),I(138,"translate"),n(139,"span",5),e(140,"*"),a(),e(141,` 2628 `),a(),e(142,` 2629 `),a(),e(143,` 2630 `),n(144,"small",6),e(145,` 2631 `),n(146,"div",24),e(147),I(148,"translate"),a(),e(149,` 2632 `),a(),e(150,` 2633 `),a(),e(151,` 2634 `),a(),e(152,` 2635 `),e(153,` 2636 `),n(154,"div",9),e(155,` 2637 `),n(156,"div",25),e(157,` 2638 `),n(158,"label"),e(159),I(160,"translate"),a(),e(161,` 2639 `),n(162,"p-checkbox",26),e(163,` 2640 `),a(),e(164,` 2641 `),a(),e(165,` 2642 `),a(),e(166,` 2643`),a(),e(167,` 2644`)),o&2){let s,c,u,x,C,O,w,F;p("formGroup",i.form()),l(9),p("fluid",!0),l(3),K(` 2645 `,y(13,37,"APP_SETTINGS.INTEGRATIONS.NAME")," "),l(7),p("hidden",i.form().controls.Name.valid||i.form().controls.Name.untouched),l(2),p("hidden",!((s=i.form().controls.Name.errors)!=null&&s.required)),l(),K(` 2646 `,y(23,39,"APP_SETTINGS.INTEGRATIONS.NAME_REQUIRED"),` 2647 `),l(3),p("hidden",!((c=i.form().controls.Name.errors)!=null&&c.maxlength)||!!((c=i.form().controls.Name.errors)!=null&&c.required)),l(),K(` 2648 `,y(27,41,"APP_SETTINGS.INTEGRATIONS.NAME_MAX_LENGTH"),` 2649 `),l(13),p("fluid",!0),l(3),K(` 2650 `,y(43,43,"APP_SETTINGS.INTEGRATIONS.ICAL_URL")," "),l(7),p("hidden",i.form().controls.Url.valid||i.form().controls.Url.untouched),l(2),p("hidden",!((u=i.form().controls.Url.errors)!=null&&u.required)),l(),K(` 2651 `,y(53,45,"APP_SETTINGS.INTEGRATIONS.ICAL_URL_REQUIRED"),` 2652 `),l(3),p("hidden",!((x=i.form().controls.Url.errors)!=null&&x.maxlength)||!!((x=i.form().controls.Url.errors)!=null&&x.required)),l(),K(` 2653 `,y(57,47,"APP_SETTINGS.INTEGRATIONS.ICAL_URL_MAX_LENGTH"),` 2654 `),l(3),p("hidden",!((C=i.form().controls.Url.errors)!=null&&C.pattern)),l(),K(` 2655 `,y(61,49,"APP_SETTINGS.INTEGRATIONS.ICAL_URL_PATTERN"),` 2656 `),l(13),p("options",i.categoryOptions())("fluid",!0),l(6),K(` 2657 `,y(80,51,"APP_SETTINGS.INTEGRATIONS.CATEGORY")," "),l(7),p("hidden",i.form().controls.CategoryId.valid||i.form().controls.CategoryId.untouched),l(2),p("hidden",!((O=i.form().controls.CategoryId.errors)!=null&&O.required)),l(),K(` 2658 `,y(90,53,"APP_SETTINGS.INTEGRATIONS.CATEGORY_REQUIRED"),` 2659 `),l(13),p("options",i.calendarOptions())("fluid",!0),l(6),K(` 2660 `,y(109,55,"APP_SETTINGS.INTEGRATIONS.CALENDAR")," "),l(7),p("hidden",i.form().controls.CalendarId.valid||i.form().controls.CalendarId.untouched),l(2),p("hidden",!((w=i.form().controls.CalendarId.errors)!=null&&w.required)),l(),K(` 2661 `,y(119,57,"APP_SETTINGS.INTEGRATIONS.CALENDAR_REQUIRED"),` 2662 `),l(13),p("options",i.intervalOptions())("fluid",!0),l(6),K(` 2663 `,y(138,59,"APP_SETTINGS.INTEGRATIONS.CACHE_INTERVAL")," "),l(7),p("hidden",i.form().controls.Interval.valid||i.form().controls.Interval.untouched),l(2),p("hidden",!((F=i.form().controls.Interval.errors)!=null&&F.required)),l(),K(` 2664 `,y(148,61,"APP_SETTINGS.INTEGRATIONS.CACHE_INTERVAL_REQUIRED"),` 2665 `),l(12),v(y(160,63,"APP_SETTINGS.INTEGRATIONS.INCLUDE_WHEN_CONFLICT_CHECKING")),l(3),p("binary",!0)}},dependencies:[Na,yt,Pe,Ii,Ne,An,Ae,se,ge,Hi,ye,Rn,Te,De,ea,it,Qt,ie],encapsulation:2,changeDetection:0})}return r})();var Dl=He(Hn());var wf=()=>({"margin-bottom":"1rem"}),Df=()=>({standalone:!0}),Fp=()=>[],Lf=r=>({count:r}),Mp=()=>["0"],Nf=()=>[15,25,50],Up=(r,d)=>({zoneName:r,locationName:d}),Of=(r,d)=>d.id,Ff=(r,d)=>d.value,Mf=(r,d)=>d.Id,Uf=(r,d)=>d.label;function Pf(r,d){r&1&&(e(0,` 2666 `),n(1,"i",9),e(2,"add"),a(),e(3,` 2667 `),n(4,"span",10),e(5),I(6,"translate"),a(),e(7,` 2668 `)),r&2&&(l(5),v(y(6,1,"APP_SETTINGS.INTEGRATIONS.CREATE_INTEGRATION")))}
2668function Gf(r,d){if(r&1){let t=b();e(0,` 2669 `),e(1,` 2670 `),n(2,"div",7),e(3,` 2671 `),n(4,"p-button",8),h("onClick",function(){E(t);let i=m();return S(i.addIntegration())}),e(5,` 2672 `),_(6,Pf,8,3,"ng-template",null,0,A),e(8,` 2673 `),a(),e(9,` 2674 `),a(),e(10,` 2675 `)}if(r&2){let t=m();l(4),p("raised",!0)("disabled",t.integrationTypes().size===0)}}function kf(r,d){r&1&&(e(0,` 2676 `),R(1,"p-stepper-separator",21),e(2,` 2677 `))}function Vf(r,d){if(r&1){let t=b();e(0,` 2678 `),n(1,"button",18),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 2679 `),n(3,"span",19),e(4),a(),e(5,` 2680 `),n(6,"span",20),e(7),I(8,"translate"),a(),e(9,` 2681 `),a(),e(10,` 2682 `),_(11,kf,3,0)}if(r&2){let t=m(),o=t.$implicit,i=t.$index,s=t.$count;l(4),v(o.value+1),l(3),v(y(8,3,o.label)),l(4),f(i!==s-1?11:-1)}}function qf(r,d){if(r&1&&(e(0,` 2683 `),n(1,"p-step",17),e(2,` 2684 `),_(3,Vf,12,5,"ng-template",null,0,A),e(5,` 2685 `),a(),e(6,` 2686 `)),r&2){let t=d.$implicit,o=m(3);l(),ve("p-disabled",t.value>o.currentStep()),p("value",t.value)}}function Bf(r,d){if(r&1&&(e(0,` 2687 `),n(1,"p-step-list"),e(2,` 2688 `),G(3,qf,7,3,null,null,Ff),a(),e(5,` 2689 `)),r&2){let t=m(2);l(3),k(t.steps())}}function Hf(r,d){if(r&1){let t=b();e(0,` 2690 `),n(1,"div",22),e(2,` 2691 `),n(3,"div",23),e(4,` 2692 `),n(5,"i",9),e(6),a(),e(7,` 2693 `),a(),e(8,` 2694 `),n(9,"div",24),e(10),a(),e(11,` 2695 `),n(12,"div",25),e(13),a(),e(14,` 2696 `),n(15,"p-button",26),I(16,"translate"),h("onClick",function(){let i=E(t).$implicit,s=m(2);return S(s.selectIntegrationType(i))}),e(17,` 2697 `),a(),e(18,` 2698 `),a(),e(19,` 2699 `)}if(r&2){let t=d.$implicit,o=m(2);l(6),v(t.icon),l(4),v(t.name),l(3),v(t.description),l(2),p("label",y(16,7,"APP_SETTINGS.INTEGRATIONS.CONNECT"))("fluid",!0)("disabled",o.isTypeAtCapacity(t))("id","qware.app-settings.integrations.type."+t.id)}}function Wf(r,d){r&1&&(e(0,` 2700 `),n(1,"div",27),e(2),I(3,"translate"),a(),e(4,` 2701 `)),r&2&&(l(2),v(y(3,1,"APP_SETTINGS.INTEGRATIONS.NO_INTEGRATIONS_FOUND")))}function jf(r,d){r&1&&xr(0)}function Yf(r,d){if(r&1&&(e(0,` 2702 `),_(1,jf,1,0,"ng-container",28),e(2,` 2703 `)),r&2){let t=m(2);l(),p("ngComponentOutlet",t.currentStepComponent())("ngComponentOutletInputs",t.stepComponentInputs())}}function Qf(r,d){if(r&1){let t=b();e(0,` 2704 `),n(1,"p-stepper",11),h("valueChange",function(i){E(t);let s=m();return S(s.onStepperChange(i))}),e(2,` 2705 `),_(3,Bf,6,0),n(4,"p-step-panels"),e(5,` 2706 `),e(6,` 2707 `),n(7,"div",12),e(8,` 2708 `),n(9,"div",13),e(10,` 2709 `),n(11,"input",14),I(12,"translate"),h("input",function(i){E(t);let s=m();return S(s.onIntegrationTypeSearch(i))}),a(),e(13,` 2710 `),a(),e(14,` 2711 `),n(15,"div",15),e(16,` 2712 `),G(17,Hf,20,9,null,null,Of),_(19,Wf,5,3),a(),e(20,` 2713 `),a(),e(21,` 2714 `),e(22,` 2715 `),n(23,"div",16),e(24,` 2716 `),_(25,Yf,3,2),a(),e(26,` 2717 `),a(),e(27,` 2718 `),a(),e(28,` 2719 `)}if(r&2){let t=m();l(),Pt(ne(13,wf)),p("value",t.currentStep()),l(2),f(t.steps().length>1?3:-1),l(4),p("hidden",t.currentStep()!==0),l(4),p("placeholder",y(12,11,"APP_SETTINGS.INTEGRATIONS.SEARCH_INTEGRATIONS"))("fluid",!0)("value",t.integrationTypeSearch()),l(6),k(t.filteredIntegrationTypes()),l(2),f(t.filteredIntegrationTypes().length===0?19:-1),l(4),p("hidden",t.currentStep()===0),l(2),f(t.currentStepComponent()?25:-1)}}function Kf(r,d){if(r&1&&(e(0,` 2720 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 2721 `)),r&2){let t,o=m(2).$implicit,i=m(2);
2721l(2),qi("",o.Name," (",y(3,2,(t=i.integrationTypes().get(o.Type))==null?null:t.name),")")}}function $f(r,d){if(r&1&&(e(0,` 2722 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 2723 `)),r&2){let t,o=m(2).$implicit,i=m(2);l(2),v(y(3,1,(t=i.integrationTypes().get(o.Type))==null?null:t.name))}}function zf(r,d){if(r&1&&(e(0,` 2724 `),R(1,"p-tag",38),I(2,"translate"),e(3,` 2725 `)),r&2){let t=d.$implicit;l(),p("severity",t.severity)("value",y(2,2,t.label))}}function Xf(r,d){if(r&1&&(e(0,` 2726 `),G(1,zf,4,4,null,null,Uf)),r&2){let t=m(4);l(),k(t.basBadges())}}function Zf(r,d){if(r&1){let t=b();e(0,` 2727 `),n(1,"p-tag",39),I(2,"translate"),h("click",function(){E(t);let i=m();return S(i.onClick==null?null:i.onClick())}),e(3,` 2728 `),a(),e(4,` 2729 `)}if(r&2){let t=m(),o=m(2).$implicit;l(),p("severity",t.severity)("value",$e(2,3,t.labelKey,pe(6,Lf,t.count())))("id","qware.app-settings.integrations.alert-badge."+o.Id)}}function Jf(r,d){r&1&&(e(0,` 2730 `),_(1,Zf,5,8)),r&2&&(l(),f(d.count()>0?1:-1))}function eh(r,d){if(r&1&&(e(0,` 2731 `),n(1,"div",40),e(2,` 2732 `),n(3,"i",41),e(4,"error_outline"),a(),e(5,` 2733 `),n(6,"span",42),e(7),I(8,"translate"),a(),e(9,` 2734 `),a(),e(10,` 2735 `)),r&2){let t=m(2).$implicit;l(),p("id","qware.app-settings.integrations.sync-failure-warning."+t.Id),l(6),v(y(8,2,"APP_SETTINGS.INTEGRATIONS.SYNC_FAILURE_WARNING"))}}function th(r,d){if(r&1){let t=b();e(0,` 2736 `),n(1,"p-button",43),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.onConfigAction(i))}),e(2,` 2737 `),n(3,"i",9),e(4,"settings"),a(),e(5,` 2738 `),a(),e(6,` 2739 `)}if(r&2){let t=m(3).$implicit;l(),p("text",!0)("rounded",!0)("id","qware.app-settings.integrations.button.config."+t.Id)}}function ih(r,d){if(r&1){let t=b();e(0,` 2740 `),n(1,"p-button",43),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.onLogAction(i))}),e(2,` 2741 `),n(3,"i",9),e(4,"insert_chart"),a(),e(5,` 2742 `),a(),e(6,` 2743 `)}if(r&2){let t=m(3).$implicit;l(),p("text",!0)("rounded",!0)("id","qware.app-settings.integrations.button.history."+t.Id)}}function nh(r,d){if(r&1){let t=b();e(0,` 2744 `),n(1,"p-button",44),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.onSyncAction(i))}),e(2,` 2745 `),n(3,"i",45),e(4,"cached"),a(),e(5,` 2746 `),a(),e(6,` 2747 `)}if(r&2){let t=m(3).$implicit,o=m(2);l(),p("text",!0)("rounded",!0)("disabled",o.syncingIds().has(t.Id)||t.State!=="ACTIVE")("id","qware.app-settings.integrations.button.sync."+t.Id),l(2),ve("spin",o.syncingIds().has(t.Id))}}function ah(r,d){if(r&1){let t=b();e(0,` 2748 `),n(1,"p-button",43),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.onDeleteAction(i))}),e(2,` 2749 `),n(3,"i",9),e(4,"delete"),a(),e(5,` 2750 `),a(),e(6,` 2751 `)}if(r&2){let t=m(3).$implicit;l(),p("text",!0)("rounded",!0)("id","qware.app-settings.integrations.button.delete."+t.Id)}}function rh(r,d){if(r&1&&(e(0,` 2752 `),_(1,th,7,3)(2,ih,7,3)(3,nh,7,6)(4,ah,7,3),e(5,` 2753 `)),r&2){let t,o=d.$implicit;l(),f((t=o)==="config"?1:t==="log"?2:t==="sync"?3:t==="delete"?4:-1)}}function oh(r,d){r&1&&(e(0,` 2754 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2755 `))}function lh(r,d){r&1&&(e(0,` 2756 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2757 `))}function sh(r,d){if(r&1&&(e(0,` 2758 `),_(1,oh,4,0)(2,lh,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function dh(r,d){r&1&&(e(0,` 2759 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2760 `))}function ph(r,d){r&1&&(e(0,` 2761 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2762 `))}function mh(r,d){if(r&1&&(e(0,` 2763 `),_(1,dh,4,0)(2,ph,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function ch(r,d){r&1&&(e(0,` 2764 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2765 `))}function uh(r,d){r&1&&(e(0,` 2766 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2767 `))}function _h(r,d){if(r&1&&(e(0,` 2768 `),_(1,ch,4,0)(2,uh,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Eh(r,d){r&1&&(e(0,` 2769 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2770 `))}function Sh(r,d){r&1&&(e(0,` 2771 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2772 `))}function xh(r,d){if(r&1&&(e(0,` 2773 `),_(1,Eh,4,0)(2,Sh,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function fh(r,d){if(r&1){let t=b();e(0,` 2774 `),n(1,"p-accordion",46),e(2,` 2775 `),n(3,"p-accordion-panel",47),e(4,` 2776 `),n(5,"p-accordion-header"),e(6),I(7,"translate"),_(8,sh,3,1,"ng-template",null,1,A),e(10,` 2777 `),a(),e(11,` 2778 `),n(12,"p-accordion-content"),e(13,` 2779 `),n(14,"div",48),e(15,` 2780 `),n(16,"qware-bas-connect-connection-step",49),h("testCompleted",function(i){E(t);let s=m(6);return S(s.onBasAgentTestCompleted(i))}),e(17,` 2781 `),a(),e(18,` 2782 `),n(19,"div",2),e(20,` 2783 `),n(21,"div",50),e(22,` 2784 `),n(23,"p-button",51),I(24,"translate"),h("onClick",function(){E(t);let i=m(6);return S(i.saveBasConnectSettings())}),e(25,` 2785 `),a(),e(26,` 2786 `),a(),e(27,` 2787 `),a(),e(28,` 2788 `),a(),e(29,` 2789 `),a(),e(30,` 2790 `),a(),e(31,` 2791 `),n(32,"p-accordion-panel",52),e(33,` 2792 `),n(34,"p-accordion-header"),e(35),I(36,"translate"),_(37,mh,3,1,"ng-template",null,1,A),e(39,` 2793 `),a(),e(40,` 2794 `),n(41,"p-accordion-content"),e(42,`
2795 `),n(43,"div",48),e(44,` 2796 `),n(45,"qware-bas-agent-token-panel",53),h("isLoading",function(i){E(t);let s=m(6);return S(s.displaySpinner.set(i))}),a(),e(46,` 2797 `),a(),e(47,` 2798 `),a(),e(48,` 2799 `),a(),e(49,` 2800 `),n(50,"p-accordion-panel",54),e(51,` 2801 `),n(52,"p-accordion-header"),e(53),I(54,"translate"),_(55,_h,3,1,"ng-template",null,1,A),e(57,` 2802 `),a(),e(58,` 2803 `),n(59,"p-accordion-content"),e(60,` 2804 `),n(61,"div",48),e(62,` 2805 `),n(63,"qware-bas-connect-zone-mapping-step",55),h("isLoading",function(i){E(t);let s=m(6);return S(s.displaySpinner.set(i))}),e(64,` 2806 `),a(),e(65,` 2807 `),n(66,"div",2),e(67,` 2808 `),n(68,"div",50),e(69,` 2809 `),n(70,"p-button",51),I(71,"translate"),h("onClick",function(){E(t);let i=m(6);return S(i.saveBasZoneMappings())}),e(72,` 2810 `),a(),e(73,` 2811 `),a(),e(74,` 2812 `),a(),e(75,` 2813 `),a(),e(76,` 2814 `),a(),e(77,` 2815 `),a(),e(78,` 2816 `),n(79,"p-accordion-panel",56),e(80,` 2817 `),n(81,"p-accordion-header"),e(82),I(83,"translate"),_(84,xh,3,1,"ng-template",null,1,A),e(86,` 2818 `),a(),e(87,` 2819 `),n(88,"p-accordion-content"),e(89,` 2820 `),n(90,"div",48),e(91,` 2821 `),n(92,"div",57),e(93,` 2822 `),n(94,"qware-bas-connect-capacity-step",58),e(95,` 2823 `),a(),e(96,` 2824 `),a(),e(97,` 2825 `),n(98,"div",2),e(99,` 2826 `),n(100,"div",50),e(101,` 2827 `),n(102,"p-button",51),I(103,"translate"),h("onClick",function(){E(t);let i=m(6);return S(i.saveBasCapacitySettings())}),e(104,` 2828 `),a(),e(105,` 2829 `),a(),e(106,` 2830 `),a(),e(107,` 2831 `),a(),e(108,` 2832 `),a(),e(109,` 2833 `),a(),e(110,` 2834 `),a(),e(111,` 2835 `)}if(r&2){let t=d,o=m(4).$implicit,i=m(2);l(),p("dt",i.accordion)("multiple",!0)("value",ne(43,Mp)),l(2),p("id","qware.app-settings.integrations.bas.connection-shade."+o.Id),l(3),K(` 2836 `,y(7,29,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_CONNECTION"),` 2837 `),l(10),p("form",t.controls.Connection),l(7),p("text",!0)("id","qware.app-settings.integrations.bas.connect.button.save."+o.Id)("disabled",t.controls.Connection.invalid||!t.controls.Connection.dirty||i.displaySpinner())("label",y(24,31,"APP_SETTINGS.INTEGRATIONS.SAVE")),l(9),p("id","qware.app-settings.integrations.bas.agent-token-shade."+o.Id),l(3),K(` 2838 `,y(36,33,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.AGENT_TOKEN.TITLE"),` 2839 `),l(15),p("id","qware.app-settings.integrations.bas.zone-mapping-shade."+o.Id),l(3),K(` 2840 `,y(54,35,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_ZONE_MAPPINGS"),` 2841 `),l(10),p("allLocations",i.allLocations())("connectionForm",t.controls.Connection)("form",t.controls.ZoneMappings),l(7),p("text",!0)("id","qware.app-settings.integrations.bas.zone-mappings.button.save."+o.Id)("disabled",t.controls.ZoneMappings.invalid||!t.controls.ZoneMappings.dirty)("label",y(71,37,"APP_SETTINGS.INTEGRATIONS.SAVE")),l(9),p("id","qware.app-settings.integrations.bas.capacity-shade."+o.Id),l(3),K(` 2842 `,y(83,39,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_CAPACITY"),` 2843 `),l(12),p("form",t.controls.Capacity)("users",i.basNotificationUsers()),l(8),p("text",!0)("id","qware.app-settings.integrations.bas.capacity.button.save."+o.Id)("disabled",t.controls.Capacity.invalid||!t.controls.Capacity.dirty||i.displaySpinner())("label",y(103,41,"APP_SETTINGS.INTEGRATIONS.SAVE"))}}function hh(r,d){if(r&1&&(e(0,` 2844 `),_(1,fh,112,44)),r&2){let t,o=m(3).$implicit,i=m(2);l(),f((t=i.asBasIntegrationForm(o.Id))?1:-1,t)}}function Ch(r,d){r&1&&(e(0,` 2845 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2846 `))}function vh(r,d){r&1&&(e(0,` 2847 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2848 `))}function gh(r,d){if(r&1&&(e(0,` 2849 `),_(1,Ch,4,0)(2,vh,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Th(r,d){if(r&1){let t=b();e(0,` 2850 `),n(1,"div",57),e(2,` 2851 `),n(3,"qware-ical-config-step",65),e(4,` 2852 `),a(),e(5,` 2853 `),a(),e(6,` 2854 `),n(7,"div",2),e(8,` 2855 `),n(9,"div",50),e(10,` 2856 `),n(11,"p-button",51),I(12,"translate"),h("onClick",function(){E(t);let i=m(4).$implicit,s=m(2);
2856return S(s.saveEditSubscription(s.asICalSubscription(i)))}),e(13,` 2857 `),a(),e(14,` 2858 `),a(),e(15,` 2859 `),a(),e(16,` 2860 `)}if(r&2){let t=d,o=m(4).$implicit,i=m(2);l(3),p("form",t)("categoryOptions",i.eventCategoryOptions())("calendarOptionsMap",i.allCalendarsMap())("intervalOptions",i.intervalOptions())("subscription",i.asICalSubscription(o)),l(8),p("text",!0)("id","qware.app-settings.integrations.config.button.save."+o.Id)("disabled",t.invalid||!t.dirty)("label",y(12,9,"APP_SETTINGS.INTEGRATIONS.SAVE"))}}function Ih(r,d){r&1&&(e(0,` 2861 `),n(1,"i",9),e(2,"expand_less"),a(),e(3,` 2862 `))}function bh(r,d){r&1&&(e(0,` 2863 `),n(1,"i",9),e(2,"expand_more"),a(),e(3,` 2864 `))}function yh(r,d){if(r&1&&(e(0,` 2865 `),_(1,Ih,4,0)(2,bh,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Ah(r,d){r&1&&(e(0,` 2866 `),n(1,"i",9),e(2,"add"),a(),e(3,` 2867 `),n(4,"span",66),e(5,"APP_SETTINGS.INTEGRATIONS.ADD_MAPPING"),a(),e(6,` 2868 `))}function Rh(r,d){r&1&&(e(0,` 2869 `),n(1,"tr"),e(2,` 2870 `),n(3,"th",67),e(4,"APP_SETTINGS.INTEGRATIONS.ICAL_LOCATION_NAME"),a(),e(5,` 2871 `),n(6,"th",67),e(7,"APP_SETTINGS.INTEGRATIONS.MAPPED_LOCATION"),a(),e(8,` 2872 `),R(9,"th",68),e(10,` 2873 `),a(),e(11,` 2874 `))}function wh(r,d){if(r&1){let t=b();e(0,` 2875 `),n(1,"tr"),e(2,` 2876 `),n(3,"td",69),e(4,` 2877 `),n(5,"input",70),j("ngModelChange",function(i){let s=E(t).$implicit;return W(s.IcalLocationName,i)||(s.IcalLocationName=i),S(i)}),h("ngModelChange",function(){E(t);let i=m(4).$implicit,s=m(2);return S(s.onMappingIcalNameChanged(i.Id))}),a(),e(6,` 2878 `),a(),e(7,` 2879 `),n(8,"td",71),e(9,` 2880 `),n(10,"qware-autocomplete",72),h("selectChange",function(i){let s=E(t).$implicit,c=m(4).$implicit,u=m(2);return S(u.onMappingLocationChanged(s,c.Id,i))}),e(11,` 2881 `),a(),e(12,` 2882 `),a(),e(13,` 2883 `),n(14,"td",68),e(15,` 2884 `),n(16,"p-button",73),h("onClick",function(){let i=E(t).rowIndex,s=m(4).$implicit,c=m(2);return S(c.removeMapping(c.asICalSubscription(s),i))}),e(17,` 2885 `),n(18,"i",9),e(19,"close"),a(),e(20,` 2886 `),a(),e(21,` 2887 `),a(),e(22,` 2888 `),a(),e(23,` 2889 `)}if(r&2){let t=d.$implicit,o=d.rowIndex,i=m(4).$implicit,s=m(2);l(5),p("fluid",!0),H("ngModel",t.IcalLocationName),l(5),p("enablePicker",!0)("singleSelect",!0)("nodeIds",s.allEventLocationIds())("allLocations",s.allLocations())("selectedOption",s.getMappingSelectedOption(t))("filterByUserAccess",!1)("matchFilterOnParents",!0)("isRequired",!1)("id","qware.app-settings.integrations.mappings.autocomplete"+o+"."+i.Id),l(6),p("rounded",!0)("text",!0)}}function Dh(r,d){r&1&&(e(0,` 2890 `),n(1,"tr"),e(2,` 2891 `),n(3,"td",74),e(4,` 2892 `),n(5,"div",75),e(6,"SHARED.RECORDS_NOT_FOUND"),a(),e(7,` 2893 `),a(),e(8,` 2894 `),a(),e(9,` 2895 `))}function Lh(r,d){if(r&1){let t=b();e(0,` 2896 `),n(1,"p-accordion",46),e(2,` 2897 `),n(3,"p-accordion-panel",47),e(4,` 2898 `),n(5,"p-accordion-header"),e(6),I(7,"translate"),_(8,gh,3,1,"ng-template",null,1,A),e(10,` 2899 `),a(),e(11,` 2900 `),n(12,"p-accordion-content"),e(13,` 2901 `),n(14,"div",48),e(15,` 2902 `),_(16,Th,17,11),a(),e(17,` 2903 `),a(),e(18,` 2904 `),a(),e(19,` 2905 `),n(20,"p-accordion-panel",52),e(21,` 2906 `),n(22,"p-accordion-header"),e(23),I(24,"translate"),_(25,yh,3,1,"ng-template",null,1,A),e(27,` 2907 `),a(),e(28,` 2908 `),n(29,"p-accordion-content"),e(30,` 2909 `),n(31,"div",48),e(32,` 2910 `),n(33,"div",59),e(34,`
2911 `),n(35,"div",7),e(36,` 2912 `),n(37,"p-button",60),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.addMapping(s.asICalSubscription(i)))}),e(38,` 2913 `),_(39,Ah,7,0,"ng-template",null,0,A),e(41,` 2914 `),a(),e(42,` 2915 `),a(),e(43,` 2916 `),n(44,"p-table",61),h("firstChange",function(i){E(t);let s=m(5);return S(s.mappingTableFirst.set(i))}),e(45,` 2917 `),_(46,Rh,12,0,"ng-template",62),e(47,` 2918 `),_(48,wh,24,13,"ng-template",63),e(49,` 2919 `),_(50,Dh,10,0,"ng-template",64),e(51,` 2920 `),a(),e(52,` 2921 `),a(),e(53,` 2922 `),n(54,"div",2),e(55,` 2923 `),n(56,"div",50),e(57,` 2924 `),n(58,"p-button",51),I(59,"translate"),h("onClick",function(){E(t);let i=m(3).$implicit,s=m(2);return S(s.updateMappings(s.asICalSubscription(i)))}),e(60,` 2925 `),a(),e(61,` 2926 `),a(),e(62,` 2927 `),a(),e(63,` 2928 `),a(),e(64,` 2929 `),a(),e(65,` 2930 `),a(),e(66,` 2931 `),a(),e(67,` 2932 `)}if(r&2){let t,o,i=m(3).$implicit,s=m(2);l(),p("dt",s.accordion)("multiple",!0)("value",ne(27,Mp)),l(2),p("id","qware.app-settings.integrations.ical.settings-shade."+i.Id),l(3),K(` 2933 `,y(7,21,"APP_SETTINGS.INTEGRATIONS.SETTINGS"),` 2934 `),l(10),f((t=s.editForms().get(i.Id))?16:-1,t),l(4),p("id","qware.app-settings.integrations.ical.mappings-shade."+i.Id),l(3),K(` 2935 `,y(24,23,"APP_SETTINGS.INTEGRATIONS.LOCATION_MAPPINGS"),` 2936 `),l(14),p("raised",!0)("id","qware.app-settings.integrations.mappings.add."+i.Id),l(7),p("value",(o=s.asICalSubscription(i).Mappings)!==null&&o!==void 0?o:ne(28,Fp))("id","qware.app-settings.integrations.mappings."+i.Id)("paginator",!0)("rows",15)("rowsPerPageOptions",ne(29,Nf))("showCurrentPageReport",!0)("first",s.mappingTableFirst()),l(14),p("text",!0)("id","qware.app-settings.integrations.mappings.button.save."+i.Id)("disabled",!s.mappingsDirtyIds().has(i.Id)||s.hasMappingValidationErrors(s.asICalSubscription(i)))("label",y(59,25,"APP_SETTINGS.INTEGRATIONS.SAVE"))}}function Nh(r,d){if(r&1&&(e(0,` 2937 `),_(1,hh,2,1)(2,Lh,68,30),e(3,` 2938 `)),r&2){let t,o=m(2).$implicit;l(),f((t=o.Type)==="bas-connect"?1:t==="ical"?2:-1)}}function Oh(r,d){r&1&&(e(0,` 2939 `),n(1,"tr"),e(2,` 2940 `),n(3,"th",67),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_TIMESTAMP"),a(),e(5,` 2941 `),n(6,"th",67),e(7,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_DATE_RANGE"),a(),e(8,` 2942 `),n(9,"th",67),e(10,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_ZONE"),a(),e(11,` 2943 `),n(12,"th",67),e(13,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_TYPE"),a(),e(14,` 2944 `),n(15,"th",67),e(16,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_STATUS"),a(),e(17,` 2945 `),n(18,"th",87),e(19,` 2946 `),n(20,"span",88),e(21,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_EXPAND"),a(),e(22,` 2947 `),a(),e(23,` 2948 `),a(),e(24,` 2949 `))}function Fh(r,d){if(r&1&&(e(0),I(1,"dateFormat"),I(2,"dateFormat")),r&2){let t=m().$implicit,o=m(6);qi(` 2950 `,ma(1,2,t.EventStartUTC,"l LT",o.timezone)," \u2013 ",ma(2,6,t.EventEndUTC,"l LT",o.timezone),` 2951 `)}}function Mh(r,d){r&1&&e(0,` 2952 \u2014 2953 `)}function Uh(r,d){if(r&1&&(e(0,` 2954 `),n(1,"p"),e(2,` 2955 `),n(3,"span",92),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.DETAIL_MESSAGE"),a(),e(5),a(),e(6,` 2956 `)),r&2){let t=m(2).$implicit;l(5),K(": ",t.ErrorDetail,` 2957 `)}}function Ph(r,d){if(r&1&&(e(0,` 2958 `),R(1,"p-message",93),e(2,` 2959 `)),r&2){let t=m(3).$implicit;l(),p("text","Slots used: "+t.CurrentSlotUsage)}}function Gh(r,d){if(r&1&&(e(0,` 2960 `),n(1,"p"),e(2,` 2961 `),n(3,"span",92),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.DETAIL_MESSAGE"),a(),e(5),a(),e(6,` 2962 `),_(7,Ph,3,1)),r&2){let t=m(2).$implicit;l(5),K(": ",t.ErrorDetail,` 2963 `),l(2),f(t.CurrentSlotUsage!==null&&t.CurrentSlotUsage!==void 0?7:-1)}}function kh(r,d){if(r&1&&(e(0,` 2964 `),n(1,"p"),e(2,` 2965 `),n(3,"span",92),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.DETAIL_MESSAGE"),a(),e(5,` 2966 `),n(6,"span"),e(7),I(8,"translate"),a(),e(9,` 2967 `),a(),e(10,` 2968 `)),r&2){let t=m(3).$implicit;l(7),K(": ",$e(8,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.SUCCESS_SUMMARY_CANCELLED",Kn(4,Up,t.ZoneName,t.LocationName)),"")}}function Vh(r,d){if(r&1&&(e(0,` 2969 `),n(1,"p"),e(2,` 2970 `),n(3,"span",92),e(4,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.DETAIL_MESSAGE"),a(),e(5,` 2971 `),n(6,"span"),e(7),I(8,"translate"),a(),e(9,` 2972 `),a(),e(10,` 2973 `)),r&2){let t=m(3).$implicit;l(7),K(": ",$e(8,1,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.SUCCESS_SUMMARY",Kn(4,Up,t.ZoneName,t.LocationName)),"")}}function qh(r,d){if(r&1&&(e(0,` 2974 `),_(1,kh,11,7)(2,Vh,11,7),e(3,` 2975 `)),r&2){let t,o=m(2).$implicit;l(),f((t=o.MutationType)==="Cancelled"?1:2)}}function Bh(r,d){if(r&1&&(e(0,` 2976 `),n(1,"tr"),e(2,` 2977 `),n(3,"td",90),e(4,` 2978 `),n(5,"div",91),e(6,` 2979 `),n(7,"p"),e(8,` 2980 `),n(9,"span",92),e(10,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_EVENT"),a(),e(11),a(),e(12,` 2981 `),n(13,"p"),e(14,` 2982 `),n(15,"span",92),e(16,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.COL_LOCATION"),a(),e(17),a(),e(18,` 2983 `),_(19,Uh,7,1)(20,Gh,8,2)(21,qh,4,1),e(22,` 2984 `),a(),e(23,` 2985 `),a(),e(24,` 2986 `),a(),e(25,` 2987 `)),r&2){let t,o=m().$implicit;l(11),K(": ",o.EventName,` 2988 `),l(6),K(": ",o.LocationName,` 2989 `),l(2),f((t=o.Outcome)==="Failure"?
298919:t==="Warning"?20:t==="Success"?21:-1)}}function Hh(r,d){if(r&1){let t=b();e(0,` 2990 `),n(1,"tr"),e(2,` 2991 `),n(3,"td"),e(4),I(5,"dateFormat"),a(),e(6,` 2992 `),n(7,"td"),e(8,` 2993 `),_(9,Fh,3,10)(10,Mh,1,0),a(),e(11,` 2994 `),n(12,"td"),e(13),a(),e(14,` 2995 `),n(15,"td"),e(16,` 2996 `),n(17,"p-tag",38),I(18,"translate"),e(19,` 2997 `),a(),e(20,` 2998 `),a(),e(21,` 2999 `),n(22,"td"),e(23,` 3000 `),n(24,"p-tag",38),I(25,"translate"),e(26,` 3001 `),a(),e(27,` 3002 `),a(),e(28,` 3003 `),n(29,"td"),e(30,` 3004 `),n(31,"p-button",89),h("onClick",function(){let i=E(t).$implicit,s=m(6);return S(s.toggleBasRowExpand(i))}),e(32,` 3005 `),n(33,"i",9),e(34),a(),e(35,` 3006 `),a(),e(36,` 3007 `),a(),e(37,` 3008 `),a(),e(38,` 3009 `),_(39,Bh,26,3)}if(r&2){let t=d.$implicit,o=m(6);l(4),v(ma(5,11,t.Timestamp,"l LTS",o.timezone)),l(5),f(t.EventStartUTC?9:10),l(4),v(t.ZoneName),l(4),p("severity",o.basActivitySeverityMap.get(t.MutationType))("value",y(18,15,o.basActivityLabelMap.get(t.MutationType))),l(7),p("severity",o.basActivitySeverityMap.get(t.Outcome))("value",y(25,17,o.basActivityLabelMap.get(t.Outcome))),l(7),p("text",!0)("rounded",!0),l(3),K(` 3010 `,o.basActivityLogExpandedRowIds().has(t.Id)?"expand_less":"expand_more",` 3011 `),l(5),f(o.basActivityLogExpandedRowIds().has(t.Id)?39:-1)}}function Wh(r,d){r&1&&e(0,` 3012 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.LOADING 3013 `)}function jh(r,d){r&1&&e(0,` 3014 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.EMPTY 3015 `)}function Yh(r,d){if(r&1&&(e(0,` 3016 `),n(1,"tr"),e(2,` 3017 `),n(3,"td",90),e(4,` 3018 `),n(5,"div",75),e(6,` 3019 `),_(7,Wh,1,0)(8,jh,1,0),a(),e(9,` 3020 `),a(),e(10,` 3021 `),a(),e(11,` 3022 `)),r&2){let t=m(6);l(7),f(t.displaySpinner()?7:8)}}function Qh(r,d){if(r&1){let t=b();e(0,` 3023 `),n(1,"div",76),e(2,` 3024 `),n(3,"div",77),e(4,` 3025 `),n(5,"h5",67),e(6,` 3026 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.PANEL_HEADING 3027 `),a(),e(7,` 3028 `),a(),e(8,` 3029 3030 `),e(9,` 3031 `),n(10,"div",78),e(11,` 3032 `),n(12,"div",79),e(13,` 3033 `),n(14,"p-floatlabel",80),e(15,` 3034 `),n(16,"p-datepicker",81),h("ngModelChange",function(i){E(t);let s=m(5);return S(s.basActivityLogFilterFrom.set(i))}),e(17,` 3035 `),a(),e(18,` 3036 `),n(19,"label",82),e(20,` 3037 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.FILTER_FROM 3038 `),a(),e(21,` 3039 `),a(),e(22,` 3040 `),a(),e(23,` 3041 `),n(24,"div",79),e(25,` 3042 `),n(26,"p-floatlabel",80),e(27,` 3043 `),n(28,"p-datepicker",83),h("ngModelChange",function(i){E(t);let s=m(5);return S(s.basActivityLogFilterTo.set(i))}),e(29,` 3044 `),a(),e(30,` 3045 `),n(31,"label",84),e(32,` 3046 APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.FILTER_TO 3047 `),a(),e(33,` 3048 `),a(),e(34,` 3049 `),a(),e(35,` 3050 `),n(36,"p-button",85),I(37,"translate"),h("onClick",function(){E(t);let i=m(5);return S(i.applyBasActivityLogFilter())}),e(38,` 3051 `),a(),e(39,` 3052 `),a(),e(40,` 3053 3054 `),e(41,`
3055 `),n(42,"p-table",86),h("onLazyLoad",function(i){E(t);let s=m(5);return S(s.loadBasActivityLogPage(i))}),e(43,` 3056 `),_(44,Oh,25,0,"ng-template",62),e(45,` 3057 `),_(46,Hh,40,19,"ng-template",63),e(47,` 3058 `),_(48,Yh,12,1,"ng-template",64),e(49,` 3059 `),a(),e(50,` 3060 `),a(),e(51,` 3061 `)}if(r&2){let t=m(5);l(16),p("ngModel",t.basActivityLogFilterFrom()),l(12),p("ngModel",t.basActivityLogFilterTo()),l(8),p("raised",!0)("disabled",!t.isBasActivityLogFilterValid())("label",y(37,13,"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.FILTER_APPLY")),l(6),p("value",t.basActivityLogEntries())("paginator",!0)("rows",t.basActivityLogRows())("totalRecords",t.basActivityLogTotalCount())("lazy",!0)("first",t.basActivityLogFirst())("dataKey","Id")("showCurrentPageReport",!0)}}function Kh(r,d){if(r&1&&(e(0,` 3062 `),n(1,"p-chart",95),e(2,` 3063 `),a(),e(3,` 3064 `)),r&2){let t=m(4).$implicit,o=m(2);l(),p("data",o.syncChartDataMap().get(t.Id))("options",o.syncChartOptions)("id","qware.app-settings.integrations.chart."+t.Id)}}function $h(r,d){r&1&&(e(0,` 3065 `),R(1,"p-skeleton",96),e(2,` 3066 `))}function zh(r,d){if(r&1&&(e(0,` 3067 `),n(1,"div",76),e(2,` 3068 `),n(3,"div",77),e(4,` 3069 `),n(5,"h5",67),e(6,` 3070 APP_SETTINGS.INTEGRATIONS.SYNC_HISTORY 3071 `),a(),e(7,` 3072 `),a(),e(8,` 3073 `),n(9,"div",94),e(10,` 3074 `),_(11,Kh,4,3)(12,$h,3,0),a(),e(13,` 3075 `),a(),e(14,` 3076 `)),r&2){let t=m(3).$implicit,o=m(2);l(11),f(o.syncChartDataMap().has(t.Id)?11:12)}}function Xh(r,d){if(r&1&&(e(0,` 3077 `),_(1,Qh,52,15)(2,zh,15,1),e(3,` 3078 `)),r&2){let t,o=m(2).$implicit;l(),f((t=o.Type)==="bas-connect"?1:2)}}function Zh(r,d){if(r&1){let t=b();e(0,` 3079 `),n(1,"div",29),e(2,` 3080 `),n(3,"div",30),e(4,` 3081 `),e(5,` 3082 `),n(6,"div",31),e(7,` 3083 `),n(8,"div",32),e(9,` 3084 `),n(10,"i",9),e(11),a(),e(12,` 3085 `),a(),e(13,` 3086 `),n(14,"div",33),e(15,` 3087 `),n(16,"p-toggleswitch",34),h("onChange",function(i){E(t);let s=m().$implicit,c=m(2);return S(c.toggleIntegrationState(s,i.checked))}),e(17,` 3088 `),a(),e(18,` 3089 `),a(),e(19,` 3090 `),a(),e(20,` 3091 3092 `),e(21,` 3093 `),n(22,"div",35),e(23,` 3094 `),_(24,Kf,5,4)(25,$f,5,3)(26,Xf,3,0)(27,Jf,2,1),a(),e(28,` 3095 3096 `),e(29,` 3097 `),n(30,"div",36),e(31),I(32,"translate"),a(),e(33,` 3098 3099 `),e(34,` 3100 `),_(35,eh,11,4),a(),e(36,` 3101 3102 `),e(37,` 3103 `),n(38,"div",37),e(39,` 3104 `),G(40,rh,6,1,null,null,Zi),a(),e(42,` 3105 3106 `),e(43,` 3107 `),_(44,Nh,4,1)(45,Xh,4,1),a(),e(46,` 3108 `)}if(r&2){let t,o,i,s,c,u,x=m().$implicit,C=m(2);l(),p("id","qware.app-settings.integrations.card."+x.Id),l(10),v((t=C.integrationTypes().get(x.Type))==null?null:t.icon),l(5),p("ngModel",x.State==="ACTIVE")("ngModelOptions",ne(15,Df))("id","qware.app-settings.integrations.toggle."+x.Id)("disabled",((o=x.ConsecutiveFailureCount)!==null&&o!==void 0?o:0)>=3),l(8),f(x.Name?24:25),l(2),f(x.Type==="bas-connect"?26:-1),l(),f((i=(i=C.integrationTypes().get(x.Type))==null?null:i.alertBadge)?27:-1,i),l(4),K(` 3109 `,y(32,13,(s=C.integrationTypes().get(x.Type))==null?null:s.description),` 3110 `),l(4),f(((c=x.ConsecutiveFailureCount)!==null&&c!==void 0?c:0)>=3?35:-1),l(5),k((u=(u=C.integrationTypes().get(x.Type))==null?null:u.actions)!==null&&u!==void 0?u:ne(16,Fp)),l(4),f(C.expandedSubscriptionIds().has(x.Id)?44:-1),l(),f(C.isLogPanelExpanded(x)?45:-1)}}function Jh(r,d){if(r&1&&(e(0,` 3111 `),_(1,Zh,47,17)),r&2){let t=d.$implicit;l(),f(t.Type?1:-1)}}function eC(r,d){r&1&&(e(0,` 3112 `),n(1,"div",97),e(2,` 3113 APP_SETTINGS.INTEGRATIONS.NO_INTEGRATIONS 3114 `),a(),e(3,` 3115 `))}function tC(r,d){if(r&1&&(e(0,` 3116 `),G(1,Jh,2,1,null,null,Mf,!1,eC,4,0)),r&2){let t=m();l(),k(t.integrations())}}function iC(r,d){if(r&1){let t=b();e(0,` 3117 `),n(1,"div",98),e(2,` 3118 `),n(3,"p-button",99),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.goBack())}),e(5,` 3119 `),a(),e(6,` 3120 `),a(),e(7,` 3121 `)}r&2&&(l(3),p("text",!0)("label",y(4,2,"APP_SETTINGS.INTEGRATIONS.BACK")))}function nC(r,d){if(r&1){let t=b();e(0,` 3122 `),n(1,"p-button",101),I(2,"translate"),h("onClick",function(){E(t);let i=m(2);return S(i.nextIntegrationStep())}),e(3,` 3123 `),a(),e(4,` 3124 `)}if(r&2){let t=m(2);l(),p("text",!0)("disabled",!t.canAdvanceCurrentStep())("label",y(2,3,"APP_SETTINGS.INTEGRATIONS.NEXT"))}}function aC(r,d){if(r&1){let t=b();e(0,` 3125 `),n(1,"p-button",102),I(2,"translate"),h("onClick",function(){E(t);let i=m(2);return S(i.saveIntegration())}),e(3,` 3126 `),a(),e(4,` 3127 `)}if(r&2){let t,o=m(2);l(),p("text",!0)("disabled",!((t=o.stepperForm())!=null&&t.valid))("label",y(2,3,"APP_SETTINGS.INTEGRATIONS.SAVE"))}}function rC(r,d){if(r&1){let t=b();e(0,` 3128 `),n(1,"div",98),e(2,` 3129 `),n(3,"p-button",100),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.cancelOrBackIntegration())}),e(5,` 3130 `),a(),e(6,` 3131 `),_(7,nC,5,5)(8,aC,5,5),a(),e(9,` 3132 `)}if(r&2){let t=m();l(3),p("text",!0)("label",y(4,4,t.currentStep()===0?"APP_SETTINGS.INTEGRATIONS.CANCEL":"APP_SETTINGS.INTEGRATIONS.BACK")),l(4),f(t.currentStep()>=1&&!t.isLastStep()?7:-1),l(),f(t.isLastStep()?8:-1)}}var oC=r=>{let d=r.get("ConfiguredMaxSlots")?.value,t=r.get("ReservedSlots")?.value;return d==null||t==null?null:t>d?{reservedExceedsMax:!0}:null},Pp=(()=>
3132{class r{appSettingsService=te(dt);authService=te(de);basConnectService=te(Sn);calendarIntegrationService=te(Cl);confirmationService=te(mt);eventService=te(oi);fb=te(be);locationService=te(zt);route=te(he);router=te(Be);toastService=te(Se);translate=te(le);userService=te(ct);allCalendarsMap=D(new Map);allLocations=D([]);basActivityLogAppliedFrom=D(null);basActivityLogAppliedTo=D(null);basActivityLogEntries=D([]);basActivityLogExpanded=D(!1);basActivityLogExpandedRowIds=D(new Set);basActivityLogFilterFrom=D(null);basActivityLogFilterTo=D(null);basActivityLogFirst=D(0);basActivityLogRows=D(25);basActivityLogTotalCount=D(0);basConnection=D(null);basLastTestResult=D(null);basMappingOriginals=D(new Map);basMostRecentFailureTimestamp=D(null);basNotificationUsers=D([]);basRejectionCount=D(0);basTokenGenerated=D(!1);currentStep=D(0);displaySpinner=D(!0);editCalendarOptionsMap=D(new Map);editForms=D(new Map);eventCategoryOptions=D([]);expandedSubscriptionIds=D(new Set);integrationTypes=D(new Map);integrationTypeSearch=D("");intervalOptions=D([]);locationOptions=D([]);mappingsDirtyIds=D(new Set);mappingTableFirst=D(0);selectedIntegrationType=D(null);showAddIntegrationForm=D(!1);stepperForm=D(null);submitted=D(!1);subscriptions=D([]);syncChartDataMap=D(new Map);syncExpandedSubscriptionIds=D(new Set);syncingIds=D(new Set);translatedIntegrationTypes=D([]);allEventLocationIds=Ye(()=>this.allLocations().filter(o=>o.EventScheduling&&o.Id).map(o=>o.Id));basBadges=Ye(()=>{let t=this.basConnection(),o=this.basLastTestResult();if(!t||t.State!==M.ACTIVE)return[{label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_INACTIVE",severity:"secondary"}];if(o===null)return[{label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_CHECKING",severity:"secondary"}];let i=o.Status!=="AgentOffline",s=i?{label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_AGENT_CONNECTED",severity:"success"}:{label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_AGENT_DISCONNECTED",severity:"warn"},c;return i?o.Status==="Connected"?c={label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_CONTROLLER_CONNECTED",severity:"success"}:c={label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_CONTROLLER_DISCONNECTED",severity:"warn"}:c={label:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STATUS_CONTROLLER_UNKNOWN",severity:"secondary"},[s,c]});canAdvanceCurrentStep=Ye(()=>{let t=this.selectedIntegrationType(),o=this.currentStep()-1,i=t?.steps[o];if(t?.id==="bas-connect"&&!i?.formKey)return this.basTokenGenerated();let s=this.currentStepForm();return s?s.valid:!0});currentStepComponent=Ye(()=>{let t=this.selectedIntegrationType(),o=this.currentStep()-1;return t?.steps[o]?.component??null});currentStepForm=Ye(()=>{let t=this.selectedIntegrationType(),o=this.currentStep()-1,i=t?.steps[o]?.formKey,s=this.stepperForm();return!i||!s?null:s.get(i)??null});filteredIntegrationTypes=Ye(()=>{let t=this.integrationTypeSearch().toLowerCase();return this.translatedIntegrationTypes().filter(i=>!t||i.name.toLowerCase().includes(t)||i.description.toLowerCase().includes(t)).sort((i,s)=>i.name.localeCompare(s.name))});integrations=Ye(()=>{let t=this.subscriptions(),o=this.basConnection();return(o?[...t,o]:t).sort((s,c)=>(s.Name??"").localeCompare(c.Name??""))});isBasActivityLogFilterValid=Ye(()=>{let t=this.basActivityLogFilterFrom(),o=this.basActivityLogFilterTo();return!t||!o?!0:t.getTime()<=o.getTime()});isLastStep=Ye(()=>{let t=this.selectedIntegrationType();return t?this.currentStep()===t.steps.length:!1});steps=Ye(()=>{let t={value:0,label:"APP_SETTINGS.INTEGRATIONS.STEP_INTEGRATION"},o=this.selectedIntegrationType();return o?[t,...o.steps.map((i,s)=>({value:s+1,label:i.labelKey}))]:[t]});stepComponentInputs=Ye(()=>{let t=this.stepperForm(),o=this.selectedIntegrationType(),i=this.currentStep()-1,s=o?.steps[i]?.formKey;switch(o?.id){case"bas-connect":switch(s){case void 0:return{onTokenGenerated:()=>this.basTokenGenerated.set(!0)};case"Connection":return{form:t?.get("Connection")};case"ZoneMappings":return{allLocations:this.allLocations(),connectionForm:t?.get("Connection"),form:t?.get("ZoneMappings")};case"Capacity":return{form:t?.get("Capacity"),users:this.basNotificationUsers()}}break;case"ical":switch(s){case"Settings":return{categoryOptions:this.eventCategoryOptions(),calendarOptionsMap:this.allCalendarsMap(),form:t?.get("Settings"),intervalOptions:this.intervalOptions(),subscription:null}}break}return{}});accordion={colorScheme:{light:{headerFirstTopBorderRadius:"0px",headerLastBottomBorderRadius:"4px"}}};activityTable={colorScheme:{light:{datatableCellBorderWidth:"0px"}}};
3132syncChartOptions={responsive:!0,plugins:{legend:{display:!0,position:"bottom"}}};timezone="";basActivityLabelMap=new Map([["Created","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.MUTATION_CREATED"],["Modified","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.MUTATION_MODIFIED"],["Cancelled","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.MUTATION_CANCELLED"],["Success","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_SUCCESS"],["Failure","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_FAILURE"],["Warning","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_WARNING"],["Dispatched","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_DISPATCHED"],["Deferred","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_DEFERRED"],["Rejected","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ACTIVITY.OUTCOME_REJECTED"]]);basActivitySeverityMap=new Map([["Created","info"],["Modified","warn"],["Cancelled","contrast"],["Success","success"],["Failure","danger"],["Warning","warn"],["Dispatched","info"],["Deferred","warn"],["Rejected","warn"]]);allEventCalendars=[];syncChartTotalStoredLabel="";syncChartSubscriptions=new Map;constructor(){let t=this.integrationTypes();this.authService.tenant.EventsModule&&t.set("ical",{id:"ical",name:"APP_SETTINGS.INTEGRATIONS.TYPES.ICAL.NAME",icon:"event",description:"APP_SETTINGS.INTEGRATIONS.TYPES.ICAL.DESCRIPTION",allowMultiple:!0,form:this.createIcalForm.bind(this),steps:[{labelKey:"APP_SETTINGS.INTEGRATIONS.STEP_SETTINGS",component:js,formKey:"Settings"}],actions:["config","log","sync","delete"],executionLog:{fetchFn:o=>{let i=Vt.convertToAppTimezone(this.timezone,!0),s=Vt.convertToAppTimezoneUTC(this.timezone,i),c=s.toISOString(),u=new Date(s.getTime()-24*60*60*1e3).toISOString();return this.calendarIntegrationService.getSyncs(o,u,c).pipe(da(x=>x.map(C=>({timestamp:new Date(C.CreatedDateUTC),outcome:C.WasSuccessful?"Success":"Failure",reference:String(C.TotalStoredEvents)}))))},columns:[{field:"timestamp",headerKey:"APP_SETTINGS.INTEGRATIONS.CHART.TRANSACTIONS_AXIS"},{field:"outcome",headerKey:"SHARED.STATE"},{field:"reference",headerKey:"APP_SETTINGS.INTEGRATIONS.CHART.TOTAL_STORED"}]}}),this.authService.tenant.EventsModule&&t.set("bas-connect",{id:"bas-connect",name:"APP_SETTINGS.INTEGRATIONS.TYPES.BAS_CONNECT.NAME",icon:"hvac",description:"APP_SETTINGS.INTEGRATIONS.TYPES.BAS_CONNECT.DESCRIPTION",allowMultiple:!1,form:this.createBasConnectForm.bind(this),steps:[{labelKey:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_AGENT_SETUP",component:Lp},{labelKey:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_CONNECTION",component:Hs,formKey:"Connection"},{labelKey:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_ZONE_MAPPINGS",component:Ws,formKey:"ZoneMappings"},{labelKey:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.STEP_CAPACITY",component:Bs,formKey:"Capacity"}],actions:["config","log","delete"],alertBadge:{count:()=>this.basRejectionCount(),severity:"danger",labelKey:"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.REJECTED_BADGE",onClick:()=>this.navigateToBasRejections()}}),this.integrationTypes.set(t)}ngOnInit(){let t=this.integrationTypes(),o=[...t.values()].flatMap(u=>[u.name,u.description]),i=["APP_SETTINGS.INTEGRATIONS.INTERVAL_15","APP_SETTINGS.INTEGRATIONS.INTERVAL_30","APP_SETTINGS.INTEGRATIONS.INTERVAL_60","APP_SETTINGS.INTEGRATIONS.CHART.TOTAL_STORED","APP_SETTINGS.INTEGRATIONS.CHART.TOTAL_STORED_AXIS","APP_SETTINGS.INTEGRATIONS.CHART.TRANSACTIONS_AXIS"],s=!!this.authService.tenant.EventsModule,c=this.basConnectService.getConnection().pipe(Lo(u=>{let x=s?this.userService.getUsers(this.authService.tenant.Id).pipe(N(),Zr(()=>Fe([]))):Fe([]),C=u?this.basConnectService.getRejectionCount().pipe(N(),Zr(()=>Fe(0))):Fe(0);return ue({rejectionCount:C,users:x}).pipe(da(({rejectionCount:O,users:w})=>({connection:u,rejectionCount:O,notificationUsers:(Array.isArray(w)?w:[]).filter(F=>F.State===M.ACTIVE&&(F.Type??Rt.INTERNAL)===Rt.INTERNAL&&!!F.Email)})))}));ue([this.translate.get([...o,...i]).pipe(N()),this.eventService.getCategories(),this.eventService.getCalendars(),this.calendarIntegrationService.getSubscriptions(this.authService.tenant.Id),this.locationService.getLocations(this.authService.tenant.Id),this.appSett
3132ingsService.getAppSettings().pipe(N()),c]).subscribe(u=>{let x=u[0],C=u[1];this.allEventCalendars=u[2],this.subscriptions.set(u[3].sort((V,z)=>(V.Name??"").localeCompare(z.Name??"")));let O=u[4];this.timezone=u[5]?.Timezone??"";let w=u[6];if(this.basConnection.set(w.connection),this.basRejectionCount.set(w.rejectionCount),this.basNotificationUsers.set(w.notificationUsers),w.connection){let V=new Date,z=new Date(V.getTime()-30*24*60*60*1e3);this.basActivityLogFilterFrom.set(z),this.basActivityLogFilterTo.set(V),this.basActivityLogAppliedFrom.set(z),this.basActivityLogAppliedTo.set(V),this.checkBasAgentConnection()}this.translatedIntegrationTypes.set([...t.values()].map(V=>ki(Di({},V),{name:x[V.name]??V.name,description:x[V.description]??V.description}))),this.intervalOptions.set([{label:x["APP_SETTINGS.INTEGRATIONS.INTERVAL_15"],value:15},{label:x["APP_SETTINGS.INTEGRATIONS.INTERVAL_30"],value:30},{label:x["APP_SETTINGS.INTEGRATIONS.INTERVAL_60"],value:60}]),this.eventCategoryOptions.set(C.filter(V=>V.State===M.ACTIVE).map(V=>({label:V.Name,value:V.Id}))),this.allLocations.set(O),this.locationOptions.set(O.map(V=>({label:V.Name,value:V.Id})));let F=new Map;for(let V of this.allEventCalendars)if(V.CategoryId&&V.State===M.ACTIVE){let z=F.get(V.CategoryId)??[];z.push({label:V.Name,value:V.Id}),F.set(V.CategoryId,z)}this.allCalendarsMap.set(F),this.syncChartTotalStoredLabel=x["APP_SETTINGS.INTEGRATIONS.CHART.TOTAL_STORED"];let L=x["APP_SETTINGS.INTEGRATIONS.CHART.TOTAL_STORED_AXIS"],U=x["APP_SETTINGS.INTEGRATIONS.CHART.TRANSACTIONS_AXIS"];this.syncChartOptions={responsive:!0,plugins:{legend:{display:!0,position:"bottom"}},scales:{y:{position:"left",title:{display:!0,text:U},min:0},yTotal:{position:"right",title:{display:!0,text:L},grid:{drawOnChartArea:!1},min:0}}},this.displaySpinner.set(!1)})}addIntegration(){this.expandedSubscriptionIds.set(new Set),this.syncExpandedSubscriptionIds.set(new Set),this.editForms.set(new Map),this.editCalendarOptionsMap.set(new Map),this.mappingsDirtyIds.set(new Set),this.currentStep.set(0),this.selectedIntegrationType.set(null),this.integrationTypeSearch.set(""),this.showAddIntegrationForm.set(!0)}backToIntegrationSelect(){this.currentStep.set(0),this.selectedIntegrationType.set(null)}cancelAddIntegration(){this.showAddIntegrationForm.set(!1),this.currentStep.set(0),this.selectedIntegrationType.set(null),this.stepperForm.set(null)}cancelOrBackIntegration(){let t=this.currentStep();t===0?this.cancelAddIntegration():t===1?this.backToIntegrationSelect():this.currentStep.update(o=>o-1)}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}isLogPanelExpanded(t){return t.Type==="bas-connect"?this.basActivityLogExpanded():t.Id?this.syncExpandedSubscriptionIds().has(t.Id):!1}nextIntegrationStep(){this.currentStep.update(t=>t+1)}onConfigAction(t){t.Type==="bas-connect"?this.toggleBasConnectSettings():this.toggleExpandSubscription(t)}onDeleteAction(t){t.Type==="bas-connect"?this.deleteBasConnect():this.deleteSubscription(t)}onIntegrationTypeSearch(t){this.integrationTypeSearch.set(t.target.value)}onLogAction(t){t.Type==="bas-connect"?this.toggleBasActivityLog():this.toggleSyncHistory(t)}onStepperChange(t){t!==void 0&&t<this.currentStep()&&(this.currentStep.set(t),t===0&&this.selectedIntegrationType.set(null))}onSyncAction(t){t.Type!=="bas-connect"&&this.triggerSync(t)}saveIntegration(){let t=this.selectedIntegrationType();if(!(!t||!this.stepperForm()?.valid))switch(t.id){case"bas-connect":this.saveBasConnectIntegration();break;case"ical":this.saveIcalIntegration(t.id);break}}selectIntegrationType(t){this.selectedIntegrationType.set(t),this.currentStep.set(1),this.stepperForm.set(t.form()??null),this.basTokenGenerated.set(!1)}isTypeAtCapacity(t){return!t.allowMultiple&&this.integrations().some(o=>o.Type===t.id)}toggleIntegrationState(t,o){t.Type==="bas-connect"?this.toggleBasConnect(o):this.toggleSubscriptionState(t,o)}closeAllExpanded(){this.expandedSubscriptionIds.set(new Set),this.syncExpandedSubscriptionIds.set(new Set),this.syncChartDataMap.set(new Map),this.editForms.set(new Map),this.editCalendarOptionsMap.set(new Map),this.mappingsDirtyIds.set(new Set),this.mappingTableFirst.set(0),this.basActivityLogExpanded.set(!1),this.basActivityLogExpandedRowIds.set(new Set)}addMapping(t){let o={TenantId:this.authService.tenant.Id,SubscriptionId:t.Id,IcalLocationName:""};this.subscriptions.update(i=>{let s=i.findIndex(c=>c.Id===t.Id);return s===-1?i:[...i.slice(0,s),ki(Di({},i[s]),{Mappings:[o,...i[s].Mappings??[]]}),...i.slice(s+1)]}),this.mappingTableFirst.set(0),this.onMappingChanged(t.Id)}asICalSubscription(t){return t}deleteSubscription(t){this.translate.get(["SHARED.DELETE_HEADER","APP_SETTINGS.INTEGRATIONS.DELETE_MESSAGE"],{entity:t.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"deletePromptDialog",header:o["SHARED.DELETE_HEADER"],message:o["APP_SETTINGS.INTEGRATIONS.DELETE_MESSAGE"],accept:()=>{this.displaySpinner.set(!0),this.calendarIntegrationService.deleteSubscription(this.authService.tenant.Id,t.Id).subscribe({next:()=>{this.subscriptions.update(i=>i.filter(s=>s.Id!==t.Id)),this.expandedSubscriptionIds.update(i=>(i.delete(t.Id),new Set(i))),this.syncExpandedSubscriptionIds.update(i=>(i.delete(t.Id),new Set(i))),this.syncChartDataMap.update(i=>(i.delete(t.Id),new Map(i))),this.editCalendarOptionsMap.update(i=>(i.delete(t.Id),new Map(i))),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.DELETE"]).pipe(N()).subscribe(i=>{this.toastService.success(i["SHARED.SUCCESS"],i["APP_SETTINGS.INTEGRATIONS.SUCCESS.DELETE"])}),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})}})})}getMappingSelectedOption(t){return t.LocationId?this.locationOptions().find(o=>o.value===t.LocationId)??null:null}hasMappingValidationErrors(t){return(t.Mappings??[]).some(o=>!o.IcalLocationName?.trim())}loadSyncChart(t){this.syncChartSubscriptions.get(t.Id)?.unsubscribe(),this.displaySpinner.set(!0);let o=Vt.convertToAppTimezone(this.timezone,!0),i=Vt.convertToAppTimezoneUTC(this.timezone,o),s=i.toISOString(),c=new Date(i.getTime()-24*60*60*1e3).toISOString(),u=ue([this.calendarIntegrationService.getSyncs(t.Id,c,s),ms(1e3)]).subscribe({next:([x])=>{let C=x.map(O=>(0,Dl.default)(Vt.convertToAppTimezone(this.timezone,!0,O.CreatedDateUTC)).format("M/D h:mm:ss A"));this.syncChartDataMap.update(O=>new Map(O).set(t.Id,{labels:C,datasets:[{label:"Added",data:x.map(w=>w.NumberAdded),borderColor:"rgba(75,192,120,1)",backgroundColor:"rgba(75,192,120,0.15)",fill:!0,tension:.3},{label:"Updated",data:x.map(w=>w.NumberUpdated),borderColor:"rgba(54,162,235,1)",backgroundColor:"rgba(54,162,235,0.15)",fill:!0,tension:.3},{label:"Removed",data:x.map(w=>w.NumberRemoved),borderColor:"rgba(255,159,64,1)",backgroundColor:"rgba(255,159,64,0.15)",fill:!0,tension:.3},{label:"Skipped",data:x.map(w=>
3132w.NumberSkipped),borderColor:"rgba(255,99,132,1)",backgroundColor:"rgba(255,99,132,0.15)",fill:!0,tension:.3},{label:this.syncChartTotalStoredLabel,data:x.map(w=>w.TotalStoredEvents),borderColor:"rgba(153,102,255,1)",backgroundColor:"rgba(153,102,255,0.15)",fill:!1,tension:.3,borderDash:[6,3],yAxisID:"yTotal"}]})),this.displaySpinner.set(!1)}});this.syncChartSubscriptions.set(t.Id,u)}onEditCategoryChanged(t,o){let i=this.editForms().get(t)?.get("CalendarId");if(o){let s=this.allEventCalendars.filter(c=>c.CategoryId===o&&c.State===M.ACTIVE).map(c=>({label:c.Name,value:c.Id}));this.editCalendarOptionsMap.update(c=>new Map(c).set(t,s)),i?.setValue(s.length===1?s[0].value??null:null)}else this.editCalendarOptionsMap.update(s=>new Map(s).set(t,[])),i?.setValue(null);i?.markAsDirty()}onMappingChanged(t){this.mappingsDirtyIds.update(o=>new Set(o).add(t))}onMappingIcalNameChanged(t){this.onMappingChanged(t)}onMappingLocationChanged(t,o,i){t.LocationId=i?.data?.id??void 0,this.onMappingChanged(o)}removeMapping(t,o){this.subscriptions.update(i=>{let s=i.findIndex(u=>u.Id===t.Id);if(s===-1)return i;let c=(i[s].Mappings??[]).filter((u,x)=>x!==o);return[...i.slice(0,s),ki(Di({},i[s]),{Mappings:c}),...i.slice(s+1)]}),this.onMappingChanged(t.Id)}saveEditSubscription(t){let o=this.editForms().get(t.Id);if(!o||o.invalid)return;this.displaySpinner.set(!0);let i=ki(Di({},t),{Name:o.value.Name,Url:o.value.Url,Interval:o.value.Interval,IncludeForConflictChecking:o.value.IncludeWhenConflictChecking??!1,CategoryId:o.value.CategoryId??void 0,CalendarId:o.value.CalendarId??void 0});this.calendarIntegrationService.updateSubscription(i).subscribe({next:s=>{this.updateLocal(ki(Di({},s),{Mappings:t.Mappings})),o.markAsPristine(),o.markAsUntouched(),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"]).pipe(N()).subscribe(c=>{this.toastService.success(c["SHARED.SUCCESS"],c["APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"])}),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})}testConnection(t){}toggleExpandSubscription(t){if(this.expandedSubscriptionIds().has(t.Id))this.expandedSubscriptionIds.update(o=>(o.delete(t.Id),new Set(o))),this.editForms.update(o=>(o.delete(t.Id),new Map(o))),this.editCalendarOptionsMap.update(o=>(o.delete(t.Id),new Map(o))),this.mappingsDirtyIds.update(o=>(o.delete(t.Id),new Set(o))),this.displaySpinner.set(!1);else{if(this.closeAllExpanded(),this.expandedSubscriptionIds.update(o=>new Set(o).add(t.Id)),this.editForms.update(o=>new Map(o).set(t.Id,this.fb.group({Type:this.fb.control(t.Type??"",[T.required]),Name:this.fb.control(t.Name??"",[T.required,T.maxLength(256)]),Url:this.fb.control(t.Url,[T.required,T.maxLength(2048),T.pattern(/^https?:\/\/.+/)]),Interval:this.fb.control(t.Interval,[T.required]),IncludeWhenConflictChecking:this.fb.control(t.IncludeForConflictChecking),CategoryId:this.fb.control(t.CategoryId??null,[T.required]),CalendarId:this.fb.control(t.CalendarId??null,[T.required])}))),t.CategoryId){let o=this.allEventCalendars.filter(i=>i.CategoryId===t.CategoryId&&i.State===M.ACTIVE).map(i=>({label:i.Name,value:i.Id}));this.editCalendarOptionsMap.update(i=>new Map(i).set(t.Id,o))}this.mappingsDirtyIds.update(o=>(o.delete(t.Id),new Set(o))),this.displaySpinner.set(!0),ue([this.calendarIntegrationService.getMappings(this.authService.tenant.Id,t.Id),ms(1e3)]).subscribe({next:([o])=>{this.displaySpinner.set(!1),this.mappingsDirtyIds.update(s=>(s.delete(t.Id),new Set(s)));let i=[...o].sort((s,c)=>s.IcalLocationName.localeCompare(c.IcalLocationName));this.subscriptions.update(s=>{let c=s.findIndex(u=>u.Id===t.Id);return c===-1?s:[...s.slice(0,c),ki(Di({},s[c]),{Mappings:i}),...s.slice(c+1)]})}})}}toggleSubscriptionState(t,o){this.displaySpinner.set(!0);let i=o?M.ACTIVE:M.DISABLED,s=ki(Di({},t),{State:i});this.calendarIntegrationService.updateSubscription(s).subscribe({next:c=>{this.updateLocal(c);let u=o?"APP_SETTINGS.INTEGRATIONS.SUCCESS.ENABLE":"APP_SETTINGS.INTEGRATIONS.SUCCESS.DISABLE";this.translate.get(["SHARED.SUCCESS",u]).pipe(N()).subscribe(x=>{this.toastService.success(x["SHARED.SUCCESS"],x[u])}),o?this.triggerSync(c):this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})}toggleSyncHistory(t){this.syncExpandedSubscriptionIds().has(t.Id)?(this.syncExpandedSubscriptionIds.update(o=>(o.delete(t.Id),new Set(o))),this.syncChartDataMap.update(o=>(o.delete(t.Id),new Map(o)))):(this.closeAllExpanded(),this.syncExpandedSubscriptionIds.update(o=>new Set(o).add(t.Id)),this.loadSyncChart(t))}triggerSync(t){this.displaySpinner.set(!0),this.expandedSubscriptionIds.update(o=>(o.delete(t.Id),new Set(o))),this.syncExpandedSubscriptionIds.update(o=>(o.delete(t.Id),new Set(o))),this.syncingIds.update(o=>new Set(o).add(t.Id)),this.calendarIntegrationService.triggerSync(t).subscribe({next:o=>{if(this.syncingIds.update(i=>(i.delete(t.Id),new Set(i))),o===null)this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.SYNC_UNMODIFIED"]).pipe(N()).subscribe(i=>{this.toastService.success(i["SHARED.SUCCESS"],i["APP_SETTINGS.INTEGRATIONS.SUCCESS.SYNC_UNMODIFIED"])});else{let i=o?.find(s=>
3132s.Id===t.Id);i&&this.updateLocal(ki(Di({},i),{Mappings:t.Mappings})),this.syncExpandedSubscriptionIds().has(t.Id)&&(this.syncChartDataMap.update(s=>(s.delete(t.Id),new Map(s))),this.loadSyncChart(t)),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.SYNC"]).pipe(N()).subscribe(s=>{this.toastService.success(s["SHARED.SUCCESS"],s["APP_SETTINGS.INTEGRATIONS.SUCCESS.SYNC"])})}this.displaySpinner.set(!1)},error:()=>{this.syncingIds.update(o=>(o.delete(t.Id),new Set(o))),this.displaySpinner.set(!1)}})}updateMappings(t){t.Mappings&&(this.displaySpinner.set(!0),this.calendarIntegrationService.updateMappings(this.authService.tenant.Id,t.Id,t.Mappings).subscribe({next:o=>{this.mappingsDirtyIds.update(s=>(s.delete(t.Id),new Set(s)));let i=[...o].sort((s,c)=>s.IcalLocationName.localeCompare(c.IcalLocationName));this.subscriptions.update(s=>{let c=s.findIndex(u=>u.Id===t.Id);return c===-1?s:[...s.slice(0,c),ki(Di({},s[c]),{Mappings:i}),...s.slice(c+1)]}),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.MAPPINGS_SAVED"]).pipe(N()).subscribe(s=>{this.toastService.success(s["SHARED.SUCCESS"],s["APP_SETTINGS.INTEGRATIONS.SUCCESS.MAPPINGS_SAVED"])}),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}}))}createIcalForm(){return new ir({Settings:this.fb.group({Type:this.fb.control("ical",[T.required]),Name:this.fb.control("",[T.required,T.maxLength(256)]),Url:this.fb.control("",[T.required,T.maxLength(2048),T.pattern(/^https?:\/\/.+/)]),Interval:this.fb.control(null,[T.required]),IncludeWhenConflictChecking:this.fb.control(!1),CategoryId:this.fb.control(null,[T.required]),CalendarId:this.fb.control(null,[T.required])})})}saveIcalIntegration(t){this.displaySpinner.set(!0);let o=this.stepperForm()?.getRawValue().Settings,i={TenantId:this.authService.tenant.Id,Name:o.Name,Url:o.Url,Interval:o.Interval,IncludeForConflictChecking:o.IncludeWhenConflictChecking??!1,CategoryId:o.CategoryId,CalendarId:o.CalendarId,Type:t,State:M.ACTIVE};this.calendarIntegrationService.createSubscription(i).subscribe({next:s=>{this.subscriptions.update(c=>[...c,s]),this.showAddIntegrationForm.set(!1),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.CREATE"]).pipe(N()).subscribe(c=>{this.toastService.success(c["SHARED.SUCCESS"],c["APP_SETTINGS.INTEGRATIONS.SUCCESS.CREATE"])}),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})}updateLocal(t){this.subscriptions.update(o=>{let i=o.findIndex(s=>s.Id===t.Id);return i===-1?o:[...o.slice(0,i),Di(Di({},o[i]),t),...o.slice(i+1)]})}applyBasActivityLogFilter(){this.basActivityLogAppliedFrom.set(this.basActivityLogFilterFrom()),this.basActivityLogAppliedTo.set(this.basActivityLogFilterTo()),this.basActivityLogFirst.set(0),this.loadBasActivityLogPage({first:0,rows:this.basActivityLogRows()})}asBasIntegrationForm(t){return this.editForms().get(t)}deleteBasConnect(){let t=this.basConnection();if(!t?.Id)return;let o=t.Id;this.translate.get(["SHARED.DELETE_HEADER","APP_SETTINGS.INTEGRATIONS.DELETE_MESSAGE","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CLEAR_EXCEPTIONS_NOTE","SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.DELETE"],{entity:"BAS Connect"}).pipe(N()).subscribe(i=>{this.confirmationService.confirm({key:"deletePromptDialog",header:i["SHARED.DELETE_HEADER"],message:i["APP_SETTINGS.INTEGRATIONS.DELETE_MESSAGE"]+` 3133 3134`+i["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CLEAR_EXCEPTIONS_NOTE"],accept:()=>{this.displaySpinner.set(!0),this.basConnectService.deleteConnection(o).subscribe({next:()=>{this.basConnection.set(null),this.basActivityLogExpanded.set(!1),this.toastService.success(i["SHARED.SUCCESS"],i["APP_SETTINGS.INTEGRATIONS.SUCCESS.DELETE"]),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})}})})}loadBasActivityLogPage(t){let o=t.first??0,i=t.rows??this.basActivityLogRows(),s=Math.floor(o/i)+1;this.basActivityLogFirst.set(o),this.basActivityLogRows.set(i);let c=this.basActivityLogAppliedFrom(),u=this.basActivityLogAppliedTo(),x=c?Vt.convertToAppTimezoneUTC(this.timezone,(0,Dl.default)(c).startOf("day").toDate()).toISOString():void 0,C=u?Vt.convertToAppTimezoneUTC(this.timezone,(0,Dl.default)(u).endOf("day").toDate()).toISOString():void 0;this.displaySpinner.set(!0),this.basConnectService.getActivityLog({dateFrom:x,dateTo:C,pageNumber:s,pageSize:i}).subscribe({next:O=>{this.basActivityLogEntries.set(O.Results??[]),this.basActivityLogTotalCount.set(O.TotalResults??0),this.displaySpinner.set(!1);let w=(O.Results??[]).find(F=>F.Outcome==="Failure");w&&this.basMostRecentFailureTimestamp.set(new Date(w.Timestamp))},error:()=>{this.displaySpinner.set(!1)}})}saveBasConnectSettings(){let t=this.basConnection(),i=(t?.Id?this.editForms().get(t.Id):void 0)?.controls.Connection;if(!i||i.invalid||!t)return;this.displaySpinner.set(!0);let s=i.getRawValue(),c=Object.assign(new nr,t,{Host:s.Host??void 0,Port:s.Port??void 0,DeviceInstance:s.DeviceInstance??void 0});this.basConnectService.updateConnection(c).subscribe({next:u=>{this.basConnection.set(Object.assign(new nr,u)),i.markAsPristine(),i.markAsUntouched(),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"]).pipe(N()).subscribe(x=>{this.toastService.success(x["SHARED.SUCCESS"],x["APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"])}),this.displaySpinner.set(!1)},error:()=>{this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"]).pipe(N()).subscribe(u=>{this.toastService.error(u["SHARED.ERROR_LABEL"],u["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"])}),this.displaySpinner.set(!1)}})}
3134saveBasCapacitySettings(){let t=this.basConnection(),i=(t?.Id?this.editForms().get(t.Id):void 0)?.controls.Capacity;if(!i||i.invalid||!t)return;this.displaySpinner.set(!0);let s=i.getRawValue(),c=Array.isArray(s.NotificationUserIds)?s.NotificationUserIds.map(x=>(x??"").trim()).filter(x=>x.length>0):[],u=Object.assign(new nr,t,{DispatchHorizonHours:s.DispatchHorizonHours??void 0,ConfiguredMaxSlots:s.ConfiguredMaxSlots??void 0,ReservedSlots:s.ReservedSlots??void 0,MaxUtilizationPct:s.MaxUtilizationPct??void 0,NotificationUserIds:c.join(",")});this.basConnectService.updateConnection(u).subscribe({next:x=>{this.basConnection.set(Object.assign(new nr,x)),i.markAsPristine(),i.markAsUntouched(),this.loadBasRejectionCount(),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"]).pipe(N()).subscribe(C=>{this.toastService.success(C["SHARED.SUCCESS"],C["APP_SETTINGS.INTEGRATIONS.SUCCESS.SAVE"])}),this.displaySpinner.set(!1)},error:()=>{this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"]).pipe(N()).subscribe(x=>{this.toastService.error(x["SHARED.ERROR_LABEL"],x["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"])}),this.displaySpinner.set(!1)}})}navigateToBasRejections(){this.router.navigate(["/system-config/app-settings/integrations/bas-connect-rejections"])}saveBasZoneMappings(){let t=this.basConnection(),i=(t?.Id?this.editForms().get(t.Id):void 0)?.controls.ZoneMappings;if(!t?.Id||!i)return;let s=t.Id,c=this.basMappingOriginals().get(s)??[],u=i.controls.map(U=>{let V=U.getRawValue(),z=(V.LocationIds??[]).map(ce=>(ce??"").trim()).filter(ce=>ce.length>0).join(",");return{ZoneObjectId:V.ZoneObjectId??"",ZoneName:V.ZoneName??"",LocationIds:z,LeadTimeMinutes:V.LeadTimeMinutes??0,SetbackMinutes:V.SetbackMinutes??0}}),x=new Map(c.filter(U=>!!U.ZoneObjectId).map(U=>[U.ZoneObjectId,U])),C=new Map(u.filter(U=>!!U.ZoneObjectId&&!!U.LocationIds).map(U=>[U.ZoneObjectId,U])),O=[],w=[];for(let[U,V]of C){let z=x.get(U);z?z.Id&&this.basMappingDiffers(z,V)&&w.push({id:z.Id,mapping:ki(Di({},V),{Id:z.Id})}):O.push(V)}let F=[];for(let[U,V]of x)!C.has(U)&&V.Id&&F.push(V.Id);if(O.length===0&&w.length===0&&F.length===0){i.markAsPristine();return}this.displaySpinner.set(!0);let L=[];O.length>0&&L.push(this.basConnectService.createMappings(O));for(let U of w)L.push(this.basConnectService.updateMapping(U.id,U.mapping));for(let U of F)L.push(this.basConnectService.deleteMapping(U));ue(L).subscribe({next:()=>{this.basConnectService.getMappings().pipe(N()).subscribe({next:U=>{this.basMappingOriginals.update(V=>new Map(V).set(s,U)),i.clear({emitEvent:!1});for(let V of U)i.push(this.createBasZoneMappingControl(V),{emitEvent:!1});i.markAsPristine(),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.MAPPINGS_SAVED"]).pipe(N()).subscribe(V=>{this.toastService.success(V["SHARED.SUCCESS"],V["APP_SETTINGS.INTEGRATIONS.SUCCESS.MAPPINGS_SAVED"])}),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1)}})},error:()=>{this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"]).pipe(N()).subscribe(U=>{this.toastService.error(U["SHARED.ERROR_LABEL"],U["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"])}),this.displaySpinner.set(!1)}})}testBasConnection(){let t=this.basConnection();t&&(this.displaySpinner.set(!0),this.basConnectService.testConnection(t).subscribe({next:o=>{this.basLastTestResult.set(o),o.Status==="Connected"?this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONNECTED"],{deviceName:o.DeviceName??""}).pipe(N()).subscribe(i=>{this.toastService.success(i["SHARED.SUCCESS"],i["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONNECTED"])}):this.translate.get(["SHARED.ERROR_LABEL"]).pipe(N()).subscribe(i=>{this.toastService.error(i["SHARED.ERROR_LABEL"],o.Reason??o.Status)}),this.displaySpinner.set(!1)},error:()=>{this.basLastTestResult.set({Status:"AgentOffline"}),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.ERROR_GENERIC"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.ERROR_GENERIC"])}),this.displaySpinner.set(!1)}}))}onBasAgentTestCompleted(t){this.basLastTestResult.set(t)}toggleBasActivityLog(){if(this.basActivityLogExpanded()){this.basActivityLogExpanded.set(!1),this.basActivityLogEntries.set([]),this.basActivityLogTotalCount.set(0),this.basActivityLogFirst.set(0),this.basActivityLogExpandedRowIds.set(new Set);return}this.closeAllExpanded(),this.basActivityLogExpanded.set(!0)}toggleBasConnect(t){let o=this.basConnection();if(!o)return;let i=t?M.ACTIVE:M.DISABLED,s=t?"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIRM_ENABLE_HEADER":"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIRM_DISABLE_HEADER",c=t?"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIRM_ENABLE_MESSAGE":"APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.CONFIRM_DISABLE_MESSAGE",u=t?"APP_SETTINGS.INTEGRATIONS.SUCCESS.ENABLE":"APP_SETTINGS.INTEGRATIONS.SUCCESS.DISABLE";this.translate.get([s,c,u,"SHARED.SUCCESS","SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.TOGGLE_ERROR"]).pipe(N()).subscribe(x=>{this.confirmationService.confirm({key:t?"enablePromptDialog":"disablePromptDialog",header:x[s],message:x[c],accept:()=>{this.displaySpinner.set(!0);let C=Object.assign(new nr,o,{State:i});this.basConnectService.updateConnection(C).subscribe({next:O=>{this.basConnection.set(O),this.toastService.success(x["SHARED.SUCCESS"],x[u]),this.displaySpinner.set(!1)},error:()=>{this.toastService.error(x["SHARED.ERROR_LABEL"],x["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.TOGGLE_ERROR"]),this.displaySpinner.set(!1)}})}})})}toggleBasConnectSettings(){let t=this.basConnection();if(!t?.Id)return;let o=t.Id;if(this.expandedSubscriptionIds().has(o)){this.expandedSubscriptionIds.update(i=>{let s=new Set(i);return s.delete(o),s}),this.editForms.update(i=>(i.delete(o),new Map(i))),this.basMappingOriginals.update(i=>(i.delete(o),new Map(i)));return}this.basActivityLogExpanded()&&this.basActivityLogExpanded.set(!1),this.displaySpinner.set(!0),this.basConnectService.getMappings().pipe(N()).subscribe({next:i=>{let s=this.buildBasIntegrationForm(t,i);this.editForms.update(c=>new Map(c).set(o,s)),this.basMappingOriginals.update(c=>new Map(c).set(o,i)),this.expandedSubscriptionIds.set(new Set([o])),this.displaySpinner.set(!1)},error:()=>{this.displaySpinner.set(!1),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.ERROR_GENERIC"]).pipe(N()).subscribe(i=>{this.toastService.error(i["SHARED.ERROR_LABEL"],i["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.ERROR_GENERIC"])})}})}toggleBasRowExpand(t){this.basActivityLogExpandedRowIds.update(o=>{let i=new Set(o);return i.has(t.Id)?i.delete(t.Id):i.add(t.Id),i})}basMappingDiffers(t,o){return this.normalizeLocationIdsCsv(t.LocationIds)!==this.normalizeLocationIdsCsv(o.LocationIds)||t.LeadTimeMinutes!==o.LeadTimeMinutes||t.SetbackMinutes!==o.SetbackMinutes}normalizeLocationIdsCsv(t){if(!t)return"";let o=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);return o.sort(),o.join(",")}buildBasIntegrationForm(t,o){return new ir({Connection:this.fb.group({Host:this.fb.control(t.Host??"",[T.required,T.maxLength(256)]),Port:this.fb.control(t.Port??47808,[T.required,T.min(1),T.max(65535)]),DeviceInstance:this.fb.control(t.DeviceInstance??null,[T.required,T.min(0),T.max(4194302)])}),ZoneMappings:new Ss(o.map(i=>this.createBasZoneMappingControl(i))),Capacity:this.createBasCapacityFormGroup(t)})}checkBasAgentConnection(){let t=this.basConnection();!t||t.State!==M.ACTIVE||(this.basLastTestResult.set(null),this.basConnectService.testConnection(t).pipe(N()).subscribe({next:o=>{this.basLastTestResult.set(o)},error:()=>{this.basLastTestResult.set({Status:"AgentOffline"})}}))}
3134createBasConnectForm(){return new ir({Connection:this.fb.group({Host:this.fb.control("",[T.required,T.maxLength(256)]),Port:this.fb.control(47808,[T.required,T.min(1),T.max(65535)]),DeviceInstance:this.fb.control(null,[T.required,T.min(0),T.max(4194302)]),ConnectionVerified:this.fb.control(!1,[T.requiredTrue])}),ZoneMappings:new Ss([]),Capacity:this.createBasCapacityFormGroup(null)})}createBasCapacityFormGroup(t){let o=(t?.NotificationUserIds??"").split(",").map(i=>i.trim()).filter(i=>i.length>0);return this.fb.group({DispatchHorizonHours:this.fb.control(t?.DispatchHorizonHours??72,[T.required,T.min(25),T.max(168)]),ConfiguredMaxSlots:this.fb.control(t?.ConfiguredMaxSlots??20,[T.required,T.min(1),T.max(500)]),ReservedSlots:this.fb.control(t?.ReservedSlots??4,[T.required,T.min(0)]),MaxUtilizationPct:this.fb.control(t?.MaxUtilizationPct??90,[T.required,T.min(50),T.max(100)]),NotificationUserIds:this.fb.control(o)},{validators:[oC]})}createBasZoneMappingControl(t){let o=(t.LocationIds??"").split(",").map(i=>i.trim()).filter(i=>i.length>0);return new ir({ZoneObjectId:this.fb.control(t.ZoneObjectId??""),ZoneName:this.fb.control(t.ZoneName??""),LocationIds:this.fb.control(o),LeadTimeMinutes:this.fb.control(t.LeadTimeMinutes??45),SetbackMinutes:this.fb.control(t.SetbackMinutes??15)})}loadBasRejectionCount(){this.basConnectService.getRejectionCount().pipe(N()).subscribe({next:t=>this.basRejectionCount.set(t),error:()=>this.basRejectionCount.set(0)})}saveBasConnectIntegration(){let t=this.stepperForm();if(!this.submitted()&&t){this.submitted.set(!0),this.displaySpinner.set(!0);let o=t.getRawValue(),i=new nr().parseForm(o);this.basConnectService.createConnection(i).subscribe({next:s=>{this.submitted.set(!1),this.showAddIntegrationForm.set(!1),this.stepperForm.set(null),this.translate.get(["SHARED.SUCCESS","APP_SETTINGS.INTEGRATIONS.SUCCESS.CREATE"]).pipe(N()).subscribe(c=>{this.toastService.success(c["SHARED.SUCCESS"],c["APP_SETTINGS.INTEGRATIONS.SUCCESS.CREATE"])}),this.basConnection.set(s),this.checkBasAgentConnection(),this.displaySpinner.set(!1)},error:()=>{this.submitted.set(!1),this.displaySpinner.set(!1),this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"]).pipe(N()).subscribe(s=>{this.toastService.error(s["SHARED.ERROR_LABEL"],s["APP_SETTINGS.INTEGRATIONS.BAS_CONNECT.ERROR.SAVE_ERROR"])})}})}}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-integration-settings"]],decls:27,vars:8,consts:[["content",""],["toggleicon",""],[1,"col-12"],[1,"form-container"],["translate","","id","qware.app-settings.integrations.page-header",1,"page-header"],["id","qware.app-settings.integrations.spinner",3,"displaySpinner"],[1,"subscription-card-container"],[1,"flex-inline","align-right",2,"margin-bottom","0.5rem"],["type","button","id","qware.app-settings.integrations.button.add",3,"onClick","raised","disabled"],[1,"material-icons"],[1,"p-button-label"],[3,"valueChange","value"],[1,"integration-container",3,"hidden"],[1,"integration-type-search"],["pInputText","","id","qware.app-settings.integrations.search",3,"input","placeholder","fluid","value"],[1,"integration-type-grid"],[3,"hidden"],[3,"value"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"],[1,"p-stepper-separator"],[1,"integration-type-card"],[1,"integration-type-icon-box"],[1,"integration-type-name"],[1,"integration-type-description"],["type","button","variant","outlined","size","small",3,"onClick","label","fluid","disabled","id"],[1,"no-results",2,"grid-column","1 / -1"],[4,"ngComponentOutlet","ngComponentOutletInputs"],[1,"integration-card",3,"id"],[1,"integration-sub-card"],[1,"integration-sub-top"],[1,"integration-sub-icon-box"],[1,"integration-sub-header-actions"],[3,"onChange","ngModel","ngModelOptions","id","disabled"],[1,"integration-sub-name"],[1,"integration-sub-description"],[1,"integration-sub-footer"],[3,"severity","value"],[3,"click","severity","value","id"],[1,"integration-sub-meta",3,"id"],[1,"material-icons-outlined","sync-failure-icon"],[1,"sync-failure-text"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded","i
3134d"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded","disabled","id"],[1,"material-icons","flip"],[3,"dt","multiple","value"],["value","0",3,"id"],[1,"accordion-content-padding"],[3,"testCompleted","form"],[1,"flex-inline","align-right"],["type","button",3,"onClick","text","id","disabled","label"],["value","1",3,"id"],[3,"isLoading"],["value","2",3,"id"],[3,"isLoading","allLocations","connectionForm","form"],["value","3",3,"id"],[1,"component-padding"],[3,"form","users"],[1,"ical-mapping-container"],["type","button",3,"onClick","raised","id"],["styleClass","no-selection-column","currentPageReportTemplate","{first}-{last} of {totalRecords}",3,"firstChange","value","id","paginator","rows","rowsPerPageOptions","showCurrentPageReport","first"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[3,"form","categoryOptions","calendarOptionsMap","intervalOptions","subscription"],["translate","",1,"p-button-label"],["translate",""],[2,"width","58px"],[2,"min-width","200px","width","50%"],["pInputText","","variant","filled",3,"ngModelChange","fluid","ngModel"],[2,"min-width","300px","width","50%"],["hierarchySelectionType","single","appendTo","body",3,"selectChange","enablePicker","singleSelect","nodeIds","allLocations","selectedOption","filterByUserAccess","matchFilterOnParents","isRequired","id"],["type","button","styleClass","icon-only-button",3,"onClick","rounded","text"],["colspan","3"],["translate","",1,"no-results"],[1,"analytics-container"],[1,"header-container"],[1,"bas-activity-filters"],[1,"medium-input"],["variant","on"],["appendTo","body","inputId","qware.app-settings.integrations.bas-activity.filter-from",3,"ngModelChange","ngModel"],["for","qware.app-settings.integrations.bas-activity.filter-from","translate",""],["appendTo","body","inputId","qware.app-settings.integrations.bas-activity.filter-to",3,"ngModelChange","ngModel"],["for","qware.app-settings.integrations.bas-activity.filter-to","translate",""],["type","button","id","qware.app-settings.integrations.bas-activity.apply",3,"onClick","raised","disabled","label"],["currentPageReportTemplate","{first}-{last} of {totalRecords}","id","qware.app-settings.integrations.bas-activity.table",3,"onLazyLoad","value","paginator","rows","totalRecords","lazy","first","dataKey","showCurrentPageReport"],[2,"width","60px"],["translate","",1,"visually-hidden"],["type","button","styleClass","row-expand icon-only-button",3,"onClick","text","rounded"],["colspan","6"],[1,"bas-activity-detail"],["translate","",1,"bold"],["severity","warn",3,"text"],[2,"padding","0 1.5rem 1.5rem"],["type","line","height","200px",3,"data","options","i
3134d"],["width","100%","height","14rem"],["translate","",1,"no-integrations-placeholder"],[1,"flex-inline","align-right","action-bar"],["id","qware.app-settings.integrations.button.back","type","button","severity","secondary",3,"onClick","text","label"],["type","button","severity","secondary","id","qware.app-settings.integrations.button.cancel",3,"onClick","text","label"],["type","button","id","qware.app-settings.integrations.button.next",3,"onClick","text","disabled","label"],["type","button","id","qware.app-settings.integrations.button.save",3,"onClick","text","disabled","label"]],template:function(o,i){o&1&&(n(0,"div",2),e(1,` 3135 `),n(2,"div",3),e(3,` 3136 `),n(4,"h3",4),e(5,` 3137 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8),I(9,"translate"),a(),e(10,` 3138 `),n(11,"p-card"),e(12,` 3139 `),n(13,"qware-spinner",5),e(14,` 3140 `),e(15,` 3141 `),n(16,"div",6),e(17,` 3142 `),_(18,Gf,11,2)(19,Qf,29,14)(20,tC,4,1),a(),e(21,` 3143 3144 `),_(22,iC,8,4)(23,rC,10,6),a(),e(24,` 3145 `),a(),e(25,` 3146 `),a(),e(26,` 3147`),a()),o&2&&(l(8),K("",y(9,6,"APP_SETTINGS.INTEGRATIONS.PAGE_HEADER"),` 3148 `),l(5),p("displaySpinner",i.displaySpinner()),l(5),f(i.showAddIntegrationForm()?-1:18),l(),f(i.showAddIntegrationForm()?19:-1),l(),f(i.showAddIntegrationForm()?-1:20),l(2),f(i.showAddIntegrationForm()?23:22))},dependencies:[tl,Mt,Pe,Nt,Ot,Ft,Dp,Bs,Hs,Ws,vi,oe,Mn,Ie,vl,Rs,Na,il,Jn,gl,Ii,Ne,An,Ae,se,Le,js,Hi,ye,Bi,gi,gd,Wa,wt,me,Oa,Rn,ea,Mr,Fr,al,ai,ti,ni,ii,nl,ka,ht,Qa,lr,pl,Ai,h0,Qt,ie,$],styles:[`qware-integration-settings .subscription-card-container{margin:1.5rem}@media screen and (max-width: 768px){qware-integration-settings .subscription-card-container{margin:1.5rem 0rem}}qware-integration-settings .integration-container{padding:.5rem}qware-integration-settings .integration-container .integration-type-search{margin-bottom:1rem}qware-integration-settings .integration-container .integration-type-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;max-height:420px;overflow-y:auto}@media screen and (max-width: 992px){qware-integration-settings .integration-container .integration-type-grid{grid-template-columns:repeat(3,1fr)}}@media screen and (max-width: 576px){qware-integration-settings .integration-container .integration-type-grid{grid-template-columns:repeat(2,1fr)}}qware-integration-settings .integration-container .integration-type-card{display:flex;flex-direction:column;align-items:center;text-align:center;padding:1.5rem 1rem 1rem;border:1px solid var(--p-surface-400);border-radius:var(--p-card-border-radius);gap:.625rem;transition:border-color .15s,box-shadow .15s}qware-integration-settings .integration-container .integration-type-card:hover{border-color:var(--p-primary-color)}qware-integration-settings .integration-container .integration-type-card .integration-type-icon-box{width:3rem;height:3rem;display:flex;align-items:center;justify-content:center;background-color:var(--p-primary-color);border-radius:var(--p-card-border-radius)}qware-integration-settings .integration-container .integration-type-card .integration-type-icon-box .material-icons{font-size:1.5rem;color:#fff}qware-integration-settings .integration-container .integration-type-card .integration-type-name{font-weight:700;font-size:var(--p-font-size-body1);flex:1}qware-integration-settings .integration-container .integration-type-card .integration-type-description{font-size:var(--p-font-size-body3);color:var(--p-text-muted-color);line-height:1.4;flex:1;margin-bottom:1rem}qware-integration-settings .integration-container .integration-type-card p-button{width:100%}qware-integration-settings .integration-card{margin-bottom:1.5rem;border-radius:var(--p-card-border-radius);border:1px solid var(--p-surface-400)}qware-integration-settings .integration-card .integration-sub-card{display:flex;flex-direction:column;padding:1.5rem;gap:.5rem}qware-integration-settings .integration-card .integration-sub-card .integration-sub-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:.25rem}qware-integration-settings .integration-card .integration-sub-card .integration-sub-icon-box{width:3rem;height:3rem;display:flex;align-items:center;justify-content:center;background-color:var(--p-primary-color);border-radius:var(--p-content-border-radius, 6px)}qware-integration-settings .integration-card .integration-sub-card .integration-sub-icon-box .material-icons{font-size:1.5rem;color:var(--p-surface-0)}qware-integration-settings .integration-card .integration-sub-card .integration-sub-header-actions{display:flex;align-items:center;gap:.25rem}qware-integration-settings .integration-card .integration-sub-card .integration-sub-name{font-weight:700;font-size:1rem;display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}qware-integration-settings .integration-card .integration-sub-card .integration-sub-description{font-size:var(--p-font-size-body2);color:var(--p-text-muted-color);line-height:1.4}qware-integration-settings .integration-card .integration-sub-card .integration-sub-meta{display:flex;align-items:center;font-size:var(--p-font-size-body3)}qware-integration-settings .integration-card .integration-sub-card .integration-sub-meta .sync-failure-icon{color:var(--p-accent-50);font-size:1rem;vertical-align:middle;margin-right:.25rem}qware-integration-settings .integration-card .integration-sub-card .integration-sub-meta .sync-failure-text{color:var(--p-accent-50)}@keyframes spin{0%{transform:rotate(360deg)}to{transform:rotate(0)}}qware-integration-settings .icon-only-button.row-expand i{color:var(--p-surface-950)}qware-integration-settings .spin{animation:spin 1s linear infinite}
3148qware-integration-settings .integration-sub-footer{padding:.5rem;border-top:1px solid var(--p-surface-400);display:flex;gap:.25rem}qware-integration-settings .analytics-container{border-top:1px solid var(--p-surface-400)}qware-integration-settings .analytics-container .header-container{padding:1.5rem 1.5rem 1rem}qware-integration-settings .analytics-container .header-container h5{margin:0}qware-integration-settings .no-integrations-placeholder{background:var(--p-surface-100);border:1px solid var(--p-surface-400);border-radius:2px;padding:2rem;display:flex;align-items:center;justify-content:center;color:var(--p-surface-750);font-weight:500}qware-integration-settings .bas-status-chip{margin-left:.5rem}qware-integration-settings .bas-activity-filters{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem 1.5rem 1rem}qware-integration-settings .bas-activity-filters .medium-input{margin:0}qware-integration-settings .bas-activity-detail p{white-space:normal}qware-integration-settings .bas-connect-summary{padding:0 1.5rem 1.5rem}qware-integration-settings .bas-connect-summary dt{font-weight:700;margin-top:.5rem}qware-integration-settings .bas-connect-summary dd{margin:0 0 .5rem}qware-integration-settings .ical-mapping-container{padding:1rem 1.5rem}qware-integration-settings .p-accordion .p-accordionpanel:last-child{border-bottom:0}qware-integration-settings .p-accordion .p-accordionpanel:first-child{border-top:1px solid var(--p-accordion-panel-border-color);border-radius:0}qware-integration-settings #qware\\.app-settings\\.integrations\\.bas-activity\\.table .p-datatable .p-datatable-table .p-datatable-thead>tr>th:first-child{border-width:1px 1px 1px 0px!important}qware-integration-settings #qware\\.app-settings\\.integrations\\.bas-activity\\.table .p-datatable .p-datatable-table .p-datatable-thead>tr>th:last-child{border-width:1px 0px 1px 1px!important}qware-integration-settings #qware\\.app-settings\\.integrations\\.bas-activity\\.table .p-datatable .p-datatable-table .p-datatable-tbody>tr>td{border-width:1px 0!important}qware-integration-settings #qware\\.app-settings\\.integrations\\.bas-activity\\.table .p-datatable .p-paginator{border-width:0px!important;border-bottom-right-radius:4px;border-bottom-left-radius:4px} 3149`],encapsulation:2,changeDetection:0})}return r})();var kr=He(Hn()),za=He(nt());var lC=["shades"],sC=["emailSubjectLDREditor"],dC=["emailSubjectLDRDropdown"],pC=["emailBodyLDREditor"],mC=["emailBodyLDRDropdown"],cC=["emailSubjectCEEditor"],uC=["emailSubjectCEDropdown"],_C=["emailBodyCEEditor"],EC=["emailBodyCEDropdown"],SC=["emailSubjectAEEditor"],xC=["emailSubjectAEDropdown"],fC=["emailBodyAEEditor"],hC=["emailBodyAEDropdown"],CC=["emailSubjectREEditor"],vC=["emailSubjectREDropdown"],gC=["emailBodyREEditor"],TC=["emailBodyREDropdown"],IC=()=>["0"],oa=r=>({value:r}),fa=()=>({standalone:!0}),bC=()=>["label"],yC=()=>({height:"320px"}),AC=()=>({height:"160px"}),RC=r=>({action:r}),wC=(r,d)=>d.field;function DC(r,d){r&1&&(e(0,` 3150 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3151 `))}function LC(r,d){r&1&&(e(0,` 3152 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3153 `))}function NC(r,d){if(r&1&&(e(0,` 3154 `),_(1,DC,4,0)(2,LC,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function OC(r,d){r&1&&(e(0,` 3155 `),n(1,"span",89),e(2,"expand_less"),a(),e(3,` 3156 `))}function FC(r,d){r&1&&(e(0,` 3157 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3158 `))}function MC(r,d){if(r&1&&(e(0,` 3159 `),n(1,"small",90),e(2,` 3160 `),n(3,"div",39),e(4),a(),e(5,` 3161 `),a(),e(6,` 3162 `)),r&2){let t=d.$implicit;l(4),v(t)}}function UC(r,d){if(r&1&&(e(0,` 3163 `),G(1,MC,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.HoursBeforeEventStartsToCancel)}}function PC(r,d){r&1&&(e(0,` 3164 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3165 `))}function GC(r,d){r&1&&(e(0,` 3166 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3167 `))}function kC(r,d){if(r&1){let t=b();e(0,` 3168 `),n(1,"span",91),e(2,` 3169 `),n(3,"p-select",92,14),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldCEES,i)||(s.selectedMergeFieldCEES=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailSubjectCESelectChanged())}),e(6,` 3170 `),_(7,PC,4,0,"ng-template",93),e(8,` 3171 `),_(9,GC,4,0,"ng-template",94),e(10,` 3172 `),a(),e(11,` 3173 `),a(),e(12,` 3174 `)}if(r&2){let t=m();l(3),q("placeholder",y(5,6,"MERGE_FIELDS.SELECT")),p("options",t.eventSubjectMergeFieldOptions),H("ngModel",t.selectedMergeFieldCEES),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}function VC(r,d){if(r&1&&(e(0,` 3175 `),n(1,"small",90),e(2,` 3176 `),n(3,"div",39),e(4),a(),e(5,` 3177 `),a(),e(6,` 3178 `)),r&2){let t=d.$implicit;l(4),v(t)}}function qC(r,d){if(r&1&&(e(0,` 3179 `),G(1,VC,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailSubjectCanceledEvent)}}function BC(r,d){r&1&&(e(0,` 3180 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3181 `))}function HC(r,d){r&1&&(e(0,` 3182 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3183 `))}function WC(r,d){if(r&1){let t=b();e(0,` 3184 `),n(1,"span",95),e(2,` 3185 `),e(3,`
3186 `),n(4,"select",96),e(5,` 3187 `),R(6,"option",97),e(7,` 3188 `),e(8,` 3189 `),R(9,"option",98),e(10,` 3190 `),R(11,"option",99),e(12,` 3191 `),R(13,"option",100),e(14,` 3192 `),a(),e(15,` 3193 `),a(),e(16,` 3194 `),n(17,"span",95),e(18,` 3195 `),e(19,` 3196 `),R(20,"select",101),e(21,` 3197 `),R(22,"select",102),e(23,` 3198 `),a(),e(24,` 3199 `),n(25,"span",95),e(26,` 3200 `),e(27,` 3201 `),R(28,"button",103),e(29,` 3202 `),R(30,"button",104),e(31,` 3203 `),R(32,"button",105),e(33,` 3204 `),R(34,"button",106),e(35,` 3205 `),R(36,"button",107),e(37,` 3206 `),a(),e(38,` 3207 `),n(39,"span",95),e(40,` 3208 `),e(41,` 3209 `),R(42,"button",108),e(43,` 3210 `),R(44,"button",109),e(45,` 3211 `),R(46,"button",110),e(47,` 3212 `),R(48,"button",111),e(49,` 3213 `),a(),e(50,` 3214 `),n(51,"span",95),e(52,` 3215 `),e(53,` 3216 `),R(54,"button",112),e(55,` 3217 `),a(),e(56,` 3218 `),e(57,` 3219 `),n(58,"span",95),e(59,` 3220 `),R(60,"button",113),e(61,` 3221 `),a(),e(62,` 3222 `),n(63,"span",91),e(64,` 3223 `),n(65,"p-select",114,15),I(67,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldCEEB,i)||(s.selectedMergeFieldCEEB=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailBodyCESelectChanged())}),e(68,` 3224 `),_(69,BC,4,0,"ng-template",93),e(70,` 3225 `),_(71,HC,4,0,"ng-template",94),e(72,` 3226 `),a(),e(73,` 3227 `),a(),e(74,` 3228 `)}if(r&2){let t=m();l(65),q("placeholder",y(67,6,"MERGE_FIELDS.SELECT")),p("options",t.eventBodyMergeFieldOptions),H("ngModel",t.selectedMergeFieldCEEB),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}function jC(r,d){if(r&1&&(e(0,` 3229 `),n(1,"small",90),e(2,` 3230 `),n(3,"div",39),e(4),a(),e(5,` 3231 `),a(),e(6,` 3232 `)),r&2){let t=d.$implicit;l(4),v(t)}}function YC(r,d){if(r&1&&(e(0,` 3233 `),G(1,jC,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailBodyCanceledEvent)}}function QC(r,d){r&1&&(e(0,` 3234 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3235 `))}function KC(r,d){r&1&&(e(0,` 3236 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3237 `))}function $C(r,d){if(r&1){let t=b();e(0,` 3238 `),n(1,"span",91),e(2,` 3239 `),n(3,"p-select",115,16),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldAEES,i)||(s.selectedMergeFieldAEES=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailSubjectAESelectChanged())}),e(6,` 3240 `),_(7,QC,4,0,"ng-template",93),e(8,` 3241 `),_(9,KC,4,0,"ng-template",94),e(10,` 3242 `),a(),e(11,` 3243 `),a(),e(12,` 3244 `)}if(r&2){let t=m();l(3),q("placeholder",y(5,6,"MERGE_FIELDS.SELECT")),p("options",t.eventSubjectMergeFieldOptions),H("ngModel",t.selectedMergeFieldAEES),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}function zC(r,d){if(r&1&&(e(0,` 3245 `),n(1,"small",90),e(2,` 3246 `),n(3,"div",39),e(4),a(),e(5,` 3247 `),a(),e(6,` 3248 `)),r&2){let t=d.$implicit;l(4),v(t)}}function XC(r,d){if(r&1&&(e(0,` 3249 `),G(1,zC,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailSubjectApprovedEvent)}}function ZC(r,d){r&1&&(e(0,` 3250 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3251 `))}function JC(r,d){r&1&&(e(0,` 3252 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3253 `))}function ev(r,d){if(r&1){let t=b();e(0,` 3254 `),n(1,"span",95),e(2,` 3255 `),e(3,`
3256 `),n(4,"select",96),e(5,` 3257 `),R(6,"option",97),e(7,` 3258 `),e(8,` 3259 `),R(9,"option",98),e(10,` 3260 `),R(11,"option",99),e(12,` 3261 `),R(13,"option",100),e(14,` 3262 `),a(),e(15,` 3263 `),a(),e(16,` 3264 `),n(17,"span",95),e(18,` 3265 `),e(19,` 3266 `),R(20,"select",101),e(21,` 3267 `),R(22,"select",102),e(23,` 3268 `),a(),e(24,` 3269 `),n(25,"span",95),e(26,` 3270 `),e(27,` 3271 `),R(28,"button",103),e(29,` 3272 `),R(30,"button",104),e(31,` 3273 `),R(32,"button",105),e(33,` 3274 `),R(34,"button",106),e(35,` 3275 `),R(36,"button",107),e(37,` 3276 `),a(),e(38,` 3277 `),n(39,"span",95),e(40,` 3278 `),e(41,` 3279 `),R(42,"button",108),e(43,` 3280 `),R(44,"button",109),e(45,` 3281 `),R(46,"button",110),e(47,` 3282 `),R(48,"button",111),e(49,` 3283 `),a(),e(50,` 3284 `),n(51,"span",95),e(52,` 3285 `),e(53,` 3286 `),R(54,"button",112),e(55,` 3287 `),a(),e(56,` 3288 `),e(57,` 3289 `),n(58,"span",95),e(59,` 3290 `),R(60,"button",113),e(61,` 3291 `),a(),e(62,` 3292 `),n(63,"span",91),e(64,` 3293 `),n(65,"p-select",116,17),I(67,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldAEEB,i)||(s.selectedMergeFieldAEEB=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailBodyAESelectChanged())}),e(68,` 3294 `),_(69,ZC,4,0,"ng-template",93),e(70,` 3295 `),_(71,JC,4,0,"ng-template",94),e(72,` 3296 `),a(),e(73,` 3297 `),a(),e(74,` 3298 `)}if(r&2){let t=m();l(65),q("placeholder",y(67,6,"MERGE_FIELDS.SELECT")),p("options",t.eventBodyMergeFieldOptions),H("ngModel",t.selectedMergeFieldAEEB),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}function tv(r,d){if(r&1&&(e(0,` 3299 `),n(1,"small",90),e(2,` 3300 `),n(3,"div",39),e(4),a(),e(5,` 3301 `),a(),e(6,` 3302 `)),r&2){let t=d.$implicit;l(4),v(t)}}function iv(r,d){if(r&1&&(e(0,` 3303 `),G(1,tv,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailBodyApprovedEvent)}}function nv(r,d){r&1&&(e(0,` 3304 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3305 `))}function av(r,d){r&1&&(e(0,` 3306 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3307 `))}function rv(r,d){if(r&1){let t=b();e(0,` 3308 `),n(1,"span",91),e(2,` 3309 `),n(3,"p-select",117,18),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldREES,i)||(s.selectedMergeFieldREES=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailSubjectRESelectChanged())}),e(6,` 3310 `),_(7,nv,4,0,"ng-template",93),e(8,` 3311 `),_(9,av,4,0,"ng-template",94),e(10,` 3312 `),a(),e(11,` 3313 `),a(),e(12,` 3314 `)}if(r&2){let t=m();l(3),q("placeholder",y(5,6,"MERGE_FIELDS.SELECT")),p("options",t.eventSubjectMergeFieldOptions),H("ngModel",t.selectedMergeFieldREES),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}
3314function ov(r,d){if(r&1&&(e(0,` 3315 `),n(1,"small",90),e(2,` 3316 `),n(3,"div",39),e(4),a(),e(5,` 3317 `),a(),e(6,` 3318 `)),r&2){let t=d.$implicit;l(4),v(t)}}function lv(r,d){if(r&1&&(e(0,` 3319 `),G(1,ov,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailSubjectRejectedEvent)}}function sv(r,d){r&1&&(e(0,` 3320 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3321 `))}function dv(r,d){r&1&&(e(0,` 3322 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3323 `))}function pv(r,d){if(r&1){let t=b();e(0,` 3324 `),n(1,"span",95),e(2,` 3325 `),e(3,` 3326 `),n(4,"select",96),e(5,` 3327 `),R(6,"option",97),e(7,` 3328 `),e(8,` 3329 `),R(9,"option",98),e(10,` 3330 `),R(11,"option",99),e(12,` 3331 `),R(13,"option",100),e(14,` 3332 `),a(),e(15,` 3333 `),a(),e(16,` 3334 `),n(17,"span",95),e(18,` 3335 `),e(19,` 3336 `),R(20,"select",101),e(21,` 3337 `),R(22,"select",102),e(23,` 3338 `),a(),e(24,` 3339 `),n(25,"span",95),e(26,` 3340 `),e(27,` 3341 `),R(28,"button",103),e(29,` 3342 `),R(30,"button",104),e(31,` 3343 `),R(32,"button",105),e(33,` 3344 `),R(34,"button",106),e(35,` 3345 `),R(36,"button",107),e(37,` 3346 `),a(),e(38,` 3347 `),n(39,"span",95),e(40,` 3348 `),e(41,` 3349 `),R(42,"button",108),e(43,` 3350 `),R(44,"button",109),e(45,` 3351 `),R(46,"button",110),e(47,` 3352 `),R(48,"button",111),e(49,` 3353 `),a(),e(50,` 3354 `),n(51,"span",95),e(52,` 3355 `),e(53,` 3356 `),R(54,"button",112),e(55,` 3357 `),a(),e(56,` 3358 `),e(57,` 3359 `),n(58,"span",95),e(59,` 3360 `),R(60,"button",113),e(61,` 3361 `),a(),e(62,` 3362 `),n(63,"span",91),e(64,` 3363 `),n(65,"p-select",118,19),I(67,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeFieldREEB,i)||(s.selectedMergeFieldREEB=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.emailBodyRESelectChanged())}),e(68,` 3364 `),_(69,sv,4,0,"ng-template",93),e(70,` 3365 `),_(71,dv,4,0,"ng-template",94),e(72,` 3366 `),a(),e(73,` 3367 `),a(),e(74,` 3368 `)}if(r&2){let t=m();l(65),q("placeholder",y(67,6,"MERGE_FIELDS.SELECT")),p("options",t.eventBodyMergeFieldOptions),H("ngModel",t.selectedMergeFieldREEB),p("ngModelOptions",ne(8,fa))("fluid",!0)("filter",!0)}}function mv(r,d){if(r&1&&(e(0,` 3369 `),n(1,"small",90),e(2,` 3370 `),n(3,"div",39),e(4),a(),e(5,` 3371 `),a(),e(6,` 3372 `)),r&2){let t=d.$implicit;l(4),v(t)}}function cv(r,d){if(r&1&&(e(0,` 3373 `),G(1,mv,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailBodyRejectedEvent)}}function uv(r,d){r&1&&(e(0,` 3374 `),n(1,"span",95),e(2,` 3375 `),e(3,` 3376 `),n(4,"select",96),e(5,` 3377 `),R(6,"option",97),e(7,` 3378 `),e(8,` 3379 `),R(9,"option",98),e(10,` 3380 `),R(11,"option",99),e(12,` 3381 `),R(13,"option",100),e(14,` 3382 `),a(),e(15,` 3383 `),a(),e(16,` 3384 `),n(17,"span",95),e(18,` 3385 `),e(19,` 3386 `),R(20,"select",101),e(21,` 3387 `),R(22,"select",102),e(23,` 3388 `),a(),e(24,` 3389 `),n(25,"span",95),e(26,` 3390 `),e(27,` 3391 `),R(28,"button",103),e(29,` 3392 `),R(30,"button",104),e(31,` 3393 `),R(32,"button",105),e(33,` 3394 `),R(34,"button",106),e(35,` 3395 `),R(36,"button",107),e(37,` 3396 `),a(),e(38,` 3397 `),n(39,"span",95),e(40,` 3398 `),e(41,` 3399 `),R(42,"button",108),e(43,` 3400 `),R(44,"button",109),e(45,` 3401 `),R(46,"button",110),e(47,` 3402 `),R(48,"button",111),e(49,` 3403 `),a(),e(50,` 3404 `),n(51,"span",95),e(52,` 3405 `),e(53,` 3406 `),R(54,"button",112),e(55,` 3407 `),a(),e(56,` 3408 `),e(57,` 3409 `),n(58,"span",95),e(59,` 3410 `),R(60,"button",113),e(61,` 3411 `),a(),e(62,` 3412 `))}function _v(r,d){if(r&1&&(e(0,` 3413 `),n(1,"small",90),e(2,` 3414 `),n(3,"div",39),e(4),a(),e(5,` 3415 `),a(),e(6,` 3416 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Ev(r,d){if(r&1&&(e(0,` 3417 `),G(1,_v,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EventAlertMessage)}}function Sv(r,d){r&1&&(e(0,` 3418 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3419 `))}function xv(r,d){r&1&&(e(0,` 3420 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3421 `))}function fv(r,d){if(r&1&&(e(0,` 3422 `),_(1,Sv,4,0)(2,xv,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function hv(r,d){r&1&&(e(0,` 3423 `),n(1,"span",89),e(2,"expand_less"),a(),e(3,` 3424 `))}function Cv(r,d){r&1&&(e(0,` 3425 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3426 `))}function vv(r,d){if(r&1&&(e(0,` 3427 `),n(1,"small",90),e(2,` 3428 `),n(3,"div",39),e(4),a(),e(5,` 3429 `),a(),e(6,` 3430 `)),r&2){let t=d.$implicit;l(4),v(t)}}
3430function gv(r,d){if(r&1&&(e(0,` 3431 `),G(1,vv,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.LimitingDateRange)}}function Tv(r,d){r&1&&(e(0,` 3432 `),n(1,"span",89),e(2,"event"),a(),e(3,` 3433 `))}function Iv(r,d){if(r&1&&(e(0,` 3434 `),n(1,"small",90),e(2,` 3435 `),n(3,"div",39),e(4),a(),e(5,` 3436 `),a(),e(6,` 3437 `)),r&2){let t=d.$implicit;l(4),v(t)}}function bv(r,d){if(r&1&&(e(0,` 3438 `),G(1,Iv,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.LimitingDateUTC)}}function yv(r,d){if(r&1){let t=b();e(0,` 3439 `),n(1,"div",44),e(2,` 3440 `),n(3,"p-inputgroup"),e(4,` 3441 `),n(5,"p-floatlabel"),e(6,` 3442 `),n(7,"p-datepicker",119),e(8,` 3443 `),_(9,Tv,4,0,"ng-template",120),e(10,` 3444 `),a(),e(11,` 3445 `),n(12,"label",121),e(13,` 3446 `),n(14,"span",39),e(15,"APP_SETTINGS.EVENT.LIMITING_DATE_EXTERNAL"),a(),n(16,"span",47),e(17," *"),a(),e(18,` 3447 `),a(),e(19,` 3448 `),a(),e(20,` 3449 `),n(21,"p-inputgroup-addon"),e(22,` 3450 `),n(23,"i",82),h("click",function(i){E(t),m();let s=Ee(390);return S(s.toggle(i))}),e(24,"info"),a(),e(25,` 3451 `),a(),e(26,` 3452 `),a(),e(27,` 3453 `),n(28,"small",48),e(29,` 3454 `),n(30,"div",122),e(31,` 3455 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REQUIRED 3456 `),a(),e(32,` 3457 `),a(),e(33,` 3458 `),_(34,bv,3,0),a(),e(35,` 3459 `)}if(r&2){let t=m();l(7),p("tabindex",15)("showIcon",!0)("showButtonBar",!0)("maxDate",t.limitingDateMax)("fluid",!0),l(21),p("hidden",t.form.controls.LimitingDateUTC.valid||t.form.controls.LimitingDateUTC.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.LimitingDateUTC.errors!=null&&t.form.controls.LimitingDateUTC.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.LimitingDateUTC&&t.form.controls.LimitingDateUTC.untouched?34:-1)}}function Av(r,d){r&1&&(e(0,` 3460 `),n(1,"span",89),e(2,"expand_less"),a(),e(3,` 3461 `))}function Rv(r,d){r&1&&(e(0,` 3462 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3463 `))}function wv(r,d){if(r&1&&(e(0,` 3464 `),n(1,"small",90),e(2,` 3465 `),n(3,"div",39),e(4),a(),e(5,` 3466 `),a(),e(6,` 3467 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Dv(r,d){if(r&1&&(e(0,` 3468 `),G(1,wv,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DaysBeforeLimitingDateSendReminder)}}function Lv(r,d){if(r&1&&(e(0,` 3469 `),n(1,"div",44),e(2,` 3470 `),n(3,"p-floatlabel"),e(4,` 3471 `),n(5,"p-inputnumber",123),e(6,` 3472 `),_(7,Av,4,0,"ng-template",null,2,A),e(9,` 3473 `),_(10,Rv,4,0,"ng-template",null,3,A),e(12,` 3474 `),a(),e(13,` 3475 `),n(14,"label",124),e(15,` 3476 `),n(16,"span",39),e(17,"APP_SETTINGS.EVENT.LIMITING_DATE_DAYS_BEFORE"),a(),n(18,"span",47),e(19," *"),a(),e(20,` 3477 `),a(),e(21,` 3478 `),a(),e(22,` 3479 `),n(23,"small",48),e(24,` 3480 `),n(25,"div",125),e(26,` 3481 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_DAYS_BEFORE_REMINDER_REQUIRED 3482 `),a(),e(27,` 3483 `),a(),e(28,` 3484 `),_(29,Dv,3,0),a(),e(30,` 3485 `)),r&2){let t=m();l(5),p("tabindex",16)("fluid",!0)("showButtons",!0)("min",0),l(18),p("hidden",t.form.controls.DaysBeforeLimitingDateSendReminder.valid||t.form.controls.DaysBeforeLimitingDateSendReminder.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.DaysBeforeLimitingDateSendReminder.errors!=null&&t.form.controls.DaysBeforeLimitingDateSendReminder.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.DaysBeforeLimitingDateSendReminder&&t.form.controls.DaysBeforeLimitingDateSendReminder.untouched?29:-1)}}function Nv(r,d){r&1&&(e(0,` 3486 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3487 `))}function Ov(r,d){r&1&&(e(0,` 3488 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3489 `))}
3489function Fv(r,d){if(r&1&&(e(0,` 3490 `),n(1,"small",90),e(2,` 3491 `),n(3,"div",39),e(4),a(),e(5,` 3492 `),a(),e(6,` 3493 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Mv(r,d){if(r&1&&(e(0,` 3494 `),G(1,Fv,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.LimitingDateReminderRecipientIds)}}function Uv(r,d){if(r&1&&(e(0,` 3495 `),n(1,"div",44),e(2,` 3496 `),n(3,"p-floatlabel"),e(4,` 3497 `),n(5,"p-multiselect",126),e(6,` 3498 `),_(7,Nv,4,0,"ng-template",null,20,A),e(9,` 3499 `),_(10,Ov,4,0,"ng-template",null,21,A),e(12,` 3500 `),a(),e(13,` 3501 `),n(14,"label",127),e(15,` 3502 `),n(16,"span",39),e(17,"APP_SETTINGS.EVENT.LIMITING_DATE_REMINDER_RECIPIENTS"),a(),n(18,"span",47),e(19," *"),a(),e(20,` 3503 `),a(),e(21,` 3504 `),a(),e(22,` 3505 `),n(23,"small",48),e(24,` 3506 `),n(25,"div",128),e(26,` 3507 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REMINDER_RECIPIENTS_REQUIRED 3508 `),a(),e(27,` 3509 `),a(),e(28,` 3510 `),_(29,Mv,3,0),a(),e(30,` 3511 `)),r&2){let t=m();l(5),p("options",t.limitingDateReminderRecipientOptions)("tabindex",17)("fluid",!0)("id","qware.app-settings.event.limiting-date-reminder-recipients")("filterFields",ne(9,bC))("maxSelectedLabels",t.limitingDateReminderRecipientOptions.length+1),l(18),p("hidden",t.form.controls.LimitingDateReminderRecipientIds.valid||t.form.controls.LimitingDateReminderRecipientIds.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.LimitingDateReminderRecipientIds.errors!=null&&t.form.controls.LimitingDateReminderRecipientIds.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.LimitingDateReminderRecipientIds&&t.form.controls.LimitingDateReminderRecipientIds.untouched?29:-1)}}function Pv(r,d){r&1&&(e(0,` 3512 `),R(1,"span",95),e(2,` 3513 `))}function Gv(r,d){if(r&1&&(e(0,` 3514 `),n(1,"small",90),e(2,` 3515 `),n(3,"div",39),e(4),a(),e(5,` 3516 `),a(),e(6,` 3517 `)),r&2){let t=d.$implicit;l(4),v(t)}}function kv(r,d){if(r&1&&(e(0,` 3518 `),G(1,Gv,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.EmailSubjectLimitingDateReminder)}}function Vv(r,d){if(r&1){let t=b();e(0,` 3519 `),n(1,"div",44),e(2,` 3520 `),n(3,"label",129),e(4,` 3521 `),n(5,"span",39),e(6,"APP_SETTINGS.EVENT.LIMITING_DATE_EMAIL_SUBJECT"),a(),n(7,"span",47),e(8," *"),a(),e(9,` 3522 `),a(),e(10,` 3523 `),n(11,"p-editor",130,22),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(13,` 3524 `),_(14,Pv,3,0,"ng-template",null,5,A),e(16,` 3525 `),a(),e(17,` 3526 `),n(18,"small",48),e(19,` 3527 `),n(20,"div",131),e(21,` 3528 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REMINDER_EMAIL_SUBJECT_REQUIRED 3529 `),a(),e(22,` 3530 `),n(23,"div",132),e(24,` 3531 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REMINDER_EMAIL_SUBJECT_LENGTH 3532 `),a(),e(25,` 3533 `),a(),e(26,` 3534 `),_(27,kv,3,0),a(),e(28,` 3535 `)}if(r&2){let t=m();l(11),p("tabindex",18),l(7),p("hidden",t.form.controls.EmailSubjectLimitingDateReminder.valid||t.form.controls.EmailSubjectLimitingDateReminder.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.EmailSubjectLimitingDateReminder.errors!=null&&t.form.controls.EmailSubjectLimitingDateReminder.errors.required)),l(3),p("hidden",!(t.form.controls.EmailSubjectLimitingDateReminder.errors!=null&&t.form.controls.EmailSubjectLimitingDateReminder.errors.maxlength)||(t.form.controls.EmailSubjectLimitingDateReminder.errors==null?null:t.form.controls.EmailSubjectLimitingDateReminder.errors.required))("translateParams",pe(6,oa,t.form.controls.EmailSubjectLimitingDateReminder.value)),l(4),f(t.validationErrors&&t.validationErrors.EmailSubjectLimitingDateReminder&&t.form.controls.EmailSubjectLimitingDateReminder.untouched?27:-1)}}function qv(r,d){r&1&&(e(0,` 3536 `),n(1,"span",95),e(2,` 3537 `),e(3,`
3538 `),n(4,"select",96),e(5,` 3539 `),R(6,"option",97),e(7,` 3540 `),e(8,` 3541 `),R(9,"option",98),e(10,` 3542 `),R(11,"option",99),e(12,` 3543 `),R(13,"option",100),e(14,` 3544 `),a(),e(15,` 3545 `),a(),e(16,` 3546 `),n(17,"span",95),e(18,` 3547 `),e(19,` 3548 `),R(20,"select",101),e(21,` 3549 `),R(22,"select",102),e(23,` 3550 `),a(),e(24,` 3551 `),n(25,"span",95),e(26,` 3552 `),e(27,` 3553 `),R(28,"button",103),e(29,` 3554 `),R(30,"button",104),e(31,` 3555 `),R(32,"button",105),e(33,` 3556 `),R(34,"button",106),e(35,` 3557 `),R(36,"button",107),e(37,` 3558 `),a(),e(38,` 3559 `),n(39,"span",95),e(40,` 3560 `),e(41,` 3561 `),R(42,"button",108),e(43,` 3562 `),R(44,"button",109),e(45,` 3563 `),R(46,"button",110),e(47,` 3564 `),R(48,"button",111),e(49,` 3565 `),a(),e(50,` 3566 `),n(51,"span",95),e(52,` 3567 `),e(53,` 3568 `),R(54,"button",112),e(55,` 3569 `),a(),e(56,` 3570 `),e(57,` 3571 `),n(58,"span",95),e(59,` 3572 `),R(60,"button",113),e(61,` 3573 `),a(),e(62,` 3574 `))}function Bv(r,d){if(r&1&&(e(0,` 3575 `),n(1,"small",90),e(2,` 3576 `),n(3,"div",39),e(4),a(),e(5,` 3577 `),a(),e(6,` 3578 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Hv(r,d){if(r&1&&(e(0,` 3579 `),G(1,Bv,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.EmailBodyLimitingDateReminder)}}function Wv(r,d){if(r&1){let t=b();e(0,` 3580 `),n(1,"div",44),e(2,` 3581 `),n(3,"label",133),e(4,` 3582 `),n(5,"span",39),e(6,"APP_SETTINGS.EVENT.LIMITING_DATE_EMAIL_BODY"),a(),n(7,"span",47),e(8," *"),a(),e(9,` 3583 `),a(),e(10,` 3584 `),n(11,"p-editor",134,23),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(13,` 3585 `),_(14,qv,63,0,"ng-template",null,5,A),e(16,` 3586 `),a(),e(17,` 3587 `),n(18,"small",48),e(19,` 3588 `),n(20,"div",135),e(21,` 3589 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REMINDER_EMAIL_BODY_REQUIRED 3590 `),a(),e(22,` 3591 `),n(23,"div",136),e(24,` 3592 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_REMINDER_EMAIL_BODY_LENGTH 3593 `),a(),e(25,` 3594 `),a(),e(26,` 3595 `),_(27,Hv,3,0),a(),e(28,` 3596 `)}if(r&2){let t=m();l(11),p("tabindex",19),l(7),p("hidden",t.form.controls.EmailBodyLimitingDateReminder.valid||t.form.controls.EmailBodyLimitingDateReminder.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.EmailBodyLimitingDateReminder.errors!=null&&t.form.controls.EmailBodyLimitingDateReminder.errors.required)),l(3),p("hidden",!(t.form.controls.EmailBodyLimitingDateReminder.errors!=null&&t.form.controls.EmailBodyLimitingDateReminder.errors.maxlength)||(t.form.controls.EmailBodyLimitingDateReminder.errors==null?null:t.form.controls.EmailBodyLimitingDateReminder.errors.required))("translateParams",pe(6,oa,t.form.controls.EmailBodyLimitingDateReminder.value)),l(4),f(t.validationErrors&&t.validationErrors.EmailBodyLimitingDateReminder&&t.form.controls.EmailBodyLimitingDateReminder.untouched?27:-1)}}function jv(r,d){r&1&&(e(0,` 3597 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3598 `))}function Yv(r,d){r&1&&(e(0,` 3599 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3600 `))}
3600function Qv(r,d){if(r&1&&(e(0,` 3601 `),_(1,jv,4,0)(2,Yv,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Kv(r,d){r&1&&(e(0,` 3602 `),n(1,"i",89),e(2,"check"),a(),e(3,` 3603 `))}function $v(r,d){if(r&1&&(e(0,` 3604 `),n(1,"p-message",151),e(2,` 3605 `),_(3,Kv,4,0,"ng-template",null,25,A),e(5,` 3606 `),n(6,"span"),e(7),a(),e(8,` 3607 `),a(),e(9,` 3608 `)),r&2){let t=m(2);l(7),v(t.linkCopiedToClipboardText)}}function zv(r,d){r&1&&(e(0,` 3609 `),n(1,"i",89),e(2,"check"),a(),e(3,` 3610 `))}function Xv(r,d){if(r&1&&(e(0,` 3611 `),n(1,"p-message",151),e(2,` 3612 `),_(3,zv,4,0,"ng-template",null,25,A),e(5,` 3613 `),n(6,"span"),e(7),a(),e(8,` 3614 `),a(),e(9,` 3615 `)),r&2){let t=m(2);l(7),v(t.linkCopiedToClipboardText)}}function Zv(r,d){r&1&&(e(0,` 3616 `),n(1,"span",95),e(2,` 3617 `),e(3,` 3618 `),n(4,"select",96),e(5,` 3619 `),R(6,"option",97),e(7,` 3620 `),e(8,` 3621 `),R(9,"option",98),e(10,` 3622 `),R(11,"option",99),e(12,` 3623 `),R(13,"option",100),e(14,` 3624 `),a(),e(15,` 3625 `),a(),e(16,` 3626 `),n(17,"span",95),e(18,` 3627 `),e(19,` 3628 `),R(20,"select",101),e(21,` 3629 `),R(22,"select",102),e(23,` 3630 `),a(),e(24,` 3631 `),n(25,"span",95),e(26,` 3632 `),e(27,` 3633 `),R(28,"button",103),e(29,` 3634 `),R(30,"button",104),e(31,` 3635 `),R(32,"button",105),e(33,` 3636 `),R(34,"button",106),e(35,` 3637 `),R(36,"button",107),e(37,` 3638 `),a(),e(38,` 3639 `),n(39,"span",95),e(40,` 3640 `),e(41,` 3641 `),R(42,"button",108),e(43,` 3642 `),R(44,"button",109),e(45,` 3643 `),R(46,"button",110),e(47,` 3644 `),R(48,"button",111),e(49,` 3645 `),a(),e(50,` 3646 `),n(51,"span",95),e(52,` 3647 `),e(53,` 3648 `),R(54,"button",112),e(55,` 3649 `),a(),e(56,` 3650 `),e(57,` 3651 `),n(58,"span",95),e(59,` 3652 `),R(60,"button",113),e(61,` 3653 `),a(),e(62,` 3654 `))}function Jv(r,d){r&1&&(e(0,` 3655 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3656 `))}function eg(r,d){r&1&&(e(0,` 3657 `),n(1,"span",89),e(2,"search"),a(),e(3,` 3658 `))}function tg(r,d){if(r&1&&(e(0,` 3659 `),n(1,"small",90),e(2,` 3660 `),n(3,"div",39),e(4),a(),e(5,` 3661 `),a(),e(6,` 3662 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ig(r,d){if(r&1&&(e(0,` 3663 `),G(1,tg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.GroupRequestApproverIds)}}function ng(r,d){if(r&1&&(e(0,` 3664 `),n(1,"small",90),e(2,` 3665 `),n(3,"div",39),e(4),a(),e(5,` 3666 `),a(),e(6,` 3667 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ag(r,d){if(r&1&&(e(0,` 3668 `),G(1,ng,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultEventStatusId)}}
3668function rg(r,d){if(r&1){let t=b();e(0,` 3669 `),n(1,"p-accordion-panel",137),e(2,` 3670 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,Qv,3,1,"ng-template",null,1,A),e(8,` 3671 `),a(),e(9,` 3672 `),n(10,"p-accordion-content"),e(11,` 3673 `),n(12,"div",35),e(13,` 3674 `),n(14,"div",79),e(15,` 3675 `),n(16,"div",37),e(17,` 3676 `),n(18,"div",138),e(19,` 3677 `),n(20,"p",39),e(21,"APP_SETTINGS.EVENT.EXTERNAL_GROUP_REQUEST_FORM_NOTE"),a(),e(22,` 3678 `),n(23,"div",139),e(24,` 3679 `),n(25,"a",140),e(26),a(),e(27,` 3680 `),n(28,"a",141),h("click",function(){E(t);let i=m();return S(i.showCopyMessage("external-request"))}),e(29,` 3681 `),n(30,"i",89),e(31,"content_copy"),a(),e(32,` 3682 `),a(),e(33,` 3683 `),a(),e(34,` 3684 `),_(35,$v,10,1),a(),e(36,` 3685 `),a(),e(37,` 3686 3687 `),n(38,"div",37),e(39,` 3688 `),n(40,"div",142),e(41,` 3689 `),n(42,"p",39),e(43,"APP_SETTINGS.EVENT.EXTERNAL_GROUP_LOGIN_LINK"),a(),e(44,` 3690 `),n(45,"div",139),e(46,` 3691 `),n(47,"a",140),e(48),a(),e(49,` 3692 `),n(50,"a",141),h("click",function(){E(t);let i=m();return S(i.showCopyMessage("external-login"))}),e(51,` 3693 `),n(52,"i",89),e(53,"content_copy"),a(),e(54,` 3694 `),a(),e(55,` 3695 `),a(),e(56,` 3696 `),_(57,Xv,10,1),a(),e(58,` 3697 `),a(),e(59,` 3698 `),n(60,"div",37),e(61,` 3699 `),e(62,` 3700 `),n(63,"div",38),e(64,` 3701 `),n(65,"label",39),e(66,"APP_SETTINGS.EVENT.REQUIRE_INSURANCE_CERTIFICATE"),a(),e(67,` 3702 `),n(68,"p-checkbox",143),e(69,` 3703 `),a(),e(70,` 3704 `),a(),e(71,` 3705 `),e(72,` 3706 `),n(73,"div",44),e(74,` 3707 `),n(75,"label",144),e(76,` 3708 `),n(77,"span",39),e(78,"APP_SETTINGS.EVENT.TERMS_AND_CONDITIONS"),a(),e(79,` 3709 `),a(),e(80,` 3710 `),n(81,"p-editor",145,24),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(83,` 3711 `),_(84,Zv,63,0,"ng-template",null,5,A),e(86,` 3712 `),a(),e(87,` 3713 `),a(),e(88,` 3714 `),e(89,` 3715 `),n(90,"div",44),e(91,` 3716 `),n(92,"p-floatlabel"),e(93,` 3717 `),n(94,"p-multiselect",146),e(95,` 3718 `),_(96,Jv,4,0,"ng-template",null,20,A),e(98,` 3719 `),_(99,eg,4,0,"ng-template",null,21,A),e(101,` 3720 `),a(),e(102,` 3721 `),n(103,"label",147),e(104,` 3722 `),n(105,"span",39),e(106,"APP_SETTINGS.EVENT.GROUP_REQUEST_APPROVERS"),a(),n(107,"span",47),e(108," *"),a(),e(109,` 3723 `),a(),e(110,` 3724 `),a(),e(111,` 3725 `),n(112,"small",48),e(113,` 3726 `),n(114,"div",148),e(115,` 3727 APP_SETTINGS.EVENT.ERROR.GROUP_REQUEST_APPROVERS_REQUIRED 3728 `),a(),e(116,` 3729 `),a(),e(117,` 3730 `),_(118,ig,3,0),a(),e(119,` 3731 3732 `),e(120,` 3733 `),n(121,"div",44),e(122,` 3734 `),n(123,"qware-autocomplete",149),e(124,` 3735 `),a(),e(125,` 3736 `),n(126,"small",48),e(127,` 3737 `),n(128,"div",150),e(129,` 3738 APP_SETTINGS.EVENT.ERROR.DEFAULT_STATUS_EXT_GROUP_REQUIRED 3739 `),a(),e(130,` 3740 `),a(),e(131,` 3741 `),_(132,ag,3,0),a(),e(133,` 3742 `),a(),e(134,` 3743 `),a(),e(135,` 3744 `),a(),e(136,` 3745 `),a(),e(137,` 3746 `),a(),e(138,` 3747 `)}if(r&2){let t=m();l(4),K(` 3748 `,y(5,29,"APP_SETTINGS.EVENT.EXTERNAL_GROUPS"),` 3749 `),l(21),p("routerLink",t.externalGroupRequestFormRoute),l(),v(t.externalGroupRequestFormLink),l(2),p("qwareCopyToClipboard",t.externalGroupRequestFormLink),l(7),f(t.
3749showCopyExternalGroupLinkMessage?35:-1),l(12),p("routerLink",t.externalGroupLoginRoute),l(),v(t.externalGroupLoginLink),l(2),p("qwareCopyToClipboard",t.externalGroupLoginLink),l(7),f(t.showCopyExternalGroupLoginLinkMessage?57:-1),l(11),p("tabindex",20)("qwareFocus",!0)("binary",!0),l(13),Pt(ne(31,yC)),p("tabindex",21),l(13),p("tabindex",22)("fluid",!0)("options",t.groupRequestApproverOptions)("maxSelectedLabels",t.groupRequestApproverOptions.length),l(18),p("hidden",t.form.controls.GroupRequestApproverIds.valid||t.form.controls.GroupRequestApproverIds.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.GroupRequestApproverIds.errors!=null&&t.form.controls.GroupRequestApproverIds.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.GroupRequestApproverIds&&t.form.controls.GroupRequestApproverIds.untouched?118:-1),l(5),p("tabindex",23)("singleSelect",!0)("isRequired",t.form.controls.EnableExternalRequestGroups.value||!1)("options",t.defaultEventStatusOptions),l(3),p("hidden",t.form.controls.DefaultEventStatusId.valid||t.form.controls.DefaultEventStatusId.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.DefaultEventStatusId.errors!=null&&t.form.controls.DefaultEventStatusId.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.DefaultEventStatusId&&t.form.controls.DefaultEventStatusId.untouched?132:-1)}}function og(r,d){r&1&&(e(0,` 3750 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3751 `))}function lg(r,d){r&1&&(e(0,` 3752 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3753 `))}function sg(r,d){if(r&1&&(e(0,` 3754 `),_(1,og,4,0)(2,lg,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function dg(r,d){r&1&&(e(0,` 3755 `),n(1,"i",89),e(2,"check"),a(),e(3,` 3756 `))}function pg(r,d){if(r&1&&(e(0,` 3757 `),n(1,"p-message",151),e(2,` 3758 `),_(3,dg,4,0,"ng-template",null,25,A),e(5,` 3759 `),n(6,"span"),e(7),a(),e(8,` 3760 `),a(),e(9,` 3761 `)),r&2){let t=m(2);l(7),v(t.linkCopiedToClipboardText)}}function mg(r,d){if(r&1&&(e(0,` 3762 `),n(1,"small",90),e(2,` 3763 `),n(3,"div",39),e(4),a(),e(5,` 3764 `),a(),e(6,` 3765 `)),r&2){let t=d.$implicit;l(4),v(t)}}function cg(r,d){if(r&1&&(e(0,` 3766 `),G(1,mg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.EventGuestUserId)}}function ug(r,d){if(r&1&&(e(0,` 3767 `),n(1,"small",90),e(2,` 3768 `),n(3,"div",39),e(4),a(),e(5,` 3769 `),a(),e(6,` 3770 `)),r&2){let t=d.$implicit;l(4),v(t)}}function _g(r,d){if(r&1&&(e(0,` 3771 `),G(1,ug,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.EventGuestDefaultCategoryId)}}function Eg(r,d){if(r&1&&(e(0,` 3772 `),n(1,"small",90),e(2,` 3773 `),n(3,"div",39),e(4),a(),e(5,` 3774 `),a(),e(6,` 3775 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Sg(r,d){if(r&1&&(e(0,` 3776 `),G(1,Eg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.EventGuestDefaultCalendarId)}}function xg(r,d){if(r&1){let t=b();e(0,` 3777 `),n(1,"p-accordion-panel",152),e(2,` 3778 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,sg,3,1,"ng-template",null,1,A),e(8,` 3779 `),a(),e(9,` 3780 `),n(10,"p-accordion-content"),e(11,` 3781 `),n(12,"div",35),e(13,` 3782 `),n(14,"div",79),e(15,` 3783 `),n(16,"div",37),e(17,` 3784 `),n(18,"div",138),e(19,` 3785 `),n(20,"p",39),e(21,"APP_SETTINGS.EVENT.GUEST_FORM_NOTE"),a(),e(22,` 3786 `),n(23,"div",139),e(24,` 3787 `),n(25,"a",153),e(26),a(),e(27,` 3788 `),n(28,"a",141),h("click",function(){E(t);let i=m();return S(i.showCopyMessage("guest-link"))}),e(29,` 3789 `),n(30,"i",89),e(31,"content_copy"),a(),e(32,` 3790 `),a(),e(33,` 3791 `),a(),e(34,` 3792 `),_(35,pg,10,1),a(),e(36,` 3793 `),a(),e(37,` 3794 `),n(38,"div",37),e(39,` 3795 `),n(40,"div",44),e(41,` 3796 `),n(42,"qware-autocomplete",154),e(43,` 3797 `),a(),e(44,` 3798 `),n(45,"small",39),e(46,"APP_SETTINGS.EVENT.GUEST_USER_NOTE"),a(),e(47,` 3799 `),n(48,"small",48),e(49,` 3800 `),n(50,"div",155),e(51,` 3801 APP_SETTINGS.EVENT.ERROR.GUEST_USER_REQUIRED 3802 `),a(),e(52,` 3803 `),a(),e(53,` 3804 `),_(54,cg,3,0),a(),e(55,` 3805 `),n(56,"div",44),e(57,` 3806 `),n(58,"qware-autocomplete",156),h("selectChange",function(i){E(t);let s=m();return S(s.guestDefaultCategoryChanged(i))}),e(59,` 3807 `),a(),e(60,` 3808 `),_(61,_g,3,0),a(),e(62,` 3809 `),n(63,"div",44),e(64,` 3810 `),n(65,"qware-autocomplete",157),e(66,` 3811 `),a(),e(67,` 3812 `),_(68,Sg,3,0),a(),e(69,` 3813 `),a(),e(70,` 3814 `),a(),e(71,` 3815 `),a(),e(72,` 3816 `),a(),e(73,` 3817 `),a(),e(74,` 3818 `)}if(r&2){let t=m();l(4),K(` 3819 `,y(5,22,"APP_SETTINGS.EVENT.GUEST_FORM"),` 3820 `),l(21),p("routerLink",t.guestFormRoute),l(),v(t.guestFormLink),l(2),p("qwareCopyToClipboard",t.guestFormLink),l(7),f(t.
3820showCopyGuestLinkMessage?35:-1),l(7),p("tabindex",24)("options",t.allInternalUserItems)("singleSelect",!0)("isRequired",t.form.controls.EnableGuestEventRequestForm.value)("virtualScroll",!0)("virtualScrollItemSize",38),l(6),p("hidden",t.form.controls.EventGuestUserId.valid||t.form.controls.EventGuestUserId.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.EventGuestUserId.errors!=null&&t.form.controls.EventGuestUserId.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.EventGuestUserId&&t.form.controls.EventGuestUserId.untouched?54:-1),l(4),p("tabindex",25)("options",t.eventCategoryOptions)("singleSelect",!0),l(3),f(t.validationErrors&&t.validationErrors.EventGuestDefaultCategoryId&&t.form.controls.EventGuestDefaultCategoryId.untouched?61:-1),l(4),p("tabindex",26)("options",t.eventCalendarOptions)("singleSelect",!0),l(3),f(t.validationErrors&&t.validationErrors.EventGuestDefaultCalendarId&&t.form.controls.EventGuestDefaultCalendarId.untouched?68:-1)}}function fg(r,d){r&1&&(e(0,` 3821 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3822 `))}function hg(r,d){r&1&&(e(0,` 3823 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3824 `))}function Cg(r,d){if(r&1&&(e(0,` 3825 `),_(1,fg,4,0)(2,hg,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function vg(r,d){r&1&&(e(0,` 3826 `),n(1,"i",89),e(2,"check"),a(),e(3,` 3827 `))}function gg(r,d){if(r&1&&(e(0,` 3828 `),n(1,"p-message",151),e(2,` 3829 `),_(3,vg,4,0,"ng-template",null,25,A),e(5,` 3830 `),n(6,"span"),e(7),a(),e(8,` 3831 `),a(),e(9,` 3832 `)),r&2){let t=m(2);l(7),v(t.linkCopiedToClipboardText)}}function Tg(r,d){if(r&1&&(e(0,` 3833 `),n(1,"small",90),e(2,` 3834 `),n(3,"div",39),e(4),a(),e(5,` 3835 `),a(),e(6,` 3836 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Ig(r,d){if(r&1&&(e(0,` 3837 `),G(1,Tg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.PublicCalendarUserId)}}function bg(r,d){r&1&&(e(0,` 3838 `),n(1,"span",95),e(2,` 3839 `),e(3,` 3840 `),n(4,"select",96),e(5,` 3841 `),R(6,"option",97),e(7,` 3842 `),e(8,` 3843 `),R(9,"option",98),e(10,` 3844 `),R(11,"option",99),e(12,` 3845 `),R(13,"option",100),e(14,` 3846 `),a(),e(15,` 3847 `),a(),e(16,` 3848 `),n(17,"span",95),e(18,` 3849 `),e(19,` 3850 `),R(20,"select",101),e(21,` 3851 `),R(22,"select",102),e(23,` 3852 `),a(),e(24,` 3853 `),n(25,"span",95),e(26,` 3854 `),e(27,` 3855 `),R(28,"button",103),e(29,` 3856 `),R(30,"button",104),e(31,` 3857 `),R(32,"button",105),e(33,` 3858 `),R(34,"button",106),e(35,` 3859 `),R(36,"button",107),e(37,` 3860 `),a(),e(38,` 3861 `),n(39,"span",95),e(40,` 3862 `),e(41,` 3863 `),R(42,"button",108),e(43,` 3864 `),R(44,"button",109),e(45,` 3865 `),R(46,"button",110),e(47,` 3866 `),R(48,"button",111),e(49,` 3867 `),a(),e(50,` 3868 `),n(51,"span",95),e(52,` 3869 `),e(53,` 3870 `),R(54,"button",112),e(55,` 3871 `),a(),e(56,` 3872 `),e(57,` 3873 `),n(58,"span",95),e(59,` 3874 `),R(60,"button",113),e(61,` 3875 `),a(),e(62,` 3876 `))}function yg(r,d){if(r&1&&(e(0,` 3877 `),n(1,"small",90),e(2,` 3878 `),n(3,"div",39),e(4),a(),e(5,` 3879 `),a(),e(6,` 3880 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Ag(r,d){if(r&1&&(e(0,` 3881 `),G(1,yg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.PublicCalendarMessage)}}function Rg(r,d){if(r&1){let t=b();e(0,` 3882 `),n(1,"p-accordion-panel",158),e(2,` 3883 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,Cg,3,1,"ng-template",null,1,A),e(8,` 3884 `),a(),e(9,` 3885 `),n(10,"p-accordion-content"),e(11,` 3886 `),n(12,"div",35),e(13,` 3887 `),n(14,"div",79),e(15,` 3888 `),e(16,` 3889 `),n(17,"div",37),e(18,` 3890 `),n(19,"div",138),e(20,` 3891 `),n(21,"p",39),e(22,"APP_SETTINGS.EVENT.PUBLIC_CALENDAR_FORM_NOTE"),a(),e(23,` 3892 `),n(24,"div",139),e(25,` 3893 `),n(26,"a",159),e(27),a(),e(28,` 3894 `),n(29,"a",141),h("click",function(){E(t);let i=m();return S(i.showCopyMessage("public-calendar"))}),e(30,` 3895 `),n(31,"i",89),e(32,"content_copy"),a(),e(33,` 3896 `),a(),e(34,` 3897 `),a(),e(35,` 3898 `),_(36,gg,10,1),a(),e(37,` 3899 `),a(),e(38,` 3900 3901 `),n(39,"div",37),e(40,` 3902 `),e(41,` 3903 `),n(42,"div",44),e(43,` 3904 `),n(44,"qware-autocomplete",160),e(45,` 3905 `),a(),e(46,` 3906 `),n(47,"small",39),e(48,"APP_SETTINGS.EVENT.PUBLIC_CALENDAR_USER_NOTE"),a(),e(49,` 3907 `),n(50,"small",48),e(51,` 3908 `),n(52,"div",161),e(53,` 3909 APP_SETTINGS.EVENT.ERROR.PUBLIC_CALENDAR_USER_REQUIRED 3910 `),a(),e(54,` 3911 `),a(),e(55,` 3912 `),_(56,Ig,3,0),a(),e(57,` 3913 `),e(58,` 3914 `),n(59,"div",44),e(60,` 3915 `),n(61,"label",162),e(62,` 3916 `),n(63,"span",39),e(64,"APP_SETTINGS.EVENT.PUBLIC_CALENDAR_MESSAGE"),a(),e(65,` 3917 `),a(),e(66,` 3918 `),n(67,"p-editor",163,24),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(69,` 3919 `),_(70,bg,63,0,"ng-template",null,5,A),e(72,` 3920 `),a(),e(73,` 3921 `),n(74,"small",48),e(75,` 3922 `),n(76,"div",164),e(77,` 3923 APP_SETTINGS.EVENT.ERROR.PUBLIC_CALENDAR_MESSAGE_LENGTH 3924 `),a(),e(78,` 3925 `),a(),e(79,` 3926 `),_(80,Ag,3,0),a(),e(81,` 3927 `),a(),e(82,` 3928 `),a(),e(83,` 3929 `),a(),e(84,` 3930 `),a(),e(85,` 3931 `),a(),e(86,` 3932 `)}if(r&2){let t,o=m();l(4),K(` 3933 `,y(5,21,"APP_SETTINGS.EVENT.PUBLIC_CALENDAR"),` 3934 `),l(22),p("routerLink",o.publicCalendarRoute),l(),v(o.publicCalendarLink),l(2),p("qwareCopyToClipboard",o.publicCalendarLink),l(7),f(o.showCopyPublicCalendarLinkMessage?36:-1),l(8),p("tabindex",27)("options",o.allInternalUserItems)("singleSelect",!0)("isRequired",(t=o.form.controls.EnablePublicCalendar.value)!==null&&t!==void 0?t:!1)("virtualScroll",!0)("virtualScrollItemSize",38),l(6),p("hidden",o.form.controls.PublicCalendarUserId.valid||o.form.controls.PublicCalendarUserId.pristine&&!o.submitted),l(2),p("hidden",!(o.form.controls.PublicCalendarUserId.errors!=null&&o.form.controls.PublicCalendarUserId.errors.required)),l(4),f(o.validationErrors&&o.validationErrors.PublicCalendarUserId&&o.form.controls.PublicCalendarUserId.untouched?56:-1),l(11),Pt(ne(23,AC)),p("tabindex",28),l(7),p("hidden",o.form.controls.PublicCalendarMessage.valid||o.form.controls.PublicCalendarMessage.pristine&&!o.submitted),l(2),p("hidden",!(o.form.controls.PublicCalendarMessage.errors!=null&&o.form.controls.PublicCalendarMessage.errors.maxlength))("translateParams",pe(24,oa,o.form.controls.PublicCalendarMessage.value==null?null:o.form.controls.PublicCalendarMessage.value.length)),l(4),f(o.validationErrors&&o.validationErrors.PublicCalendarMessage&&o.form.controls.PublicCalendarMessage.untouched?8
39340:-1)}}function wg(r,d){r&1&&(e(0,` 3935 `),n(1,"i",89),e(2,"expand_less"),a(),e(3,` 3936 `))}function Dg(r,d){r&1&&(e(0,` 3937 `),n(1,"i",89),e(2,"expand_more"),a(),e(3,` 3938 `))}function Lg(r,d){if(r&1&&(e(0,` 3939 `),_(1,wg,4,0)(2,Dg,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Ng(r,d){r&1&&(e(0,` 3940 `),n(1,"span",89),e(2,"expand_more"),a(),e(3,` 3941 `))}function Og(r,d){r&1&&(e(0,` 3942 `),n(1,"span",89),e(2,"event"),a(),e(3,` 3943 `))}function Fg(r,d){if(r&1&&(e(0,` 3944 `),n(1,"th",183),e(2,` 3945 `),n(3,"span"),e(4),a(),e(5,` 3946 `),a(),e(6,` 3947 `)),r&2){let t,o=d.$implicit;l(),p("ngClass",pe(2,RC,o.field==="Delete")),l(3),v((t=o.header)!==null&&t!==void 0?t:"")}}function Mg(r,d){if(r&1&&(e(0,` 3948 `),n(1,"tr"),e(2,` 3949 `),G(3,Fg,7,4,null,null,Zi),a(),e(5,` 3950 `)),r&2){let t=d.$implicit;l(3),k(t)}}function Ug(r,d){if(r&1&&(e(0,` 3951 `),n(1,"span",186),e(2),a(),e(3,` 3952 `)),r&2){let t=m().$implicit;l(2),v(t.header)}}function Pg(r,d){if(r&1&&(e(0,` 3953 `),n(1,"span"),e(2),I(3,"dateFormat"),a(),e(4,` 3954 `)),r&2){let t=m(3).$implicit,o=m(3);l(2),K(" - ",ma(3,1,t.EndDateUTC,"M/D",o.timezone),"")}}function Gg(r,d){if(r&1&&(e(0,` 3955 `),n(1,"span"),e(2,` 3956 `),n(3,"span"),e(4),I(5,"dateFormat"),a(),e(6,` 3957 `),_(7,Pg,5,5),a(),e(8,` 3958 `)),r&2){let t=m(2).$implicit,o=m(3);l(4),v(ma(5,2,t.StartDateUTC,"M/D",o.timezone)),l(3),f(t.IsSingleDate?-1:7)}}function kg(r,d){if(r&1&&(e(0,` 3959 `),n(1,"span"),e(2),a(),e(3,` 3960 `)),r&2){let t=m(2).$implicit;l(2),v(t.Note)}}function Vg(r,d){if(r&1){let t=b();e(0,` 3961 `),n(1,"p-button",187),h("onClick",function(){E(t);let i=m(2).$implicit,s=m(3);return S(s.blockedDatesDeleteOnClick(i))}),e(2,` 3962 `),n(3,"i",89),e(4,"delete"),a(),e(5,` 3963 `),a(),e(6,` 3964 `)}r&2&&(l(),p("text",!0)("rounded",!0))}function qg(r,d){if(r&1&&(e(0,` 3965 `),n(1,"td"),e(2,` 3966 `),_(3,Ug,4,1),n(4,"div",185),e(5,` 3967 `),_(6,Gg,9,6)(7,kg,4,1)(8,Vg,7,2),a(),e(9,` 3968 `),a(),e(10,` 3969 `)),r&2){let t=d.$implicit;l(3),f(t.header?3:-1),l(3),f(t.field==="StartDateUTC"?6:-1),l(),f(t.field==="Note"?7:-1),l(),f(t.field==="Delete"?8:-1)}}function Bg(r,d){if(r&1&&(e(0,` 3970 `),n(1,"tr",184),e(2,` 3971 `),G(3,qg,11,4,null,null,wC),a(),e(5,` 3972 `)),r&2){let t=d.columns;l(3),k(t)}}function Hg(r,d){r&1&&(e(0,` 3973 `),n(1,"tr"),e(2,` 3974 `),n(3,"td"),e(4,` 3975 `),n(5,"div",188),e(6,"SHARED.RECORDS_NOT_FOUND"),a(),e(7,` 3976 `),a(),e(8,` 3977 `),a(),e(9,` 3978 `)),r&2&&(l(3),Ve("colspan",3))}function Wg(r,d){if(r&1&&(e(0,` 3979 `),n(1,"p-table",179,26),e(3,` 3980 `),_(4,Mg,6,0,"ng-template",180),e(5,` 3981 `),_(6,Bg,6,0,"ng-template",181),e(7,` 3982 `),_(8,Hg,10,1,"ng-template",182),e(9,` 3983 `),a(),e(10,` 3984 `)),r&2){let t=m(2);l(),p("value",t.blockedDates)("paginator",!0)("rows",10)("columns",t.tableColumns)("scrollable",!0)}}function jg(r,d){if(r&1){let t=b();e(0,` 3985 `),n(1,"p-accordion-panel",165),e(2,` 3986 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,Lg,3,1,"ng-template",null,1,A),e(8,` 3987 `),a(),e(9,` 3988 `),n(10,"p-accordion-content"),e(11,` 3989 `),n(12,"div",35),e(13,` 3990 `),n(14,"div",166),e(15,` 3991 `),n(16,"div",167),e(17,` 3992 `),e(18,` 3993 `),n(19,"div",44),e(20,` 3994 `),n(21,"p-floatlabel"),e(22,` 3995 `),n(23,"p-select",168),j("ngModelChange",function(i){E(t);let s=m();return W(s.blockedDatesSelectionType,i)||(s.blockedDatesSelectionType=i),S(i)}),h("onChange",function(i){E(t);let s=m();return S(s.blockedDatesSelectionTypeOnChange(i))}),e(24,` 3996 `),_(25,Ng,4,0,"ng-template",93),e(26,` 3997 `),a(),e(27,` 3998 `),n(28,"label",169),e(29,` 3999 `),n(30,"span",39),e(31,"APP_SETTINGS.EVENT.SELECT_TYPE"),a(),e(32,` 4000 `),a(),e(33,` 4001 `),a(),e(34,` 4002 `),a(),e(35,` 4003 `),a(),e(36,` 4004 `),n(37,"div",170),e(38,` 4005 `),e(39,` 4006 `),n(40,"div",44),e(41,` 4007 `),n(42,"p-floatlabel"),e(43,` 4008 `),n(44,"p-datepicker",171),h("ngModelChange",function(i){E(t);let s=m();return S(s.checkForValidDate(i))}),j("ngModelChange",function(i){E(t);let s=m();return W(s.blockedDateOrDateRangeSelected,i)||(s.blockedDateOrDateRangeSelected=i),S(i)}),e(45,` 4009 `),_(46,Og,4,0,"ng-template",120),e(47,` 4010 `),a(),e(48,` 4011 `),n(49,"label",172),e(50,` 4012 `),n(51,"span"),e(52),a(),e(53,` 4013 `),a(),e(54,` 4014 `),a(),e(55,` 4015 `),a(),e(56,` 4016 `),a(),e(57,` 4017 `),n(58,"div",173),e(59,` 4018 `),e(60,` 4019 `),n(61,"div",174),e(62,` 4020 `),n(63,"p-floatlabel"),e(64,` 4021 `),n(65,"input",175),j("ngModelChange",function(i){E(t);let s=m();return W(s.blockedDateOrDateRangeNote,i)||(s.blockedDateOrDateRangeNote=i),S(i)}),a(),e(66,` 4022 `),n(67,"label",176),e(68,` 4023 `),n(69,"span",39),e(70,"APP_SETTINGS.EVENT.NOTE"),a(),e(71,` 4024 `),a(),e(72,` 4025 `),a(),e(73,` 4026 `),a(),e(74,` 4027 4028 `),e(75,` 4029 `),n(76,"div",44),e(77,` 4030 `),n(78,"div",177),e(79,` 4031 `),n(80,"p-button",178),h("onClick",function(){E(t);let i=m();return S(i.addDateOnClick())}),e(81,` 4032 `),a(),e(82,` 4033 `),a(),e(83,` 4034 `),a(),e(84,` 4035 4036 `),e(85,` 4037 `),n(86,"div",44),e(87,` 4038 `),_(88,Wg,11,5),a(),e(89,` 4039 `),a(),e(90,` 4040 `),a(),e(91,` 4041 `),a(),e(92,` 4042 `),a(),e(93,` 4043 `),a(),e(94,` 4044 `)}if(r&2){let t=m();l(4),K(` 4045 `,y(5,23,"APP_SETTINGS.EVENT.BLOCKED_DATES"),` 4046 `),l(19),p("tabindex",29)("fluid",!0)("options",t.blockedDatesSelectionTypeOptions),H("ngModel",t.blockedDatesSelectionType),p("ngModelOptions",ne(25,fa)),l(21),p("tabindex",30)("selectionMode",t.blockedDatesSelectionMode),H("ngModel",t.blockedDateOrDateRangeSelected),p("fluid",!0)("ngModelOptions",ne(26,fa))("showIcon",!0)("disabled",!t.blockedDatesSelectionType),l(8),v(t.blockedDatesDateLabel),l(13),p("tabindex",31)("fluid",!0),H("ngModel",t.blockedDateOrDateRangeNote),p("ngModelOptions",ne(27,fa)),l(15),p("tabindex",32)("raised",!0)("label",t.addDateButtonLabel)("disabled",!t.blockedDateOrDateRangeSelected||t.dateSelectionIsInvalid),l(8),f(t.blockedDates?88:-1)}}var Gp=(()=>
4046{class r{appSettingsService;authService;eventService;fb;toastService;responseService;route;router;statusService;translate;userService;editors;shades;emailSubjectLDREditor;emailSubjectLDRDropdown;emailBodyLDREditor;emailBodyLDRDropdown;emailSubjectCEEditor;emailSubjectCEDropdown;emailBodyCEEditor;emailBodyCEDropdown;emailSubjectAEEditor;emailSubjectAEDropdown;emailBodyAEEditor;emailBodyAEDropdown;emailSubjectREEditor;emailSubjectREDropdown;emailBodyREEditor;emailBodyREDropdown;allInternalUserGroups=[];allInternalUsers=[];allInternalUserItems=[];addDateButtonLabel="";blockedDates=[];blockedDatesDateLabel;blockedDateOrDateRangeSelected;blockedDateOrDateRangeNote;blockedDatesSelectionMode="single";blockedDatesSelectionType="single";blockedDatesSelectionTypeOptions=[];canceledEventBodyFields=[];canceledEventSubjectFields=[];dateSelectionIsInvalid=!0;defaultEventStatusOptions=[];displaySpinner=!0;eventBodyMergeFieldOptions=[];eventCalendarOptions=[];eventCategoryOptions=[];eventSubjectMergeFieldOptions=[];externalGroupLoginLink;externalGroupRequestFormLink;form;groupRequestApproverOptions=[];guestFormLink;hideLimitingDateConfigs=!1;isEditing;limitingDateMax;limitingDateReminderBodyFields=[];limitingDateReminderSubjectFields=[];limitingDateReminderRecipientOptions=[];linkCopiedToClipboardText="";publicCalendarLink;selectedMergeFieldCEEB;selectedMergeFieldCEES;selectedMergeFieldAEEB;selectedMergeFieldAEES;selectedMergeFieldREEB;selectedMergeFieldREES;selectedMergeFieldLDREB;selectedMergeFieldLDRES;shadeFormGroups=[{controls:{EnableExternalRequestGroups:"",EnableGuestEventRequestForm:"",EnablePublicCalendar:"",EnableBookingOverBlockingEvents:"",HoursBeforeEventStartsToCancel:"",CanceledEventWorkOrderStatusId:"",EmailSubjectCanceledEvent:"",EmailBodyCanceledEvent:"",EmailSubjectApprovedEvent:"",EmailBodyApprovedEvent:"",EmailSubjectRejectedEvent:"",EmailBodyRejectedEvent:"",EventAlertMessage:""}},{controls:{LimitingDateRange:"",LimitingDateUTC:"",DaysBeforeLimitingDateSendReminder:"",LimitingDateReminderRecipientIds:"",EmailSubjectLimitingDateReminder:"",EmailBodyLimitingDateReminder:""}},{controls:{RequireInsuranceCertificate:"",EventTermsAndConditions:"",GroupRequestApproverIds:"",DefaultEventStatusId:""}},{controls:{EventGuestUserId:"",EventGuestDefaultCategoryId:"",EventGuestDefaultCalendarId:""}}];showCopyExternalGroupLinkMessage=!1;showCopyExternalGroupLoginLinkMessage=!1;showCopyGuestLinkMessage=!1;showCopyPublicCalendarLinkMessage=!1;submitted=!1;tableColumns=[];textareaFocused=!1;timezone;unit="";validationErrors;workOrderStatusOptions=[];allEventCalendars=[];allEventCategories=[];appSettings;translations={};canCreateBlockingDates=!1;externalGroupLoginRoute="";externalGroupRequestFormRoute="";guestFormRoute="";publicCalendarRoute="";accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px"}}};constructor(t,o,i,s,c,u,x,C,O,w,F){this.appSettingsService=t,this.authService=o,this.eventService=i,this.fb=s,this.toastService=c,this.responseService=u,this.route=x,this.router=C,this.statusService=O,this.translate=w,this.userService=F,this.externalGroupLoginRoute="/"+gs.login+"/"+this.authService.tenant.Key+"/"+gs.external,this.externalGroupRequestFormRoute="/"+P.systemConfig+"/"+this.authService.tenant.Key+"/"+P.userExternal+"/"+P.requestGroupAccess,this.guestFormRoute="/"+Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.createGuest,this.canCreateBlockingDates=this.authService.userHasPrivilege(ae.CAN_CREATE_BLOCKING_EVENTS),this.publicCalendarRoute="/"+Cs.calendar+"/"+this.authService.tenant.Key+"/"+Cs.publicCalendar}ngOnInit(){this.createForm(),ue([this.translate.get(["APP_SETTINGS.EVENT.DATE_SINGLE","APP_SETTINGS.EVENT.DATE_RANGE","APP_SETTINGS.EVENT.ADD_DATE","APP_SETTINGS.EVENT.ADD_DATE_RANGE","APP_SETTINGS.EVENT.DATE","APP_SETTINGS.EVENT.NOTE","APP_SETTINGS.EVENT.LIMITING_DATE_RANGE_UNIT","APP_SETTINGS.EVENT.DEFAULT_VALUE.ALERT_MESSAGE","APP_SETTINGS.EVENT.DEFAULT_VALUE.CANCELED_EMAIL_BODY","APP_SETTINGS.EVENT.DEFAULT_VALUE.CANCELED_EMAIL_SUBJECT","APP_SETTINGS.EVENT.DEFAULT_VALUE.APPROVED_EMAIL_BODY","APP_SETTINGS.EVENT.DEFAULT_VALUE.APPROVED_EMAIL_SUBJECT","APP_SETTINGS.EVENT.DEFAULT_VALUE.REJECTED_EMAIL_BODY","APP_SETTINGS.EVENT.DEFAULT_VALUE.REJECTED_EMAIL_SUBJECT","APP_SETTINGS.EVENT.DEFAULT_VALUE.TERMS_CONDITIONS","APP_SETTINGS.EVENT.LINK_COPIED_TO_CLIPBOARD","MERGE_FIELDS.SELECT","MERGE_FIELDS.NAME","MERGE_FIELDS.CALENDAR","MERGE_FIELDS.CATEGORY","MERGE_FIELDS.STATUS","MERGE_FIELDS.START_DATE","MERGE_FIELDS.END_DATE","MERGE_FIELDS.LOCATION","MERGE_FIELDS.CREATED_BY","MERGE_FIELDS.DESCRIPTION"]).pipe(N()),this.appSett
4046ingsService.getAppSettingsForEdit(),this.eventService.getEventBlockedDates(this.authService.tenant.Id),this.statusService.getStatuses(this.authService.tenant.Id),this.userService.getUsers(this.authService.tenant.Id),this.eventService.getCategories(),this.eventService.getCalendars()]).subscribe(t=>{this.translations=t[0],this.appSettings=t[1];let o=t[2],i=t[3],s=t[4];this.allEventCategories=t[5],this.allEventCalendars=t[6],this.unit=this.translations["APP_SETTINGS.EVENT.LIMITING_DATE_RANGE_UNIT"],this.blockedDatesDateLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE"],this.timezone=this.appSettings.Timezone??"",this.limitingDateMax=(0,kr.default)(Vt.convertToAppTimezone(this.timezone,!0)).add(12,"M").toDate(),this.tableColumns=[{field:"StartDateUTC",header:this.translations["APP_SETTINGS.EVENT.DATE"]},{field:"Note",header:this.translations["APP_SETTINGS.EVENT.NOTE"]},{field:"Delete"}],this.blockedDates=this.sortBlockedDates(o).map(C=>{let O=(0,kr.default)(C.EndDateUTC).diff(C.StartDateUTC,"h");return C.IsSingleDate=!C.EndDateUTC||O<24,C});let c=i.filter(C=>C.State===M.ACTIVE&&C.Type===Li.EVENTS&&C.Category===vn.NEW),u=i.filter(C=>C.State===M.ACTIVE&&C.Type===Li.WORK_ORDERS);this.allInternalUsers=s.filter(C=>C.Type===Rt.INTERNAL&&C.State===M.ACTIVE);let x=this.allEventCategories.filter(C=>{let O=this.allEventCalendars.filter(w=>w.State===M.ACTIVE&&w.CategoryId===C.Id);return C.State===M.ACTIVE&&O.length>0});this.eventCategoryOptions=x.map(C=>({label:C.Name,value:C.Id})),this.eventCalendarOptions=this.allEventCalendars.filter(C=>C.State===M.ACTIVE).map(C=>({label:C.Name,value:C.Id})),this.defaultEventStatusOptions=za.default.map(c,C=>({value:C.Id,label:C.Name})),this.workOrderStatusOptions=za.default.map(u,C=>({value:C.Id,label:C.Name})),this.groupRequestApproverOptions=za.default.map(this.allInternalUsers,C=>({value:C.Id,label:C.fullNameWithEmail()})),this.limitingDateReminderRecipientOptions=za.default.map(this.allInternalUsers,C=>({value:C.Id,label:C.fullNameWithEmail()})),this.appSettings.LimitingDateUTC&&(this.appSettings.LimitingDateUTC=Vt.convertToAppTimezone(this.appSettings?.Timezone??"",!0,this.appSettings.LimitingDateUTC)),this.eventSubjectMergeFieldOptions=[{label:this.translations["MERGE_FIELDS.CALENDAR"],value:"[EVENT_CALENDAR]"},{label:this.translations["MERGE_FIELDS.CATEGORY"],value:"[EVENT_CATEGORY]"},{label:this.translations["MERGE_FIELDS.CREATED_BY"],value:"[EVENT_CREATED_BY]"},{label:this.translations["MERGE_FIELDS.END_DATE"],value:"[EVENT_END_DATE]"},{label:this.translations["MERGE_FIELDS.LOCATION"],value:"[EVENT_LOCATION]"},{label:this.translations["MERGE_FIELDS.NAME"],value:"[EVENT_NAME]"},{label:this.translations["MERGE_FIELDS.START_DATE"],value:"[EVENT_START_DATE]"},{label:this.translations["MERGE_FIELDS.STATUS"],value:"[EVENT_STATUS]"}],this.eventBodyMergeFieldOptions=[{label:this.translations["MERGE_FIELDS.CALENDAR"],value:"[EVENT_CALENDAR]"},{label:this.translations["MERGE_FIELDS.CATEGORY"],value:"[EVENT_CATEGORY]"},{label:this.translations["MERGE_FIELDS.CREATED_BY"],value:"[EVENT_CREATED_BY]"},{label:this.translations["MERGE_FIELDS.END_DATE"],value:"[EVENT_END_DATE]"},{label:this.translations["MERGE_FIELDS.DESCRIPTION"],value:"[EVENT_DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.LOCATION"],value:"[EVENT_LOCATION]"},{label:this.translations["MERGE_FIELDS.NAME"],value:"[EVENT_NAME]"},{label:this.translations["MERGE_FIELDS.START_DATE"],value:"[EVENT_START_DATE]"},{label:this.translations["MERGE_FIELDS.STATUS"],value:"[EVENT_STATUS]"}],this.blockedDatesSelectionTypeOptions=[{value:"single",label:this.translations["APP_SETTINGS.EVENT.DATE_SINGLE"]},{value:"range",label:this.translations["APP_SETTINGS.EVENT.DATE_RANGE"]}],this.addDateButtonLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE"],this.linkCopiedToClipboardText=this.translations["APP_SETTINGS.EVENT.LINK_COPIED_TO_CLIPBOARD"],this.setGuestFormOptionsOnModel(),this.guestFormLink=location.protocol+"//"+location.host+"/#"+this.guestFormRoute,this.publicCalendarLink=location.protocol+"//"+location.host+"/#"+this.publicCalendarRoute,this.externalGroupLoginLink=location.protocol+"//"+location.host+"/#"+this.externalGroupLoginRoute,this.externalGroupRequestFormLink=location.protocol+"//"+location.host+"/#"+this.externalGroupRequestFormRoute,this.setFormDefaultValues(),this.appSett
4046ings.EnableExternalRequestGroups&&this.enableExternalGroupForm({checked:!0}),this.appSettings.EnableGuestEventRequestForm&&this.enableGuestForm({checked:!0}),(this.appSettings.EnableExternalRequestGroups||this.appSettings.EnableGuestEventRequestForm)&&this.enableLimitingDateConfigs(),this.appSettings.CanceledEventWorkOrderStatusId&&(this.appSettings.CanceledEventWorkOrderStatus=u.find(C=>C.Id===this.appSettings?.CanceledEventWorkOrderStatusId)),this.appSettings.DefaultEventStatusId&&(this.appSettings.DefaultEventStatus=c.find(C=>C.Id===this.appSettings?.DefaultEventStatusId)),this.appSettings.EventGuestUserId&&(this.appSettings.EventGuestUser=this.allInternalUsers.find(C=>C.Id===this.appSettings?.EventGuestUserId)),this.appSettings.PublicCalendarUserId&&(this.appSettings.PublicCalendarUser=this.allInternalUsers.find(C=>C.Id===this.appSettings?.PublicCalendarUserId)),this.appSettings.EventGuestDefaultCategoryId&&(this.appSettings.EventGuestDefaultCategory=this.allEventCategories.find(C=>C.Id===this.appSettings?.EventGuestDefaultCategoryId)),this.appSettings.EventGuestDefaultCalendarId&&(this.appSettings.EventGuestDefaultCalendar=this.allEventCalendars.find(C=>C.Id===this.appSettings?.EventGuestDefaultCalendarId)),this.form.patchValue(new Ln().toEventForm(this.appSettings)),this.guestDefaultCategoryChanged(this.form.get("EventGuestDefaultCategoryId")?.value??null,!1),this.form.markAsPristine(),this.form.markAsUntouched(),this.displaySpinner=!1})}createForm(){this.form=this.fb.group({EnableExternalRequestGroups:this.fb.control(!1),EnableGuestEventRequestForm:this.fb.control(!1),EnableBookingOverBlockingEvents:this.fb.control(!1),HoursBeforeEventStartsToCancel:this.fb.control(0,[T.required]),CanceledEventWorkOrderStatusId:this.fb.control(null),EmailSubjectCanceledEvent:this.fb.control("",[T.required,T.maxLength(fi)]),EmailBodyCanceledEvent:this.fb.control("",[T.required,T.maxLength(Kt)]),EmailSubjectApprovedEvent:this.fb.control("",[T.required,T.maxLength(fi)]),EmailBodyApprovedEvent:this.fb.control("",[T.required,T.maxLength(Kt)]),EmailSubjectRejectedEvent:this.fb.control("",[T.required,T.maxLength(fi)]),EmailBodyRejectedEvent:this.fb.control("",[T.required,T.maxLength(Kt)]),EventAlertMessage:this.fb.control("",[T.maxLength(Kt)]),LimitingDateRange:this.fb.control(null,[T.required]),LimitingDateUTC:this.fb.control(null),DaysBeforeLimitingDateSendReminder:this.fb.control(0),LimitingDateReminderRecipientIds:this.fb.control([]),EmailSubjectLimitingDateReminder:this.fb.control(""),EmailBodyLimitingDateReminder:this.fb.control(""),RequireInsuranceCertificate:this.fb.control(!1),EventTermsAndConditions:this.fb.control(""),GroupRequestApproverIds:this.fb.control([]),DefaultEventStatusId:this.fb.control(null),EventGuestUserId:this.fb.control(null),EventGuestDefaultCategoryId:this.fb.control(null),EventGuestDefaultCalendarId:this.fb.control(null),EnablePublicCalendar:this.fb.control(!1),PublicCalendarMessage:this.fb.control("",[T.maxLength(Kt)]),PublicCalendarUserId:this.fb.control(null)})}setFormDefaultValues(){this.form.get("EventTermsAndConditions")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.TERMS_CONDITIONS"]),this.form.get("EmailSubjectCanceledEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.CANCELED_EMAIL_SUBJECT"]),this.form.get("EmailBodyCanceledEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.CANCELED_EMAIL_BODY"]),this.form.get("EmailSubjectApprovedEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.APPROVED_EMAIL_SUBJECT"]),this.form.get("EmailBodyApprovedEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.APPROVED_EMAIL_BODY"]),this.form.get("EmailSubjectRejectedEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.REJECTED_EMAIL_SUBJECT"]),this.form.get("EmailBodyRejectedEvent")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.REJECTED_EMAIL_BODY"]),this.form.get("EventAlertMessage")?.setValue(this.translations["APP_SETTINGS.EVENT.DEFAULT_VALUE.ALERT_MESSAGE"])}emailSubjectLDRSelectChanged(){this.selectedMergeFieldLDRES&&(this.editorDropDownSelectChanged(this.emailSubjectLDREditor,this.emailSubjectLDRDropdown,this.selectedMergeFieldLDRES),this.selectedMergeFieldLDRES=void 0)}emailBodyLDRSelectChanged(){this.selectedMergeFieldLDREB&&(this.editorDropDownSelectChanged(this.emailBodyLDREditor,this.emailBodyLDRDropdown,this.selectedMergeFieldLDREB),this.selectedMergeFieldLDREB=void 0)}emailSubjectCESelectChanged(){this.selectedMergeFieldCEES&&(this.editorDropDownSelectChanged(this.emailSubjectCEEditor,this.emailSubjectCEDropdown,this.selectedMergeFieldCEES),this.selectedMergeFieldCEES=void 0)}emailBodyCESelectChanged(){this.selectedMergeFieldCEEB&&(this.editorDropDownSelectChanged(this.emailBodyCEEditor,this.emailBodyCEDropdown,this.selectedMergeFieldCEEB),this.selectedMergeFieldCEEB=void 0)}emailSubjectAESelectChanged(){this.selectedMergeFieldAEES&&(this.editorDropDownSelectChanged(this.emailSubjectAEEditor,this.emailSubjectAEDropdown,this.selectedMergeFieldAEES),this.selectedMergeFieldAEES=void 0)}emailBodyAESelectChanged(){this.selectedMergeFieldAEEB&&(this.editorDropDownSelectChanged(this.emailBodyAEEditor,this.emailBodyAEDropdown,this.selectedMergeFieldAEEB),this.selectedMergeFieldAEEB=void 0)}emailSubjectRESelectChanged(){this.selectedMergeFieldREES&&(this.editorDropDownSelectChanged(this.emailSubjectREEditor,this.emailSubjectREDropdown,this.selectedMergeFieldREES),this.selectedMergeFieldREES=void 0)}emailBodyRESelectChanged(){this.selectedMergeFieldREEB&&(this.editorDropDownSelectChanged(this.emailBodyREEditor,this.emailBodyREDropdown,this.selectedMergeFieldREEB),this.selectedMergeFieldREEB=void 0)}editorDropDownSelectChanged(t,o,i){let s=t.quill,c=0,u=s.history.quill.selection.savedRange;u&&(u.length===0?c=u.index:(c=u.index,s.deleteText(u.index,u.length))),s.insertText(c,i,"user"),s.setSelection(s.getText(0).length),s.focus(),o.updateModel(void 0)}
4046AfterViewInit(){this.editors.forEach(t=>{t.quill.options.container.firstChild.addEventListener("blur",()=>{this.textareaFocused=!1})})}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}enableExternalGroupForm(t){let o=this.form.get("GroupRequestApproverIds"),i=this.form.get("DefaultEventStatusId"),s=this.form.get("EnableGuestEventRequestForm")?.value;t&&t.checked?(o?.addValidators([T.required]),o?.updateValueAndValidity(),i?.addValidators([T.required]),i?.updateValueAndValidity(),s||this.enableLimitingDateConfigs()):(this.form.get("RequireInsuranceCertificate")?.reset(),this.form.get("EventTermsAndConditions")?.reset(),o?.clearValidators(),o?.reset(),i?.clearValidators(),i?.reset(),s||this.disableLimitingDateConfigs())}enableGuestForm(t){let o=this.form.get("EventGuestUserId"),i=this.form.get("EnableExternalRequestGroups")?.value;t&&t.checked?(o?.addValidators([T.required]),o?.updateValueAndValidity(),i||this.enableLimitingDateConfigs()):(o?.clearValidators(),o?.reset(),i||this.disableLimitingDateConfigs())}enablePublicCalendarForm(t){let o=this.form.get("PublicCalendarUserId");t&&t.checked?(o?.addValidators([T.required]),o?.updateValueAndValidity()):(o?.clearValidators(),o?.reset())}enableLimitingDateConfigs(){this.hideLimitingDateConfigs=!1;let t=this.form.get("LimitingDateUTC"),o=this.form.get("DaysBeforeLimitingDateSendReminder"),i=this.form.get("LimitingDateReminderRecipientIds"),s=this.form.get("EmailSubjectLimitingDateReminder"),c=this.form.get("EmailBodyLimitingDateReminder");t?.addValidators([T.required]),t?.updateValueAndValidity(),o?.addValidators([T.required]),o?.updateValueAndValidity(),i?.addValidators([T.required]),i?.updateValueAndValidity(),s?.addValidators([T.required,T.maxLength(fi)]),s?.updateValueAndValidity(),c?.addValidators([T.required,T.maxLength(Kt)]),c?.updateValueAndValidity(),this.form.markAsPristine(),this.form.markAsUntouched()}disableLimitingDateConfigs(){let t=this.form.get("LimitingDateUTC"),o=this.form.get("DaysBeforeLimitingDateSendReminder"),i=this.form.get("LimitingDateReminderRecipientIds"),s=this.form.get("EmailSubjectLimitingDateReminder"),c=this.form.get("EmailBodyLimitingDateReminder");t?.clearValidators(),t?.reset(),o?.clearValidators(),o?.reset(),i?.clearValidators(),i?.reset(),s?.clearValidators(),s?.reset(),c?.clearValidators(),c?.reset(),this.hideLimitingDateConfigs=!0}addDateOnClick(){let t=za.default.cloneDeep(this.blockedDates);if(this.blockedDateOrDateRangeSelected){if(this.blockedDatesSelectionType==="single"){let o=(0,kr.default)(this.blockedDateOrDateRangeSelected).endOf("d").toDate();t.push({StartDateUTC:Vt.convertToAppTimezoneUTC(this.appSettings?.Timezone??"",this.blockedDateOrDateRangeSelected),EndDateUTC:Vt.convertToAppTimezoneUTC(this.appSettings?.Timezone??"",o),Note:this.blockedDateOrDateRangeNote,TenantId:this.appSettings?.TenantId})}else if(this.blockedDatesSelectionType==="range"){let o=(0,kr.default)(this.blockedDateOrDateRangeSelected[1]).endOf("d").toDate();t.push({StartDateUTC:Vt.convertToAppTimezoneUTC(this.appSettings?.Timezone??"",this.blockedDateOrDateRangeSelected[0]),EndDateUTC:Vt.convertToAppTimezoneUTC(this.appSettings?.Timezone??"",o),Note:this.blockedDateOrDateRangeNote,TenantId:this.appSettings?.TenantId})}}this.blockedDates=this.sortBlockedDates(t).map(o=>{let i=(0,kr.default)(o.EndDateUTC).diff(o.StartDateUTC,"h");return o.IsSingleDate=i<24,o}),this.blockedDateOrDateRangeSelected=void 0,this.blockedDateOrDateRangeNote="",this.markFormDirty()}checkForValidDate(t){this.blockedDatesSelectionMode==="single"?this.dateSelectionIsInvalid=!t:this.dateSelectionIsInvalid=!t||!t[1]}blockedDatesSelectionTypeOnChange(t){t&&t.value&&(this.blockedDateOrDateRangeSelected=void 0,this.blockedDatesSelectionMode=t.value,t.value==="single"?(this.addDateButtonLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE"],this.blockedDatesDateLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE"]):t.value==="range"&&(this.addDateButtonLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE_RANGE"],this.blockedDatesDateLabel=this.translations["APP_SETTINGS.EVENT.ADD_DATE_RANGE"]))}blockedDatesDeleteOnClick(t){if(t){let o=this.blockedDates.indexOf(t);this.blockedDates.splice(o,1)}this.markFormDirty()}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Ln;
4046this.appSettings&&(t=new Ln().parseEventsForm(this.form.getRawValue(),this.appSettings)),this.appSettingsService.updateAppSettings(t).pipe(we(()=>this.eventService.createOrUpdateEventBlockedDates(this.authService.tenant.Id,this.blockedDates))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("APP_SETTINGS.EVENT.SUCCESS.SAVE","../",this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}sortBlockedDates(t){return za.default.sortBy(t,o=>new Date(o.StartDateUTC??""))}showCopyMessage(t){this.showCopyGuestLinkMessage=t==="guest-link",this.showCopyExternalGroupLinkMessage=t==="external-request",this.showCopyExternalGroupLoginLinkMessage=t==="external-login",this.showCopyPublicCalendarLinkMessage=t==="public-calendar",setTimeout(()=>{t==="guest-link"?this.showCopyGuestLinkMessage=!1:t==="external-request"?this.showCopyExternalGroupLinkMessage=!1:t==="external-login"?this.showCopyExternalGroupLoginLinkMessage=!1:t==="public-calendar"&&(this.showCopyPublicCalendarLinkMessage=!1)},2e3)}isDirty(){return this.form.dirty&&!this.submitted}markFormDirty(){this.form.markAsDirty(),this.form.markAsTouched()}setGuestFormOptionsOnModel(){this.setGuestUserSelectItems(),this.appSettings&&this.appSettings.EventGuestUserId&&(this.appSettings.EventGuestUserId=this.allInternalUserItems.find(t=>t.value===this.appSettings?.EventGuestUserId)?.value)}setGuestUserSelectItems(){let t=za.default.sortBy(this.allInternalUsers,o=>(o.fullNameWithEmail()??"").toLowerCase());this.allInternalUserItems=t.map(o=>({label:o.fullNameWithEmail(),value:o.Id}))}guestDefaultCategoryChanged(t,o=!0){let i=t?.value,s=this.form.get("EventGuestDefaultCalendarId");if(i){this.eventCalendarOptions=this.allEventCalendars.filter(u=>u.CategoryId===i&&u.State===M.ACTIVE).map(u=>({label:u.Name,value:u.Id}));let c=(this.eventCalendarOptions&&this.eventCalendarOptions.length)===1?this.eventCalendarOptions[0]:null;o&&s?.setValue(c),s?.enable()}else o&&s?.setValue(null),s?.disable()}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(oi),g(be),g(Se),g(Re),g(he),g(Be),g(Oi),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-event-settings"]],viewQuery:function(o,i){if(o&1&&(X(lC,7),X(sC,5),X(dC,5),X(pC,5),X(mC,5),X(cC,7),X(uC,5),X(_C,7),X(EC,5),X(SC,7),X(xC,5),X(fC,7),X(hC,5),X(CC,7),X(vC,5),X(gC,7),X(TC,5),X(Jt,5)),o&2){let s;Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.emailSubjectLDREditor=s.first),Y(s=Q())&&(i.emailSubjectLDRDropdown=s.first),Y(s=Q())&&(i.emailBodyLDREditor=s.first),Y(s=Q())&&(i.emailBodyLDRDropdown=s.first),Y(s=Q())&&(i.emailSubjectCEEditor=s.first),Y(s=Q())&&(i.emailSubjectCEDropdown=s.first),Y(s=Q())&&(i.emailBodyCEEditor=s.first),Y(s=Q())&&(i.emailBodyCEDropdown=s.first),Y(s=Q())&&(i.emailSubjectAEEditor=s.first),Y(s=Q())&&(i.emailSubjectAEDropdown=s.first),Y(s=Q())&&(i.emailBodyAEEditor=s.first),Y(s=Q())&&(i.emailBodyAEDropdown=s.first),Y(s=Q())&&(i.emailSubjectREEditor=s.first),Y(s=Q())&&(i.emailSubjectREDropdown=s.first),Y(s=Q())&&(i.emailBodyREEditor=s.first),Y(s=Q())&&(i.emailBodyREDropdown=s.first),Y(s=Q())&&(i.editors=s)}},standalone:!1,decls:431,vars:113,consts:[["shades",""],["toggleicon",""],["incrementbuttonicon",""],["decrementbuttonicon",""],["emailSubjectCEEditor",""],["header",""],["emailBodyCEEditor",""],["emailSubjectAEEditor",""],["emailBodyAEEditor",""],["emailSubjectREEditor",""],["emailBodyREEditor",""],["eventAlertMessageEditor",""],["limitingDateRangeInfo",""],["limitingDateInfo",""],["emailSubjectCEDropdown",""],["emailBodyCEDropdown",""],["emailSubjectAEDropdown",""],["emailBodyAEDropdown",""],["emailSubjectREDropdown",""],["emailBodyREDropdown",""],["dropdownicon",""],["filtericon",""],["emailSubjectLDREditor",""],["emailBodyLDREditor",""],["eventTermsAndConditions",""],["icon",""],["eventBlockedDatesTable",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.event.page-header",1,"page-header"],[3,"dt"],["id","qware.app-settings.event.spinner",3,"displaySpinner"],[3,"formGroup"],[3,"multiple","dt","value"],["id","qware.app-settings.event.general-shade","value","0"],[1,"accordion-content-padding"],[1,"grid"],[1,"col-12"],[1,"medium-input","flex-inline","flex-space-between"],["translate",""],["id","qware.app-settings.event.checkbox.enable-ext-request-groups","name","EnableExternalRequestGroups","formControlName","EnableExternalRequestGroups",3,"onChange","tabindex","binary"],["id","qware.app-settings.event.checkbox.enable-guest-event-request-form","name","EnableGuestEventRequestForm","formControlName","EnableGuestEventRequestForm",3,"onChange","tabindex","binary"],["id","qware.app-settings.event.checkbox.enable-booking-over-blocking-events","name","EnableBookingOverBlockingEvents","formControlName","EnableBookingOverBlockingEvents",3,"tabindex","binary"],["id","qware.app-settings.event.checkbox.enable-public-calendar","name","EnablePublicCalendar","formControlName","EnablePublicCalendar",3,"onChange","tabindex","binary"],[1,"medium-input"],["formControlName","HoursBeforeEventStartsToCancel","inputId","qware.app-settings.event.hours-before-event-starts-to-cancel.input","variant","filled",1,"is-filled",3,"tabindex","showButtons","min","fluid"],["for","qware.app-settings.event.hours-before-event-starts-to-cancel.input","id","qware.app-settings.event.hours-before-event-starts-to-cancel.label"],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.event.hours-before-event-starts-to-cancel.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.qware-autocomplete.canceled-event-wo-status","labelId","qware.app-settings.event.canceled-event-wo-status.label","elementId","qware.app-settings.event.canceled-event-wo-status","label","APP_SETTINGS.EVENT.CANCELED_EVENT_WO_STATUS","formControlName","CanceledEventWorkOrderStatusId",3,"tabindex","singleSelect","options"],["id","qware.app-settings.event.label.email-subject-canceled-event",1,"standalone-label"],["id","qware.app-settings.event.email-subject-canceled-event.editor","formControlName","EmailSubjectCanceledEvent",3,"onTextChange","tabindex"],["
4046id","qware.app-settings.event.email-subject-canceled-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-subject-canceled-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-body-canceled-event",1,"standalone-label"],["id","qware.app-settings.event.email-body-canceled-event.editor","formControlName","EmailBodyCanceledEvent",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-body-canceled-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-body-canceled-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-subject-approved-event",1,"standalone-label"],["id","qware.app-settings.event.email-subject-approved-event.editor","formControlName","EmailSubjectApprovedEvent",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-subject-approved-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-subject-approved-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-body-approved-event",1,"standalone-label"],["id","qware.app-settings.event.email-body-approved-event.editor","formControlName","EmailBodyApprovedEvent",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-body-approved-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-body-approved-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-subject-rejected-event",1,"standalone-label"],["id","qware.app-settings.event.email-subject-rejected-event.editor","formControlName","EmailSubjectRejectedEvent",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-subject-rejected-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-subject-rejected-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-body-rejected-event",1,"standalone-label"],["id","qware.app-settings.event.email-body-rejected-event.editor","formControlName","EmailBodyRejectedEvent",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-body-rejected-event.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-body-rejected-event.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.alert-message",1,"standalone-label"],["id","qware.app-settings.event.alert-message.editor","formControlName","EventAlertMessage",3,"onTextChange","tabindex"],["id","qware.app-settings.event.error.event-alert-message-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.limiting-dates-shade","value","1"],[1,"display-in-grid"],["formControlName","LimitingDateRange","inputId","qware.app-settings.event.limiting-date-range","variant","filled",1,"is-filled",3,"tabindex","showButtons","min","max","suffix","fluid"],["for","qware.app-settings.event.limiting-date-range","id","qware.app-settings.event.limiting-date-range.label"],[1,"info-icon","material-icons-outlined",3,"click"],["id","qware.app-settings.event.limiting-date-range.error-required","translate","",3,"hidden"],[1,"popover-width"],["translate","",1,"info-text"],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.event.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.event.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"material-icons"],[1,"validation-error"],[1,"ql-formats","merge-field"],["id","qware.app-settings.event.dropdown.email-subject-canceled-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["pTemplate","dropdownicon"],["pTemplate","filtericon"],[1,"ql-formats"],[1,"ql-size"],["value","small"],["selected",""],["value","large"],["value","huge"],[1,"ql-color"],[1,"ql-background"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],["value","sub",1,"ql-script"],["value","super",1,"ql-script"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"],[1,"ql-link"],[1,"ql-clean"],["id","qware.app-settings.event.dropdown.email-body-canceled-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["id","qware.app-settings.event.dropdown.email-subject-approved-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["id","qware.app-settings.event.dropdown.email-body-approved-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["id","qware.app-settings.event.dropdown.email-subject-rejected-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["id","qware.app-settings.event.dropdown.email-body-rejected-event.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["formControlName","LimitingDateUTC","id","qware.app-settings.event.limiting-date","variant","filled",1,"is-filled",3,"tabindex","showIcon","showButtonBar","maxDate","fluid"],["pTemplate","triggericon"],["id","qware.app-settings.event.limiting-date.label","for","qware.app-settings.event.limiting-date"],["id","qware.app-settings.event.limiting-date.error-required","translate","",3,"hidden"],["formControlName","DaysBeforeLimitingDateSendReminder","variant","filled","inputId","qware.app-settings.event.days-before-limiting-date-send-reminder.input",1,"is-filled",3,"tabindex","fluid","showButtons","min"],["for","qware.app-settings.event.days-before-limiting-date-send-reminder.input","id","qware.app-settings.event.days-before-limiting-date-send-reminder.label"],["id","qware.app-settings.event.days-before-limiting-date.error-required","translate","",3,"hidden"],["display","chip","variant","filled","formControlName","LimitingDateReminderRecipientIds",3,"options","tabindex","fluid","id","filterFields","maxSelectedLabels"],["id","qware.app-settings.event.limiting-date-reminder-recipients.label","for","qware.app-settings.event.limiting-date-reminder-recipients"],["id","qware.app-settings.event.limiting-date-reminder-recipients.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.label.email-subject-limiting-date-reminder",1,"standalone-label"],["id","qware.app-settings.event.email-subject-limiting-date-reminder.editor","formControlName","EmailSubjectLimitingDateReminder",3,"onTextChange","tabindex"],["
4046id","qware.app-settings.event.email-subject-limiting-date-reminder.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-subject-limiting-date-reminder.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.label.email-body-limiting-date-reminder",1,"standalone-label"],["id","qware.app-settings.event.email-body-limiting-date-reminder.editor","formControlName","EmailBodyLimitingDateReminder",3,"onTextChange","tabindex"],["id","qware.app-settings.event.email-body-limiting-date-reminder.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.email-body-limiting-date-reminder.error-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.groups-shade","value","2"],[1,"medium-input",2,"margin-bottom","0"],[1,"copy-link"],[3,"routerLink"],[3,"click","qwareCopyToClipboard"],[1,"medium-input",2,"margin-bottom","0","margin-top","0"],["id","qware.app-settings.event.checkbox.require-insurance-certificate","name","RequireInsuranceCertificate","formControlName","RequireInsuranceCertificate",3,"tabindex","qwareFocus","binary"],["id","qware.app-settings.event.label.terms-and-conditions",1,"standalone-label"],["id","qware.app-settings.event.terms-and-conditions.editor","formControlName","EventTermsAndConditions",3,"onTextChange","tabindex"],["display","chip","id","qware.app-settings.event.multiselect.group-request-approvers","variant","filled","formControlName","GroupRequestApproverIds",3,"tabindex","fluid","options","maxSelectedLabels"],["for","qware.app-settings.event.multiselect.group-request-approvers","id","qware.app-settings.event.group-request-approvers.label"],["id","qware.app-settings.event.group-request-approvers.error-required","translate","",3,"hidden"],["id","qware.app-settings.event.qware-autocomplete.default-event-status","labelId","qware.app-settings.event.default-event-status.label","elementId","qware.app-settings.event.default-event-status","label","APP_SETTINGS.EVENT.DEFAULT_STATUS","formControlName","DefaultEventStatusId",3,"tabindex","singleSelect","isRequired","options"],["id","qware.app-settings.event.default-event-status.error-required","translate","",3,"hidden"],["severity","success"],["id","qware.app-settings.event.guest-form-shade","value","3"],["id","qware.app-settings.event.guest-form-link",3,"routerLink"],["formControlName","EventGuestUserId","labelId","qware.app-settings.event.label.guest-user","label","APP_SETTINGS.EVENT.GUEST_USER","elementId","qware.app-settings.event.guest-user","id","qware.app-settings.event.guest-user-e2e",3,"tabindex","options","singleSelect","isRequired","virtualScroll","virtualScrollItemSize"],["id","qware.app-settings.event.error.guest-user-req","translate","",3,"hidden"],["formControlName","EventGuestDefaultCategoryId","labelId","qware.app-settings.event.label.guest-default-category","label","APP_SETTINGS.EVENT.GUEST_DEFAULT_CATEGORY","elementId","qware.app-settings.event.guest-default-cateogry","id","qware.app-settings.event.guest-default-category-e2e",3,"selectChange","tabindex","options","singleSelect"],["formControlName","EventGuestDefaultCalendarId","labelId","qware.app-settings.event.label.guest-default-calendar","label","APP_SETTINGS.EVENT.GUEST_DEFAULT_CALENDAR","elementId","qware.app-settings.event.guest-default-calendar","id","qware.app-settings.event.guest-default-calendar-e2e",3,"tabindex","options","singleSelect"],["id","qware.app-settings.event.public-calendar-shade","value","4"],["id","qware.app-settings.event.public-calendar-link",3,"routerLink"],["formControlName","PublicCalendarUserId","labelId","qware.app-settings.event.label.public-calendar-user","label","APP_SETTINGS.EVENT.PUBLIC_CALENDAR_USER","elementId","qware.app-settings.event.public-calendar-user","id","qware.app-settings.event.public-calendar-user-e2e",3,"tabindex","options","singleSelect","isRequired","virtualScroll","virtualScrollItemSize"],["id","qware.app-settings.event.error.public-calendar-user-req","translate","",3,"hidden"],["id","qware.app-settings.event.label.public-calendar-message",1,"standalone-label"],["id","qware.app-settings.event.public-calendar-message.editor","formControlName","PublicCalendarMessage",3,"onTextChange","tabindex"],["
4046id","qware.app-settings.event.error.public-calendar-message-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.event.blocked-dates-shade","value","5"],[1,"grid","zipper","flex-inline"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],["id","qware.app-settings.event.dropdown.select-type","variant","filled",3,"ngModelChange","onChange","tabindex","fluid","options","ngModel","ngModelOptions"],["for","qware.app-settings.event.dropdown.select-type","id","qware.app-settings.event.select-type.label"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.app-settings.event.calendar.date","dateFormat","m/d","variant","filled",1,"is-filled",3,"ngModelChange","tabindex","selectionMode","ngModel","fluid","ngModelOptions","showIcon","disabled"],["for","qware.app-settings.event.calendar.date","id","qware.app-settings.event.calendar.date.label"],[1,"col-12",2,"padding-top","0px"],[1,"medium-input",2,"margin-top","0px"],["id","qware.app_settings.event.input.note","variant","filled","type","text","pInputText","",3,"ngModelChange","tabindex","fluid","ngModel","ngModelOptions"],["id","qware.app_settings.event.input.note.label","for","qware.app_settings.event.input.input.note"],[1,"add-button"],["id","qware.app-settings.event.button.add-date","type","button",3,"onClick","tabindex","raised","label","disabled"],["responsiveLayout","stack","id","qware.app-settings.event.table.selected-blocked-dates","styleClass","no-selection-column",3,"value","paginator","rows","columns","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[3,"ngClass"],[1,"responsive-border"],["qwareTruncate",""],[1,"p-datatable-column-title"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded"],["translate","",1,"no-results"]],template:function(o,i){if(o&1){let s=b();n(0,"div",27),h("keydown.enter",function(){return E(s),S(i.textareaFocused?void 0:i.save())}),e(1,` 4047 `),n(2,"div",28),e(3,` 4048 `),n(4,"h3",29),e(5,` 4049 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.EVENT.EVENTS 4050 `),a(),e(9,` 4051 `),n(10,"p-card",30),e(11,` 4052 `),n(12,"qware-spinner",31),e(13,` 4053 `),n(14,"div",32),e(15,` 4054 `),n(16,"p-accordion",33,0),e(18,` 4055 `),e(19,` 4056 `),n(20,"p-accordion-panel",34),e(21,` 4057 `),n(22,"p-accordion-header"),e(23),I(24,"translate"),_(25,NC,3,1,"ng-template",null,1,A),e(27,` 4058 `),a(),e(28,` 4059 `),n(29,"p-accordion-content"),e(30,` 4060 `),n(31,"div",35),e(32,` 4061 `),n(33,"div",36),e(34,` 4062 `),n(35,"div",37),e(36,` 4063 `),e(37,` 4064 `),n(38,"div",38),e(39,` 4065 `),n(40,"label",39),e(41,"APP_SETTINGS.EVENT.ENABLE_EXT_REQUEST_GROUPS"),a(),e(42,` 4066 `),n(43,"p-checkbox",40),h("onChange",function(u){return E(s),S(i.enableExternalGroupForm(u))}),e(44,` 4067 `),a(),e(45,` 4068 `),a(),e(46,` 4069 4070 `),e(47,` 4071 `),n(48,"div",38),e(49,` 4072 `),n(50,"label",39),e(51,"APP_SETTINGS.EVENT.ENABLE_GUEST_EVENT_REQUEST_FORM"),a(),e(52,` 4073 `),n(53,"p-checkbox",41),h("onChange",function(u){return E(s),S(i.enableGuestForm(u))}),e(54,` 4074 `),a(),e(55,` 4075 `),a(),e(56,` 4076 4077 `),e(57,` 4078 `),n(58,"div",38),e(59,` 4079 `),n(60,"label",39),e(61,"APP_SETTINGS.EVENT.ENABLE_BOOKING_OVER_BLOCKING_EVENTS"),a(),e(62,` 4080 `),n(63,"p-checkbox",42),e(64,` 4081 `),a(),e(65,` 4082 `),a(),e(66,` 4083 4084 `),e(67,` 4085 `),n(68,"div",38),e(69,` 4086 `),n(70,"label",39),e(71,"APP_SETTINGS.EVENT.ENABLE_PUBLIC_CALENDAR"),a(),e(72,` 4087 `),n(73,"p-checkbox",43),h("onChange",function(u){return E(s),S(i.enablePublicCalendarForm(u))}),e(74,` 4088 `),a(),e(75,` 4089 `),a(),e(76,` 4090 4091 `),e(77,` 4092 `),n(78,"div",44),e(79,` 4093 `),n(80,"p-floatlabel"),e(81,` 4094 `),n(82,"p-inputnumber",45),e(83,` 4095 `),_(84,OC,4,0,"ng-template",null,2,A),e(86,` 4096 `),_(87,FC,4,0,"ng-template",null,3,A),e(89,` 4097 `),a(),e(90,` 4098 `),n(91,"label",46),e(92,` 4099 `),n(93,"span",39),e(94,"APP_SETTINGS.EVENT.HOURS_BEFORE_EVENT_STARTS_TO_CANCEL"),a(),n(95,"span",47),e(96," *"),a(),e(97,` 4100 `),a(),e(98,` 4101 `),a(),e(99,` 4102 `),n(100,"small",48),e(101,` 4103 `),n(102,"div",49),e(103,` 4104 APP_SETTINGS.EVENT.ERROR.TIME_BEFORE_EVENT_STARTS_REQUIRED 4105 `),a(),e(104,` 4106 `),a(),e(105,` 4107 `),_(106,UC,3,0),a(),e(107,` 4108 4109 `),e(108,` 4110 `),n(109,"div",44),e(110,` 4111 `),n(111,"qware-autocomplete",50),e(112,` 4112 `),a(),e(113,` 4113 `),a(),e(114,` 4114 4115 `),e(115,` 4116 `),n(116,"div",44),e(117,` 4117 `),n(118,"label",51),e(119,` 4118 `),n(120,"span",39),e(121,"APP_SETTINGS.EVENT.CANCEL_EVENT_EMAIL_SUBJECT"),a(),n(122,"span",47),e(123," *"),a(),e(124,` 4119 `),a(),e(125,` 4120 `),n(126,"p-editor",52,4),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(128,` 4121 `),_(129,kC,13,9,"ng-template",null,5,A),e(131,` 4122 `),a(),e(132,` 4123 `),n(133,"small",48),e(134,` 4124 `),n(135,"div",53),e(136,` 4125 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_SUBJECT_REQUIRED 4126 `),a(),e(137,` 4127 `),n(138,"div",54),e(139,` 4128 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_SUBJECT_LENGTH 4129 `),a(),e(140,` 4130 `),a(),e(141,`
4131 `),_(142,qC,3,0),a(),e(143,` 4132 4133 `),e(144,` 4134 `),n(145,"div",44),e(146,` 4135 `),n(147,"label",55),e(148,` 4136 `),n(149,"span",39),e(150,"APP_SETTINGS.EVENT.CANCEL_EVENT_EMAIL_BODY"),a(),n(151,"span",47),e(152," *"),a(),e(153,` 4137 `),a(),e(154,` 4138 `),n(155,"p-editor",56,6),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(157,` 4139 `),_(158,WC,75,9,"ng-template",null,5,A),e(160,` 4140 `),a(),e(161,` 4141 `),n(162,"small",48),e(163,` 4142 `),n(164,"div",57),e(165,` 4143 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_BODY_REQUIRED 4144 `),a(),e(166,` 4145 `),n(167,"div",58),e(168,` 4146 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_BODY_LENGTH 4147 `),a(),e(169,` 4148 `),a(),e(170,` 4149 `),_(171,YC,3,0),a(),e(172,` 4150 4151 `),e(173,` 4152 `),n(174,"div",44),e(175,` 4153 `),n(176,"label",59),e(177,` 4154 `),n(178,"span",39),e(179,"APP_SETTINGS.EVENT.APPROVED_EVENT_EMAIL_SUBJECT"),a(),n(180,"span",47),e(181," *"),a(),e(182,` 4155 `),a(),e(183,` 4156 `),n(184,"p-editor",60,7),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(186,`
4157 `),_(187,$C,13,9,"ng-template",null,5,A),e(189,` 4158 `),a(),e(190,` 4159 `),n(191,"small",48),e(192,` 4160 `),n(193,"div",61),e(194,` 4161 APP_SETTINGS.EVENT.ERROR.APPROVED_EVENT_EMAIL_SUBJECT_REQUIRED 4162 `),a(),e(195,` 4163 `),n(196,"div",62),e(197,` 4164 APP_SETTINGS.EVENT.ERROR.APPROVED_EVENT_EMAIL_SUBJECT_LENGTH 4165 `),a(),e(198,` 4166 `),a(),e(199,` 4167 `),_(200,XC,3,0),a(),e(201,` 4168 4169 `),e(202,` 4170 `),n(203,"div",44),e(204,` 4171 `),n(205,"label",63),e(206,` 4172 `),n(207,"span",39),e(208,"APP_SETTINGS.EVENT.APPROVED_EVENT_EMAIL_BODY"),a(),n(209,"span",47),e(210," *"),a(),e(211,` 4173 `),a(),e(212,` 4174 `),n(213,"p-editor",64,8),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(215,` 4175 `),_(216,ev,75,9,"ng-template",null,5,A),e(218,` 4176 `),a(),e(219,` 4177 `),n(220,"small",48),e(221,` 4178 `),n(222,"div",65),e(223,` 4179 APP_SETTINGS.EVENT.ERROR.APPROVED_EVENT_EMAIL_BODY_REQUIRED 4180 `),a(),e(224,` 4181 `),n(225,"div",66),e(226,` 4182 APP_SETTINGS.EVENT.ERROR.APPROVED_EVENT_EMAIL_BODY_LENGTH 4183 `),a(),e(227,` 4184 `),a(),e(228,` 4185 `),_(229,iv,3,0),a(),e(230,` 4186 4187 `),e(231,` 4188 `),n(232,"div",44),e(233,` 4189 `),n(234,"label",67),e(235,` 4190 `),n(236,"span",39),e(237,"APP_SETTINGS.EVENT.REJECTED_EVENT_EMAIL_SUBJECT"),a(),e(238,` 4191 `),n(239,"span",47),e(240," *"),a(),e(241,` 4192 `),a(),e(242,` 4193 `),n(243,"p-editor",68,9),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(245,` 4194 `),_(246,rv,13,9,"ng-template",null,5,A),e(248,` 4195 `),a(),e(249,` 4196 `),n(250,"small",48),e(251,` 4197 `),n(252,"div",69),e(253,` 4198 APP_SETTINGS.EVENT.ERROR.REJECTED_EVENT_EMAIL_SUBJECT_REQUIRED 4199 `),a(),e(254,` 4200 `),n(255,"div",70),e(256,` 4201 APP_SETTINGS.EVENT.ERROR.REJECTED_EVENT_EMAIL_SUBJECT_LENGTH 4202 `),a(),e(257,` 4203 `),a(),e(258,` 4204 `),_(259,lv,3,0),a(),e(260,` 4205 4206 `),e(261,` 4207 `),n(262,"div",44),e(263,` 4208 `),n(264,"label",71),e(265,` 4209 `),n(266,"span",39),e(267,"APP_SETTINGS.EVENT.REJECTED_EVENT_EMAIL_BODY"),a(),n(268,"span",47),e(269," *"),a(),e(270,` 4210 `),a(),e(271,` 4211 `),n(272,"p-editor",72,10),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(274,` 4212 `),_(275,pv,75,9,"ng-template",null,5,A),e(277,` 4213 `),a(),e(278,` 4214 `),n(279,"small",48),e(280,` 4215 `),n(281,"div",73),e(282,` 4216 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_BODY_REQUIRED 4217 `),a(),e(283,` 4218 `),n(284,"div",74),e(285,` 4219 APP_SETTINGS.EVENT.ERROR.CANCEL_EVENT_EMAIL_BODY_LENGTH 4220 `),a(),e(286,` 4221 `),a(),e(287,` 4222 `),_(288,cv,3,0),a(),e(289,` 4223 4224 `),e(290,` 4225 `),n(291,"div",44),e(292,` 4226 `),n(293,"label",75),e(294,` 4227 `),n(295,"span",39),e(296,"APP_SETTINGS.EVENT.ALERT_MESSAGE"),a(),e(297,` 4228 `),a(),e(298,` 4229 `),n(299,"p-editor",76,11),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(301,` 4230 `),_(302,uv,63,0,"ng-template",null,5,A),e(304,` 4231 `),a(),e(305,` 4232 `),n(306,"small",48),e(307,` 4233 `),n(308,"div",77),e(309,` 4234 APP_SETTINGS.EVENT.ERROR.ALERT_MESSAGE_LENGTH 4235 `),a(),e(310,` 4236 `),a(),e(311,` 4237 `),_(312,Ev,3,0),a(),e(313,` 4238 `),a(),e(314,` 4239 `),a(),e(315,` 4240 `),a(),e(316,` 4241 `),a(),e(317,` 4242 `),a(),e(318,` 4243 `),e(319,` 4244 `),n(320,"p-accordion-panel",78),e(321,` 4245 `),n(322,"p-accordion-header"),e(323),I(324,"translate"),_(325,fv,3,1,"ng-template",null,1,A),e(327,` 4246 `),a(),e(328,` 4247 `),n(329,"p-accordion-content"),e(330,` 4248 `),n(331,"div",35),e(332,` 4249 `),n(333,"div",79),e(334,` 4250 `),n(335,"div",37),e(336,` 4251 `),e(337,` 4252 `),n(338,"div",44),e(339,` 4253 `),n(340,"p-inputgroup"),e(341,` 4254 `),n(342,"p-floatlabel"),e(343,` 4255 `),n(344,"p-inputnumber",80),e(345,` 4256 `),_(346,hv,4,0,"ng-template",null,2,A),e(348,` 4257 `),_(349,Cv,4,0,"ng-template",null,3,A),e(351,` 4258 `),a(),e(352,` 4259 `),n(353,"label",81),e(354,` 4260 `),n(355,"span",39),e(356,"APP_SETTINGS.EVENT.LIMITING_DATE_RANGE"),a(),n(357,"span",47),e(358," *"),a(),e(359,` 4261 `),a(),e(360,` 4262 `),a(),e(361,` 4263 `),n(362,"p-inputgroup-addon"),e(363,` 4264 `),n(364,"i",82),h("click",function(u){E(s);let x=Ee(378);return S(x.toggle(u))}),e(365,"info"),a(),e(366,` 4265 `),a(),e(367,` 4266 `),a(),e(368,` 4267 `),n(369,"small",48),e(370,` 4268 `),n(371,"div",83),e(372,` 4269 APP_SETTINGS.EVENT.ERROR.LIMITING_DATE_RANGE_REQUIRED 4270 `),a(),e(373,` 4271 `),a(),e(374,` 4272 `),_(375,gv,3,0),a(),e(376,` 4273 `),n(377,"p-popover",null,12),e(379,` 4274 `),n(380,"div",84),e(381,` 4275 `),n(382,"span",85),e(383,"APP_SETTINGS.EVENT.LIMITING_DATE_RANGE_INFO"),a(),e(384,` 4276 `),a(),e(385,` 4277 `),a(),e(386,` 4278 4279 `),e(387,` 4280 `),_(388,yv,36,8),n(389,"p-popover",null,13),e(391,` 4281 `),n(392,"div",84),e(393,` 4282 `),n(394,"span",85),e(395,"APP_SETTINGS.EVENT.LIMITING_DATE_INFO"),a(),e(396,` 4283 `),a(),e(397,` 4284 `),a(),e(398,` 4285 4286 `),e(399,` 4287 `),_(400,Lv,31,7)(401,Uv,31,10)(402,Vv,29,8)(403,Wv,29,8),a(),e(404,` 4288 `),a(),e(405,` 4289 `),a(),e(406,` 4290 `),a(),e(407,` 4291 `),a(),e(408,` 4292 `),e(409,` 4293 `),_(410,rg,139,32)(411,xg,75,24)(412,Rg,87,26)(413,jg,95,28),a(),e(414,` 4294 `),a(),e(415,` 4295 `),n(416,"div",86),e(417,` 4296 `),n(418,"p-button",87),I(419,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(420,` 4297 `),a(),e(421,` 4298 `),n(422,"p-button",88),I(423,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(424,`
4299 `),a(),e(425,` 4300 `),a(),e(426,` 4301 `),a(),e(427,` 4302 `),a(),e(428,` 4303 `),a(),e(429,` 4304`),a(),e(430,` 4305`)}if(o&2){let s;l(10),p("dt",i.accordionCard),l(2),p("displaySpinner",i.displaySpinner),l(2),p("formGroup",i.form),l(2),p("multiple",!0)("dt",i.accordion)("value",ne(98,IC)),l(7),K(` 4306 `,y(24,90,"APP_SETTINGS.EVENT.GENERAL"),` 4307 `),l(20),p("tabindex",1)("binary",!0),l(10),p("tabindex",2)("binary",!0),l(10),p("tabindex",3)("binary",!0),l(10),p("tabindex",4)("binary",!0),l(9),p("tabindex",5)("showButtons",!0)("min",0)("fluid",!0),l(18),p("hidden",i.form.controls.HoursBeforeEventStartsToCancel.valid||i.form.controls.HoursBeforeEventStartsToCancel.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.HoursBeforeEventStartsToCancel.errors!=null&&i.form.controls.HoursBeforeEventStartsToCancel.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.HoursBeforeEventStartsToCancel&&i.form.controls.HoursBeforeEventStartsToCancel.untouched?106:-1),l(5),p("tabindex",6)("singleSelect",!0)("options",i.workOrderStatusOptions),l(15),p("tabindex",7),l(7),p("hidden",i.form.controls.EmailSubjectCanceledEvent.valid||i.form.controls.EmailSubjectCanceledEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailSubjectCanceledEvent.errors!=null&&i.form.controls.EmailSubjectCanceledEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailSubjectCanceledEvent.errors!=null&&i.form.controls.EmailSubjectCanceledEvent.errors.maxlength)||(i.form.controls.EmailSubjectCanceledEvent.errors==null?null:i.form.controls.EmailSubjectCanceledEvent.errors.required))("translateParams",pe(99,oa,i.form.controls.EmailSubjectCanceledEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailSubjectCanceledEvent&&i.form.controls.EmailSubjectCanceledEvent.untouched?142:-1),l(13),p("tabindex",8),l(7),p("hidden",i.form.controls.EmailBodyCanceledEvent.valid||i.form.controls.EmailBodyCanceledEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailBodyCanceledEvent.errors!=null&&i.form.controls.EmailBodyCanceledEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailBodyCanceledEvent.errors!=null&&i.form.controls.EmailBodyCanceledEvent.errors.maxlength)||(i.form.controls.EmailBodyCanceledEvent.errors==null?null:i.form.controls.EmailBodyCanceledEvent.errors.required))("translateParams",pe(101,oa,i.form.controls.EmailBodyCanceledEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailBodyCanceledEvent&&i.form.controls.EmailBodyCanceledEvent.untouched?171:-1),l(13),p("tabindex",9),l(7),p("hidden",i.form.controls.EmailSubjectApprovedEvent.valid||i.form.controls.EmailSubjectApprovedEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailSubjectApprovedEvent.errors!=null&&i.form.controls.EmailSubjectApprovedEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailSubjectApprovedEvent.errors!=null&&i.form.controls.EmailSubjectApprovedEvent.errors.maxlength)||(i.form.controls.EmailSubjectApprovedEvent.errors==null?null:i.form.controls.EmailSubjectApprovedEvent.errors.required))("translateParams",pe(103,oa,i.form.controls.EmailSubjectApprovedEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailSubjectApprovedEvent&&i.form.controls.EmailSubjectApprovedEvent.untouched?200:-1),l(13),p("tabindex",10),l(7),p("hidden",i.form.controls.EmailBodyApprovedEvent.valid||i.form.controls.EmailBodyApprovedEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailBodyApprovedEvent.errors!=null&&i.form.controls.EmailBodyApprovedEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailBodyApprovedEvent.errors!=null&&i.form.controls.EmailBodyApprovedEvent.errors.maxlength)||(i.form.controls.EmailBodyApprovedEvent.errors==null?null:i.form.controls.EmailBodyApprovedEvent.errors.required))("translateParams",pe(105,oa,i.form.controls.EmailBodyApprovedEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailBodyApprovedEvent&&i.form.controls.EmailBodyApprovedEvent.untouched?229:-1),l(14),p("tabindex",11),l(7),p("hidden",i.form.controls.EmailSubjectRejectedEvent.valid||i.form.controls.EmailSubjectRejectedEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailSubjectRejectedEvent.errors!=null&&i.form.controls.EmailSubjectRejectedEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailSubjectRejectedEvent.errors!=null&&i.form.controls.EmailSubjectRejectedEvent.errors.maxlength)||(i.form.controls.EmailSubjectRejectedEvent.errors==null?null:i.form.controls.EmailSubjectRejectedEvent.errors.required))("translateParams",pe(107,oa,i.form.controls.EmailSubjectRejectedEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailSubjectRejectedEvent&&i.form.controls.EmailSubjectRejectedEvent.untouched?259:-1),l(13),p("tabindex",12),l(7),p("hidden",i.form.controls.EmailBodyRejectedEvent.valid||i.form.controls.EmailBodyRejectedEvent.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EmailBodyRejectedEvent.errors!=null&&i.form.controls.EmailBodyRejectedEvent.errors.required)),l(3),p("hidden",!(i.form.controls.EmailBodyRejectedEvent.errors!=null&&i.form.controls.EmailBodyRejectedEvent.errors.maxlength)||(i.form.controls.EmailBodyRejectedEvent.errors==null?null:i.form.controls.EmailBodyRejectedEvent.errors.required))("translateParams",pe(109,oa,i.form.controls.EmailBodyRejectedEvent.value)),l(4),f(i.validationErrors&&i.validationErrors.EmailBodyRejectedEvent&&i.form.controls.EmailBodyRejectedEvent.untouched?288:-1),l(11),p("tabindex",13),l(7),p("hidden",i.form.controls.EventAlertMessage.valid||i.form.controls.EventAlertMessage.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.EventAlertMessage.errors!=null&&i.form.controls.EventAlertMessage.errors.maxlength))("translateParams",pe(111,oa,i.form.controls.EventAlertMessage.value)),l(4),f(i.validationErrors&&i.validationErrors.EventAlertMessage&&i.form.controls.EventAlertMessage.untouched?312:-1),l(11),K(` 4308 `,y(324,92,"APP_SETTINGS.EVENT.LIMITING_DATES"),` 4309 `),l(21),p("tabindex",14)("showButtons",!0)("min",1)("max",12)("suffix",i.unit)("fluid",!0),l(25),p("hidden",i.form.controls.LimitingDateRange.valid||i.form.controls.LimitingDateRange.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.LimitingDateRange.errors!=null&&i.form.controls.LimitingDateRange.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.LimitingDateRange&&i.form.controls.LimitingDateRange.untouched?375:-1),l(13),f(i.hideLimitingDateConfigs?-1:388),l(12),f(i.hideLimitingDateConfigs?-1:400),l(),f(i.hideLimitingDateConfigs?-1:401),l(),f(i.hideLimitingDateConfigs?-1:402),l(),f(i.hideLimitingDateConfigs?-1:403),l(7),f(i.form.controls.EnableExternalRequestGroups.value?410:-1),l(),f(i.form.controls.EnableGuestEventRequestForm.value?411:-1),l(),f((s=i.form.controls.EnablePublicCalendar.value)!==null&&s!==void 0&&s?412:-1),l(),f(i.canCreateBlockingDates?413:-1),l(5),q("label",y(419,94,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(423,96,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}},dependencies:[Mt,Pe,Nt,Ot,Ft,oe,Ie,yt,Qe,_n,Jn,Jt,Ne,je,Cr,vr,Ae,se,ge,Le,mo,co,bi,ye,gi,Ni,fl,wt,me,kt,Te,De,it,et,ht,$,Oa,ie],styles:[".info-icon[_ngcontent-%COMP%]{display:block;margin-top:3px;
4309cursor:pointer}.info-text[_ngcontent-%COMP%]{font-size:var(--p-font-size-body2)}.action[_ngcontent-%COMP%]{width:58px}.copy-link[_ngcontent-%COMP%]{margin:.5rem 0}.subscription-card-container[_ngcontent-%COMP%]{margin:1.5rem}"]})}return r})();var Vp=He(Hn()),xo=He(nt());var Nl=class{static range(d,t){return o=>o.value&&(isNaN(o.value)||o.value<d||o.value>t)?{range:!0}:null}};var Yg=["fileup"],Qg=r=>({value:r}),Kg=()=>[];function $g(r,d){r&1&&(e(0,` 4310 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 4311 `))}function zg(r,d){if(r&1&&(e(0,` 4312 `),n(1,"small",45),e(2,` 4313 `),n(3,"div",20),e(4),a(),e(5,` 4314 `),a(),e(6,` 4315 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Xg(r,d){if(r&1&&(e(0,` 4316 `),G(1,zg,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().AuthTypes)}}function Zg(r,d){if(r&1&&(e(0,` 4317 `),n(1,"small",45),e(2,` 4318 `),n(3,"div",20),e(4),a(),e(5,` 4319 `),a(),e(6,` 4320 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Jg(r,d){if(r&1&&(e(0,` 4321 `),G(1,Zg,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().OpenIDProviderName)}}function eT(r,d){if(r&1&&(e(0,` 4322 `),n(1,"small",45),e(2,` 4323 `),n(3,"div",20),e(4),a(),e(5,` 4324 `),a(),e(6,` 4325 `)),r&2){let t=d.$implicit;l(4),v(t)}}function tT(r,d){if(r&1&&(e(0,` 4326 `),G(1,eT,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().OpenIDTenantID)}}function iT(r,d){if(r&1&&(e(0,` 4327 `),n(1,"small",45),e(2,` 4328 `),n(3,"div",20),e(4),a(),e(5,` 4329 `),a(),e(6,` 4330 `)),r&2){let t=d.$implicit;l(4),v(t)}}function nT(r,d){if(r&1&&(e(0,` 4331 `),G(1,iT,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().OpenIDClientID)}}function aT(r,d){if(r&1&&(e(0,` 4332 `),n(1,"div",17),e(2,` 4333 `),e(3,` 4334 `),n(4,"p-floatlabel"),e(5,` 4335 `),R(6,"input",46),e(7,` 4336 `),n(8,"label",47),e(9,` 4337 `),n(10,"span",20),e(11,"APP_SETTINGS.GENERAL.OPENID.PROVIDERNAME"),a(),e(12,` 4338 `),n(13,"span",21),e(14," *"),a(),e(15,` 4339 `),a(),e(16,` 4340 `),a(),e(17,` 4341 `),n(18,"small",22),e(19,` 4342 `),n(20,"div",48),e(21,` 4343 APP_SETTINGS.GENERAL.ERROR.OPENID.PROVIDERNAME_REQUIRED 4344 `),a(),e(22,` 4345 `),n(23,"div",24),e(24,` 4346 APP_SETTINGS.GENERAL.ERROR.OPENID.PROVIDERNAME_LENGTH 4347 `),a(),e(25,` 4348 `),a(),e(26,` 4349 `),_(27,Jg,3,0),a(),e(28,` 4350 `),n(29,"div",17),e(30,` 4351 `),e(31,` 4352 `),n(32,"p-floatlabel"),e(33,` 4353 `),R(34,"input",49),e(35,` 4354 `),n(36,"label",50),e(37,` 4355 `),n(38,"span",20),e(39,"APP_SETTINGS.GENERAL.OPENID.TENANTID"),a(),e(40,` 4356 `),n(41,"span",21),e(42," *"),a(),e(43,` 4357 `),a(),e(44,` 4358 `),a(),e(45,` 4359 `),n(46,"small",22),e(47,` 4360 `),n(48,"div",51),e(49,` 4361 APP_SETTINGS.GENERAL.ERROR.OPENID.TENANTID_REQUIRED 4362 `),a(),e(50,` 4363 `),n(51,"div",24),e(52,` 4364 APP_SETTINGS.GENERAL.ERROR.OPENID.TENANTID_LENGTH 4365 `),a(),e(53,` 4366 `),a(),e(54,` 4367 `),_(55,tT,3,0),a(),e(56,` 4368 `),n(57,"div",17),e(58,` 4369 `),e(59,` 4370 `),n(60,"p-floatlabel"),e(61,` 4371 `),R(62,"input",52),e(63,` 4372 `),n(64,"label",53),e(65,` 4373 `),n(66,"span",20),e(67,"APP_SETTINGS.GENERAL.OPENID.CLIENTID"),a(),e(68,` 4374 `),n(69,"span",21),e(70," *"),a(),e(71,` 4375 `),a(),e(72,` 4376 `),a(),e(73,` 4377 `),n(74,"small",22),e(75,` 4378 `),n(76,"div",54),e(77,` 4379 APP_SETTINGS.GENERAL.ERROR.OPENID.CLIENTID_REQUIRED 4380 `),a(),e(78,` 4381 `),n(79,"div",24),e(80,` 4382 APP_SETTINGS.GENERAL.ERROR.OPENID.CLIENTID_LENGTH 4383 `),a(),e(81,` 4384 `),a(),e(82,` 4385 `),_(83,nT,3,0),a(),e(84,` 4386 `)),r&2){let t=m(2);l(6),p("fluid",!0),l(12),p("hidden",t.generalForm.controls.OpenIDProviderName.valid||t.generalForm.controls.OpenIDProviderName.pristine&&!t.submitted()),l(2),p("hidden",!(t.generalForm.controls.OpenIDProviderName.errors!=null&&t.generalForm.controls.OpenIDProviderName.errors.required)),l(3),p("hidden",!(t.generalForm.controls.OpenIDProviderName.errors!=null&&t.generalForm.controls.OpenIDProviderName.errors.maxlength)),l(4),f(t.validationErrors()&&t.validationErrors().OpenIDProviderName&&t.generalForm.controls.OpenIDProviderName.untouched?27:-1),l(7),p("fluid",!0),l(12),p("hidden",t.generalForm.controls.OpenIDTenantID.valid||t.generalForm.controls.OpenIDTenantID.pristine&&!t.submitted()),l(2),p("hidden",!(t.generalForm.controls.OpenIDTenantID.errors!=null&&t.generalForm.controls.OpenIDTenantID.errors.required)),l(3),p("hidden",!(t.generalForm.controls.OpenIDTenantID.errors!=null&&t.generalForm.controls.OpenIDTenantID.errors.maxlength)),l(4),f(t.validationErrors()&&t.validationErrors().OpenIDTenantID&&t.generalForm.controls.OpenIDTenantID.untouched?55:-1),l(7),p("fluid",!0),l(12),p("hidden",t.generalForm.controls.OpenIDClientID.val
4386id||t.generalForm.controls.OpenIDClientID.pristine&&!t.submitted()),l(2),p("hidden",!(t.generalForm.controls.OpenIDClientID.errors!=null&&t.generalForm.controls.OpenIDClientID.errors.required)),l(3),p("hidden",!(t.generalForm.controls.OpenIDClientID.errors!=null&&t.generalForm.controls.OpenIDClientID.errors.maxlength)),l(4),f(t.validationErrors()&&t.validationErrors().OpenIDClientID&&t.generalForm.controls.OpenIDClientID.untouched?83:-1)}}function rT(r,d){r&1&&(e(0,` 4387 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 4388 `))}function oT(r,d){if(r&1&&(e(0,` 4389 `),n(1,"span"),e(2),a(),e(3,` 4390 `)),r&2){let t=d.$implicit;l(),Bt(t.styleClass),l(),v(t.label)}}function lT(r,d){if(r&1&&(e(0,` 4391 `),n(1,"small",45),e(2,` 4392 `),n(3,"div",20),e(4),a(),e(5,` 4393 `),a(),e(6,` 4394 `)),r&2){let t=d.$implicit;l(4),v(t)}}function sT(r,d){if(r&1&&(e(0,` 4395 `),G(1,lT,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().DefaultUserGroup)}}function dT(r,d){r&1&&(e(0,` 4396 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 4397 `))}function pT(r,d){r&1&&(e(0,` 4398 `),n(1,"span",44),e(2,"search"),a(),e(3,` 4399 `))}function mT(r,d){if(r&1&&(e(0,` 4400 `),n(1,"span"),e(2),a(),e(3,` 4401 `)),r&2){let t=d.$implicit;l(),Bt(t.styleClass),l(),v(t.label)}}function cT(r,d){if(r&1&&(e(0,` 4402 `),n(1,"small",45),e(2,` 4403 `),n(3,"div",20),e(4),a(),e(5,` 4404 `),a(),e(6,` 4405 `)),r&2){let t=d.$implicit;l(4),v(t)}}function uT(r,d){if(r&1&&(e(0,` 4406 `),G(1,cT,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().DefaultServiceAreas)}}function _T(r,d){if(r&1&&(e(0,` 4407 `),n(1,"small",45),e(2,` 4408 `),n(3,"div",20),e(4),a(),e(5,` 4409 `),a(),e(6,` 4410 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ET(r,d){if(r&1&&(e(0,` 4411 `),G(1,_T,7,1,null,null,J)),r&2){let t=m(3);l(),k(t.validationErrors().DefaultLocations)}}function ST(r,d){if(r&1){let t=b();e(0,` 4412 `),n(1,"div",17),e(2,` 4413 `),n(3,"qware-autocomplete",55),h("createNewItemChange",function(i){E(t);let s=m(2);return S(s.addNewDomain(i))})("isSearching",function(i){E(t);let s=m(2);return S(s.updateAddNewDomainText(i))}),e(4,` 4414 `),a(),e(5,` 4415 `),a(),e(6,` 4416 `),n(7,"div",17),e(8,` 4417 `),n(9,"p-floatlabel"),e(10,` 4418 `),n(11,"p-select",56),h("onChange",function(i){E(t);let s=m(2);return S(s.removeInactiveUserGroupOption(i))}),e(12,` 4419 `),_(13,rT,4,0,"ng-template",42),e(14,` 4420 `),_(15,oT,4,3,"ng-template",null,3,A),e(17,` 4421 `),a(),e(18,` 4422 `),n(19,"label",57),e(20,` 4423 `),n(21,"span",20),e(22,"APP_SETTINGS.GENERAL.DEFAULT_USER_GROUP"),a(),e(23,` 4424 `),n(24,"span",21),e(25," *"),a(),e(26,` 4425 `),a(),e(27,` 4426 `),a(),e(28,` 4427 `),_(29,sT,3,0),a(),e(30,` 4428 `),n(31,"div",17),e(32,` 4429 `),n(33,"p-floatlabel"),e(34,` 4430 `),n(35,"p-multiselect",58),h("onChange",function(i){E(t);let s=m(2);return S(s.removeInactiveServiceAreaOptions(i))}),e(36,` 4431 `),_(37,dT,4,0,"ng-template",null,4,A),e(39,` 4432 `),_(40,pT,4,0,"ng-template",null,5,A),e(42,` 4433 `),_(43,mT,4,3,"ng-template",null,3,A),e(45,` 4434 `),a(),e(46,` 4435 `),n(47,"label",59),e(48,` 4436 `),n(49,"span",20),e(50,"APP_SETTINGS.GENERAL.DEFAULT_SERVICE_AREAS"),a(),e(51,` 4437 `),a(),e(52,` 4438 `),a(),e(53,` 4439 `),_(54,uT,3,0),a(),e(55,` 4440 `),n(56,"div",17),e(57,` 4441 `),n(58,"qware-autocomplete",60),h("selectChange",function(i){E(t);let s=m(2);return S(s.locationsChanged(i))}),e(59,` 4442 `),a(),e(60,` 4443 `),_(61,ET,3,0),a(),e(62,` 4444 `)}if(r&2){let t,o=m(2);l(3),p("tabindex",5)("showEmptyMessage",!1)("dropdown",!1)("createNewItemText",o.addNewDomainTextWithName())("canAddNew",o.canAddNewDomain())("forceSelection",!1),l(8),p("tabindex",6)("id","qware.app-settings.general.dropdown.default-usergroup")("autoDisplayFirst",!1)("options",o.userGroupOptions())("fluid",!0),l(18),f(o.validationErrors()&&o.validationErrors().DefaultUserGroup&&o.generalForm.controls.DefaultUserGroup.untouched?29:-1),l(6),p("options",o.serviceAreaOptions())("maxSelectedLabels",o.serviceAreaOptions().length+1)("fluid",!0)("tabindex",7),l(19),f(o.validationErrors()&&o.validationErrors().DefaultServiceAreas&&o.generalForm.controls.DefaultServiceAreas.untouched?54:-1),l(4),p("enablePicker",!0)("nodeIds",o.selectableLocationIds())("tabindex",8)("allLocations",(t=o.allLocations())!==null&&t!==void 0?t:ne(24,Kg))("selectedOption",o.selectedLocationItems())("filterByUserAccess",!1),l(3),f(o.validationErrors()&&o.validationErrors().DefaultLocations&&o.generalForm.controls.DefaultLocations.untouched?61:-1)}}
4444function xT(r,d){if(r&1){let t=b();e(0,` 4445 `),n(1,"div",17),e(2,` 4446 `),n(3,"p-floatlabel"),e(4,` 4447 `),n(5,"p-select",41),h("onChange",function(i){E(t);let s=m();return S(s.authTypeChanged(i))}),e(6,` 4448 `),_(7,$g,4,0,"ng-template",42),e(8,` 4449 `),a(),e(9,` 4450 `),n(10,"label",43),e(11,` 4451 `),n(12,"span",20),e(13,"APP_SETTINGS.GENERAL.AUTH_TYPE"),a(),e(14,` 4452 `),n(15,"span",21),e(16," *"),a(),e(17,` 4453 `),a(),e(18,` 4454 `),a(),e(19,` 4455 `),_(20,Xg,3,0),a(),e(21,` 4456 `),_(22,aT,85,15)(23,ST,63,25)}if(r&2){let t=m();l(5),p("tabindex",1)("id","qware.app-settings.general.dropdown.auth-types")("autoDisplayFirst",!0)("options",t.authOptions())("fluid",!0),l(15),f(t.validationErrors()&&t.validationErrors().AuthTypes&&t.generalForm.controls.AuthTypes.untouched?20:-1),l(2),f(t.generalForm.controls.AuthTypes&&t.generalForm.controls.AuthTypes.value==="OPENID"?22:-1),l(),f(t.generalForm.controls.AuthTypes&&t.generalForm.controls.AuthTypes.value!=="INTERNAL"?23:-1)}}function fT(r,d){if(r&1&&(e(0,` 4457 `),n(1,"small",45),e(2,` 4458 `),n(3,"div",20),e(4),a(),e(5,` 4459 `),a(),e(6,` 4460 `)),r&2){let t=d.$implicit;l(4),v(t)}}function hT(r,d){if(r&1&&(e(0,` 4461 `),G(1,fT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().SendEmails)}}function CT(r,d){if(r&1&&(e(0,` 4462 `),n(1,"small",45),e(2,` 4463 `),n(3,"div",20),e(4),a(),e(5,` 4464 `),a(),e(6,` 4465 `)),r&2){let t=d.$implicit;l(4),v(t)}}function vT(r,d){if(r&1&&(e(0,` 4466 `),G(1,CT,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().SendSMS)}}function gT(r,d){if(r&1&&(e(0,` 4467 `),n(1,"div",14),e(2,` 4468 `),n(3,"label",61),e(4,"APP_SETTINGS.GENERAL.SEND_SMS"),a(),e(5,` 4469 `),n(6,"p-checkbox",62),e(7,` 4470 `),a(),e(8,` 4471 `),a(),e(9,` 4472 `),_(10,vT,3,0)),r&2){let t=m();l(6),p("tabindex",10)("binary",!0),l(4),f(t.validationErrors()&&t.validationErrors().SendSMS&&t.generalForm.controls.SendSMS.untouched?10:-1)}}function TT(r,d){if(r&1&&(e(0,` 4473 `),n(1,"small",45),e(2,` 4474 `),n(3,"div",20),e(4),a(),e(5,` 4475 `),a(),e(6,` 4476 `)),r&2){let t=d.$implicit;l(4),v(t)}}function IT(r,d){if(r&1&&(e(0,` 4477 `),G(1,TT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().CompanyName)}}function bT(r,d){if(r&1&&(e(0,` 4478 `),n(1,"small",45),e(2,` 4479 `),n(3,"div",20),e(4),a(),e(5,` 4480 `),a(),e(6,` 4481 `)),r&2){let t=d.$implicit;l(4),v(t)}}function yT(r,d){if(r&1&&(e(0,` 4482 `),G(1,bT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Timezone)}}function AT(r,d){if(r&1&&(e(0,` 4483 `),n(1,"small",45),e(2,` 4484 `),n(3,"div",20),e(4),a(),e(5,` 4485 `),a(),e(6,` 4486 `)),r&2){let t=d.$implicit;l(4),v(t)}}
4486function RT(r,d){if(r&1&&(e(0,` 4487 `),G(1,AT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().CurrencyType)}}function wT(r,d){r&1&&(e(0,` 4488 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 4489 `))}function DT(r,d){if(r&1&&(e(0,` 4490 `),n(1,"div",17),e(2,` 4491 `),n(3,"p-floatlabel"),e(4,` 4492 `),n(5,"p-select",63),e(6,` 4493 `),_(7,wT,4,0,"ng-template",42),e(8,` 4494 `),a(),e(9,` 4495 `),n(10,"label",64),e(11,` 4496 `),n(12,"span",20),e(13,"APP_SETTINGS.GENERAL.BARCODE_SCAN_TYPE"),a(),e(14,` 4497 `),n(15,"span",21),e(16," *"),a(),e(17,` 4498 `),a(),e(18,` 4499 `),a(),e(19,` 4500 `),a(),e(20,` 4501 `)),r&2){let t=m();l(5),p("tabindex",14)("id","qware.app-settings.general.dropdown.barcode-scan-type")("autoDisplayFirst",!0)("options",t.barcodeScanOptions())("fluid",!0)}}function LT(r,d){r&1&&(e(0,` 4502 `),n(1,"span",44),e(2,"expand_more"),a(),e(3,` 4503 `))}function NT(r,d){if(r&1&&(e(0,` 4504 `),n(1,"div",17),e(2,` 4505 `),n(3,"p-floatlabel"),e(4,` 4506 `),n(5,"p-select",65),e(6,` 4507 `),_(7,LT,4,0,"ng-template",42),e(8,` 4508 `),a(),e(9,` 4509 `),n(10,"label",66),e(11,` 4510 `),n(12,"span",20),e(13,"APP_SETTINGS.GENERAL.BARCODE_DISPLAY_TYPE"),a(),e(14,` 4511 `),n(15,"span",21),e(16," *"),a(),e(17,` 4512 `),a(),e(18,` 4513 `),a(),e(19,` 4514 `),a(),e(20,` 4515 `)),r&2){let t=m();l(5),p("tabindex",15)("id","qware.app-settings.general.dropdown.barcode-display-type")("autoDisplayFirst",!0)("options",t.barcodeDisplayOptions())("fluid",!0)}}function OT(r,d){if(r&1){let t=b();e(0,` 4516 `),n(1,"div",68),e(2,` 4517 `),R(3,"img",69),e(4,` 4518 `),n(5,"p-button",70),h("onClick",function(){E(t);let i=m(2);return S(i.fileRemove())}),e(6,` 4519 `),n(7,"i",44),e(8,"close"),a(),e(9,` 4520 `),a(),e(10,` 4521 `),a(),e(11,` 4522 `)}if(r&2){let t=m(2);l(3),p("src",t.customLogoURL(),jt),l(2),p("raised",!0)("rounded",!0)}}function FT(r,d){if(r&1){let t=b();e(0,` 4523 `),n(1,"div",73),e(2,` 4524 `),n(3,"div"),e(4,` 4525 `),R(5,"img",74),e(6,` 4526 `),a(),e(7,` 4527 `),n(8,"div",75),e(9),a(),e(10,` 4528 `),n(11,"div",76),e(12),I(13,"fileSize"),a(),e(14,` 4529 `),n(15,"div"),e(16,` 4530 `),n(17,"p-button",70),h("onClick",function(){E(t);let i=m(3);return S(i.fileRemove())}),e(18,` 4531 `),n(19,"i",44),e(20,"close"),a(),e(21,` 4532 `),a(),e(22,` 4533 `),a(),e(23,` 4534 `),a(),e(24,` 4535 `)}if(r&2){let t=d.$implicit;l(5),p("src",t.objectURL,jt)("width",50),l(4),v(t.name),l(3),v(y(13,6,t.size)),l(5),p("raised",!0)("rounded",!0)}}function MT(r,d){r&1&&(e(0,` 4536 `),n(1,"div",77),e(2,` 4537 `),n(3,"span",20),e(4,"SHARED.DRAG_N_DROP"),a(),e(5,` 4538 `),a(),e(6,` 4539 `))}function UT(r,d){if(r&1&&(e(0,` 4540 `),_(1,MT,7,0)),r&2){let t=d.$implicit;l(),f(t.length===0?1:-1)}}function PT(r,d){if(r&1){let t=b();e(0,` 4541 `),n(1,"p-fileUpload",71,6),h("onSelect",function(){E(t);let i=m(2);return S(i.fileAdd())})("onRemove",function(){E(t);let i=m(2);return S(i.fileRemove())})("uploadHandler",function(i){E(t);let s=m(2);return S(s.onFileUpload(i))}),e(3,` 4542 `),_(4,FT,25,8,"ng-template",72),e(5,` 4543 `),_(6,UT,2,1,"ng-template",null,7,A),e(8,` 4544 `),a(),e(9,` 4545 `)}if(r&2){let t=m(2);l(),q("chooseLabel",t.imageUploadLabel()),q("invalidFileTypeMessageSummary",t.errorUploadFileTypeTitle()),q("invalidFileTypeMessageDetail",t.errorUploadFileTypeDescription()),p("multiple",!1)("showUploadButton",!1)("showCancelButton",!1)("url",t.fileUploadDestinationURL())("withCredentials",!1)("customUpload",!0)("disabled",t.customLogoDisabled())}}function GT(r,d){if(r&1&&(e(0,` 4546 `),n(1,"div",17),e(2,` 4547 `),n(3,"label",67),e(4,` 4548 `),n(5,"span",20),e(6,"APP_SETTINGS.GENERAL.COMPANY_LOGO"),a(),e(7,` 4549 `),a(),e(8,` 4550 `),_(9,OT,12,3)(10,PT,10,10),a(),e(11,` 4551 `)),r&2){let t=m();l(9),f(t.customLogoURL()?9:10)}}function kT(r,d){if(r&1&&(e(0,` 4552 `),n(1,"small",45),e(2,` 4553 `),n(3,"div",20),e(4),a(),e(5,` 4554 `),a(),e(6,` 4555 `)),r&2){let t=d.$implicit;l(4),v(t)}}function VT(r,d){if(r&1&&(e(0,` 4556 `),G(1,kT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().SupportLink)}}function qT(r,d){r&1&&(e(0,` 4557 `),n(1,"span",78),e(2,` 4558 `),e(3,`
4559 `),R(4,"button",79),e(5,` 4560 `),R(6,"button",80),e(7,` 4561 `),R(8,"button",81),e(9,` 4562 `),a(),e(10,` 4563 `),n(11,"span",78),e(12,` 4564 `),e(13,` 4565 `),R(14,"button",82),e(15,` 4566 `),a(),e(16,` 4567 `),e(17,` 4568 `),n(18,"span",78),e(19,` 4569 `),R(20,"button",83),e(21,` 4570 `),a(),e(22,` 4571 `))}function BT(r,d){if(r&1&&(e(0,` 4572 `),n(1,"small",45),e(2,` 4573 `),n(3,"div",20),e(4),a(),e(5,` 4574 `),a(),e(6,` 4575 `)),r&2){let t=d.$implicit;l(4),v(t)}}function HT(r,d){if(r&1&&(e(0,` 4576 `),G(1,BT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().SupportMessage)}}function WT(r,d){r&1&&(e(0,` 4577 `),n(1,"span",78),e(2,` 4578 `),e(3,` 4579 `),n(4,"select",84),e(5,` 4580 `),R(6,"option",85),e(7,` 4581 `),e(8,` 4582 `),R(9,"option",86),e(10,` 4583 `),R(11,"option",87),e(12,` 4584 `),R(13,"option",88),e(14,` 4585 `),a(),e(15,` 4586 `),a(),e(16,` 4587 `),n(17,"span",78),e(18,` 4588 `),e(19,` 4589 `),R(20,"select",89),e(21,` 4590 `),R(22,"select",90),e(23,` 4591 `),a(),e(24,` 4592 `),n(25,"span",78),e(26,` 4593 `),e(27,` 4594 `),R(28,"button",79),e(29,` 4595 `),R(30,"button",80),e(31,` 4596 `),R(32,"button",81),e(33,` 4597 `),R(34,"button",91),e(35,` 4598 `),R(36,"button",92),e(37,` 4599 `),a(),e(38,` 4600 `),n(39,"span",78),e(40,` 4601 `),e(41,` 4602 `),R(42,"button",93),e(43,` 4603 `),R(44,"button",94),e(45,` 4604 `),R(46,"button",95),e(47,` 4605 `),R(48,"button",96),e(49,` 4606 `),a(),e(50,` 4607 `),n(51,"span",78),e(52,` 4608 `),e(53,` 4609 `),R(54,"button",82),e(55,` 4610 `),a(),e(56,` 4611 `),e(57,` 4612 `),n(58,"span",78),e(59,` 4613 `),R(60,"button",83),e(61,` 4614 `),a(),e(62,` 4615 `))}function jT(r,d){if(r&1&&(e(0,` 4616 `),n(1,"small",45),e(2,` 4617 `),n(3,"div",20),e(4),a(),e(5,` 4618 `),a(),e(6,` 4619 `)),r&2){let t=d.$implicit;l(4),v(t)}}function YT(r,d){if(r&1&&(e(0,` 4620 `),G(1,jT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().LoginMessage)}}function QT(r,d){if(r&1&&(e(0,` 4621 `),n(1,"small",45),e(2,` 4622 `),n(3,"div",20),e(4),a(),e(5,` 4623 `),a(),e(6,` 4624 `)),r&2){let t=d.$implicit;l(4),v(t)}}function KT(r,d){if(r&1&&(e(0,` 4625 `),G(1,QT,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().DaysPasswordExpires)}}var qp=(()=>{class r{appSettingsService;authService;documentService;fb;instanceDataService;locationService;responseService;route;router;serviceAreaService;tenantService;toastService;translate;userGroupService;fileup;editors;addNewDomainTextWithName=D("");allLocations=D(void 0);authOptions=D([]);barcodeDisplayOptions=D([]);barcodeScanOptions=D([]);barcodingDisabled=D(!0);canAddNewDomain=D(!1);currencyOptions=D(o0);customLogoDisabled=D(!0);customLogoURL=D("");displaySpinner=D(!0);errorUploadFileTypeDescription=D("");errorUploadFileTypeTitle=D("");fileUploadDestinationURL=D("");imageUploadLabel=D("");linkPlaceholder=D("");locationOptions=D([]);selectableLocationIds=D([]);selectedLocationItems=D([]);serviceAreaOptions=D([]);ssoDisabled=D(!0);submitted=D(!1);textareaFocused=D(!1);textMessagingDisabled=D(!0);timezoneOptions=D(Is);userGroupOptions=D([]);validationErrors=D(void 0);addNewDomainText="";generalForm;allServiceAreas;allUserGroups;appSettings;editorBlurListener;editorFocusListener;translations={};uploadObs;
4625uploadSubject=new pd;constructor(t,o,i,s,c,u,x,C,O,w,F,L,U,V){this.appSettingsService=t,this.authService=o,this.documentService=i,this.fb=s,this.instanceDataService=c,this.locationService=u,this.responseService=x,this.route=C,this.router=O,this.serviceAreaService=w,this.tenantService=F,this.toastService=L,this.translate=U,this.userGroupService=V,this.customLogoDisabled.set(!this.authService.qwareSubscription?.customLogo),this.barcodingDisabled.set(!this.authService.qwareSubscription?.barcoding),this.ssoDisabled.set(!this.authService.qwareSubscription?.sso),this.textMessagingDisabled.set(!this.authService.qwareSubscription?.textNotifications)}ngOnInit(){this.uploadObs=this.uploadSubject.asObservable(),this.fileUploadDestinationURL.set(this.documentService.DOCUMENTS_API_URL+"Upload"),this.generalForm=this.fb.group({AuthTypes:this.fb.control("",T.required),BarcodeDisplayType:this.fb.control(Ir.NONE),BarcodeScanType:this.fb.control(ao.NONE),CompanyName:this.fb.control("",[T.required,T.maxLength(re)]),CurrencyType:this.fb.control({label:"United States Dollars \u2013 USD",value:"USD"},T.required),DaysPasswordExpires:this.fb.control(null,[Nl.range(0,9999)]),DefaultLocations:this.fb.control(null),DefaultServiceAreas:this.fb.control(null),DefaultUserGroup:this.fb.control(null),DomainNames:this.fb.control([]),HasCustomLogoUrl:this.fb.control(!1),LoginMessage:this.fb.control("",T.maxLength(Kt)),OpenIDProviderName:this.fb.control(""),OpenIDClientID:this.fb.control(""),OpenIDTenantID:this.fb.control(""),SendEmails:this.fb.control(!0),SendSMS:this.fb.control(!1),SupportLink:this.fb.control(null),SupportMessage:this.fb.control(null),Timezone:this.fb.control(Is.find(t=>t.value===Vp.default.tz.guess())??null,T.required)}),ue([this.translate.get(["APP_SETTINGS.GENERAL.ERROR.UPLOAD_LOGO_INVALID_FILE_TYPE_DESCRIPTION","SHARED.ERROR.UPLOAD_INVALID_FILE_TYPE_TITLE","SHARED.UPLOAD_IMAGE","APP_SETTINGS.GENERAL.AUTH_TYPES.INTERNAL","APP_SETTINGS.GENERAL.AUTH_TYPES.GOOGLE","APP_SETTINGS.GENERAL.AUTH_TYPES.AZURE","APP_SETTINGS.GENERAL.BARCODES.NONE","APP_SETTINGS.GENERAL.BARCODES.ASSOCIATED_BARCODE","APP_SETTINGS.GENERAL.BARCODES.Q_CODE","APP_SETTINGS.GENERAL.BARCODES.BOTH_ASSOCIATED_Q_CODE","APP_SETTINGS.GENERAL.BARCODES.BARCODE_1D","APP_SETTINGS.GENERAL.BARCODES.BARCODE_2D","APP_SETTINGS.GENERAL.SUPPORT_LINK_EXAMPLE","APP_SETTINGS.GENERAL.AUTH_TYPES.OPENID","APP_SETTINGS.GENERAL.OPENID.PROVIDERNAME","APP_SETTINGS.GENERAL.OPENID.TENANTID","APP_SETTINGS.GENERAL.OPENID.CLIENTID","APP_SETTINGS.GENERAL.ADD_NEW_DOMAIN","SHARED.DELETED","SHARED.DISABLED"]).pipe(N()),this.appSettingsService.getAppSettingsForEdit()]).pipe(we(t=>{this.translations=t[0];let o=t[1];if(this.errorUploadFileTypeDescription.set(this.translations["APP_SETTINGS.GENERAL.ERROR.UPLOAD_LOGO_INVALID_FILE_TYPE_DESCRIPTION"]),this.errorUploadFileTypeTitle.set(this.translations["SHARED.ERROR.UPLOAD_INVALID_FILE_TYPE_TITLE"]),this.imageUploadLabel.set(this.translations["SHARED.UPLOAD_IMAGE"]),this.linkPlaceholder.set(this.translations["APP_SETTINGS.GENERAL.SUPPORT_LINK_EXAMPLE"]),this.addNewDomainText=this.translations["APP_SETTINGS.GENERAL.ADD_NEW_DOMAIN"],this.addNewDomainTextWithName.set(this.translations["APP_SETTINGS.GENERAL.ADD_NEW_DOMAIN"]),this.authOptions.set([{label:this.translations["APP_SETTINGS.GENERAL.AUTH_TYPES.INTERNAL"],value:"INTERNAL"},{label:this.translations["APP_SETTINGS.GENERAL.AUTH_TYPES.GOOGLE"],value:"GOOGLE"},{label:this.translations["APP_SETTINGS.GENERAL.AUTH_TYPES.AZURE"],value:"AZURE_AD"},{label:this.translations["APP_SETTINGS.GENERAL.AUTH_TYPES.OPENID"],value:"OPENID"}]),this.barcodeDisplayOptions.set([{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.NONE"],value:Ir.NONE},{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.ASSOCIATED_BARCODE"],value:Ir.ASSOCIATED},{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.Q_CODE"],value:Ir.Q_CODE},{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.BOTH_ASSOCIATED_Q_CODE"],value:Ir.BOTH}]),this.barcodeScanOptions.set([{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.NONE"],value:ao.NONE},{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.BARCODE_1D"],value:ao.BARCODE_1D},{label:this.translations["APP_SETTINGS.GENERAL.BARCODES.BARCODE_2D"],value:ao.QR_CODE}
4625]),o.CompanyName=this.authService.tenant.Name,this.appSettings=o,this.appSettings.HasCustomLogoUrl&&(this.customLogoURL.set(this.appSettings.CompanyLogo+"?t="+Date.now()),this.generalForm.get("HasCustomLogoUrl")?.setValue(!0)),this.appSettings.AuthTypes[0]===io.OPENID){let s=this.generalForm.get("OpenIDProviderName"),c=this.generalForm.get("OpenIDClientID"),u=this.generalForm.get("OpenIDTenantID");s?.setValidators([T.required,T.maxLength(re)]),c?.setValidators([T.required,T.maxLength(re)]),u?.setValidators([T.required,T.maxLength(re)]),s?.updateValueAndValidity(),c?.updateValueAndValidity(),u?.updateValueAndValidity()}let i=this.appSettings.AuthTypes[0]===io.INTERNAL||this.appSettings.AuthTypes.length===0;if(!i){let s=this.generalForm.get("DefaultUserGroup");s?.setValidators(T.required),s?.updateValueAndValidity()}return ue([i?Fe(void 0):this.userGroupService.getUserGroups(this.authService.tenant.Id),i?Fe(void 0):this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),i?Fe(void 0):this.locationService.getLocations(this.authService.tenant.Id)])})).subscribe({next:t=>{this.allUserGroups=t[0],this.allServiceAreas=t[1],this.allLocations.set(t[2]),(this.allUserGroups||this.allServiceAreas||this.allLocations())&&this.setDefaultOptions(),this.appSettings&&this.generalForm.patchValue(new Ln().toGeneralForm(this.appSettings)),this.generalForm.markAsPristine(),this.generalForm.markAsUntouched(),this.displaySpinner.set(!1)},error:t=>{console.log(t)}})}ngOnDestroy(){(this.editorBlurListener||this.editorFocusListener)&&this.editors&&this.editors.forEach(t=>{let o=t?.quill?.options.container.firstChild;o&&(this.editorBlurListener&&o.removeEventListener("blur",this.editorBlurListener),this.editorFocusListener&&o.removeEventListener("focus",this.editorFocusListener))}),this.uploadSubject.complete()}locationsChanged(t){if(t){let o=t.filter(i=>i.data?.id).map(i=>i.data.id);this.setDefaultLocations(o),this.generalForm.markAsDirty()}}setDefaultOptions(){let t=this.allUserGroups?.filter(i=>i.State===M.ACTIVE).map(i=>({label:i.Name,value:i.Id}))??[];if(this.appSettings?.DefaultTenantGroupId){let i=this.allUserGroups?.find(s=>s.Id===this.appSettings?.DefaultTenantGroupId);if(i&&i.State!==M.ACTIVE){let s=this.translations[i.State===M.DELETED?"SHARED.DELETED":"SHARED.DISABLED"];t.push({label:i.Name+" ("+s+")",value:i.Id,styleClass:"p-disabled"})}}let o=this.allServiceAreas?.filter(i=>i.State===M.ACTIVE).map(i=>({label:i.Name,value:i.Id}))??[];this.appSettings?.DefaultServiceAreaIds&&this.appSettings.DefaultServiceAreaIds.length>0&&this.appSettings.DefaultServiceAreaIds.forEach(i=>{let s=this.allServiceAreas?.find(c=>c.Id===i);if(s&&s.State!==M.ACTIVE){let c=this.translations[s.State===M.DELETED?"SHARED.DELETED":"SHARED.DISABLED"];o.push({label:s.Name+" ("+c+")",value:s.Id,styleClass:"p-disabled"})}}),this.selectableLocationIds.set((this.allLocations()??[]).filter(i=>i.Id).map(i=>i.Id)),this.appSettings?.DefaultLocationIds&&this.appSettings.DefaultLocationIds.length>0&&this.setDefaultLocations(this.appSettings.DefaultLocationIds),this.userGroupOptions.set(t),this.serviceAreaOptions.set(o)}setDefaultLocations(t){let o=[];this.generalForm.get("DefaultLocations")?.setValue(t),t.forEach(i=>{let s=(this.allLocations()??[]).find(c=>c.Id===i);if(s){let c=this.locationService.getLocationName(s,this.allLocations()),u;s.State!==M.ACTIVE&&(u=s.State===M.DELETED?this.translations["SHARED.DELETED"]:this.translations["SHARED.DISABLED"]);let x={label:c+(u?" ("+u+")":""),value:s.Id};o.push(x)}}),this.selectedLocationItems.set(xo.default.sortBy(xo.default.cloneDeep(o),i=>i.label?.toLowerCase()))}removeInactiveServiceAreaOptions(t){this.serviceAreaOptions.set(this.serviceAreaOptions().filter(o=>t.value.includes(o.value)||o.styleClass!=="p-disabled"))}removeInactiveUserGroupOption(t){this.userGroupOptions.set(this.userGroupOptions().filter(o=>t.value===o.value||o.styleClass!=="p-disabled"))}isDirty(){return this.generalForm.dirty&&!this.submitted()}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}onFileUpload(t){let o=new FormData;
4625t.files.forEach(i=>{o.append("Attachments",i,i.name)}),this.appSettingsService.uploadLogo(o).subscribe(i=>{i&&typeof i=="string"?this.uploadSubject.next(i):this.uploadSubject.next(void 0)})}fileUpload(){this.fileup&&this.fileup.files.length>0?this.fileup.upload():this.uploadSubject.next("")}fileAdd(){this.generalForm.get("HasCustomLogoUrl")?.setValue(!0),this.fileChange()}fileRemove(){this.generalForm.get("HasCustomLogoUrl")?.setValue(!1),this.customLogoURL.set(""),this.fileChange()}fileChange(){this.generalForm.markAsDirty(),this.generalForm.markAsTouched()}addNewDomain(t){let o=xo.default.clone(t);if(t?.includes("@")){let c=t.split("@");t=c[c.length-1]}let i=t?.split(".");if(!t||!t.includes(".")||i[i.length-1].length===0){this.translate.get(["SHARED.ERROR_LABEL","APP_SETTINGS.GENERAL.ERROR.DOMAIN_FORMATTING"],{domain:o}).pipe(N()).subscribe(c=>{this.toastService.error(c["SHARED.ERROR_LABEL"],c["APP_SETTINGS.GENERAL.ERROR.DOMAIN_FORMATTING"])});return}t=t.trim();let s=this.generalForm.get("DomainNames");if(s){let c=s.value?.map(u=>u.value);c=xo.default.uniq((c??[]).concat([t])).map(u=>({label:u,value:u})),s.setValue(c),s.markAsDirty(),this.canAddNewDomain.set(!1)}}updateAddNewDomainText(t){this.canAddNewDomain.set(t.query!==void 0&&t.query.length>0),this.addNewDomainTextWithName.set(this.addNewDomainText+(t.query&&t.query.length>0?": "+t.query:""))}authTypeChanged(t){let o=this.generalForm.get("OpenIDProviderName"),i=this.generalForm.get("OpenIDTenantID"),s=this.generalForm.get("OpenIDClientID"),c=this.generalForm.get("DefaultUserGroup");t.value===io.OPENID?(o?.setValidators([T.required,T.maxLength(re)]),i?.setValidators([T.required,T.maxLength(re)]),s?.setValidators([T.required,T.maxLength(re)])):(o?.clearValidators(),i?.clearValidators(),s?.clearValidators()),o?.updateValueAndValidity(),i?.updateValueAndValidity(),s?.updateValueAndValidity(),t.value!==io.INTERNAL?(c?.setValidators(T.required),this.displaySpinner.set(!0),ue([this.allUserGroups?Fe(this.allUserGroups):this.userGroupService.getUserGroups(this.authService.tenant.Id),this.allServiceAreas?Fe(this.allServiceAreas):this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.allLocations()?Fe(this.allLocations()):this.locationService.getLocations(this.authService.tenant.Id)]).subscribe(u=>{this.allUserGroups=u[0],this.allServiceAreas=u[1],this.allLocations.set(u[2]),this.setDefaultOptions(),this.displaySpinner.set(!1)})):c?.clearValidators(),c?.updateValueAndValidity()}save(){if(!this.submitted())if(this.generalForm.valid){this.submitted.set(!0),this.displaySpinner.set(!0);let t;this.appSettings&&(t=new Ln().parseGeneralForm(this.generalForm.value,this.appSettings),t.CompanyLogo=t?.HasCustomLogoUrl?this.instanceDataService.LOGO_CONTAINER_URL+this.authService.tenant.Id+"/logo.png":void 0),t&&(this.uploadObs?.pipe(N(),we(()=>this.appSettingsService.updateAppSettings(t)),we(()=>{if(t.CompanyName&&t.CompanyName!==this.authService.tenant.Name){let o=this.authService.tenant;return o.Name=t.CompanyName,this.authService.tenant=o,this.tenantService.updateTenant(this.authService.tenant)}return Fe("")})).subscribe({next:()=>{this.displaySpinner.set(!1),this.responseService.onSuccess("APP_SETTINGS.GENERAL.SUCCESS.SAVE","../",this.route)},error:o=>{this.submitted.set(!1),this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(o,this.generalForm))}}),this.fileUpload())}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}addEditorListeners(t){this.editorBlurListener||(this.editorBlurListener=()=>this.textareaFocused.set(!1)),this.editorFocusListener||(this.editorFocusListener=()=>this.textareaFocused.set(!0));let o=t.editor?.container.firstChild;o&&(o.addEventListener("blur",this.editorBlurListener),o.addEventListener("focus",this.editorFocusListener))}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(mn),g(be),g(Zn),g(zt),g(Re),g(he),g(Be),g(_i),g($i),g(Se),g(le),g(Tt))};
vendor: 5,573 bytes, line 4625
4625static \u0275cmp=B({type:r,selectors:[["qware-general-settings"]],viewQuery:function(o,i){if(o&1&&(X(Yg,5),X(Jt,5)),o&2){let s;Y(s=Q())&&(i.fileup=s.first),Y(s=Q())&&(i.editors=s)}},standalone:!1,decls:165,vars:49,consts:[["supportMessageEditor",""],["header",""],["loginMessageEditor",""],["item",""],["dropdownicon",""],["filtericon",""],["fileup",""],["content",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.page-header",1,"page-header"],["id","qware.app-settings.general.spinner",3,"displaySpinner"],[3,"formGroup"],[1,"col-12","field-container"],[1,"medium-input","flex-inline","flex-space-between"],["id","qware.app_settings.general.label.send-emails","translate",""],["id","qware.app-settings.general.checkbox.sendEmails","name","SendEmails","formControlName","SendEmails",3,"tabindex","binary"],[1,"medium-input"],["id","qware.app_settings.general.input.company-name","tabindex","11","type","text","pInputText","","name","CompanyName","formControlName","CompanyName","variant","filled",3,"fluid"],["id","qware.app_settings.general.label.company-name","for","qware.app_settings.general.input.company-name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.app_settings.general.error.company-name-req","translate","",3,"hidden"],["translate","",3,"hidden"],["elementId","qware.app-settings.general.dropdown.timezone","formControlName","Timezone","labelId","qware.app_settings.general.label.timezone","label","APP_SETTINGS.GENERAL.TIMEZONE","id","qware.app-settings.general.dropdown-e2e.timezone",3,"singleSelect","tabindex","isRequired","options"],["elementId","qware.app-settings.general.dropdown.currency-type","formControlName","CurrencyType","labelId","qware.app_settings.general.label.currency-type","label","APP_SETTINGS.GENERAL.CURRENCY_TYPE",3,"singleSelect","tabindex","isRequired","options"],["id","qware.app_settings.general.input.support-link","tabindex","16","type","text","pInputText","","name","SupportLink","formControlName","SupportLink","variant","filled",1,"p-filled",3,"placeholder","fluid"],["id","qware.app_settings.general.label.support-link","for","qware.app_settings.general.input.support-link"],["id","qware.status.label.support-message"],["id","qware.app_settings.general.supportMessage.editor","formControlName","SupportMessage",3,"onInit","onTextChange"],[1,"medium-input",3,"hidden"],["id","qware.status.label.body"],["id","qware.app_settings.general.loginMessage.editor","formControlName","LoginMessage",3,"onInit","onTextChange"],["translate","",3,"hidden","translateParams"],["tabindex","17","type","number","pInputText","","name","DaysPasswordExpires","formControlName","DaysPasswordExpires","id","qware.appsettings.general.passwordexpire.input.value","variant","filled",3,"fluid"],["id","qware.app_settings.general.label.password-expiry"],["id","qware.app-settings.general.error.days-password-expires-range","translate",""],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.general.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.general.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["formControlName","AuthTypes","variant","filled",3,"onChange","tabindex","id","autoDisplayFirst","options","fluid"],["pTemplate","dropdownicon"],["id","qware.app_settings.general.label.auth-types","for","qware.app-settings.general.dropdown.auth-types"],[1,"material-icons"],[1,"validation-error"],["id","qware.app_settings.general.input.provider-name-req","tabindex","2","type","text","pInputText","","name","OpenIDProviderName","formControlName","OpenIDProviderName","variant","filled",3,"fluid"],["id","qware.app_settings.general.label.provider-name-req","for","qware.app_settings.general.input.provider-name-req"],["id","qware.app_settings.general.error.provider-name-req","translate","",3,"hidden"],["id","qware.app_settings.general.input.OpenIDTenantID","tabindex","3","type","text","pInputText","","name","OpenIDTenantID","formControlName","OpenIDTenantID","variant","filled",3,"fluid"],["id","qware.app_settings.general.label.OpenIDTenantID","for","qware.app_settings.general.input.OpenIDTenantID"],["id","qware.app_settings.general.error.openid-tenant-id-req","translate","",3,"hidden"],["id","qware.app_settings.general.input.OpenIDClientID","tabindex","4","type","text","pInputText","","name","OpenIDClientID","formControlName","OpenIDClientID","variant","filled",3,"fluid"],["id","qware.app_settings.general.label.OpenIDClientID","for","qware.app_settings.general.input.OpenIDClientID"],["id","qware.app_settings.general.error.openid-client-id-req","translate","",3,"hidden"],["formControlName","DomainNames","labelId","qware.app-settings.general.label.domainNames","label","APP_SETTINGS.GENERAL.DOMAIN_NAMES","elementId","qware.app-settings.general.domainNames","id","qware.app-settings.general.dropdown-e2e.domains",3,"createNewItemChange","isSearching","tabindex","showEmptyMessage","dropdown","createNewItemText","canAddNew","forceSelection"],["formControlName","DefaultUserGroup","variant","filled",3,"onChange","tabindex","id","autoDisplayFirst","options","fluid"],["id","qware.app_settings.general.label.default-usergroup","for","qware.app-settings.general.dropdown.default-usergroup"],["id","qware.app_settings.general.label.default-service-areas","formControlName","DefaultServiceAreas","display","chip","variant","filled",3,"onChange","options","maxSelectedLabels","fluid","tabindex"],["
4625id","qware.app_settings.general.label.default-service-areas","for","qware.app_settings.general.label.default-service-areas"],["label","EVENT.SELECT_LOCATIONS","hierarchySelectionType","hierarchy","elementId","qware.app-settings.general.dropdown.default-locations","labelId","qware.app_settings.general.label.default-locations","id","qware.app-settings.general.dropdown.default-locations-e2e","label","APP_SETTINGS.GENERAL.DEFAULT_LOCATIONS",3,"selectChange","enablePicker","nodeIds","tabindex","allLocations","selectedOption","filterByUserAccess"],["id","qware.app_settings.general.label.send-sms","translate",""],["id","qware.app-settings.general.checkbox.sms","name","SendSMS","formControlName","SendSMS",3,"tabindex","binary"],["formControlName","BarcodeScanType","variant","filled",3,"tabindex","id","autoDisplayFirst","options","fluid"],["id","qware.app_settings.general.label.barcode-scan-types","for","qware.app-settings.general.dropdown.barcode-scan-type"],["formControlName","BarcodeDisplayType","variant","filled",3,"tabindex","id","autoDisplayFirst","options","fluid"],["id","qware.app_settings.general.label.barcode-display-types","for","qware.app-settings.general.dropdown.barcode-display-type"],["id","qware.app_settings.general.label.company-logo"],["id","qware.app_settings.general.image.company-logo",1,"flex-inline","align-left","custom-logo"],[3,"src"],["styleClass","icon-only-button-small",3,"onClick","raised","rounded"],["name","CompanyLogo","accept","image/*","id","qware.app_settings.general.upload.company-logo",3,"onSelect","onRemove","uploadHandler","multiple","showUploadButton","showCancelButton","chooseLabel","url","withCredentials","customUpload","disabled","invalidFileTypeMessageSummary","invalidFileTypeMessageDetail"],["pTemplate","file"],[1,"p-fileupload-row","full-width"],[3,"src","width"],[1,"file-upload-row-text",2,"max-width","500px"],[1,"file-upload-expanded-info"],[1,"drop-helper"],[1,"ql-formats"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],[1,"ql-link"],[1,"ql-clean"],[1,"ql-size"],["value","small"],["selected",""],["value","large"],["value","huge"],[1,"ql-color"],[1,"ql-background"],["value","sub",1,"ql-script"],["value","super",1,"ql-script"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),h("keydown.enter",function(){return E(s),S(i.textareaFocused()?void 0:i.save())}),e(1,` 4626 `),n(2,"div",9),e(3,` 4627 `),n(4,"h3",10),e(5,` 4628 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.GENERAL.GENERAL 4629 `),a(),e(9,` 4630 `),n(10,"p-card"),e(11,` 4631 `),n(12,"qware-spinner",11),e(13,` 4632 `),n(14,"div",12),e(15,` 4633 `),n(16,"div",13),e(17,` 4634 `),_(18,xT,24,8),n(19,"div",14),e(20,` 4635 `),n(21,"label",15),e(22,"APP_SETTINGS.GENERAL.SEND_EMAILS"),a(),e(23,` 4636 `),n(24,"p-checkbox",16),e(25,` 4637 `),a(),e(26,` 4638 `),a(),e(27,` 4639 `),_(28,hT,3,0)(29,gT,11,3),n(30,"div",17),e(31,` 4640 `),n(32,"p-floatlabel"),e(33,` 4641 `),R(34,"input",18),e(35,` 4642 `),n(36,"label",19),e(37,` 4643 `),n(38,"span",20),e(39,"APP_SETTINGS.GENERAL.COMPANY_NAME"),a(),e(40,` 4644 `),n(41,"span",21),e(42," *"),a(),e(43,` 4645 `),a(),e(44,` 4646 `),a(),e(45,` 4647 `),n(46,"small",22),e(47,` 4648 `),n(48,"div",23),e(49,` 4649 APP_SETTINGS.GENERAL.ERROR.COMPANY_NAME_REQUIRED 4650 `),a(),e(50,` 4651 `),n(51,"div",24),e(52,` 4652 APP_SETTINGS.GENERAL.ERROR.COMPANY_NAME_LENGTH 4653 `),a(),e(53,` 4654 `),a(),e(54,` 4655 `),_(55,IT,3,0),a(),e(56,` 4656 4657 `),n(57,"div",17),e(58,` 4658 `),n(59,"qware-autocomplete",25),e(60,` 4659 `),a(),e(61,` 4660 `),_(62,yT,3,0),a(),e(63,` 4661 4662 `),n(64,"div",17),e(65,` 4663 `),n(66,"qware-autocomplete",26),e(67,` 4664 `),a(),e(68,` 4665 `),_(69,RT,3,0),a(),e(70,` 4666 4667 `),_(71,DT,21,5)(72,NT,21,5)(73,GT,12,1),n(74,"div",17),e(75,` 4668 `),n(76,"p-floatlabel"),e(77,` 4669 `),R(78,"input",27),e(79,` 4670 `),n(80,"label",28),e(81,` 4671 `),n(82,"span",20),e(83,"APP_SETTINGS.GENERAL.SUPPORT_LINK_OVERRIDE"),a(),e(84,` 4672 `),a(),e(85,` 4673 `),a(),e(86,` 4674 `),_(87,VT,3,0),a(),e(88,` 4675 4676 `),n(89,"div",17),e(90,` 4677 `),n(91,"label",29),e(92,` 4678 `),n(93,"span",20),e(94,"APP_SETTINGS.GENERAL.SUPPORT_MESSAGE_OVERRIDE"),a(),e(95,` 4679 `),a(),e(96,` 4680 `),n(97,"p-editor",30,0),h("onInit",function(u){return E(s),S(i.addEditorListeners(u))})("onTextChange",function(){return E(s),S(i.textareaFocused.set(!0))}),e(99,` 4681 `),_(100,qT,23,0,"ng-template",null,1,A),e(102,` 4682 `),a(),e(103,` 4683 `),_(104,HT,3,0),a(),e(105,` 4684 4685 `),e(106,` 4686 `),n(107,"div",31),e(108,` 4687 `),n(109,"label",32),e(110,` 4688 `),n(111,"span",20),e(112,"APP_SETTINGS.GENERAL.LOGIN_MESSAGE"),a(),e(113,` 4689 `),a(),e(114,` 4690 `),n(115,"p-editor",33,2),h("onInit",function(u){return E(s),S(i.addEditorListeners(u))})("onTextChange",function(){return E(s),S(i.textareaFocused.set(!0))}),e(117,` 4691 `),_(118,WT,63,0,"ng-template",null,1,A),e(120,` 4692 `),a(),e(121,` 4693 `),n(122,"small",22),e(123,` 4694 `),n(124,"div",34),e(125,` 4695 APP_SETTINGS.GENERAL.ERROR.LOGIN_MESSAGE_LENGTH 4696 `),a(),e(126,` 4697 `),a(),e(127,` 4698 `),_(128,YT,3,0),a(),e(129,` 4699 4700 `),e(130,` 4701 `),n(131,"div",31),e(132,` 4702 `),R(133,"input",35),e(134,` 4703 `),n(135,"label",36),e(136,` 4704 `),n(137,"span",20),e(138,"APP_SETTINGS.GENERAL.PASSWORD_EXPIRY"),a(),e(139,` 4705 `),a(),e(140,` 4706 `),n(141,"small",22),e(142,` 4707 `),n(143,"div",37),e(144,` 4708 APP_SETTINGS.GENERAL.ERROR.PASSWORD_EXPIRY_RANGE 4709 `),a(),e(145,` 4710 `),a(),e(146,` 4711 `),_(147,KT,3,0),a(),e(148,` 4712 `),a(),e(149,` 4713 `),a(),e(150,` 4714 `),n(151,"div",38),e(152,` 4715 `),n(153,"p-button",39),I(154,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(155,` 4716 `),a(),e(156,` 4717 `),n(157,"p-button",40),I(158,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(159,` 4718 `),a(),e(160,` 4719 `),a(),e(161,` 4720 `),a(),e(162,` 4721 `),a(),e(163,` 4722 `),a(),e(164,` 4723`),a()}o&2&&(l(12),p("displaySpinner",i.displaySpinner()),l(2),p("formGroup",i.generalForm),l(4),f(i.ssoDisabled()?-1:18),l(6),p("tabindex",9)("binary",!0),l(4),f(i.validationErrors()&&i.validationErrors().SendEmail
4723s&&i.generalForm.controls.SendEmails.untouched?28:-1),l(),f(i.textMessagingDisabled()?-1:29),l(5),p("fluid",!0),l(12),p("hidden",i.generalForm.controls.CompanyName.valid||i.generalForm.controls.CompanyName.pristine&&!i.submitted()),l(2),p("hidden",!(i.generalForm.controls.CompanyName.errors!=null&&i.generalForm.controls.CompanyName.errors.required)),l(3),p("hidden",!(i.generalForm.controls.CompanyName.errors!=null&&i.generalForm.controls.CompanyName.errors.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().CompanyName&&i.generalForm.controls.CompanyName.untouched?55:-1),l(4),p("singleSelect",!0)("tabindex",12)("isRequired",!0)("options",i.timezoneOptions()),l(3),f(i.validationErrors()&&i.validationErrors().Timezone&&i.generalForm.controls.Timezone.untouched?62:-1),l(4),p("singleSelect",!0)("tabindex",13)("isRequired",!0)("options",i.currencyOptions()),l(3),f(i.validationErrors()&&i.validationErrors().CurrencyType&&i.generalForm.controls.CurrencyType.untouched?69:-1),l(2),f(i.barcodingDisabled()?-1:71),l(),f(i.barcodingDisabled()?-1:72),l(),f(i.customLogoDisabled()?-1:73),l(5),p("placeholder",i.linkPlaceholder())("fluid",!0),l(9),f(i.validationErrors()&&i.validationErrors().SupportLink&&i.generalForm.controls.SupportLink.untouched?87:-1),l(17),f(i.validationErrors()&&i.validationErrors().SupportMessage&&i.generalForm.controls.SupportMessage.untouched?104:-1),l(3),p("hidden",!0),l(15),p("hidden",i.generalForm.controls.LoginMessage.valid||i.generalForm.controls.LoginMessage.pristine&&!i.submitted()),l(2),p("hidden",!(i.generalForm.controls.LoginMessage.errors!=null&&i.generalForm.controls.LoginMessage.errors.maxlength))("translateParams",pe(47,Qg,i.generalForm.controls.LoginMessage.value)),l(4),f(i.validationErrors()&&i.validationErrors().LoginMessage&&i.generalForm.controls.LoginMessage.untouched?128:-1),l(3),p("hidden",!0),l(2),p("fluid",!0),l(8),p("hidden",i.generalForm.controls.DaysPasswordExpires.valid||i.generalForm.controls.DaysPasswordExpires.pristine&&!i.submitted()),l(6),f(i.validationErrors()&&i.validationErrors().DaysPasswordExpires&&i.generalForm.controls.DaysPasswordExpires.untouched?147:-1),l(6),q("label",y(154,43,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(158,45,"SHARED.SAVE")),p("text",!0)("disabled",!i.generalForm.valid||!i.generalForm.dirty))},dependencies:[Pe,oe,Ie,yt,Jt,gr,Ne,Cr,vr,Ae,Fd,se,ge,ye,Ni,wt,me,Te,De,it,$,Wo,ie],styles:[".custom-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:calc(100% - 35px);max-height:95px;margin-right:.5rem}"],changeDetection:0})}return r})();var Gn=He(nt());function zT(r,d){if(r&1&&(e(0,` 4724 `),n(1,"small",53),e(2,` 4725 `),n(3,"div",11),e(4),a(),e(5,` 4726 `),a(),e(6,` 4727 `)),r&2){let t=d.$implicit;l(4),v(t)}}function XT(r,d){if(r&1&&(e(0,` 4728 `),G(1,zT,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.HostedServiceLayerUrl)}}function ZT(r,d){r&1&&(e(0,` 4729 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4730 `))}function JT(r,d){if(r&1&&(e(0,` 4731 `),n(1,"small",53),e(2,` 4732 `),n(3,"div",11),e(4),a(),e(5,` 4733 `),a(),e(6,` 4734 `)),r&2){let t=d.$implicit;l(4),v(t)}}function e2(r,d){if(r&1&&(e(0,` 4735 `),G(1,JT,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultBaseMap)}}function t2(r,d){r&1&&(e(0,` 4736 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4737 `))}function i2(r,d){r&1&&(e(0,` 4738 `),n(1,"span",54),e(2,"search"),a(),e(3,` 4739 `))}function n2(r,d){if(r&1&&(e(0,` 4740 `),pa(),R(1,"path"),e(2,` 4741 `)),r&2){let t=d.$implicit;l(),Ve("d",t)}}function a2(r,d){if(r&1&&(e(0,` 4742 `),n(1,"div",55),e(2,` 4743 `),pa(),n(3,"svg",56),e(4,` 4744 `),G(5,n2,3,1,null,null,J),a(),e(7,` 4745 `),us(),n(8,"div"),e(9),a(),e(10,` 4746 `),a(),e(11,` 4747 `)),r&2){let t=d.$implicit,o=m(2);l(3),Ve("fill",o.form.controls.DefaultColor.value),l(2),k(t.value),l(4),v(t.label)}}
4747function r2(r,d){if(r&1&&(e(0,` 4748 `),pa(),R(1,"path"),e(2,` 4749 `)),r&2){let t=d.$implicit;l(),Ve("d",t)}}function o2(r,d){if(r&1&&(e(0,` 4750 `),n(1,"div",55),e(2,` 4751 `),pa(),n(3,"svg",56),e(4,` 4752 `),G(5,r2,3,1,null,null,J),a(),e(7,` 4753 `),us(),n(8,"div"),e(9),a(),e(10,` 4754 `),a(),e(11,` 4755 `)),r&2){let t=d.$implicit,o=m(2);l(3),Ve("fill",o.form.controls.DefaultColor.value),l(2),k(t.value),l(4),v(t.label)}}function l2(r,d){if(r&1&&(e(0,` 4756 `),n(1,"small",53),e(2,` 4757 `),n(3,"div",11),e(4),a(),e(5,` 4758 `),a(),e(6,` 4759 `)),r&2){let t=d.$implicit;l(4),v(t)}}function s2(r,d){if(r&1&&(e(0,` 4760 `),G(1,l2,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultMarker)}}function d2(r,d){if(r&1&&(e(0,` 4761 `),n(1,"small",53),e(2,` 4762 `),n(3,"div",11),e(4),a(),e(5,` 4763 `),a(),e(6,` 4764 `)),r&2){let t=d.$implicit;l(4),v(t)}}function p2(r,d){if(r&1&&(e(0,` 4765 `),G(1,d2,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultColor)}}function m2(r,d){r&1&&(e(0,` 4766 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4767 `))}function c2(r,d){if(r&1&&(e(0,` 4768 `),n(1,"small",53),e(2,` 4769 `),n(3,"div",11),e(4),a(),e(5,` 4770 `),a(),e(6,` 4771 `)),r&2){let t=d.$implicit;l(4),v(t)}}function u2(r,d){if(r&1&&(e(0,` 4772 `),G(1,c2,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultLengthUnit)}}function _2(r,d){r&1&&(e(0,` 4773 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4774 `))}function E2(r,d){if(r&1&&(e(0,` 4775 `),n(1,"small",53),e(2,` 4776 `),n(3,"div",11),e(4),a(),e(5,` 4777 `),a(),e(6,` 4778 `)),r&2){let t=d.$implicit;l(4),v(t)}}function S2(r,d){if(r&1&&(e(0,` 4779 `),G(1,E2,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.DefaultAreaUnit)}}function x2(r,d){r&1&&(e(0,` 4780 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4781 `))}function f2(r,d){r&1&&(e(0,` 4782 `),n(1,"span",54),e(2,"search"),a(),e(3,` 4783 `))}function h2(r,d){if(r&1&&(e(0,` 4784 `),n(1,"div"),e(2,` 4785 `),n(3,"div",57),e(4,` 4786 `),n(5,"div",58),e(6,` 4787 `),n(7,"i",59),e(8,"drag_handle"),a(),e(9,` 4788 `),a(),e(10,` 4789 `),n(11,"div",60),e(12,` 4790 `),n(13,"span"),e(14),a(),e(15,` 4791 `),a(),e(16,` 4792 `),a(),e(17,` 4793 `),a(),e(18,` 4794 `)),r&2){let t=d.$implicit;l(14),v(t.label)}}function C2(r,d){r&1&&(e(0,` 4795 `),n(1,"span",54),e(2,"expand_more"),a(),e(3,` 4796 `))}function v2(r,d){r&1&&(e(0,` 4797 `),n(1,"span",54),e(2,"search"),a(),e(3,` 4798 `))}function g2(r,d){if(r&1&&(e(0,` 4799 `),n(1,"div"),e(2,` 4800 `),n(3,"div",57),e(4,` 4801 `),n(5,"div",58),e(6,` 4802 `),n(7,"i",59),e(8,"drag_handle"),a(),e(9,` 4803 `),a(),e(10,` 4804 `),n(11,"div",60),e(12,` 4805 `),n(13,"span"),e(14),a(),e(15,` 4806 `),a(),e(16,` 4807 `),a(),e(17,` 4808 `),a(),e(18,` 4809 `)),r&2){let t=d.$implicit;l(14),v(t.label)}}function T2(r,d){if(r&1){let t=b();e(0,` 4810 `),n(1,"div",6),e(2,` 4811 `),n(3,"div",7),e(4,` 4812 `),n(5,"div",8),e(6,` 4813 `),n(7,"p-floatlabel"),e(8,` 4814 `),R(9,"input",9),e(10,` 4815 `),n(11,"label",10),e(12,` 4816 `),n(13,"span",11),e(14,"APP_SETTINGS.GIS.HOSTED_SERVICE_LAYER_URL"),a(),e(15,` 4817 `),n(16,"span",12),e(17," *"),a(),e(18,` 4818 `),a(),e(19,` 4819 `),a(),e(20,` 4820 `),n(21,"small",13),e(22,` 4821 `),n(23,"div",14),e(24,` 4822 APP_SETTINGS.GENERAL.ERROR.HOSTED_SERVICE_LAYER_URL_REQUIRED 4823 `),a(),e(25,` 4824 `),n(26,"div",15),e(27,` 4825 APP_SETTINGS.GENERAL.ERROR.HOSTED_SERVICE_LAYER_URL_LENGTH 4826 `),a(),e(28,` 4827 `),a(),e(29,` 4828 `),_(30,XT,3,0),a(),e(31,` 4829 `),n(32,"div",8),e(33,` 4830 `),n(34,"p-floatlabel"),e(35,` 4831 `),n(36,"p-select",16),e(37,` 4832 `),_(38,ZT,4,0,"ng-template",17),e(39,` 4833 `),a(),e(40,` 4834 `),n(41,"label",18),e(42,`
4835 `),n(43,"span",11),e(44,"APP_SETTINGS.GIS.DEFAULT_BASEMAP"),a(),e(45,` 4836 `),n(46,"span",12),e(47," *"),a(),e(48,` 4837 `),a(),e(49,` 4838 `),a(),e(50,` 4839 `),n(51,"small",13),e(52,` 4840 `),n(53,"div",19),e(54,` 4841 APP_SETTINGS.GENERAL.ERROR.DEFALT_BASEMAP_REQUIRED 4842 `),a(),e(55,` 4843 `),a(),e(56,` 4844 `),_(57,e2,3,0),a(),e(58,` 4845 `),n(59,"div",20),e(60,` 4846 `),n(61,"p-floatlabel"),e(62,` 4847 `),n(63,"p-select",21),e(64,` 4848 `),_(65,t2,4,0,"ng-template",17),e(66,` 4849 `),_(67,i2,4,0,"ng-template",null,0,A),e(69,` 4850 `),_(70,a2,12,2,"ng-template",22),e(71,` 4851 `),_(72,o2,12,2,"ng-template",23),e(73,` 4852 `),a(),e(74,` 4853 `),n(75,"label",24),e(76,` 4854 `),n(77,"span",11),e(78,"APP_SETTINGS.GIS.DEFAULT_MARKER"),a(),e(79,` 4855 `),n(80,"span",12),e(81," *"),a(),e(82,` 4856 `),a(),e(83,` 4857 `),a(),e(84,` 4858 `),n(85,"small",13),e(86,` 4859 `),n(87,"div",25),e(88,` 4860 APP_SETTINGS.GENERAL.ERROR.DEFALT_MARKER_REQUIRED 4861 `),a(),e(89,` 4862 `),a(),e(90,` 4863 `),_(91,s2,3,0),a(),e(92,` 4864 `),n(93,"div",26),e(94,` 4865 `),n(95,"label",27),e(96,` 4866 `),n(97,"span",11),e(98,"APP_SETTINGS.GIS.DEFAULT_COLOR"),a(),e(99,` 4867 `),n(100,"span",12),e(101," *"),a(),e(102,` 4868 `),a(),e(103,` 4869 `),n(104,"div",28),e(105,` 4870 `),R(106,"p-colorPicker",29),e(107,` 4871 `),R(108,"p-inputmask",30),e(109,` 4872 `),a(),e(110,` 4873 `),n(111,"small",13),e(112,` 4874 `),n(113,"div",31),e(114,` 4875 GIS.ERROR.DEFAULT_COLOR_REQUIRED 4876 `),a(),e(115,` 4877 `),a(),e(116,` 4878 `),_(117,p2,3,0),a(),e(118,` 4879 `),n(119,"div",8),e(120,` 4880 `),n(121,"p-floatlabel"),e(122,` 4881 `),n(123,"p-select",32),e(124,` 4882 `),_(125,m2,4,0,"ng-template",17),e(126,` 4883 `),a(),e(127,` 4884 `),n(128,"label",33),e(129,` 4885 `),n(130,"span",11),e(131,"APP_SETTINGS.GIS.DEFAULT_LENGTH_UNIT"),a(),e(132,` 4886 `),n(133,"span",12),e(134," *"),a(),e(135,` 4887 `),a(),e(136,` 4888 `),a(),e(137,` 4889 `),n(138,"small",13),e(139,` 4890 `),n(140,"div",34),e(141,` 4891 APP_SETTINGS.GENERAL.ERROR.DEFALT_LENGTH_UNIT_REQUIRED 4892 `),a(),e(142,` 4893 `),a(),e(143,` 4894 `),_(144,u2,3,0),a(),e(145,` 4895 `),n(146,"div",8),e(147,` 4896 `),n(148,"p-floatlabel"),e(149,` 4897 `),n(150,"p-select",35),e(151,` 4898 `),_(152,_2,4,0,"ng-template",17),e(153,` 4899 `),a(),e(154,` 4900 `),n(155,"label",36),e(156,` 4901 `),n(157,"span",11),e(158,"APP_SETTINGS.GIS.DEFAULT_AREA_UNIT"),a(),e(159,` 4902 `),n(160,"span",12),e(161," *"),a(),e(162,` 4903 `),a(),e(163,` 4904 `),a(),e(164,` 4905 `),n(165,"small",13),e(166,` 4906 `),n(167,"div",37),e(168,` 4907 APP_SETTINGS.GENERAL.ERROR.DEFALT_AREA_UNIT_REQUIRED 4908 `),a(),e(169,` 4909 `),a(),e(170,` 4910 `),_(171,S2,3,0),a(),e(172,` 4911 `),n(173,"div",38),e(174,` 4912 `),n(175,"label",11),e(176,"APP_SETTINGS.GIS.DEFAULT_SUB_LOCATIONS"),a(),e(177,` 4913 `),n(178,"p-checkbox",39),e(179,` 4914 `),a(),e(180,` 4915 `),a(),e(181,` 4916 `),n(182,"div",38),e(183,` 4917 `),n(184,"label",11),e(185,"APP_SETTINGS.GIS.DEFAULT_SUB_ASSETS"),a(),e(186,` 4918 `),n(187,"p-checkbox",40),e(188,` 4919 `),a(),e(189,` 4920 `),a(),e(190,` 4921 `),n(191,"div",20),e(192,` 4922 `),n(193,"p-floatlabel"),e(194,` 4923 `),n(195,"p-multiselect",41),h("ngModelChange",function(i){E(t);let s=m();return S(s.removeInactiveOptions(i))}),e(196,` 4924 `),_(197,x2,4,0,"ng-template",null,1,A),e(199,` 4925 `),_(200,f2,4,0,"ng-template",null,0,A),e(202,` 4926 `),a(),e(203,` 4927 `),n(204,"label",42),e(205,` 4928 `),n(206,"span",11),e(207,"APP_SETTINGS.GIS.ASSET_FIELDS"),a(),e(208,` 4929 `),n(209,"span",12),e(210," *"),a(),e(211,` 4930 `),a(),e(212,` 4931 `),a(),e(213,` 4932 `),a(),e(214,` 4933 `),n(215,"div",43),e(216,` 4934 `),n(217,"label",44),e(218,` 4935 `),n(219,"span",11),e(220,"APP_SETTINGS.GIS.ASSET_FIELDS_SORT_ORDER"),a(),e(221,` 4936 `),a(),e(222,` 4937 `),n(223,"div",45),h("dragulaModelChange",function(i){E(t);let s=m();return S(s.setOptions(i,"AssetFields"))}),e(224,` 4938 `),G(225,h2,19,1,null,null,J),a(),e(227,` 4939 `),a(),e(228,` 4940 `),n(229,"div",20),e(230,` 4941 `),n(231,"p-floatlabel"),e(232,` 4942 `),n(233,"p-multiselect",46),e(234,` 4943 `),_(235,C2,4,0,"ng-template",null,1,A),e(237,` 4944 `),_(238,v2,4,0,"ng-template",null,0,A),e(240,` 4945 `),a(),e(241,` 4946 `),n(242,"label",47),e(243,` 4947 `),n(244,"span",11),e(245,"APP_SETTINGS.GIS.LOCATION_FIELDS"),a(),e(246,` 4948 `),n(247,"span",12),e(248," *"),a(),e(249,` 4949 `),a(),e(250,` 4950 `),a(),e(251,` 4951 `),a(),e(252,` 4952 `),n(253,"div",43),e(254,` 4953 `),n(255,"label",48),e(256,` 4954 `),n(257,"span",11),e(258,"APP_SETTINGS.GIS.LOCATION_FIELDS_SORT_ORDER"),a(),e(259,` 4955 `),a(),e(260,` 4956 `),n(261,"div",49),h("dragulaModelChange",function(i){E(t);let s=m();return S(s.setOptions(i,"LocationFields"))}),e(262,` 4957 `),G(263,g2,19,1,null,null,J),a(),e(265,` 4958 `),a(),e(266,` 4959 `),a(),e(267,` 4960 `),a(),e(268,` 4961 `),n(269,"div",50),e(270,` 4962 `),n(271,"p-button",51),I(272,"translate"),h("onClick",function(){E(t);let i=m();return S(i.goBack())}),e(273,` 4963 `),a(),e(274,` 4964 `),n(275,"p-button",52),I(276,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(277,` 4965 `),a(),e(278,` 4966 `),a(),e(279,` 4967 `)}if(r&2){let t,o,i=m();l(),p("formGroup",i.form),l(8),p("fluid",!0),l(12),p("hidden",i.form.controls.HostedServiceLayer
4967Url.valid||i.form.controls.HostedServiceLayerUrl.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.HostedServiceLayerUrl.errors!=null&&i.form.controls.HostedServiceLayerUrl.errors.required)),l(3),p("hidden",!(i.form.controls.HostedServiceLayerUrl.errors!=null&&i.form.controls.HostedServiceLayerUrl.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.HostedServiceLayerUrl&&i.form.controls.HostedServiceLayerUrl.untouched?30:-1),l(6),p("options",i.baseMapOptions)("fluid",!0)("tabindex",1),l(15),p("hidden",i.form.controls.DefaultBaseMap.valid||i.form.controls.DefaultBaseMap.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.DefaultBaseMap.errors!=null&&i.form.controls.DefaultBaseMap.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.DefaultBaseMap&&i.form.controls.DefaultBaseMap.untouched?57:-1),l(6),p("options",i.markerOptions)("group",!0)("filter",!0)("virtualScroll",!0)("virtualScrollItemSize",42)("tabindex",2)("fluid",!0),l(22),p("hidden",i.form.controls.DefaultMarker.valid||i.form.controls.DefaultMarker.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.DefaultMarker.errors!=null&&i.form.controls.DefaultMarker.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.DefaultMarker&&i.form.controls.DefaultMarker.untouched?91:-1),l(20),p("hidden",i.form.controls.DefaultColor.valid||i.form.controls.DefaultColor.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.DefaultColor.errors!=null&&i.form.controls.DefaultColor.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.DefaultColor&&i.form.controls.DefaultColor.untouched?117:-1),l(6),p("options",i.lengthUnitOptions)("tabindex",4)("fluid",!0),l(15),p("hidden",i.form.controls.DefaultLengthUnit.valid||i.form.controls.DefaultLengthUnit.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.DefaultLengthUnit.errors!=null&&i.form.controls.DefaultLengthUnit.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.DefaultLengthUnit&&i.form.controls.DefaultLengthUnit.untouched?144:-1),l(6),p("options",i.areaUnitOptions)("tabindex",5)("fluid",!0),l(15),p("hidden",i.form.controls.DefaultAreaUnit.valid||i.form.controls.DefaultAreaUnit.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.DefaultAreaUnit.errors!=null&&i.form.controls.DefaultAreaUnit.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.DefaultAreaUnit&&i.form.controls.DefaultAreaUnit.untouched?171:-1),l(7),p("tabindex",6)("binary",!0),l(9),p("tabindex",7)("binary",!0),l(8),p("options",i.assetFieldOptions)("group",!0)("virtualScrollItemSize",39)("virtualScroll",!0)("resetFilterOnHide",!0)("selectionLimit",8)("showToggleAll",!1)("maxSelectedLabels",8)("tabindex",5)("fluid",!0),l(28),p("dragulaModel",(t=i.form.controls.AssetFields.value)!==null&&t!==void 0?t:void 0),l(2),k(i.form.controls.AssetFields.value),l(8),p("options",i.locationFieldOptions)("virtualScrollItemSize",39)("virtualScroll",!0)("resetFilterOnHide",!0)("selectionLimit",7)("showToggleAll",!1)("maxSelectedLabels",7)("tabindex",6)("fluid",!0),l(28),p("dragulaModel",(o=i.form.controls.LocationFields.value)!==null&&o!==void 0?o:void 0),l(2),k(i.form.controls.LocationFields.value),l(8),q("label",y(272,67,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(276,69,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}}var Bp=(()=>{class r{appSettingsService;authService;customFieldService;fb;responseService;route;router;toastService;translate;areaUnitOptions=[];assetFieldOptions=[];baseMapOptions=[];displaySpinner=!0;form;locationFieldOptions=[];lengthUnitOptions=[];markerOptions=[];submitted=!1;translations={};validationErrors;allCustomAssetFieldOptions=[];defaultColorSubscription;appSettings;constructor(t,o,i,s,c,u,x,C,O){this.appSettingsService=t,this.authService=o,this.customFieldService=i,this.fb=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O}ngOnInit(){ue([this.translate.get(["GIS.MAPS.IMG","GIS.MAPS.NAV","GIS.MAPS.NAV_NIGHT","GIS.MAPS.OPEN","GIS.MAPS.TOP","APP_SETTINGS.GIS.CUSTOM_FIELDS","APP_SETTINGS.GIS.STANDARD_FIELDS","ASSET.NAME","ASSET.CATEGORY","ASSET.MAKE","ASSET.MODEL","ASSET.SERIAL_NUMBER","ASSET.TAG_NAME","ASSET.BARCODE","ASSET.VENDOR","ASSET.LOCATION","ASSET.ASSIGNED_TO","ASSET.PURCHASE_PRICE","ASSET.PURCHASE_DATE","ASSET.RETIRE_DATE","ASSET.DESCRIPTION","ASSET.NOTES","ASSET.STATE","LOCATION.ADDRESS","LOCATION.CAPACITY","LOCATION.DESCRIPTION","LOCATION.NAME","LOCATION.LOCATION_TYPE","LOCATION.SQUARE_FOOTAGE","LOCATION.STATE","GIS.UNITS.FT","GIS.UNITS.FT2","GIS.UNITS.M","GIS.UNITS.M2","GIS.UNITS.YD","GIS.UNITS.YD2","GIS.UNITS.KM","GIS.UNITS.KM2","GIS.UNITS.MI","GIS.UNITS.MI2"]).pipe(N()),this.appSett
4967ingsService.getAppSettings().pipe(N()),this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id)]).subscribe(t=>{this.translations=t[0],this.appSettings=t[1];let o=t[2];this.baseMapOptions=[{label:this.translations["GIS.MAPS.IMG"],value:"ArcGIS:Imagery"},{label:this.translations["GIS.MAPS.NAV"],value:"ArcGIS:Navigation"},{label:this.translations["GIS.MAPS.NAV_NIGHT"],value:"ArcGIS:NavigationNight"},{label:this.translations["GIS.MAPS.OPEN"],value:"OSM:Standard"},{label:this.translations["GIS.MAPS.TOP"],value:"ArcGIS:Topographic"}],Gn.default.keys(As.icons).map(x=>{let C=As.icons[x],O={label:x,value:Gn.default.isArray(C[21])?C[21].map(F=>F.d):[C[21]]},w=this.markerOptions.find(F=>F.label===C.category);w?w.items=Gn.default.sortBy(Gn.default.concat(w.items,[O]),F=>F.label?.toLowerCase()):this.markerOptions=Gn.default.sortBy(Gn.default.concat(this.markerOptions,[{label:C.category,value:C.category,items:[O]}]),F=>F.label.toLowerCase())}),this.lengthUnitOptions=[{label:this.translations["GIS.UNITS.FT"],value:"ft"},{label:this.translations["GIS.UNITS.YD"],value:"yd"},{label:this.translations["GIS.UNITS.M"],value:"m"},{label:this.translations["GIS.UNITS.KM"],value:"km"},{label:this.translations["GIS.UNITS.MI"],value:"mi"}],this.areaUnitOptions=[{label:this.translations["GIS.UNITS.FT2"],value:"ft"},{label:this.translations["GIS.UNITS.YD2"],value:"yd"},{label:this.translations["GIS.UNITS.M2"],value:"m"},{label:this.translations["GIS.UNITS.KM2"],value:"km"},{label:this.translations["GIS.UNITS.MI2"],value:"mi"}];let i=[{label:this.translations["ASSET.ASSIGNED_TO"],value:"AssignedToUserIds"},{label:this.translations["ASSET.BARCODE"],value:"Barcode"},{label:this.translations["ASSET.CATEGORY"],value:"Category"},{label:this.translations["ASSET.DESCRIPTION"],value:"Description"},{label:this.translations["ASSET.LOCATION"],value:"Location"},{label:this.translations["ASSET.MAKE"],value:"Make"},{label:this.translations["ASSET.MODEL"],value:"Model"},{label:this.translations["ASSET.NAME"],value:"Name"},{label:this.translations["ASSET.NOTES"],value:"Notes"},{label:this.translations["ASSET.PURCHASE_DATE"],value:"PurchaseDateUTC"},{label:this.translations["ASSET.PURCHASE_PRICE"],value:"PurchasePrice"},{label:this.translations["ASSET.RETIRE_DATE"],value:"RetireDateUTC"},{label:this.translations["ASSET.SERIAL_NUMBER"],value:"SerialNumber"},{label:this.translations["ASSET.STATE"],value:"State"},{label:this.translations["ASSET.TAG_NAME"],value:"TagName"},{label:this.translations["ASSET.VENDOR"],value:"Vendor"}],s=[];if(this.appSettings.GisAssetFields){let x=JSON.parse(this.appSettings.GisAssetFields);x&&x.length>0&&(s=x)}let c=s.map(x=>x.label);this.allCustomAssetFieldOptions=Gn.default.sortBy(Gn.default.uniqBy(Gn.default.flatten(o.filter(x=>x.Type==="ASSETS").map(x=>(x.Fields??[]).filter(C=>(C.State===M.ACTIVE||c.includes(C.Name))&&C.Type!=="FILE"))),"ParentId"),x=>(x.Name??"").toLowerCase()).map(x=>({label:x.Name+(x.State!==M.ACTIVE?" ("+x.State+")":""),value:x.Name})),this.assetFieldOptions=[{label:this.translations["APP_SETTINGS.GIS.STANDARD_FIELDS"],value:this.translations["APP_SETTINGS.GIS.STANDARD_FIELDS"],items:i},{label:this.translations["APP_SETTINGS.GIS.CUSTOM_FIELDS"],value:this.translations["APP_SETTINGS.GIS.CUSTOM_FIELDS"],items:this.allCustomAssetFieldOptions}],this.locationFieldOptions=[{label:this.translations["LOCATION.ADDRESS"],value:"Address"},{label:this.translations["LOCATION.CAPACITY"],value:"Capacity"},{label:this.translations["LOCATION.DESCRIPTION"],value:"Description"},{label:this.translations["LOCATION.NAME"],value:"Name"},{label:this.translations["LOCATION.LOCATION_TYPE"],value:"LocationType"},{label:this.translations["LOCATION.SQUARE_FOOTAGE"],value:"SquareFootage"},{label:this.translations["LOCATION.STATE"],value:"State"}];let u=[];if(this.appSettings.GisLocationFields){let x=JSON.parse(this.appSettings.GisLocationFields);x&&x.length>0&&(u=x)}this.form=this.fb.group({HostedServiceLayerUrl:this.fb.control({value:this.appSettings.GisHostedServiceLayerUrl??null,disabled:!0},[T.required,T.maxLength(re)]),DefaultBaseMap:this.fb.control(this.appSett
4967ings.GisDefaultBaseMap??null,T.required),DefaultMarker:this.fb.control(this.appSettings.GisDefaultMarker??null,T.required),DefaultColor:this.fb.control(this.appSettings.GisDefaultColor??null,T.required),DefaultLengthUnit:this.fb.control(this.appSettings.GisDefaultLengthUnit??null,T.required),DefaultAreaUnit:this.fb.control(this.appSettings.GisDefaultAreaUnit??null,T.required),DefaultIncludeSubLocations:this.fb.control(this.appSettings.GisDefaultIncludeSubLocations??!1),DefaultIncludeSubAssets:this.fb.control(this.appSettings.GisDefaultIncludeSubAssets??!1),AssetFields:this.fb.control(s??[],T.required),LocationFields:this.fb.control(u??[],T.required)}),this.defaultColorSubscription=this.form.get("DefaultColor")?.valueChanges.subscribe(x=>{this.form.get("DefaultColor")?.setValue(x,{onlySelf:!0,emitEvent:!1,emitModelToViewChange:!0})}),this.displaySpinner=!1})}ngOnDestroy(){this.defaultColorSubscription&&!this.defaultColorSubscription.closed&&this.defaultColorSubscription.unsubscribe()}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}setOptions(t,o){let i=this.form.get(o);i&&(i.setValue(t),i.markAsTouched(),i.markAsDirty())}save(){if(!this.submitted)if(this.form.valid&&this.appSettings){this.submitted=!0,this.displaySpinner=!0;let t=this.form.value,o=Gn.default.cloneDeep(this.appSettings);o.GisDefaultBasemap=t.DefaultBaseMap??void 0,o.GisDefaultMarker=t.DefaultMarker??void 0,o.GisDefaultColor=t.DefaultColor??void 0,o.GisDefaultLengthUnit=t.DefaultLengthUnit??void 0,o.GisDefaultAreaUnit=t.DefaultAreaUnit??void 0,o.GisDefaultIncludeSubLocations=t.DefaultIncludeSubLocations??!1,o.GisDefaultIncludeSubAssets=t.DefaultIncludeSubAssets??!1,o.GisAssetFields=JSON.stringify(t.AssetFields??[]),o.GisLocationFields=JSON.stringify(t.LocationFields??[]),this.appSettingsService.updateAppSettings(o).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("APP_SETTINGS.GIS.SUCCESS.SAVE","../",this.route)},error:i=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}removeInactiveOptions(t){let o=Gn.default.cloneDeep(this.assetFieldOptions);o[1].items=this.allCustomAssetFieldOptions.filter(i=>i.label&&(!i.label.includes(M.DELETED)&&!i.label.includes(M.DISABLED)||t.includes(i))),this.assetFieldOptions=o}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g($t),g(be),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-gis-settings"]],decls:19,vars:2,consts:[["filtericon",""],["dropdownicon",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.page-header",1,"page-header"],["id","qware.app-settings.gis.spinner",3,"displaySpinner"],[3,"formGroup"],[1,"col-12","field-container"],[1,"medium-input"],["id","qware.app_settings.gis.input.hosted-service-layer-url","tabindex","0","type","text","pInputText","","name","HostedServiceLayerUrl","formControlName","HostedServiceLayerUrl","variant","filled",3,"fluid"],["id","qware.app_settings.gis.label.hosted-service-layer-url","for","qware.app_settings.gis.input.hosted-service-layer-url"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.app_settings.gis.error.hosted-service-layer-url-req","translate","",3,"hidden"],["translate","",3,"hidden"],["formControlName","DefaultBaseMap","variant","filled","inputId","qware.app_settings.gis.input.default-basemap",3,"options","fluid","tabindex"],["pTemplate","dropdownicon"],["id","qware.app_settings.gis.label.default-basemap","for","qware.app_settings.gis.input.default-basemap"],["id","qware.app_settings.gis.error.default-basemap-req","translate","",3,"hidden"],[1,"medium-input",2,"margin-bottom","0.5rem"],["formControlName","DefaultMarker","filterBy","label","styleClass","marker-dropdown","variant","filled","optionLabel","label","optionValue","label",3,"options","group","filter","virtualScroll","virtualScrollItemSize","tabindex","fluid"],["pTemplate","selectedItem"],["pTemplate","item"],["id","qware.app_settings.gis.label.default-marker","for","qware.app_settings.gis.input.default-marker"],["id","qware.app_settings.gis.error.default-marker-req","translate","",3,"hidden"],[1,"medium-input",2,"margin-top","0.5rem"],[1,"standalone-label"],[1,"app-setting-color-picker"],["formControlName","DefaultColor","appendTo","body"],["formControlName","DefaultColor","styleClass","hex-input","slotChar","#000000","mask","#***?***","tabindex","3"],["id","qware.gis.feature-edit.error.default-color-req","translate","",3,"hidden"],["formControlName","DefaultLengthUnit","inputId","qware.app_settings.gis.input.default-length","variant","filled",3,"options","tabindex","fluid"],["id","qware.app_settings.gis.label.default-length","for","qware.app_settings.gis.input.default-length"],["id","qware.app_settings.gis.error.default-length-req","translate","",3,"hidden"],["formControlName","DefaultAreaUnit","inputId","qware.app_settings.gis.input.default-area","variant","filled",3,"options","tabindex","fluid"],["id","qware.app_settings.gis.label.default-area","for","qware.app_settings.gis.input.default-area"],["id","qware.app_settings.gis.error.default-area-req","translate","",3,"hidden"],[1,"medium-input","flex-inline","flex-space-between"],["id","qware.app_settings.gis.input.default-sub-locations","name","DefaultIncludeSubLocations","formControlName","DefaultIncludeSubLocations",3,"tabindex","binary"],["id","qware.app_settings.gis.input.default-sub-assets","name","DefaultIncludeSubAssets","formControlName","DefaultIncludeSubAssets",3,"tabindex","binary"],["formControlName","AssetFields","inputId","qware.app_settings.gis.input.asset-fields","optionLabel","label","dataKey","value","display","chip","variant","filled",3,"ngModelChange","options","group","virtualScrollItemSize","virtualScroll","resetFilterOnHide","selectionLimit","showToggleAll","maxSelectedLabels","tabindex","fluid"],["id","qware.app_settings.gis.label.asset-fields","for","qware.app_settings.gis.input.asset-fields"],[1,"draggable-container"],["id","qware.app-settings.gis.label.asset-field-sort",1,"standalone-label"],["dragula","ASSETFIELDOPTIONS",3,"dragulaModelChange","dragulaModel"],["formControlName","LocationFields","inputId","qware.app_settings.gis.input.location-fields","optionLabel","label","display","chip","variant","filled",3,"options","virtualScrollItemSize","virtualScroll","resetFilterOnHide","selectionLimit","showToggleAll","maxSelectedLabels","tabindex","fluid"],["id","qware.app_settings.gis.label.location-fields","for","qware.app_settings.gis.input.location-fields"],["id","qware.app-settings.gis.label.location-field-sort",1,"standalone-label"],["dragula","LOCATIONFIELDOPTIONS",3,"dragulaModelChange","dragulaModel"],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.gis.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.gis.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"validation-error"],[1,"material-icons"],[1,"app-setting-marker-option"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 21 21"],[1,"field-option"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"field-name"]],template:function(o,i){o&1&&(n(0,"div",2),h("keydown.enter",function(){return i.save()}),e(1,` 4968 `),n(2,"div",3),e(3,`
4969 `),n(4,"h3",4),e(5,` 4970 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.GIS.GIS 4971 `),a(),e(9,` 4972 `),n(10,"p-card"),e(11,` 4973 `),n(12,"qware-spinner",5),e(13,` 4974 `),_(14,T2,280,71),a(),e(15,` 4975 `),a(),e(16,` 4976 `),a(),e(17,` 4977`),a(),e(18,` 4978`)),o&2&&(l(12),p("displaySpinner",i.displaySpinner),l(2),f(i.form?14:-1))},dependencies:[vi,oe,Pe,Mn,Ie,Na,yt,xl,Sl,Ho,pn,Ii,Ne,ul,Un,Hi,ye,Dr,Ni,Wa,me,Rn,Ae,se,ge,Te,De,ea,it,Qt,ie,$],styles:[`qware-gis-settings .form-container .app-settings-card .field-container{padding:1.125em 1.5em}qware-gis-settings .draggable-container{margin:0 1rem 2rem}qware-gis-settings .draggable-container .field-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}qware-gis-settings .app-setting-marker-option{display:flex;align-items:center}qware-gis-settings .app-setting-marker-option>svg{margin-right:.5rem;flex:0 0 auto;width:21px;height:21px}qware-gis-settings .app-setting-color-picker{display:flex}qware-gis-settings .app-setting-color-picker .hex-input{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;width:100px}body>.gu-mirror .field-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)} 4979`],encapsulation:2})}return r})();var rn=He(nt());var I2=["bodyDropdown"],b2=["subjectDropdown"],y2=["unitInput"],A2=()=>["0"],Hp=r=>({value:r}),Xa=()=>({standalone:!0});function R2(r,d){r&1&&(e(0,` 4980 `),n(1,"i",55),e(2,"expand_less"),a(),e(3,` 4981 `))}function w2(r,d){r&1&&(e(0,` 4982 `),n(1,"i",55),e(2,"expand_more"),a(),e(3,` 4983 `))}function D2(r,d){if(r&1&&(e(0,` 4984 `),_(1,R2,4,0)(2,w2,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function L2(r,d){r&1&&(e(0,` 4985 `),n(1,"span",55),e(2,"expand_more"),a(),e(3,` 4986 `))}function N2(r,d){r&1&&(e(0,` 4987 `),n(1,"span",55),e(2,"search"),a(),e(3,` 4988 `))}function O2(r,d){if(r&1){let t=b();e(0,` 4989 `),n(1,"span",56),e(2,` 4990 `),n(3,"p-select",57,6),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.selectChanged("subject"))}),e(6,` 4991 `),_(7,L2,4,0,"ng-template",58),e(8,` 4992 `),_(9,N2,4,0,"ng-template",59),e(10,` 4993 `),a(),e(11,` 4994 `),a(),e(12,` 4995 `)}if(r&2){let t=m();l(3),q("placeholder",y(5,6,"MERGE_FIELDS.SELECT")),p("options",t.threshholdSubjectFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(8,Xa))("fluid",!0)("filter",!0)}}function F2(r,d){if(r&1&&(e(0,` 4996 `),n(1,"small",60),e(2,` 4997 `),n(3,"div",21),e(4),a(),e(5,` 4998 `),a(),e(6,` 4999 `)),r&2){let t=d.$implicit;l(4),v(t)}}function M2(r,d){if(r&1&&(e(0,` 5000 `),G(1,F2,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Subject)}}function U2(r,d){r&1&&(e(0,` 5001 `),n(1,"span",55),e(2,"expand_more"),a(),e(3,` 5002 `))}function P2(r,d){r&1&&(e(0,` 5003 `),n(1,"span",55),e(2,"search"),a(),e(3,` 5004 `))}
5004function G2(r,d){if(r&1){let t=b();e(0,` 5005 `),n(1,"span",61),e(2,` 5006 `),e(3,` 5007 `),R(4,"select",62),e(5,` 5008 `),R(6,"select",63),e(7,` 5009 `),a(),e(8,` 5010 `),n(9,"span",61),e(10,` 5011 `),e(11,` 5012 `),R(12,"button",64),e(13,` 5013 `),R(14,"button",65),e(15,` 5014 `),R(16,"button",66),e(17,` 5015 `),a(),e(18,` 5016 `),n(19,"span",61),e(20,` 5017 `),e(21,` 5018 `),R(22,"button",67),e(23,` 5019 `),R(24,"button",68),e(25,` 5020 `),R(26,"button",69),e(27,` 5021 `),R(28,"button",70),e(29,` 5022 `),a(),e(30,` 5023 `),n(31,"span",61),e(32,` 5024 `),e(33,` 5025 `),R(34,"button",71),e(35,` 5026 `),a(),e(36,` 5027 `),e(37,` 5028 `),n(38,"span",61),e(39,` 5029 `),R(40,"button",72),e(41,` 5030 `),a(),e(42,` 5031 `),n(43,"span",56),e(44,` 5032 `),n(45,"p-select",73,7),I(47,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.selectChanged("body"))}),e(48,` 5033 `),_(49,U2,4,0,"ng-template",58),e(50,` 5034 `),_(51,P2,4,0,"ng-template",59),e(52,` 5035 `),a(),e(53,` 5036 `),a(),e(54,` 5037 `)}if(r&2){let t=m();l(45),q("placeholder",y(47,6,"MERGE_FIELDS.SELECT")),p("options",t.threshholdBodyFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(8,Xa))("fluid",!0)("filter",!0)}}function k2(r,d){if(r&1&&(e(0,` 5038 `),n(1,"small",60),e(2,` 5039 `),n(3,"div",21),e(4),a(),e(5,` 5040 `),a(),e(6,` 5041 `)),r&2){let t=d.$implicit;l(4),v(t)}}function V2(r,d){if(r&1&&(e(0,` 5042 `),G(1,k2,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.ReorderThreshholdBody)}}function q2(r,d){r&1&&(e(0,` 5043 `),n(1,"i",55),e(2,"expand_less"),a(),e(3,` 5044 `))}function B2(r,d){r&1&&(e(0,` 5045 `),n(1,"i",55),e(2,"expand_more"),a(),e(3,` 5046 `))}function H2(r,d){if(r&1&&(e(0,` 5047 `),_(1,q2,4,0)(2,B2,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function W2(r,d){r&1&&(e(0,` 5048 `),n(1,"span",21),e(2,"APP_SETTINGS.INVENTORY.ASSIGN_UNITS"),a(),e(3,` 5049 `))}function j2(r,d){r&1&&(e(0,` 5050 `),n(1,"span",21),e(2,"APP_SETTINGS.INVENTORY.UNITS_OF_ISSUE"),a(),e(3,` 5051 `))}function Y2(r,d){if(r&1){let t=b();e(0,` 5052 `),n(1,"p-floatlabel"),e(2,` 5053 `),n(3,"input",81),h("change",function(){E(t);let i=m(2);return S(i.markFormDirty())})("ngModelChange",function(i){E(t);let s=m().$implicit,c=m();return S(c.setUnit(s,"Name",i))}),a(),e(4,` 5054 `),n(5,"label",21),e(6,"APP_SETTINGS.INVENTORY.UNIT_NAME"),a(),e(7,` 5055 `),a(),e(8,` 5056 `)}if(r&2){let t,o=m().$implicit,i=m();l(3),p("qwareFocus",!0)("fluid",!0)("ngModel",(t=i.unitsMap.get(o))==null?null:t.Name)("ngModelOptions",ne(4,Xa))}}function Q2(r,d){if(r&1&&(e(0,` 5057 `),n(1,"span"),e(2),a(),e(3,` 5058 `)),r&2){let t,o=m().$implicit,i=m();l(2),v((t=i.unitsMap.get(o))==null?null:t.Name)}}function K2(r,d){if(r&1){let t=b();e(0,` 5059 `),n(1,"p-floatlabel"),e(2,` 5060 `),n(3,"input",82),h("change",function(){E(t);let i=m(2);return S(i.markFormDirty())})("ngModelChange",function(i){E(t);let s=m().$implicit,c=m();return S(c.setUnit(s,"PluralName",i))}),a(),e(4,` 5061 `),n(5,"label",21),e(6,"APP_SETTINGS.INVENTORY.UNIT_PLURAL_NAME"),a(),e(7,` 5062 `),a(),e(8,` 5063 `)}if(r&2){let t,o=m().$implicit,i=m();l(3),p("ngModel",(t=i.unitsMap.get(o))==null?null:t.PluralName)("ngModelOptions",ne(3,Xa))("fluid",!0)}}
5063function $2(r,d){if(r&1&&(e(0,` 5064 `),n(1,"span"),e(2),a(),e(3,` 5065 `)),r&2){let t,o=m().$implicit,i=m();l(2),v((t=i.unitsMap.get(o))==null?null:t.PluralName)}}function z2(r,d){if(r&1){let t=b();e(0,` 5066 `),n(1,"p-floatlabel"),e(2,` 5067 `),n(3,"input",82),h("change",function(){E(t);let i=m(2);return S(i.markFormDirty())})("ngModelChange",function(i){E(t);let s=m().$implicit,c=m();return S(c.setUnit(s,"AbbreviatedName",i))}),a(),e(4,` 5068 `),n(5,"label",21),e(6,"APP_SETTINGS.INVENTORY.UNIT_ABBREVIATED_NAME"),a(),e(7,` 5069 `),a(),e(8,` 5070 `)}if(r&2){let t,o=m().$implicit,i=m();l(3),p("ngModel",(t=i.unitsMap.get(o))==null?null:t.AbbreviatedName)("ngModelOptions",ne(3,Xa))("fluid",!0)}}function X2(r,d){if(r&1&&(e(0,` 5071 `),n(1,"span"),e(2),a(),e(3,` 5072 `)),r&2){let t,o=m().$implicit,i=m();l(2),v((t=i.unitsMap.get(o))==null?null:t.AbbreviatedName)}}function Z2(r,d){if(r&1){let t=b();e(0,` 5073 `),n(1,"p-button",80),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.editUnitOption(i))}),e(2,` 5074 `),n(3,"i",55),e(4,"close"),a(),e(5,` 5075 `),a(),e(6,` 5076 `)}r&2&&(l(),p("text",!0)("rounded",!0))}function J2(r,d){if(r&1){let t=b();e(0,` 5077 `),n(1,"p-button",80),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.editUnitOption(i))}),e(2,` 5078 `),n(3,"i",55),e(4,"edit"),a(),e(5,` 5079 `),a(),e(6,` 5080 `)}r&2&&(l(),p("text",!0)("rounded",!0))}function eI(r,d){if(r&1){let t=b();e(0,` 5081 `),n(1,"div"),e(2,` 5082 `),n(3,"div",74),e(4,` 5083 `),n(5,"div",75),e(6,` 5084 `),n(7,"i",76),e(8,"drag_handle"),a(),e(9,` 5085 `),a(),e(10,` 5086 `),n(11,"div",77),e(12,` 5087 `),n(13,"div",78),e(14,` 5088 `),_(15,Y2,9,5)(16,Q2,4,1),a(),e(17,` 5089 `),n(18,"div",78),e(19,` 5090 `),_(20,K2,9,4)(21,$2,4,1),a(),e(22,` 5091 `),n(23,"div",78),e(24,` 5092 `),_(25,z2,9,4)(26,X2,4,1),a(),e(27,` 5093 `),n(28,"div",79),e(29,` 5094 `),n(30,"p-button",80),h("onClick",function(){let i=E(t).$index,s=m();return S(s.deleteUnitOption(i))}),e(31,` 5095 `),n(32,"i",55),e(33,"delete"),a(),e(34,` 5096 `),a(),e(35,` 5097 `),_(36,Z2,7,2)(37,J2,7,2),a(),e(38,` 5098 `),a(),e(39,` 5099 `),a(),e(40,` 5100 `),a(),e(41,` 5101 `)}if(r&2){let t=d.$index,o=m();l(15),f(o.isEditing==="isEditing"+t?15:16),l(5),f(o.isEditing==="isEditing"+t?20:21),l(5),f(o.isEditing==="isEditing"+t?25:26),l(5),p("text",!0)("rounded",!0),l(6),f(o.isEditing==="isEditing"+t?36:37)}}function tI(r,d){if(r&1&&(e(0,` 5102 `),n(1,"small",60),e(2,` 5103 `),n(3,"div",21),e(4),a(),e(5,` 5104 `),a(),e(6,` 5105 `)),r&2){let t=d.$implicit;l(4),v(t)}}function iI(r,d){if(r&1&&(e(0,` 5106 `),G(1,tI,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.UnitsOfIssue)}}var Wp=(()=>{class r{appSettingsService;dragulaService;fb;inventoryService;responseService;route;router;toastService;translate;bodyDropdown;subjectDropdown;unitInput;editors;displaySpinner=!0;dragulaGroupName="UNITOPTIONS";form;isEditing;selectedMergeField;sortAscIcon="../../../../../assets/icons/actions/sort_asc.svg";
5106sortDescIcon="../../../../../assets/icons/actions/sort_desc.svg";sortOrder;submitted=!1;textareaFocused=!1;threshholdBodyFields=[];threshholdSubjectFields=[];unitName;unitPluralName;unitAbbreviatedName;unitOptions=[];unitsMap=new Map;validationErrors;appSettings;dragulaSubs=new Vi;translations={};unitsToDelete=[];accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px"}}};constructor(t,o,i,s,c,u,x,C,O){this.appSettingsService=t,this.dragulaService=o,this.fb=i,this.inventoryService=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O,this.dragulaService.find(this.dragulaGroupName)||(this.dragulaService.createGroup(this.dragulaGroupName,{moves:(w,F,L)=>L?L.className==="drag-handle":!1}),this.dragulaSubs.add(o.drop(this.dragulaGroupName).subscribe(()=>{this.isEditing=void 0,this.sortOrder="custom",this.form.get("UnitsOfIssue")?.setValue(this.unitOptions),this.markFormDirty()})))}ngOnDestroy(){this.dragulaService.destroy(this.dragulaGroupName),this.dragulaSubs.unsubscribe()}ngOnInit(){this.form=this.fb.group({UnitsOfIssue:this.fb.control([]),ReorderThreshholdSubject:this.fb.control("",[T.required,T.maxLength(fi)]),ReorderThreshholdBody:this.fb.control("",[T.required,T.maxLength(Kt)])}),ue([this.translate.get(["APP_SETTINGS.INVENTORY.UNIT_NAME","APP_SETTINGS.INVENTORY.UNIT_PLURAL_NAME","APP_SETTINGS.INVENTORY.UNIT_ABBREVIATED_NAME","MERGE_FIELDS.LINK_TO_INVENTORY","MERGE_FIELDS.INVENTORY_NAME","MERGE_FIELDS.STORE_ROOM_NAME","MERGE_FIELDS.STORE_ROOM_QUANTITY","MERGE_FIELDS.REORDER_THRESHHOLD","MERGE_FIELDS.SELECT","MERGE_FIELDS.VENDOR_NAME","MERGE_FIELDS.VENDOR_PHONE_NUMBER"]).pipe(N()),this.appSettingsService.getAppSettingsForEdit(),this.inventoryService.getInventoryUnits()]).subscribe(t=>{this.translations=t[0],this.appSettings=t[1];let o=t[2];this.threshholdSubjectFields=[{label:this.translations["MERGE_FIELDS.INVENTORY_NAME"],value:"[INVENTORY_NAME]"},{label:this.translations["MERGE_FIELDS.REORDER_THRESHHOLD"],value:"[REORDER_THRESHHOLD]"},{label:this.translations["MERGE_FIELDS.STORE_ROOM_NAME"],value:"[STORE_ROOM_NAME]"},{label:this.translations["MERGE_FIELDS.STORE_ROOM_QUANTITY"],value:"[STORE_ROOM_QUANTITY]"}];let i=rn.default.concat(this.threshholdSubjectFields,[{label:this.translations["MERGE_FIELDS.LINK_TO_INVENTORY"],value:"[INVENTORY_LINK]"},{label:this.translations["MERGE_FIELDS.VENDOR_NAME"],value:"[VENDOR_NAME]"},{label:this.translations["MERGE_FIELDS.VENDOR_PHONE_NUMBER"],value:"[VENDOR_PHONE_NUMBER]"}]);this.threshholdBodyFields=rn.default.sortBy(i,s=>(s.label??"").toLowerCase()),rn.default.each(rn.default.sortBy(o,s=>s.SortOrder??(s.Name??"").toLowerCase()),s=>{s.Name&&(this.unitsMap.set(s.Name,s),this.unitOptions.push(s.Name))}),this.form.get("UnitsOfIssue")?.setValue(this.unitOptions),this.form.patchValue(this.appSettings),this.form.markAsPristine(),this.form.markAsUntouched(),this.displaySpinner=!1})}AfterViewInit(){this.editors.forEach(t=>{t.quill.options.container.firstChild.addEventListener("blur",()=>{this.textareaFocused=!1})})}isDirty(){return this.form.dirty&&!this.submitted}selectChanged(t){if(this.selectedMergeField){let o=t==="subject"?this.editors.toArray()[0].quill:this.editors.toArray()[1].quill,i=0,s=o.history.quill.selection.savedRange;s&&(s.length===0?i=s.index:(i=s.index,o.deleteText(s.index,s.length))),o.insertText(i,this.selectedMergeField,"user"),o.setSelection(o.getText(0).length),o.focus(),this.bodyDropdown.updateModel(void 0),this.subjectDropdown.updateModel(void 0)}}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=[Fe(!1)];this.unitsToDelete.length>0&&(t=this.unitsToDelete.filter(o=>o.Id).map(o=>this.inventoryService.deleteInventoryUnit(o.Id))),ue(t).pipe(N(),we(()=>(rn.default.each(this.unitOptions,(o,i)=>{let s=this.unitsMap.get(o);s&&(s.SortOrder=i)}),this.inventoryService.setInventoryUnits(Array.from(this.unitsMap.values())))),we(()=>{if(this.appSettings){let o=new Ln().parseInventoryForm(this.form.value,this.appSett
5106ings);return this.appSettingsService.updateAppSettings(o)}else return Fe({})})).subscribe({next:()=>{this.dragulaService.destroy("UNITOPTIONS"),this.displaySpinner=!1,this.responseService.onSuccess("APP_SETTINGS.INVENTORY.SUCCESS.SAVE","../",this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}markFormDirty(){this.form.markAsDirty(),this.form.markAsTouched()}addUnitOption(){if(this.sortOrder="custom",this.unitName=rn.default.trim(this.unitName),this.unitName)if(rn.default.some(this.unitOptions,t=>rn.default.trim(rn.default.toLower(t))===rn.default.toLower(this.unitName)))this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"]).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"])});else if(this.unitName.length>255)this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.MAX_LENGTH"],{field:this.translations["APP_SETTINGS.INVENTORY.UNIT_NAME"]}).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.MAX_LENGTH"])});else if(rn.default.size(this.unitPluralName)>255)this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.MAX_LENGTH"],{field:this.translations["APP_SETTINGS.INVENTORY.UNIT_PLURAL_NAME"]}).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.MAX_LENGTH"])});else if(rn.default.size(this.unitAbbreviatedName)>255)this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.MAX_LENGTH"],{field:this.translations["APP_SETTINGS.INVENTORY.UNIT_ABBREVIATED_NAME"]}).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.MAX_LENGTH"])});else{this.unitOptions.unshift(this.unitName);let t=new c0;t.Name=this.unitName,t.PluralName=this.unitPluralName,t.AbbreviatedName=this.unitAbbreviatedName,this.unitsMap.set(this.unitName,t),this.form.get("UnitsOfIssue")?.setValue(this.unitOptions),this.unitName=this.unitPluralName=this.unitAbbreviatedName=void 0,this.unitInput.nativeElement.focus(),this.markFormDirty()}}editUnitOption(t){this.isEditing&&this.isEditing!=="isEditing"+t?this.isEditing="isEditing"+t:this.isEditing=this.isEditing?void 0:"isEditing"+t}sortUnitsAlpha(){this.isEditing||(this.sortOrder==="desc"?(this.sortOrder="asc",this.unitOptions=this.unitOptions.sort((t,o)=>t.localeCompare(o))):(this.sortOrder="desc",this.unitOptions=this.unitOptions.sort((t,o)=>t.localeCompare(o)).reverse()),this.markFormDirty())}deleteUnitOption(t){this.sortOrder="custom";let o=rn.default.head(this.unitOptions.splice(t,1));o&&this.unitsMap.get(o)&&(this.unitsToDelete.push(rn.default.clone(this.unitsMap.get(o))),this.unitsMap.delete(o)),this.form.get("UnitsOfIssue")?.setValue(this.unitOptions),this.markFormDirty()}setUnit(t,o,i){this.unitsMap.get(t)&&(this.unitsMap.get(t)[o]=i)}static \u0275fac=function(o){return new(o||r)(g(dt),g(Dn),g(be),g(Wi),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-inventory-settings"]],viewQuery:function(o,i){if(o&1&&(X(I2,5),X(b2,5),X(y2,5),X(Jt,5)),o&2){let s;Y(s=Q())&&(i.bodyDropdown=s.first),Y(s=Q())&&(i.subjectDropdown=s.first),Y(s=Q())&&(i.unitInput=s.first),Y(s=Q())&&(i.editors=s)}},standalone:!1,decls:229,vars:64,consts:[["shades",""],["toggleicon",""],["subjectEditor",""],["header",""],["bodyEditor",""],["unitInput",""],["subjectDropdown",""],["bodyDropdown",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.inventory.page-header",1,"page-header"],[3,"dt"],["id","qware.app-settings.inventory.spinner",3,"displaySpinner"],[3,"formGroup"],[3,"dt","multiple","value"],["id","qware.app-settings.inventory.general-shade","value","0"],[1,"accordion-content-padding"],[1,"grid"],[1,"col-12"],[1,"medium-input",2,"margin-bottom","0","padding-bottom","0"],["id","qware.app-settings.inventory.label.subject",1,"standalone-label"],["translate",""],[1,"required-mark"],["id","qware.app-settings.inventory.subject.editor","formControlName","ReorderThreshholdSubject",3,"onTextChange"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.inventory.error.subject-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.inventory.error.subject-req","translate","",3,"hidden"],[1,"medium-input"],["id","qware.status.label.body",1,"standalone-label"],["id","qware.app-settings.inventory.body.editor","formControlName","ReorderThreshholdBody",3,"onTextChange"],["id","qware.app-settings.inventory.error.body-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.inventory.error.body-req","translate","",3,"hidden"],["id","qware.app-settings.inventory.units-sha
5106de","value","1"],[1,"grid","flex-inline","unit-container"],[1,"col-12","lg:col-6","md:col-6","first-column"],["tabindex","1","type","text","pInputText","","name","Unit Name","id","qware.inventory-settings.input.unit-name","variant","filled",3,"ngModelChange","keydown.enter","ngModel","ngModelOptions","fluid"],["id","qware.inventory-settings.input.label.unit-name","for","qware.inventory-settings.input.unit-name"],["tabindex","2","type","text","pInputText","","name","Unit Plural Name","id","qware.inventory-settings.input.unit-plural-name","variant","filled",3,"ngModelChange","ngModel","ngModelOptions","fluid"],["id","qware.inventory-settings.input.label.unit-plural-name","for","qware.inventory-settings.input.unit-plural-name"],["tabindex","3","type","text","pInputText","","name","Unit Abbreviated Name","id","qware.inventory-settings.input.unit-abbreviated-name","variant","filled",3,"ngModelChange","ngModel","ngModelOptions","fluid"],["id","qware.inventory-settings.input.label.unit-abbreviated-name","for","qware.inventory-settings.input.unit-abbreviated-name"],[1,"col-12","lg:col-6","md:col-6","second-column","flex-inline","align-items-bottom"],[1,"medium-input","flex-inline","flex-space-between",2,"width","100%"],[1,"add-button"],["tabindex","4","type","button","id","qware.inventory-settings.unit.button.add",3,"onClick","disabled","raised","label"],[1,"sort-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded","raised","hidden"],[3,"src"],[1,"unit-options"],["id","qware.inventory-settings.label.unit-list",1,"standalone-label"],["dragula","UNITOPTIONS",3,"dragulaModelChange","hidden","dragulaModel"],["translate","",3,"hidden"],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.inventory.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.inventory.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"material-icons"],[1,"ql-formats","merge-field"],["id","qware.app-settings.inventory.dropdown.subject.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],["pTemplate","dropdownicon"],["pTemplate","filtericon"],[1,"validation-error"],[1,"ql-formats"],[1,"ql-color"],[1,"ql-background"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"],[1,"ql-link"],[1,"ql-clean"],["id","qware.app-settings.inventory.dropdown.body.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid","filter"],[1,"unit-option"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline","align-items-center"],[1,"unit-fields"],[1,"delete-button","flex-inline","align-right"],["type","button","severity","secondary","styleClass","icon-only-button","tabindex","-1",3,"onClick","text","rounded"],["type","text","pInputText","","variant","filled",3,"change","ngModelChange","qwareFocus","fluid","ngModel","ngModelOptions"],["type","text","pInputText","","variant","filled",3,"change","ngModelChange","ngModel","ngModelOptions","fluid"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),h("keydown.enter",function(){return E(s),S(i.textareaFocused?void 0:i.save())}),e(1,` 5107 `),n(2,"div",9),e(3,` 5108 `),n(4,"h3",10),e(5,` 5109 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.INVENTORY.INVENTORY 5110 `),a(),e(9,` 5111 `),n(10,"p-card",11),e(11,` 5112 `),n(12,"qware-spinner",12),e(13,` 5113 `),n(14,"div",13),e(15,` 5114 `),n(16,"p-accordion",14,0),e(18,` 5115 `),n(19,"p-accordion-panel",15),e(20,` 5116 `),n(21,"p-accordion-header"),e(22),I(23,"translate"),_(24,D2,3,1,"ng-template",null,1,A),e(26,` 5117 `),a(),e(27,` 5118 `),n(28,"p-accordion-content"),e(29,` 5119 `),n(30,"div",16),e(31,` 5120 `),n(32,"div",17),e(33,` 5121 `),n(34,"div",18),e(35,` 5122 `),n(36,"div",19),e(37,` 5123 `),n(38,"label",20),e(39,` 5124 `),n(40,"span",21),e(41,"APP_SETTINGS.INVENTORY.SUBJECT"),a(),e(42,` 5125 `),n(43,"span",22),e(44," *"),a(),e(45,` 5126 `),a(),e(46,` 5127 `),n(47,"p-editor",23,2),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(49,` 5128 `),_(50,O2,13,9,"ng-template",null,3,A),e(52,` 5129 `),a(),e(53,` 5130 `),n(54,"small",24),e(55,` 5131 `),n(56,"div",25),e(57,` 5132 APP_SETTINGS.INVENTORY.ERROR.SUBJECT_LENGTH 5133 `),a(),e(58,` 5134 `),n(59,"div",26),e(60,` 5135 APP_SETTINGS.INVENTORY.ERROR.SUBJECT_REQUIRED 5136 `),a(),e(61,` 5137 `),a(),e(62,` 5138 `),_(63,M2,3,0),a(),e(64,` 5139 `),a(),e(65,` 5140 5141 `),n(66,"div",18),e(67,` 5142 `),n(68,"div",27),e(69,` 5143 `),n(70,"label",28),e(71,` 5144 `),n(72,"span",21),e(73,"APP_SETTINGS.INVENTORY.BODY"),a(),e(74,` 5145 `),n(75,"span",22),e(76," *"),a(),e(77,` 5146 `),a(),e(78,` 5147 `),n(79,"p-editor",29,4),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(81,` 5148 `),_(82,G2,55,9,"ng-template",null,3,A),e(84,` 5149 `),a(),e(85,` 5150 `),n(86,"small",24),e(87,` 5151 `),n(88,"div",30),e(89,` 5152 APP_SETTINGS.INVENTORY.ERROR.BODY_LENGTH 5153 `),a(),e(90,` 5154 `),n(91,"div",31),e(92,` 5155 APP_SETTINGS.INVENTORY.ERROR.BODY_REQUIRED 5156 `),a(),e(93,` 5157 `),a(),e(94,` 5158 `),_(95,V2,3,0),a(),e(96,` 5159 `),a(),e(97,` 5160 `),a(),e(98,` 5161 `),a(),e(99,` 5162 `),a(),e(100,` 5163 `),a(),e(101,` 5164 `),n(102,"p-accordion-panel",32),e(103,` 5165 `),n(104,"p-accordion-header"),e(105),I(106,"translate"),_(107,H2,3,1,"ng-template",null,1,A),e(109,` 5166 `),a(),e(110,` 5167 `),n(111,"p-accordion-content"),e(112,` 5168 `),n(113,"div",16),e(114,` 5169 `),n(115,"div",33),e(116,` 5170 `),n(117,"div",34),e(118,` 5171 `),n(119,"div",27),e(120,` 5172 `),n(121,"p-floatlabel"),e(122,` 5173 `),n(123,"input",35,5),j("ngModelChange",function(u){return E(s),W(i.unitName,u)||(i.unitName=u),S(u)}
5173),h("keydown.enter",function(){return E(s),S(i.addUnitOption())}),a(),e(125,` 5174 `),n(126,"label",36),e(127,` 5175 `),n(128,"span",21),e(129,"APP_SETTINGS.INVENTORY.UNIT_NAME"),a(),e(130,` 5176 `),a(),e(131,` 5177 `),a(),e(132,` 5178 `),a(),e(133,` 5179 `),n(134,"div",27),e(135,` 5180 `),n(136,"p-floatlabel"),e(137,` 5181 `),n(138,"input",37,5),j("ngModelChange",function(u){return E(s),W(i.unitPluralName,u)||(i.unitPluralName=u),S(u)}),a(),e(140,` 5182 `),n(141,"label",38),e(142,` 5183 `),n(143,"span",21),e(144,"APP_SETTINGS.INVENTORY.UNIT_PLURAL_NAME"),a(),e(145,` 5184 `),a(),e(146,` 5185 `),a(),e(147,` 5186 `),a(),e(148,` 5187 `),n(149,"div",27),e(150,` 5188 `),n(151,"p-floatlabel"),e(152,` 5189 `),n(153,"input",39,5),j("ngModelChange",function(u){return E(s),W(i.unitAbbreviatedName,u)||(i.unitAbbreviatedName=u),S(u)}),a(),e(155,` 5190 `),n(156,"label",40),e(157,` 5191 `),n(158,"span",21),e(159,"APP_SETTINGS.INVENTORY.UNIT_ABBREVIATED_NAME"),a(),e(160,` 5192 `),a(),e(161,` 5193 `),a(),e(162,` 5194 `),a(),e(163,` 5195 `),a(),e(164,` 5196 5197 `),n(165,"div",41),e(166,` 5198 `),n(167,"div",42),e(168,` 5199 `),n(169,"div",43),e(170,` 5200 `),n(171,"p-button",44),I(172,"translate"),h("onClick",function(){return E(s),S(i.addUnitOption())}),e(173,` 5201 `),a(),e(174,` 5202 `),a(),e(175,` 5203 `),n(176,"div",45),e(177,` 5204 `),n(178,"p-button",46),h("onClick",function(){return E(s),S(i.sortUnitsAlpha())}),e(179,` 5205 `),R(180,"img",47),e(181,` 5206 `),a(),e(182,` 5207 `),a(),e(183,` 5208 `),a(),e(184,` 5209 `),a(),e(185,` 5210 5211 `),n(186,"div",18),e(187,` 5212 `),n(188,"div",48),e(189,` 5213 `),n(190,"label",49),e(191,` 5214 `),_(192,W2,4,0)(193,j2,4,0),a(),e(194,` 5215 `),n(195,"div",50),j("dragulaModelChange",function(u){return E(s),W(i.unitOptions,u)||(i.unitOptions=u),S(u)}),e(196,` 5216 `),G(197,eI,42,6,null,null,Zi),a(),e(199,` 5217 `),a(),e(200,` 5218 `),n(201,"small",24),e(202,` 5219 `),n(203,"div",51),e(204,` 5220 CUSTOM_FIELD.ERROR.OPTION_REQUIRED 5221 `),a(),e(205,` 5222 `),a(),e(206,` 5223 `),_(207,iI,3,0),a(),e(208,` 5224 `),a(),e(209,` 5225 `),a(),e(210,` 5226 `),a(),e(211,` 5227 `),a(),e(212,` 5228 `),a(),e(213,` 5229 `),a(),e(214,` 5230 `),n(215,"div",52),e(216,` 5231 `),n(217,"p-button",53),I(218,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(219,` 5232 `),a(),e(220,` 5233 `),n(221,"p-button",54),I(222,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(223,` 5234 `),a(),e(224,` 5235 `),a(),e(225,` 5236 `),a(),e(226,` 5237 `),a(),e(227,` 5238 `),a(),e(228,` 5239`),a()}if(o&2){let s;l(10),p("dt",i.accordionCard),l(2),p("displaySpinner",i.displaySpinner),l(2),p("formGroup",i.form),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(56,A2)),l(6),K(` 5240 `,y(23,46,"APP_SETTINGS.INVENTORY.THRESHHOLD_EMAIL"),` 5241 `),l(32),p("hidden",i.form.controls.ReorderThreshholdSubject.valid||i.form.controls.ReorderThreshholdSubject.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.ReorderThreshholdSubject.errors!=null&&i.form.controls.ReorderThreshholdSubject.errors.maxlength))("translateParams",pe(57,Hp,i.form.controls.ReorderThreshholdSubject.value)),l(3),p("hidden",!(i.form.controls.ReorderThreshholdSubject.errors!=null&&i.form.controls.ReorderThreshholdSubject.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.ReorderThreshholdSubject&&i.form.controls.ReorderThreshholdSubject.untouched?63:-1),l(23),p("hidden",i.form.controls.ReorderThreshholdBody.valid||i.form.controls.ReorderThreshholdBody.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.ReorderThreshholdBody.errors!=null&&i.form.controls.ReorderThreshholdBody.errors.maxlength))("translateParams",pe(59,Hp,i.form.controls.ReorderThreshholdBody.value)),l(3),p("hidden",!(i.form.controls.ReorderThreshholdBody.errors!=null&&i.form.controls.ReorderThreshholdBody.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.ReorderThreshholdBody&&i.form.controls.ReorderThreshholdBody.untouched?95:-1),l(10),K(` 5242 `,y(106,48,"APP_SETTINGS.INVENTORY.UNITS"),` 5243 `),l(18),H("ngModel",i.unitName),p("ngModelOptions",ne(61,Xa))("fluid",!0),l(15),H("ngModel",i.unitPluralName),p("ngModelOptions",ne(62,Xa))("fluid",!0),l(15),H("ngModel",i.unitAbbreviatedName),p("ngModelOptions",ne(63,Xa))("fluid",!0),l(18),q("label",y(172,50,"APP_SETTINGS.INVENTORY.ADD_UNIT")),p("disabled",i.isEditing||!i.unitName||i.unitName&&i.unitName.length<1)("raised",!0),l(7),p("text",!0)("rounded",!0)("raised",!0)("hidden",i.isEditing||((s=i.form.controls.UnitsOfIssue.value==null?null:i.form.controls.UnitsOfIssue.value.length)!==null&&s!==void 0?s:0)<2),l(2),p("src",i.sortOrder==="desc"?i.sortDescIcon:i.sortAscIcon,jt),l(12),f((i.form.controls.UnitsOfIssue.value==null?null:i.form.controls.UnitsOfIssue.value.length)===0?192:193),l(3),p("hidden",(i.form.controls.UnitsOfIssue.value==null?null:i.form.controls.UnitsOfIssue.value.length)===0),H("dragulaModel",i.unitOptions),l(2),k(i.unitOptions),l(4),p("hidden",i.form.controls.UnitsOfIssue.valid||i.form.controls.UnitsOfIssue.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.UnitsOfIssue.errors!=null&&i.form.controls.UnitsOfIssue.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.UnitsOfIssue&&i.form.controls.UnitsOfIssue.untouched?207:-1),l(10),q("label",y(218,52,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(222,54,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}},dependencies:[Mt,Pe,Nt,Ot,Ft,oe,Ie,pn,Jt,Ne,je,Ae,se,ge,Le,ye,me,Te,De,it,$,ie],styles:[`qware-inventory-settings .unit-options{margin:0 1rem 1rem}qware-inventory-settings .unit-options .unit-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}qware-inventory-settings .unit-options .unit-option .drag-handle{margin-bottom:.5rem}qware-inventory-settings .unit-options .unit-option .unit-fields{width:20%;margin-right:.5rem}qware-inventory-settings .unit-options .unit-option .unit-fields input{border-width:0 0 1px 0}qware-inventory-settings .unit-options .unit-option .delete-button{flex:1 1 auto}@media screen and (max-width: 768px){qware-inventory-settings .unit-container>div:first-of-type{padding-bottom:0}qware-inventory-settings .unit-container>div:nth-of-type(2){padding-top:0;padding-bottom:0}qware-inventory-settings .unit-container>div:nth-of-type(2) .medium-input{margin:0 1rem 1rem;padding:0}qware-inventory-settings .unit-options{margin:1rem;padding-bottom:.5rem}qware-inventory-settings .unit-options .unit-option>div:nth-of-type(2){flex-direction:column;align-items:initial}qware-inventory-settings .unit-options .unit-option>div:nth-of-type(2) .unit-fields{width:calc(100% - 1.7rem);margin:.85rem}}body>.gu-mirror .unit-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}body>.gu-mirror .unit-option .drag-handle{margin-bottom:.5rem}body>.gu-mirror .unit-option .unit-fields{width:20%;margin-right:.5rem}body>.gu-mirror .unit-option .delete-button{pointer-events:none;flex:1 1 auto} 5244`],encapsulation:2})}return r})();var nI=["additionalFieldsDropdown"],aI=["additionalFieldsEditor"],rI=["spinner"],oI=()=>({standalone:!0});function lI(r,d){if(r&1&&(e(0,` 5245 `),n(1,"small",25),e(2,` 5246 `),n(3,"div",10),e(4),a(),e(5,` 5247 `),a(),e(6,` 5248 `)),r&2){let t=d.$implicit;l(4),v(t)}}function sI(r,d){if(r&1&&(e(0,` 5249 `),G(1,lI,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Name)}}function dI(r,d){r&1&&(e(0,` 5250 `),n(1,"span",26),e(2,"expand_more"),a(),e(3,` 5251 `))}function pI(r,d){if(r&1&&(e(0,` 5252 `),n(1,"small",25),e(2,` 5253 `),n(3,"div",10),e(4),a(),e(5,` 5254 `),a(),e(6,` 5255 `)),r&2){let t=d.$implicit;l(4),v(t)}}function mI(r,d){if(r&1&&(e(0,` 5256 `),G(1,pI,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.LabelTemplateTypeId)}}function cI(r,d){r&1&&(e(0,` 5257 `),n(1,"span",26),e(2,"expand_more"),a(),e(3,` 5258 `))}function uI(r,d){if(r&1&&(e(0,` 5259 `),n(1,"small",25),e(2,` 5260 `),n(3,"div",10),e(4),a(),e(5,` 5261 `),a(),e(6,` 5262 `)),r&2){let t=d.$implicit;l(4),v(t)}}function _I(r,d){if(r&1&&(e(0,` 5263 `),n(1,"div"),e(2,` 5264 `),G(3,uI,7,1,null,null,J),a(),e(5,` 5265 `)),r&2){let t=m(2);l(3),k(t.validationErrors.BarcodeType)}}function EI(r,d){if(r&1&&(e(0,` 5266 `),n(1,"small",25),e(2,` 5267 `),n(3,"div",10),e(4),a(),e(5,` 5268 `),a(),e(6,` 5269 `)),r&2){let t=d.$implicit;l(4),v(t)}}function SI(r,d){if(r&1&&(e(0,` 5270 `),G(1,EI,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Description)}}function xI(r,d){r&1&&(e(0,` 5271 `),n(1,"span",26),e(2,"expand_more"),a(),e(3,` 5272 `))}function fI(r,d){if(r&1){let t=b();e(0,` 5273 `),n(1,"span",27),e(2,` 5274 `),n(3,"p-select",28,4),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.selectedAdditionalField,i)||(s.selectedAdditionalField=i),S(i)}),h("onChange",function(){E(t);let i=m(2);return S(i.selectAdditionalFieldChanged())}),e(6,` 5275 `),_(7,xI,4,0,"ng-template",29),e(8,` 5276 `),a(),e(9,` 5277 `),a(),e(10,` 5278 `)}if(r&2){let t=m(2);l(3),q("placeholder",y(5,4,"MERGE_FIELDS.SELECT")),p("options",t.labelAdditionalFields),H("ngModel",t.selectedAdditionalField),p("ngModelOptions",ne(6,oI))}}function hI(r,d){if(r&1&&(e(0,` 5279 `),n(1,"small",25),e(2,` 5280 `),n(3,"div",10),e(4),a(),e(5,` 5281 `),a(),e(6,` 5282 `)),r&2){let t=d.$implicit;l(4),v(t)}}function CI(r,d){if(r&1&&(e(0,` 5283 `),G(1,hI,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.AdditionalFields)}}function vI(r,d){if(r&1){let t=b();e(0,` 5284 `),n(1,"div",5),e(2,` 5285 `),e(3,`
5286 `),n(4,"div",6),e(5,` 5287 `),n(6,"div",7),e(7,` 5288 `),n(8,"p-floatlabel"),e(9,` 5289 `),R(10,"input",8),e(11,` 5290 `),n(12,"label",9),e(13,` 5291 `),n(14,"span",10),e(15,"LABEL_TEMPLATE.NAME"),a(),e(16,` 5292 `),n(17,"span",11),e(18," *"),a(),e(19,` 5293 `),a(),e(20,` 5294 `),a(),e(21,` 5295 `),n(22,"small",12),e(23,` 5296 `),n(24,"div",13),e(25,` 5297 LABEL_TEMPLATE.ERROR.NAME_REQUIRED 5298 `),a(),e(26,` 5299 `),n(27,"div",14),e(28,` 5300 LABEL_TEMPLATE.ERROR.NAME_LENGTH 5301 `),a(),e(29,` 5302 `),n(30,"div",15),e(31,` 5303 LABEL_TEMPLATE.ERROR.DUPLICATE_NAME 5304 `),a(),e(32,` 5305 `),a(),e(33,` 5306 `),_(34,sI,3,0),a(),e(35,` 5307 5308 `),n(36,"div",7),e(37,` 5309 `),n(38,"p-floatlabel"),e(39,` 5310 `),n(40,"p-select",16),e(41,` 5311 `),_(42,dI,4,0,"ng-template",null,1,A),e(44,` 5312 `),a(),e(45,` 5313 `),n(46,"label",17),e(47,` 5314 `),n(48,"span",10),e(49,"LABEL_TEMPLATE.LABEL_TEMPLATE_TYPE"),a(),e(50,` 5315 `),n(51,"span",11),e(52," *"),a(),e(53,` 5316 `),a(),e(54,` 5317 `),a(),e(55,` 5318 `),n(56,"small",12),e(57,` 5319 `),n(58,"div",18),e(59,` 5320 LABEL_TEMPLATE.ERROR.LABEL_TEMPLATE_TYPE_REQUIRED 5321 `),a(),e(60,` 5322 `),a(),e(61,` 5323 `),_(62,mI,3,0),a(),e(63,` 5324 5325 `),n(64,"div",7),e(65,` 5326 `),n(66,"p-floatlabel"),e(67,` 5327 `),n(68,"p-select",19),e(69,` 5328 `),_(70,cI,4,0,"ng-template",null,1,A),e(72,` 5329 `),a(),e(73,` 5330 `),n(74,"label",17),e(75,` 5331 `),n(76,"span",10),e(77,"LABEL_TEMPLATE.BARCODE_TYPE"),a(),e(78,` 5332 `),n(79,"span",11),e(80," *"),a(),e(81,` 5333 `),a(),e(82,` 5334 `),a(),e(83,` 5335 `),n(84,"small",12),e(85,` 5336 `),n(86,"div",18),e(87,"LABEL_TEMPLATE.ERROR.BARCODE_TYPE_REQUIRED"),a(),e(88,` 5337 `),a(),e(89,` 5338 `),_(90,_I,6,0),a(),e(91,` 5339 `),a(),e(92,` 5340 `),e(93,` 5341 `),n(94,"div",20),e(95,` 5342 `),n(96,"div",7),e(97,` 5343 `),n(98,"p-floatlabel"),e(99,` 5344 `),n(100,"textarea",21),h("focus",function(){E(t);let i=m();return S(i.textareaFocus(!0))})("blur",function(){E(t);let i=m();return S(i.textareaFocus(!1))}),e(101," "),a(),e(102,` 5345 `),n(103,"label",22),e(104,` 5346 `),n(105,"span",10),e(106,"LABEL_TEMPLATE.DESCRIPTION"),a(),e(107,` 5347 `),a(),e(108,` 5348 `),a(),e(109,` 5349 `),n(110,"small",12),e(111,` 5350 `),n(112,"div",18),e(113,` 5351 LABEL_TEMPLATE.ERROR.ADDITIONAL_FIELDS_LENGTH 5352 `),a(),e(114,` 5353 `),a(),e(115,` 5354 `),_(116,SI,3,0),a(),e(117,` 5355 5356 `),n(118,"div",7),e(119,` 5357 `),n(120,"label",23),e(121,` 5358 `),n(122,"span",10),e(123,"LABEL_TEMPLATE.ADDITIONAL_FIELDS"),a(),e(124,` 5359 `),a(),e(125,` 5360 `),n(126,"p-editor",24,2),e(128,` 5361 `),_(129,fI,11,7,"ng-template",null,3,A),e(131,` 5362 `),a(),e(132,` 5363 `),n(133,"small",12),e(134,` 5364 `),n(135,"div",18),e(136,` 5365 LABEL_TEMPLATE.ERROR.ADDITIONAL_FIELDS_LENGTH 5366 `),a(),e(137,` 5367 `),a(),e(138,` 5368 `),_(139,CI,3,0),a(),e(140,` 5369 `),a(),e(141,` 5370 `),a(),e(142,` 5371 `)}if(r&2){let t=m();l(),p("formGroup",t.form),l(9),p("fluid",!0)("qwareFocus",t.autoFocus),l(12),p("hidden",t.form.controls.Name.valid||t.form.controls.Name.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Name.errors!=null&&t.form.controls.Name.errors.required)),l(3),p("hidden",!(t.form.controls.Name.errors!=null&&t.form.controls.Name.errors.maxlength)),l(3),p("hidden",!(t.form.controls.Name.errors!=null&&t.form.controls.Name.errors.duplicateString)),l(4),f(t.validationErrors&&t.validationErrors.Name&&t.form.controls.Name.untouched?34:-1),l(6),p("tabindex",3)("options",t.labelTemplateTypeOptions)("fluid",!0),l(16),p("hidden",t.form.controls.LabelTemplateTypeId.valid||t.form.controls.LabelTemplateTypeId.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.LabelTemplateTypeId.errors!=null&&t.form.controls.LabelTemplateTypeId.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.LabelTemplateTypeId&&t.form.controls.LabelTemplateTypeId.untouched?62:-1),l(6),p("tabindex",4)("options",t.barcodeTypes)("fluid",!0),l(16),p("hidden",t.form.controls.BarcodeType.valid||t.form.controls.BarcodeType.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.BarcodeType.errors!=null&&t.form.controls.BarcodeType.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.BarcodeType&&t.form.controls.BarcodeType.untouched?90:-1),l(10),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",t.form.controls.Description.valid||t.form.controls.Description.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Description.errors!=null&&t.form.controls.Description.errors.maxlength)),l(4),f(t.validationErrors&&t.validationErrors.Description&&t.form.controls.Description.untouched?116:-1),l(17),p("hidden",t.form.controls.AdditionalFields.valid||t.form.controls.AdditionalFields.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.AdditionalFields.errors!=null&&t.form.controls.AdditionalFields.errors.maxlength)),l(4),f(t.validationErrors&&t.validationErrors.AdditionalFields&&t.form.controls.AdditionalFields.untouched?139:-1)}}var Ol=(()=>{class r{translate;additionalFieldsDropdown;additionalFieldsEditor;spinner;labelTemplateTypeOptions=[];autoFocus=!0;editMode=!1;form;submitted=!1;validationErrors;textareaFocusChange=new Yt;barcodeTypes=[];labelAdditionalFields=[];selectedAdditionalField;translations={};constructor(t){this.translate=t}ngOnInit(){this.translate.get(["LABEL_TEMPLATE.BARCODE_TYPES.BARCODE","LABEL_TEMPLATE.BARCODE_TYPES.QR_CODE","LABEL_TEMPLATE.BARCODE_TYPES.Q_CODE","MERGE_FIELDS.ASSET_NAME","MERGE_FIELDS.CATEGORY","MERGE_FIELDS.MAKE","MERGE_FIELDS.MODEL","MERGE_FIELDS.SERIAL_NUMBER","MERGE_FIELDS.TAG_NAME","MERGE_FIELDS.VENDOR_NAME","MERGE_FIELDS.SELECT"]).pipe(N()).subscribe(t=>{this.translations=t,this.barcodeTypes=[{label:this.translations["LABEL_TEMPLATE.BARCODE_TYPES.BARCODE"],value:Qo.BARCODE},{label:this.translations["LABEL_TEMPLATE.BARCODE_TYPES.QR_CODE"],value:Qo.QR_CODE},{label:this.translations["LABEL_TEMPLATE.BARCODE_TYPES.Q_CODE"],value:Qo.Q_CODE}],this.labelAdditionalFields=[{label:this.translations["MERGE_FIELDS.CATEGORY"],value:"[CATEGORY]"},{label:this.translations["MERGE_FIELDS.MAKE"],value:"[MAKE]"},{label:this.translations["MERGE_FIELDS.MODEL"],value:"[MODEL]"},{label:this.translations["MERGE_FIELDS.ASSET_NAME"],value:"[ASSET_NAME]"},{label:this.translations["MERGE_FIELDS.SERIAL_NUMBER"],value:"[SERIAL_NUMBER]"},{label:this.translations["MERGE_FIELDS.TAG_NAME"],value:"[TAG_NAME]"},{label:this.translations["MERGE_FIELDS.VENDOR_NAME"],value:"[VENDOR_NAME]"}]})}selectAdditionalFieldChanged(){if(this.selectedAdditionalField){let t=this.additionalFieldsEditor.quill,o=0,i=t.history.quill.selection.savedRange;i&&(i.length===0?o=i.index:(o=i.index,t.deleteText(i.index,i.length))),t.insertText(o,this.selectedAdditionalField,"user"),t.setSelection(t.getText(0).length),t.focus(),this.selectedAdditionalField="",this.additionalFieldsDropdown.updateModel(void 0)}}textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)(g(le))};static \u0275cmp=B({type:r,selectors:[["qware-label-template-details"]],viewQuery:function(o,i){if(o&1&&(X(nI,5),X(aI,5),X(rI,7)),o&2){let s;Y(s=Q())&&(i.additionalFieldsDropdown=s.first),Y(s=Q())&&(i.additionalFieldsEditor=s.first),Y(s=Q())&&(i.spinner=s.first)}},inputs:{labelTemplateTypeOptions:"labelTemplateTypeOptions",autoFocus:"autoFocus",editMode:"editMode",form:"form",submitted:"submitted",validationErrors:"validationErrors"},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:4,vars:1,consts:[["spinner",""],["dropdownicon",""],["additionalFieldsEditor",""],["header",""],["additionalFieldsDropdown",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.label-template.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"fluid","qwareFocus"],["id","qware.label-template.details.label.name","for","qware.label-template.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.label-template.details.error.
5371name-req","translate","",3,"hidden"],["id","qware.label-template.details.error.name-length","translate","",3,"hidden"],["id","qware.label-template.details.error.dup-name","translate","",3,"hidden"],["id","qware.label-template.details.dropdown.label-type","formControlName","LabelTemplateTypeId","variant","filled",3,"tabindex","options","fluid"],["id","qware.label-template.details.label.label-type","for","qware.label-template.details.dropdown.label-type"],["translate","",3,"hidden"],["id","qware.label-template.details.dropdown.label-type","formControlName","BarcodeType","variant","filled",3,"tabindex","options","fluid"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","2","id","qware.label-template.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.label-template.details.label.description","for","qware.label-template.details.textarea.description"],["id","qware.label-template.details.additional-fields.label",1,"standalone-label"],["id","qware.label-template.details.additional-fields.editor","formControlName","AdditionalFields"],[1,"validation-error"],[1,"material-icons"],[1,"ql-formats","merge-field"],["id","qware.label-template.details.additional-fields.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions"],["pTemplate","dropdownicon"]],template:function(o,i){o&1&&(n(0,"qware-spinner",null,0),e(2,` 5372 `),_(3,vI,143,30),a()),o&2&&(l(3),f(i.form?3:-1))},dependencies:[Pe,Jt,Ne,je,Ae,se,ge,Le,ye,me,Te,De,it,ri,$,ie],encapsulation:2,changeDetection:0})}return r})();var Qp=(()=>{class r{authService;fb;labelTemplateService;responseService;route;toastService;translate;displaySpinner=!0;form;labelTemplateTypeOptions=[];submitted=!1;textareaFocused=!1;validationErrors;labelTemplateListRoute="../"+P.list;allLabelTemplateNames=[];constructor(t,o,i,s,c,u,x){this.authService=t,this.fb=o,this.labelTemplateService=i,this.responseService=s,this.route=c,this.toastService=u,this.translate=x}ngOnInit(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),LabelTemplateTypeId:this.fb.control(null,T.required),BarcodeType:this.fb.control(null,T.required),Description:this.fb.control("",T.maxLength(ft)),AdditionalFields:this.fb.control("",T.maxLength(ft))}),ue([this.labelTemplateService.getLabelTemplateTypes(),this.labelTemplateService.getLabelTemplates(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1];this.labelTemplateTypeOptions=o.map(s=>({label:s.Name,value:s.Id})),this.allLabelTemplateNames=i.filter(s=>s.Name).map(s=>s.Name),this.form.get("Name")?.setValidators([T.required,T.maxLength(re),Ki(this.allLabelTemplateNames)]),this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){let t=new ro().parseForm(this.form.value);this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=M.ACTIVE,this.labelTemplateService.createOrUpdateLabelTemplate(t).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t.get("SHARED.ERROR_LABEL"),t.get("SHARED.ERROR.FAILED_VALIDATION"))})}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g(be),g(ja),g(Re),g(he),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-label-template-create"]],standalone:!1,decls:32,vars:15,consts:[[1,"col-12",3,"keydown.enter"],["id","qware.label-template.create.spinner",3,"displaySpinner"],[1,"form-container"],["translate","","id","qware.label-template.create.page-header",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors","labelTemplateTypeOptions"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.label-template.create.button.cancel","type","button","severity","secondary",3,"text","routerLink","label"],["tabindex","999","id","qware.label-template.create.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"]],template:function(o,i){o&1&&(n(0,"div",0),h("key
5372down.enter",function(){return i.textareaFocused?void 0:i.save()}),e(1,` 5373 `),n(2,"qware-spinner",1),e(3,` 5374 `),n(4,"div",2),e(5,` 5375 `),n(6,"h3",3),e(7,` 5376 LABEL_TEMPLATE.CREATE_LABEL_TEMPLATE 5377 `),a(),e(8,` 5378 `),n(9,"p-card"),e(10,` 5379 `),n(11,"div"),e(12,` 5380 `),n(13,"qware-label-template-details",4),h("textareaFocusChange",function(c){return i.updateTextAreaFocus(c)}),e(14,` 5381 `),a(),e(15,` 5382 `),a(),e(16,` 5383 `),n(17,"div",5),e(18,` 5384 `),n(19,"p-button",6),I(20,"translate"),e(21,` 5385 `),a(),e(22,` 5386 `),n(23,"p-button",7),I(24,"translate"),h("onClick",function(){return i.save()})("keydown.enter",function(c){return c.preventDefault()}),e(25,` 5387 `),a(),e(26,` 5388 `),a(),e(27,` 5389 `),a(),e(28,` 5390 `),a(),e(29,` 5391 `),a(),e(30,` 5392`),a(),e(31,` 5393`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(11),p("form",i.form)("submitted",i.submitted)("validationErrors",i.validationErrors)("labelTemplateTypeOptions",i.labelTemplateTypeOptions),l(6),q("label",y(20,11,"SHARED.CANCEL")),p("text",!0)("routerLink",i.labelTemplateListRoute),l(4),q("label",y(24,13,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty))},dependencies:[oe,Ie,me,et,$,Ol,ie],encapsulation:2})}return r})();var Kp=He(nt());var gI=["actionsMenu"],TI=["drawer"],II=r=>({"lg:col-8":r});function bI(r,d){if(r&1&&(e(0,` 5394 `),n(1,"a",18),e(2,` 5395 `),n(3,"span",19),e(4),a(),e(5,` 5396 `),n(6,"span",20),e(7),a(),e(8,` 5397 `),a(),e(9,` 5398 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function yI(r,d){r&1&&(e(0,` 5399 `),n(1,"span",22),e(2,"SHARED.ACTIONS"),a(),e(3,` 5400 `),n(4,"i",23),e(5,"expand_more"),a(),e(6,` 5401 `))}function AI(r,d){if(r&1){let t=b();e(0,` 5402 `),n(1,"p-button",21),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 5403 `),_(3,yI,7,0,"ng-template",null,2,A),e(5,` 5404 `),a(),e(6,` 5405 `)}r&2&&(l(),p("raised",!0))}function RI(r,d){if(r&1&&(e(0,` 5406 `),n(1,"a",18),e(2,` 5407 `),n(3,"span",19),e(4),a(),e(5,` 5408 `),n(6,"span",20),e(7),a(),e(8,` 5409 `),a(),e(9,` 5410 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function wI(r,d){if(r&1){let t=b();e(0,` 5411 `),n(1,"div",24),e(2,` 5412 `),n(3,"p-menu",25,3),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 5413 `),_(6,RI,10,2,"ng-template",null,1,A),e(8,` 5414 `),a(),e(9,` 5415 `),n(10,"p-button",26),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 5416 `),n(12,"i",23),e(13,"more_vert"),a(),e(14,` 5417 `),a(),e(15,` 5418 `),a(),e(16,` 5419 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function DI(r,d){if(r&1){let t=b();e(0,` 5420 `),n(1,"p-button",27),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 5421 `),a(),e(4,` 5422 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function LI(r,d){r&1&&(e(0,` 5423 `),n(1,"div",30),e(2,` 5424 `),n(3,"span",31),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 5425 `),a(),e(6,` 5426 `))}function NI(r,d){if(r&1){let t=b();e(0,` 5427 `),n(1,"qware-spinner",32),e(2,` 5428 `),n(3,"div",33),e(4,` 5429 `),n(5,"qware-entity-history",34),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 5430 `),a(),e(7,` 5431 `),a(),e(8,` 5432 `),a(),e(9,` 5433 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function OI(r,d){if(r&1){let t=b();e(0,` 5434 `),n(1,"div",28),e(2,` 5435 `),n(3,"p-drawer",29,4),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 5436 `),_(6,LI,7,0,"ng-template",null,5,A),e(8,` 5437 `),_(9,NI,10,7,"ng-template",null,2,A),e(11,` 5438 `),a(),e(12,` 5439 `),a(),e(13,` 5440 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var $p=(()=>{class r{authService;confirmationService;fb;labelTemplateService;responseService;route;toastService;translate;actionsMenu;drawer;displayDrawerSpinner=D(!1);actionItems=[];displaySpinner=!0;historyArrayProperties=["Options"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;labelTemplate;labelTemplateTypeOptions=[];form;moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;validationErrors;auditLoggingDisabled=!0;labelTemplateListRoute="../../"+P.list;allLabelTemplateNames=[];translations={};constructor(t,o,i,s,c,u,x,C){this.authService=t,this.confirmationService=o,this.fb=i,this.labelTemplateService=s,this.responseService=c,this.route=u,this.toastService=x,this.translate=C,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.LABEL_TEMPLATE"]).pipe(N()),this.labelTemplateService.getLabelTemplateTypes(),this.labelTemplateService.getLabelTemplates(this.authService.tenant.Id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1],i=t[2];this.labelTemplate=i.find(c=>
5440c.Id===this.route.snapshot.params.id),this.labelTemplateTypeOptions=o.map(c=>({label:c.Name,value:c.Id})),this.allLabelTemplateNames=i.filter(c=>c.Name&&c.Name!==this.labelTemplate?.Name).map(c=>c.Name),this.form.get("Name")?.addValidators(Ki(this.allLabelTemplateNames)),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let s=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableLabelTemplate()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableLabelTemplate()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteLabelTemplate()}];this.labelTemplate?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&s.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreLabelTemplate()}),this.actionItems=s.filter(c=>this.labelTemplate?.State===M.DISABLED?c.id!=="disable.action":this.labelTemplate?.State===M.DELETED?c.id!=="disable.action"&&c.id!=="enable.action"&&c.id!=="delete.action":c.id!=="enable.action"),this.setHistoryParams(),this.labelTemplate&&(this.form.patchValue(new ro().toForm(this.labelTemplate)),this.form.markAsPristine()),this.labelTemplate?.State==="DELETED"&&this.form.disable(),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.labelTemplateListRoute,this.route)}})}createForm(){this.form=this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),LabelTemplateTypeId:this.fb.control(null,T.required),BarcodeType:this.fb.control(null,T.required),Description:this.fb.control("",T.maxLength(ft)),AdditionalFields:this.fb.control("",T.maxLength(ft))})}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.LABEL_TEMPLATE"]+' "'+this.labelTemplate?.Name+'"',this.historyIdMap=new Map;let t=new Map;t.set("Name","LABEL_TEMPLATE.NAME"),t.set("Description","LABEL_TEMPLATE.DESCRIPTION"),t.set("AdditionalFields","LABEL_TEMPLATE.ADDITIONAL_FIELDS"),t.set("BarcodeType","LABEL_TEMPLATE.BARCODE_TYPE"),t.set("LabelTemplateTypeId","LABEL_TEMPLATE.LABEL_TEMPLATE_TYPE"),this.historyNameMap=t}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){let t=new ro().parseForm(this.form.value);this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=this.labelTemplate?.State??M.ACTIVE,t.Id=this.labelTemplate?.Id,this.labelTemplateService.createOrUpdateLabelTemplate(t).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.SAVE",this.labelTemplateListRoute,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableLabelTemplate(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.labelTemplate?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.labelTemplate&&(this.displaySpinner=!0,this.submitted=!0,this.labelTemplate.State=M.DISABLED,this.labelTemplateService.createOrUpdateLabelTemplate(this.labelTemplate).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.DISABLE",this.labelTemplateListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableLabelTemplate(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.labelTemplate?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.labelTemplate&&(this.displaySpinner=!0,this.submitted=!0,this.labelTemplate.State=M.ACTIVE,this.labelTemplateService.createOrUpdateLabelTemplate(this.labelTemplate).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.ENABLE",this.labelTemplateListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteLabelTemplate(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.labelTemplate?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.labelTemplate&&(this.displaySpinner=!0,this.submitted=!0,this.labelTemplate.State=M.DELETED,this.labelTemplateService.createOrUpdateLabelTemplate(this.labelTemplate).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.DELETE",this.labelTemplateListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreLabelTemplate(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.labelTemplate?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.labelTemplate&&(this.displaySpinner=!0,this.submitted=!0,this.labelTemplate.State=M.ACTIVE,this.labelTemplateService.createOrUpdateLabelTemplate(this.labelTemplate).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("LABEL_TEMPLATE.SUCCESS.RESTORE",this.labelTemplateListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Kp.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(mt),g(be),g(ja),g(Re),g(he),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-label-template-edit"]],viewQuery:function(o,i){if(o&1&&(X(gI,7),X(TI,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:48,vars:22,consts:[["actionsMenu",""],["item",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.label-template.edit",1,"grid"],["id","qware.label-template.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.label-template.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.label-template.edit.edit.actions-menu",3,"model","popup"],["id","qware.label-template.edit.spinner",3,"displaySpinner"],[3,"lockEditing"],[1,"label-template-form"],[3,"form","submitted","autoFocus","labelTemplateTypeOptions","validationErrors","editMode"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.label-template.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.label-template.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.label-template.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.label-template.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.label-template.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.label-template.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.label-template.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","labelTemplate",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){o&1&&(n(0,"div",6),e(1,` 5441 `),n(2,"div",7),e(3,` 5442 `),n(4,"div",8),e(5,` 5443 `),n(6,"h3",9),e(7,` 5444 LABEL_TEMPLATE.EDIT_LABEL_TEMPLATE 5445 `),a(),e(8,` 5446 `),n(9,"div",10),e(10,` 5447 `),n(11,"p-menu",11,0),e(13,` 5448 `),_(14,bI,10,2,"ng-template",null,1,A),e(16,` 5449 `),a(),e(17,` 5450 `),_(18,AI,7,1),a(),e(19,` 5451 `),_(20,wI,17,4),a(),e(21,` 5452 `),n(22,"qware-spinner",12),e(23,` 5453 `),n(24,"p-card"),e(25,` 5454 `),n(26,"qware-edit-lock",13),e(27,` 5455 `),n(28,"div",14),e(29,` 5456 `),n(30,"qware-label-template-details",15),e(31,` 5457 `),a(),e(32,` 5458 `),a(),e(33,` 5459 `),a(),e(34,` 5460 `),n(35,"div",16),e(36,` 5461 `),n(37,"p-button",17),I(38,"translate"),e(39,` 5462 `),a(),e(40,` 5463 `),_(41,DI,5,5),a(),e(42,` 5464 `),a(),e(43,` 5465 `),a(),e(44,` 5466 `),a(),e(45,` 5467 `),_(46,OI,14,6),a(),e(47,` 5468`)),o&2&&(l(2),p("ngClass",pe(20,II,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(4),p("lockEditing",i.labelTemplate!==void 0&&i.labelTemplate.State==="DELETED"),l(4),p("form",i.form)("submitted",i.submitted)("autoFocus",!1)("labelTemplateTypeOptions",i.labelTemplateTypeOptions)("validationErrors",i.validationErrors)("editMode",!0),l(7),q("label",y(38,18,"SHARED.CANCEL")),p("routerLink",i.labelTemplateListRoute)("text",!0),l(4),f((i.labelTemplate==null?null:i.labelTemplate.State)!=="DELETED"?41:-1),l(5),f(i.auditLoggingDisabled?-1:46))},dependencies:[oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,Ol,ie],encapsulation:2})}return r})();var FI=["dt"],MI=r=>({"disabled-row":r}),zp=(r,d)=>d.field;function UI(r,d){if(r&1){let t=b();e(0,` 5469 `),n(1,"div",17),e(2,` 5470 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 5471 `),n(7,"p-toggleswitch",18),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 5472 `),a(),e(9,` 5473 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function PI(r,d){if(r&1&&(e(0,` 5474 `),R(1,"p-sortIcon",21),e(2,` 5475 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function GI(r,d){if(r&1&&(e(0,` 5476 `),n(1,"th",19),e(2,` 5477 `),n(3,"span",20),e(4),a(),e(5,` 5478 `),_(6,PI,3,1),a(),e(7,` 5479 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function kI(r,d){if(r&1&&(e(0,` 5480 `),n(1,"tr"),e(2,` 5481 `),G(3,GI,8,3,null,null,zp),a(),e(5,` 5482 `)),r&2){let t=d.$implicit;l(3),k(t)}}function VI(r,d){r&1&&(e(0,` 5483 `),n(1,"span",26),e(2,"SHARED.DISABLED"),a(),e(3,` 5484 `))}function qI(r,d){r&1&&(e(0,` 5485 `),n(1,"span",26),e(2,"SHARED.DELETED"),a(),e(3,` 5486 `))}function BI(r,d){if(r&1&&(e(0,` 5487 `),n(1,"span"),e(2,` 5488 `),n(3,"a",25),e(4),a(),e(5,` 5489 `),_(6,VI,4,0)(7,qI,4,0),a(),e(8,` 5490 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(3),gt("routerLink","",i.labelTemplateEditRoute,"/",o.Id,""),l(),v(o[t.field]),l(2),f(o.State==="DISABLED"?6:-1),l(),f(o.State==="DELETED"?7:-1)}}function HI(r,d){if(r&1&&(e(0,` 5491 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 5492 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(y(3,1,"LABEL_TEMPLATE.BARCODE_TYPES."+o[t.field]))}}function WI(r,d){if(r&1&&(e(0,` 5493 `),n(1,"span"),e(2),a(),e(3,` 5494 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function jI(r,d){if(r&1&&(e(0,` 5495 `),n(1,"td"),e(2,` 5496 `),n(3,"span",23),e(4),a(),e(5,` 5497 `),n(6,"div",24),e(7,` 5498 `),n(8,"span"),e(9,` 5499 `),_(10,BI,9,6)(11,HI,5,3)(12,WI,4,1),e(13,` 5500 `),a(),e(14,` 5501 `),a(),e(15,` 5502 `),a(),e(16,` 5503 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:t==="BarcodeType"?11:12)}}function YI(r,d){if(r&1&&(e(0,` 5504 `),n(1,"tr",22),e(2,` 5505 `),G(3,jI,17,2,null,null,zp),a(),e(5,` 5506 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,MI,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function QI(r,d){r&1&&(e(0,` 5507 `),n(1,"div",27),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 5508 `))}function KI(r,d){r&1&&(e(0,` 5509 `),n(1,"div",27),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 5510 `))}function $I(r,d){if(r&1&&(e(0,` 5511 `),n(1,"tr"),e(2,` 5512 `),n(3,"td"),e(4,` 5513 `),_(5,QI,4,0)(6,KI,4,0),a(),e(7,` 5514 `),a(),e(8,` 5515 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:6)}}var Xp=(()=>{class r{authService;labelTemplateService;translate;dt;allLabelTemplates=[];allLabelTemplateTypes=[];displaySpinner=!0;generalFilter="";isActive=!1;labelTemplates=[];labelTemplateTypes=[];moreItems=[];searchEnabled=!1;searchResults=!1;showDeleted=!1;tableColumns=[];translations={};canViewDeleted=!1;labelTemplateCreateRoute="../"+P.create;labelTemplateEditRoute="../"+P.edit;constructor(t,o,i){this.authService=t,this.labelTemplateService=o,this.translate=i,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED)}ngOnInit(){ue([this.translate.get(["LABEL_TEMPLATE.NAME","LABEL_TEMPLATE.DESCRIPTION","LABEL_TEMPLATE.LABEL_TEMPLATE_TYPE","LABEL_TEMPLATE.BARCODE_TYPE"]).pipe(N()),this.labelTemplateService.getLabelTemplates(this.authService.tenant.Id),this.labelTemplateService.getLabelTemplateTypes()]).subscribe(t=>{this.translations=t[0],this.allLabelTemplates=t[1],this.allLabelTemplateTypes=t[2],this.allLabelTemplates.forEac
5515h(i=>{i.LabelTemplateType=this.allLabelTemplateTypes.find(s=>s.Id===i.LabelTemplateTypeId),i.LabelTemplateTypeName=i.LabelTemplateType?.Name}),this.labelTemplates=this.filterLabelTemplates(this.allLabelTemplates);let o=window.localStorage.getItem(Oe.LABEL_TEMPLATE_FILTER_STORAGE_KEY);o&&(this.generalFilter=o,this.generalFilterOnChange()),this.labelTemplates.length===0?this.searchResults=!1:this.detectFilter(),this.tableColumns=[{field:"Name",header:this.translations["LABEL_TEMPLATE.NAME"]},{field:"Description",header:this.translations["LABEL_TEMPLATE.DESCRIPTION"]},{field:"LabelTemplateTypeName",header:this.translations["LABEL_TEMPLATE.LABEL_TEMPLATE_TYPE"]},{field:"BarcodeType",header:this.translations["LABEL_TEMPLATE.BARCODE_TYPE"]}],this.displaySpinner=!1})}filterLabelTemplates(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}toggleShowDeleted(){this.labelTemplates=this.filterLabelTemplates(this.allLabelTemplates)}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}generalFilterOnChange(){localStorage.setItem(Oe.LABEL_TEMPLATE_FILTER_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt.filterGlobal(this.generalFilter,"contains")}static \u0275fac=function(o){return new(o||r)(g(de),g(ja),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-label-template-list"]],viewQuery:function(o,i){if(o&1&&X(FI,7),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},standalone:!1,decls:52,vars:18,consts:[["dt",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.label-template.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.label-template.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"col-12","data-grid"],["id","qware.label-template.list.spinner",3,"displaySpinner"],["id","qware.label-template.list.table","responsiveLayout","stack","sortField","Name","dataKey","Id",3,"onFilter","columns","value","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button",3,"raised","routerLink"],[1,"show-deleted-switch"],["id","qware.label-template-list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],[3,"pSortableColumn"],["translate",""],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.label-template.list.table.label-template-name",3,"routerLink"],["translate","",1,"badge"],["translate","",1,"no-results"]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 5516 `),n(2,"div",2),e(3,` 5517 `),n(4,"h3",3),e(5,` 5518 LABEL_TEMPLATE.LABEL_TEMPLATE_MANAGEMENT 5519 `),a(),e(6,` 5520 `),_(7,UI,10,4),a(),e(8,` 5521 `),n(9,"div",4),e(10,` 5522 `),n(11,"div",5),e(12,` 5523 `),n(13,"p-iconfield",6),e(14,` 5524 `),n(15,"p-inputicon"),e(16,` 5525 `),n(17,"span",7),e(18,"search"),a(),e(19,` 5526 `),a(),e(20,` 5527 `),n(21,"input",8),I(22,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 5528 `),a(),e(24,` 5529 `),a(),e(25,` 5530 `),a(),e(26,` 5531 `),n(27,"div",9),e(28,` 5532 `),n(29,"qware-spinner",10),e(30,` 5533 `),n(31,"p-table",11,0),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(33,` 5534 `),_(34,kI,6,0,"ng-template",12),e(35,` 5535 `),_(36,YI,6,4,"ng-template",13),e(37,` 5536 `),_(38,$I,9,2,"ng-template",14),e(39,` 5537 `),a(),e(40,` 5538 `),a(),e(41,` 5539 `),a(),e(42,` 5540 `),n(43,"div",15),e(44,` 5541 `),n(45,"p-button",16),e(46,` 5542 `),n(47,"i",7),e(48,"add"),a(),e(49,` 5543 `),a(),e(50,` 5544 `),a(),e(51,` 5545`),a()}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(12),q("placeholder",y(22,16,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(8),p("displaySpinner",i.displaySpinner),l(2),p("columns",i.tableColumns)("value",i.labelTemplates)("sortOrder",1)("paginator",!0)("pageLinks",3)("rows",15)("scrollable",!0),l(14),q("routerLink",i.labelTemplateCreateRoute),p("raised",!0))},dependencies:[Pe,oe,Qe,je,Ae,se,Le,pi,mi,ye,me,kt,et,ht,ji,Yi,cn,Ai,$,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0!important}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{display:flex!important;position:relative!important;margin:0!important;width:100%}"]})}return r})();var tm=He(nt());var Zp=He(nt());function zI(r,d){if(r&1&&(e(0,` 5546 `),n(1,"small",21),e(2,` 5547 `),n(3,"div",5),e(4),a(),e(5,` 5548 `),a(),e(6,` 5549 `)),r&2){let t=d.$implicit;l(4),v(t)}}function XI(r,d){if(r&1&&(e(0,` 5550 `),G(1,zI,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Name)}}function ZI(r,d){if(r&1&&(e(0,` 5551 `),n(1,"small",21),e(2,` 5552 `),n(3,"div",5),e(4),a(),e(5,` 5553 `),a(),e(6,` 5554 `)),r&2){let t=d.$implicit;l(4),v(t)}}function JI(r,d){if(r&1&&(e(0,` 5555 `),G(1,ZI,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().ParentId)}}function eb(r,d){r&1&&(e(0,` 5556 `),n(1,"span",22),e(2,"expand_more"),a(),e(3,` 5557 `))}
5557function tb(r,d){if(r&1&&(e(0,` 5558 `),n(1,"div",23),e(2,` 5559 `),R(3,"img",24),e(4,` 5560 `),n(5,"div",25),e(6),a(),e(7,` 5561 `),a(),e(8,` 5562 `)),r&2){let t=d.$implicit;l(3),p("src",t.value,jt),l(3),v(t.label)}}function ib(r,d){if(r&1&&(e(0,` 5563 `),n(1,"div",23),e(2,` 5564 `),R(3,"img",24),e(4,` 5565 `),n(5,"div",25),e(6),a(),e(7,` 5566 `),a(),e(8,` 5567 `)),r&2){let t=d.$implicit;l(3),p("src",t.value,jt),l(3),v(t.label)}}function nb(r,d){if(r&1&&(e(0,` 5568 `),n(1,"small",21),e(2,` 5569 `),n(3,"div",5),e(4),a(),e(5,` 5570 `),a(),e(6,` 5571 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ab(r,d){if(r&1&&(e(0,` 5572 `),G(1,nb,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Icon)}}function rb(r,d){if(r&1&&(e(0,` 5573 `),n(1,"small",21),e(2,` 5574 `),n(3,"div",5),e(4),a(),e(5,` 5575 `),a(),e(6,` 5576 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ob(r,d){if(r&1&&(e(0,` 5577 `),G(1,rb,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Description)}}var Fl=(()=>{class r{allLocationTypeOptions=ee([]);autoFocus=ee(!0);form=ee.required();submitted=ee(!1);validationErrors=ee(void 0);textareaFocusChange=Dt();iconOptions=D([]);noParent=Ye(()=>{let t=this.allLocationTypeOptions();return t&&t.length>0?t.find(o=>!o.value):void 0});translate=te(le);ngOnInit(){this.translate.get(["LOCATIONTYPEICONS.BUILDING","LOCATIONTYPEICONS.CAMPUS","LOCATIONTYPEICONS.CELL","LOCATIONTYPEICONS.COUNTRY","LOCATIONTYPEICONS.FLOOR","LOCATIONTYPEICONS.GROUNDS","LOCATIONTYPEICONS.PARKING_LOT","LOCATIONTYPEICONS.ROAD","LOCATIONTYPEICONS.ROOM","LOCATIONTYPEICONS.ZONE"]).pipe(N()).subscribe(t=>{let o=[{label:t["LOCATIONTYPEICONS.BUILDING"],value:"assets/icons/location-types/building.svg"},{label:t["LOCATIONTYPEICONS.CAMPUS"],value:"assets/icons/location-types/campus.svg"},{label:t["LOCATIONTYPEICONS.CELL"],value:"assets/icons/location-types/cell.svg"},{label:t["LOCATIONTYPEICONS.COUNTRY"],value:"assets/icons/location-types/country.svg"},{label:t["LOCATIONTYPEICONS.FLOOR"],value:"assets/icons/location-types/floor.svg"},{label:t["LOCATIONTYPEICONS.GROUNDS"],value:"assets/icons/location-types/grounds.svg"},{label:t["LOCATIONTYPEICONS.PARKING_LOT"],value:"assets/icons/location-types/parking.svg"},{label:t["LOCATIONTYPEICONS.ROAD"],value:"assets/icons/location-types/road.svg"},{label:t["LOCATIONTYPEICONS.ROOM"],value:"assets/icons/location-types/room.svg"},{label:t["LOCATIONTYPEICONS.ZONE"],value:"assets/icons/location-types/zone.svg"}];this.iconOptions.set(Zp.default.sortBy(o,i=>(i.label??"").toLowerCase()))})}textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-type-details"]],inputs:{allLocationTypeOptions:[1,"allLocationTypeOptions"],autoFocus:[1,"autoFocus"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:99,vars:28,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.location-type.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"qwareFocus","fluid"],["id","qware.location-type.details.label.name","for","qware.location-type.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.location-type.details.error.name-req","translate","",3,"hidden"],["id","qware.location-type.details.error.name-length","translate","",3,"hidden"],["formControlName","ParentId","labelId","qware.location-type.details.label.parent","label","LOCATIONTYPE.PARENT","elementId","qware.location-type.details.dropdown.parent","id","qware.location-type.details.dropdown-e2e.parent",3,"singleSelect","tabindex","options","isRequired","defaultOption"],["id","qware.location-type.details.error.parentid-req","translate","",3,"hidden"],["id","qware.location-type.details.dropdown.icon","formControlName","Icon","variant","filled",3,"tabindex","options","fluid"],["pTemplate","dropdownicon"],["pTemplate","selectedItem"],["pTemplate","item"],["id","qware.location-type.details.label.icon","for","qware.location-type.details.dropdown.icon"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","3","id","qware.location-type.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.location-type.details.label.description","for","qware.location-type.details.textarea.description"],[1,"validation-error"],[1,"material-icons"],[1,"select-item-icon-container"],[1,"select-item-icon",3,"src"],[1,"select-item-icon-label"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 5578 `),n(2,"div",1),e(3,` 5579 `),n(4,"div",2),e(5,` 5580 `),n(6,"p-floatlabel"),e(7,` 5581 `),R(8,"input",3),e(9,` 5582 `),n(10,"label",4),e(11,` 5583 `),n(12,"span",5),e(13,"LOCATIONTYPE.NAME"),a(),n(14,"span",6),e(15," *"),a(),e(16,` 5584 `),a(),e(17,` 5585 `),a(),e(18,` 5586 `),n(19,"small",7),e(20,` 5587 `),n(21,"div",8),e(22,` 5588 LOCATIONTYPE.ERROR.NAME_REQUIRED 5589 `),a(),e(23,` 5590 `),n(24,"div",9),e(25,` 5591 LOCATIONTYPE.ERROR.NAME_LENGTH 5592 `),a(),e(26,` 5593 `),a(),e(27,` 5594 `),_(28,XI,3,0),a(),e(29,` 5595 5596 `),n(30,"div",2),e(31,` 5597 `),n(32,"qware-autocomplete",10),e(33,` 5598 `),a(),e(34,` 5599 `),n(35,"small",7),e(36,` 5600 `),n(37,"div",11),e(38,` 5601 LOCATIONTYPE.ERROR.PARENT_REQUIRED 5602 `),a(),e(39,` 5603 `),a(),e(40,` 5604 `),_(41,JI,3,0),a(),e(42,` 5605 5606 `),n(43,"div",2),e(44,` 5607 `),n(45,"p-floatlabel"),e(46,` 5608 `),n(47,"p-select",12),e(48,` 5609 `),_(49,eb,4,0,"ng-template",13),e(50,` 5610 `),_(51,tb,9,2,"ng-template",14),e(52,` 5611 `),_(53,ib,9,2,"ng-template",15),e(54,` 5612 `),a(),e(55,` 5613 `),n(56,"label",16),e(57,` 5614 `),n(58,"span",5),e(59,"LOCATIONTYPE.ICON"),a(),n(60,"span",6),e(61," *"),a(),e(62,` 5615 `),a(),e(63,` 5616 `),a(),e(64,` 5617 `),n(65,"small",7),e(66,` 5618 `),n(67,"div",17),e(68,"LOCATIONTYPE.ERROR.ICON_REQUIRED"),a(),e(69,` 5619 `),a(),e(70,` 5620 `),_(71,ab,3,0),a(),e(72,` 5621 `),a(),e(73,` 5622 5623 `),n(74,"div",18),e(75,` 5624 `),n(76,"div",2),e(77,` 5625 `),n(78,"p-floatlabel"),e(79,` 5626 `),n(80,"textarea",19),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(81," "),a(),e(82,` 5627 `),n(83,"label",20),e(84,` 5628 `),n(85,"span",5),e(86,"LOCATIONTYPE.DESCRIPTION"),a(),e(87,` 5629 `),a(),e(88,` 5630 `),a(),e(89,` 5631 `),n(90,"small",7),e(91,` 5632 `),n(92,"div",17),e(93,` 5633 LOCATIONTYPE.ERROR.DESCRIPTION_LENGTH 5634 `),a(),e(94,` 5635 `),a(),e(95,` 5636 `),_(96,ob,3,0),a(),e(97,` 5637 `),a(),e(98,` 5638`),a()),o&2){let s,c,u,x,C;p("formGroup",i.form()),l(8),p("qwareFocus",i.autoFocus())("fluid",!0),l(11),p("hidden",i.form().controls.Name.valid||i.form().controls.Name.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.Name.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.Name.errors)!=null&&c.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Name&&i.form().controls.Name.untouched?28:-1),l(4),p("singleSelect",!0)("tabindex",2)("options",i.allLocationTypeOptions())("isRequired",!0)("defaultOption",i.noParent()),l(3),p("hidden",i.form().controls.ParentId.valid||i.form().controls.ParentId.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.ParentId.errors)!=null&&u.required)),l(4),f(i.validationErrors()&&i.validationErrors().ParentId&&i.form().controls.ParentId.untouched?41:-1),l(6),p("tabindex",4)("options",i.iconOptions())("fluid",!0),l(18),p("hidden",i.form().controls.Icon.valid||i.form().controls.Icon.pristine&&!i.submitted()),l(2),p("hidden",!((x=i.form().controls.Icon.errors)!=null&&x.required)),l(4),f(i.validationErrors()&&i.validationErrors().Icon&&i.form().controls.Icon.untouched?71:-1),l(9),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",i.form().controls.Description.valid||i.form().controls.Description.pristine&&!i.submitted()),l(2),p("hidden",!((C=i.form().controls.Description.errors)!=null&&C.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Description&&i.form().controls.Description.untouched?96:-1)}},dependencies:[Pe,Ne,je,Ae,se,ge,ye,wt,Te,De,it,ri,$],styles:[".select-item-icon[_ngcontent-%COMP%]{top:-2px}.text-box[_ngcontent-%COMP%]{min-height:93px}"],changeDetection:0})}return r})();var Ml=(()=>{class r{form;submitted=!1;validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-type-settings"]],inputs:{form:"form",submitted:"submitted",validationErrors:"validationErrors"},standalone:!1,decls:32,vars:7,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],[1,"medium-input"],["id","qware.location-type.settings.checkbox.address.label","for","qware.location-type.settings.checkbox.address","translate",""],["id","qware.location-type.settings.checkbox.address","name","Address","formControlName","Address",3,"tabindex","binary"],["id","qware.location-type.settings.checkbox.capacity.label","for","qware.location-type.settings.checkbox.capacity","translate",""],["id","qware.location-type.settings.checkbox.capacity","name","Capacity","formControlName","Capacity",3,"tabindex","binary"],["id","qware.location-type.settings.checkbox.squareFootage.label","for","qware.location-type.settings.checkbox.squareFootage","translate",""],["id","qware.location-type.settings.checkbox.squareFootage","name","SquareFootage","formControlName","SquareFootage",3,"tabindex","binary"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 5639 `),n(2,"div",1),e(3,` 5640 `),n(4,"div",2),e(5,` 5641 `),n(6,"label",3),e(7,` 5642 LOCATIONTYPE.TRACK_ADDRESS 5643 `),a(),e(8,` 5644 `),n(9,"p-checkbox",4),e(10,` 5645 `),a(),e(11,` 5646 `),a(),e(12,` 5647 `),n(13,"div",2),e(14,` 5648 `),n(15,"label",5),e(16,` 5649 LOCATIONTYPE.TRACK_CAPACITY 5650 `),a(),e(17,` 5651 `),n(18,"p-checkbox",6),e(19,` 5652 `),a(),e(20,` 5653 `),a(),e(21,` 5654 `),n(22,"div",2),e(23,` 5655 `),n(24,"label",7),e(25,` 5656 LOCATIONTYPE.TRACK_SQUARE_FOOTAGE 5657 `),a(),e(26,` 5658 `),n(27,"p-checkbox",8),e(28,` 5659 `),a(),e(29,` 5660 `),a(),e(30,` 5661 `),a(),e(31,` 5662`),a()),o&2&&(p("formGroup",i.form),l(9),p("tabindex",5)("binary",!0),l(9),p("tabindex",6)("binary",!0),l(9),p("tabindex",7)("binary",!0))},dependencies:[yt,se,ge,Te,De,$],styles:[".medium-input[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"]})}return r})();function lb(r,d){if(r&1){let t=b();e(0,` 5663 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 5664 `),n(3,"span",16),e(4),a(),e(5,` 5665 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 5666 `),a(),e(10,` 5667 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"LOCATIONTYPE.DETAILS"))}}
5667function sb(r,d){if(r&1){let t=b();e(0,` 5668 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 5669 `),n(3,"span",16),e(4),a(),e(5,` 5670 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 5671 `),a(),e(10,` 5672 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"LOCATIONTYPE.SETTINGS"))}}function db(r,d){if(r&1){let t=b();e(0,` 5673 `),n(1,"div",3),e(2,` 5674 `),n(3,"h3",4),e(4,` 5675 LOCATIONTYPE.CREATE_LOCATION_TYPE 5676 `),a(),e(5,` 5677 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 5678 `),n(8,"p-step-list"),e(9,` 5679 `),n(10,"p-step",6),e(11,` 5680 `),_(12,lb,11,4,"ng-template",null,0,A),e(14,` 5681 `),a(),e(15,` 5682 `),n(16,"p-step",6),e(17,` 5683 `),_(18,sb,11,4,"ng-template",null,0,A),e(20,` 5684 `),a(),e(21,` 5685 `),a(),e(22,` 5686 `),n(23,"p-step-panels"),e(24,` 5687 `),n(25,"p-card"),e(26,` 5688 `),n(27,"div",7),e(28,` 5689 `),n(29,"h4",8),e(30,` 5690 LOCATIONTYPE.DETAILS 5691 `),a(),e(31,` 5692 `),n(32,"qware-location-type-details",9),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))}),e(33,` 5693 `),a(),e(34,` 5694 `),a(),e(35,` 5695 `),n(36,"div",7),e(37,` 5696 `),n(38,"h4",10),e(39,` 5697 LOCATIONTYPE.SETTINGS 5698 `),a(),e(40,` 5699 `),n(41,"qware-location-type-settings",11),e(42,` 5700 `),a(),e(43,` 5701 `),a(),e(44,` 5702 `),n(45,"div",12),e(46,` 5703 `),n(47,"p-button",13),I(48,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(49,` 5704 `),a(),e(50,` 5705 `),n(51,"p-button",14),I(52,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(53,` 5706 `),a(),e(54,` 5707 `),a(),e(55,` 5708 `),a(),e(56,` 5709 `),a(),e(57,` 5710 `),a(),e(58,` 5711 `),a(),e(59,` 5712 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex===0),p("value",1),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.Details)("submitted",t.submitted)("validationErrors",t.validationErrors)("allLocationTypeOptions",t.locationTypeOptions),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.Settings)("submitted",t.submitted)("validationErrors",t.validationErrors),l(6),q("label",y(48,19,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(52,21,t.stepIndex===1?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.stepFormGroups[t.stepIndex]!=null&&t.stepFormGroups[t.stepIndex].valid))}}var im=(()=>{class r{authService;cacheService;fb;locationTypeService;responseService;route;router;toastService;translate;displaySpinner=!0;form;isLoaded=!1;locationTypeOptions=[];stepFormGroups=[];stepIndex=0;submitted=!1;textareaFocused=!1;validationErrors;constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.cacheService=o,this.fb=i,this.locationTypeService=s,this.responseService=c,this.route=u,this.router=x,this.toastService=C,this.translate=O}ngOnInit(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),ParentId:this.fb.control(null,[T.required]),Icon:this.fb.control(null,[T.required])}),Settings:this.fb.group({Address:this.fb.control(!1),Capacity:this.fb.control(!1),SquareFootage:this.fb.control(!1)})}),this.stepFormGroups=[this.form.get("Details"),this.form.get("Settings")],this.locationTypeService.getLocationTypes(this.authService.tenant.Id).subscribe(t=>{let o=t;this.locationTypeOptions=o.filter(i=>i.State===M.ACTIVE).map(i=>({label:i.Name,value:i.Id})),this.locationTypeOptions=tm.default.sortBy(this.locationTypeOptions,i=>(i.label??"").toLowerCase()),this.translate.get("LOCATIONTYPE.NO_PARENT").pipe(N()).subscribe(i=>{this.locationTypeOptions.unshift({label:i,value:void 0})}),this.isLoaded=!0,this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../"+P.list],t)}else this.stepIndex--}stepSubmit(t){this.stepFormGroups[this.stepIndex]?.valid&&(t<1?this.stepIndex++:this.submitForm(new br().parseForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,this.form.get("Details.ParentId")?.value&&(t.ParentId=this.form.get("Details.ParentId")?.value?.value),this.locationTypeService.createLocationType(t).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.stepFormGroups,this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(be),g(yi),g(Re),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-location-type-create"]],standalone:!1,decls:7,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.location-type.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.location-type.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.location-type.create.details.label","translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors","allLocationTypeOptions"],["id","qware.location-type.create.settings.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.location-type.create-location-type.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.location-type.create-location-type.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("key
5712down.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(1,` 5713 `),n(2,"qware-spinner",2),e(3,` 5714 `),_(4,db,60,23),a(),e(5,` 5715`),a(),e(6,` 5716`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,Fl,Ml,ie],encapsulation:2})}return r})();var nm=He(nt());var pb=["actionsMenu"],mb=["shades"],cb=["drawer"],ub=r=>({"lg:col-8":r}),_b=()=>["0","1"];function Eb(r,d){if(r&1&&(e(0,` 5717 `),n(1,"a",26),e(2,` 5718 `),n(3,"span",27),e(4),a(),e(5,` 5719 `),n(6,"span",28),e(7),a(),e(8,` 5720 `),a(),e(9,` 5721 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function Sb(r,d){r&1&&(e(0,` 5722 `),n(1,"span",30),e(2,"SHARED.ACTIONS"),a(),e(3,` 5723 `),n(4,"i",31),e(5,"expand_more"),a(),e(6,` 5724 `))}function xb(r,d){if(r&1){let t=b();e(0,` 5725 `),n(1,"p-button",29),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 5726 `),_(3,Sb,7,0,"ng-template",null,4,A),e(5,` 5727 `),a(),e(6,` 5728 `)}r&2&&(l(),p("raised",!0))}function fb(r,d){if(r&1&&(e(0,` 5729 `),n(1,"a",26),e(2,` 5730 `),n(3,"span",27),e(4),a(),e(5,` 5731 `),n(6,"span",28),e(7),a(),e(8,` 5732 `),a(),e(9,` 5733 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function hb(r,d){if(r&1){let t=b();e(0,` 5734 `),n(1,"div",32),e(2,` 5735 `),n(3,"p-menu",33,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 5736 `),_(6,fb,10,2,"ng-template",null,1,A),e(8,` 5737 `),a(),e(9,` 5738 `),n(10,"p-button",34),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 5739 `),n(12,"i",31),e(13,"more_vert"),a(),e(14,` 5740 `),a(),e(15,` 5741 `),a(),e(16,` 5742 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function Cb(r,d){r&1&&(e(0,` 5743 `),n(1,"i",31),e(2,"expand_less"),a(),e(3,` 5744 `))}function vb(r,d){r&1&&(e(0,` 5745 `),n(1,"i",31),e(2,"expand_more"),a(),e(3,` 5746 `))}function gb(r,d){if(r&1&&(e(0,` 5747 `),_(1,Cb,4,0)(2,vb,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Tb(r,d){r&1&&(e(0,` 5748 `),n(1,"i",31),e(2,"expand_less"),a(),e(3,` 5749 `))}function Ib(r,d){r&1&&(e(0,` 5750 `),n(1,"i",31),e(2,"expand_more"),a(),e(3,` 5751 `))}function bb(r,d){if(r&1&&(e(0,` 5752 `),_(1,Tb,4,0)(2,Ib,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function yb(r,d){if(r&1){let t=b();e(0,` 5753 `),n(1,"p-button",35),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 5754 `),a(),e(4,` 5755 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function Ab(r,d){r&1&&(e(0,` 5756 `),n(1,"div",38),e(2,` 5757 `),n(3,"span",39),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 5758 `),a(),e(6,` 5759 `))}function Rb(r,d){if(r&1){let t=b();e(0,` 5760 `),n(1,"qware-spinner",40),e(2,` 5761 `),n(3,"div",41),e(4,` 5762 `),n(5,"qware-entity-history",42),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 5763 `),a(),e(7,` 5764 `),a(),e(8,` 5765 `),a(),e(9,` 5766 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap),H("parentSpinnerState",t.displayDrawerSpinner)}}function wb(r,d){if(r&1){let t=b();e(0,` 5767 `),n(1,"div",36),e(2,` 5768 `),n(3,"p-drawer",37,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 5769 `),_(6,Ab,7,0,"ng-template",null,7,A),e(8,` 5770 `),_(9,Rb,10,6,"ng-template",null,4,A),e(11,` 5771 `),a(),e(12,` 5772 `),a(),e(13,` 5773 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var am=(()=>{class r{authService;cacheService;confirmationService;fb;locationTypeService;responseService;route;toastService;translate;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];displaySpinner=!0;form;historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;locationType;locationTypeOptions=[];moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;validationErrors;auditLoggingDisabled=!0;locationTypeListRoute="../../../"+P.locationType+"/"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};icons=[];parentLocationType;shadeFormGroups=[];translations={};constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.cacheService=o,this.confirmationService=i,this.fb=s,this.locationTypeService=c,this.responseService=u,this.route=x,this.toastService=C,this.translate=O,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","LOCATIONTYPE.NO_PARENT","SHARED.DISABLED","SHARED.DELETED","AUDIT.LOCATION_TYPE","LOCATIONTYPEICONS.BUILDING","LOCATIONTYPEICONS.CAMPUS","LOCATIONTYPEICONS.CELL","LOCATIONTYPEICONS.COUNTRY","LOCATIONTYPEICONS.FLOOR","LOCATIONTYPEICONS.GROUNDS","LOCATIONTYPEICONS.PARKING_LOT","LOCATIONTYPEICONS.ROAD","LOCATIONTYPEICONS.ROOM","LOCATIONTYPEICONS.ZONE"]).pipe(N()),this.locationTypeService.getLocationTypes(this.authService.tenant.Id),this.locationTypeService.getLocationType(this.route.
5773snapshot.params.id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1],i=t[2];this.historyIdMap=new Map,this.moreItems=[{label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let s=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableLocationType()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableLocationType()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteLocationType()}];i?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&s.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreLocationType()}),this.actionItems=s.filter(u=>i?.State===M.DISABLED?u.id!=="disable.action":i?.State===M.DELETED?u.id!=="disable.action"&&u.id!=="enable.action"&&u.id!=="delete.action":u.id!=="enable.action"),this.locationTypeOptions=[{label:this.translations["LOCATIONTYPE.NO_PARENT"],value:void 0}],this.locationTypeOptions=this.locationTypeOptions.concat(o.filter(u=>u.State===M.ACTIVE).map(u=>({label:u.Name,value:u.Id})));let c=i.ParentId;if(c&&(this.parentLocationType=o.find(u=>u.Id===c),i.Parent=this.parentLocationType),this.locationType=Object.assign(new br,i),this.form.get("Details.ParentId")?.disable(),!this.locationTypeOptions.find(u=>u.value===i.ParentId)){let u=o.find(x=>x.Id===i.ParentId);if(u){let x=u.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":u.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.locationTypeOptions.push({label:u.Name+x,value:u.Id})}}this.icons=[{Name:this.translations["LOCATIONTYPEICONS.BUILDING"],Image:"assets/icons/location-types/building.svg"},{Name:this.translations["LOCATIONTYPEICONS.CAMPUS"],Image:"assets/icons/location-types/campus.svg"},{Name:this.translations["LOCATIONTYPEICONS.CELL"],Image:"assets/icons/location-types/cell.svg"},{Name:this.translations["LOCATIONTYPEICONS.COUNTRY"],Image:"assets/icons/location-types/country.svg"},{Name:this.translations["LOCATIONTYPEICONS.FLOOR"],Image:"assets/icons/location-types/floor.svg"},{Name:this.translations["LOCATIONTYPEICONS.GROUNDS"],Image:"assets/icons/location-types/grounds.svg"},{Name:this.translations["LOCATIONTYPEICONS.PARKING_LOT"],Image:"assets/icons/location-types/parking.svg"},{Name:this.translations["LOCATIONTYPEICONS.ROAD"],Image:"assets/icons/location-types/road.svg"},{Name:this.translations["LOCATIONTYPEICONS.ROOM"],Image:"assets/icons/location-types/room.svg"},{Name:this.translations["LOCATIONTYPEICONS.ZONE"],Image:"assets/icons/location-types/zone.svg"}],this.setHistoryParams(),this.form.patchValue(new br().toForm(i)),this.locationType.State==="DELETED"&&this.form.disable(),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.locationTypeListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),ParentId:this.fb.control(null,[T.required]),Icon:this.fb.control("",[T.required])}),Settings:this.fb.group({Address:this.fb.control(!1),Capacity:this.fb.control(!1),SquareFootage:this.fb.control(!1)})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("Settings")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.LOCATION_TYPE"]+' "'+this.locationType?.Name+'"';let t=new Map;t.set("Icon",[this.icons,"Image","Name"]),this.historyIdMap=t;let o=new Map;o.set("Name","LOCATIONTYPE.NAME"),o.set("Description","LOCATIONTYPE.DESCRIPTION"),o.set("Icon","LOCATIONTYPE.ICON"),o.set("Address","LOCATIONTYPE.TRACK_ADDRESS"),o.set("Capacity","LOCATIONTYPE.TRACK_CAPACITY"),o.set("SquareFootage","LOCATIONTYPE.TRACK_SQUARE_FOOTAGE"),this.historyNameMap=o}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new br().parseForm(this.form.value);t.Id=this.locationType?.Id,t.TenantId=this.authService.tenant.Id,t.ParentId=this.locationType?.ParentId,t.State=this.locationType?.State??M.ACTIVE,this.form.get("Details.ParentId")?.value&&(t.ParentId=this.form.get("Details.ParentId")?.value?.value),this.locationTypeService.updateLocationType(t).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.SAVE",this.locationTypeListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableLocationType(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.locationType?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.locationType?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.locationTypeService.disableLocationType(this.locationType.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.DISABLE",this.locationTypeListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableLocationType(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE","SHARED.ERROR_LABEL","SHARED.DISABLED_PARENT"],{entity:this.locationType?.Name}).pipe(N()).subscribe(t=>{this.parentLocationType&&this.parentLocationType.State===M.DISABLED?this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.DISABLED_PARENT"]):this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.locationType?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.locationTypeService.enableLocationType(this.locationType.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.ENABLE",this.locationTypeListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteLocationType(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.locationType?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.locationType?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.locationTypeService.deleteLocationType(this.locationType.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.DELETE",this.locationTypeListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreLocationType(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.locationType?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.locationType?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.locationTypeService.restoreLocationType(this.locationType.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATION_TYPES),this.displaySpinner=!1,this.responseService.onSuccess("LOCATIONTYPE.SUCCESS.RESTORE",this.locationTypeListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=nm.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(mt),g(be),g(yi),g(Re),g(he),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-location-type-edit"]],viewQuery:function(o,i){if(o&1&&(X(pb,7),X(mb,7),X(cb,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:90,vars:35,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.location-type.edit",1,"grid"],["id","qware.location-type.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.location-type.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.location-type.edit.edit.actions-menu",3,"model","popup"],["id","qware.location-type.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.location-type.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"form","submitted","autoFocus","validationErrors","allLocationTypeOptions"],["id","qware.location-type.edit.settings-shade","value","1"],[3,"form","submitted","validationErrors"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.location-type.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.location-type.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.location-type.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.location-type.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.location-type.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.location-type.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.location-type.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","locationType",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","parentSpinnerState"]],template:function(o,i){o&1&&(n(0,"div",8),e(1,` 5774 `),n(2,"div",9),e(3,`
5775 `),n(4,"div",10),e(5,` 5776 `),n(6,"h3",11),e(7,` 5777 LOCATIONTYPE.EDIT_LOCATION_TYPE 5778 `),a(),e(8,` 5779 `),n(9,"div",12),e(10,` 5780 `),n(11,"p-menu",13,0),e(13,` 5781 `),_(14,Eb,10,2,"ng-template",null,1,A),e(16,` 5782 `),a(),e(17,` 5783 `),_(18,xb,7,1),a(),e(19,` 5784 `),_(20,hb,17,4),a(),e(21,` 5785 `),n(22,"qware-spinner",14),e(23,` 5786 `),n(24,"p-card",15),e(25,` 5787 `),n(26,"qware-edit-lock",16),e(27,` 5788 `),n(28,"p-accordion",17,2),e(30,` 5789 `),n(31,"p-accordion-panel",18),e(32,` 5790 `),n(33,"p-accordion-header"),e(34),I(35,"translate"),_(36,gb,3,1,"ng-template",null,3,A),e(38,` 5791 `),a(),e(39,` 5792 `),n(40,"p-accordion-content"),e(41,` 5793 `),n(42,"div",19),e(43,` 5794 `),n(44,"div",20),e(45,` 5795 `),n(46,"qware-location-type-details",21),e(47,` 5796 `),a(),e(48,` 5797 `),a(),e(49,` 5798 `),a(),e(50,` 5799 `),a(),e(51,` 5800 `),a(),e(52,` 5801 `),n(53,"p-accordion-panel",22),e(54,` 5802 `),n(55,"p-accordion-header"),e(56),I(57,"translate"),_(58,bb,3,1,"ng-template",null,3,A),e(60,` 5803 `),a(),e(61,` 5804 `),n(62,"p-accordion-content"),e(63,` 5805 `),n(64,"div",19),e(65,` 5806 `),n(66,"div",20),e(67,` 5807 `),n(68,"qware-location-type-settings",23),e(69,` 5808 `),a(),e(70,` 5809 `),a(),e(71,` 5810 `),a(),e(72,` 5811 `),a(),e(73,` 5812 `),a(),e(74,` 5813 `),a(),e(75,` 5814 `),a(),e(76,` 5815 `),n(77,"div",24),e(78,` 5816 `),n(79,"p-button",25),I(80,"translate"),e(81,` 5817 `),a(),e(82,` 5818 `),_(83,yb,5,5),a(),e(84,` 5819 `),a(),e(85,` 5820 `),a(),e(86,` 5821 `),a(),e(87,` 5822 `),_(88,wb,14,6),a(),e(89,` 5823`)),o&2&&(l(2),p("ngClass",pe(32,ub,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.locationType!==void 0&&i.locationType.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(34,_b)),l(6),K(` 5824 `,y(35,26,"LOCATIONTYPE.DETAILS"),` 5825 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted)("autoFocus",!1)("validationErrors",i.validationErrors)("allLocationTypeOptions",i.locationTypeOptions),l(10),K(` 5826 `,y(57,28,"LOCATIONTYPE.SETTINGS"),` 5827 `),l(12),p("form",i.form.controls.Settings)("submitted",i.submitted)("validationErrors",i.validationErrors),l(11),q("label",y(80,30,"SHARED.CANCEL")),p("routerLink",i.locationTypeListRoute)("text",!0),l(4),f((i.locationType==null?null:i.locationType.State)!=="DELETED"?83:-1),l(5),f(i.auditLoggingDisabled?-1:88))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,Fl,Ml,ie],encapsulation:2})}return r})();var rm=He(nt());function Db(r,d){if(r&1){let t=b();e(0,` 5828 `),n(1,"div",9),e(2,` 5829 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 5830 `),n(7,"p-toggleswitch",10),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 5831 `),a(),e(9,` 5832 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}var om=(()=>{class r{authService;locationTypeService;displaySpinner=D(!0);allLocationTypes=[];locationTypeTreeNodes=[];privilegesEnum=ae;showDeleted=!1;locationTypeCreateRoute="../"+P.create;locationTypeEditRoute="../"+P.edit;storageKey=Oe.LOC_TYPES_FILTER_STORAGE_KEY;canViewDeleted=!1;constructor(t,o){this.authService=t,this.locationTypeService=o,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED)}ngOnInit(){this.locationTypeService.getLocationTypes(this.authService.tenant.Id).subscribe(t=>{let o=t;this.allLocationTypes=rm.default.sortBy(o,s=>(s.Name??"").toLowerCase());let i=this.filterLocationTypes(this.allLocationTypes);this.locationTypeTreeNodes=i.map(s=>this.locationTypeService.convertToTreeNode(s)),(!o||o.length===0)&&this.displaySpinner.set(!1)})}filterLocationTypes(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}toggleShowDeleted(){let t=this.filterLocationTypes(this.allLocationTypes);this.locationTypeTreeNodes=t.map(o=>this.locationTypeService.convertToTreeNode(o))}static \u0275fac=function(o){return new(o||r)(g(de),g(yi))};static \u0275cmp=B({type:r,selectors:[["qware-location-type-list"]],standalone:!1,decls:28,vars:13,consts:[["spinner",""],[1,"align-items-center","col-12"],["translate","","id","qware.location-types.list.page-header",1,"page-header"],[1,"col-12",2,"padding-top","0"],["id","qware.location-type.list.spinner",3,"displaySpinner"],["selectionType","multiple",3,"parentSpinnerStateChange","primaryNodes","allowFilter","showExpandAllButton","editRoute","searchFilterStorageKey","removeDeleted","removeDisabled","showCheckboxes","parentSpinnerState"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button","id","qware.location-types.list.create-button",3,"raised","routerLink"],[1,"material-icons"],[1,"show-deleted-switch"],["id","qware.location-types.list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"]],template:function(o,i){if(o&1){let s=b();n(0,"div"),e(1,` 5833 `),n(2,"div",1),e(3,` 5834 `),n(4,"h3",2),e(5,` 5835 LOCATIONTYPE.LOCATION_TYPE_MANAGEMENT 5836 `),a(),e(6,` 5837 `),_(7,Db,10,4),a(),e(8,` 5838 `),n(9,"div",3),e(10,` 5839 `),n(11,"qware-spinner",4,0),e(13,` 5840 `),n(14,"qware-hierarchy-picker",5),j("parentSpinnerStateChange",function(u){return E(s),W(i.displaySpinner,u)||(i.displaySpinner=u),S(u)}),e(15,` 5841 `),a(),e(16,` 5842 `),n(17,"div",6),e(18,` 5843 `),n(19,"p-button",7),e(20,` 5844 `),n(21,"i",8),e(22,"add"),a(),e(23,` 5845 `),a(),e(24,` 5846 `),a(),e(25,` 5847 `),a(),e(26,` 5848 `),a(),e(27,` 5849`),a()}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(4),p("displaySpinner",i.displaySpinner()),l(3),p("primaryNodes",i.locationTypeTreeNodes)("allowFilter",!0)("showExpandAllButton",!0)("editRoute",i.locationTypeEditRoute)("searchFilterStorageKey",i.storageKey)("removeDeleted",!1)("removeDisabled",!1)("showCheckboxes",!1),H("parentSpinnerState",i.displaySpinner),l(5),q("routerLink",i.locationTypeCreateRoute),p("raised",!0))},dependencies:[oe,se,Le,Ri,me,et,Ai,$,ie],encapsulation:2})}return r})();var Js=He(nt());
5849function Lb(r,d){if(r&1&&(e(0,` 5850 `),n(1,"div",0),e(2,` 5851 `),n(3,"div",1),e(4,` 5852 `),n(5,"div",2),e(6,` 5853 `),n(7,"qware-assignments",3),e(8,` 5854 `),a(),e(9,` 5855 `),a(),e(10,` 5856 `),a(),e(11,` 5857 `),a(),e(12,` 5858`)),r&2){let t,o=m();l(),p("formGroup",o.formGroup()),l(6),p("allUserOptions",o.userOptions())("assignmentType",o.assignmentType)("entityId",(t=o.location())==null?null:t.Id)("formGroup",o.formGroup())("validationErrors",o.validationErrors())("submitted",o.submitted())}}var qr=(()=>{class r{formGroup=ee();location=ee();submitted=ee(!1);userOptions=ee([]);validationErrors=ee();assignmentType=p0.LOCATION_ASSIGNMENT;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-assignments"]],inputs:{formGroup:[1,"formGroup"],location:[1,"location"],submitted:[1,"submitted"],userOptions:[1,"userOptions"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:1,vars:1,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],[2,"padding","0.5rem 0.5rem 1rem"],[3,"allUserOptions","assignmentType","entityId","formGroup","validationErrors","submitted"]],template:function(o,i){o&1&&_(0,Lb,13,7),o&2&&f(i.formGroup()?0:-1)},dependencies:[ge,D0,Te],encapsulation:2,changeDetection:0})}return r})();var Br=(()=>{class r{form;submitted=!1;userTreeNodes=[];validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-associated-users"]],inputs:{form:"form",submitted:"submitted",userTreeNodes:"userTreeNodes",validationErrors:"validationErrors"},standalone:!1,decls:12,vars:8,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],[1,"single-layer",2,"padding","1rem 1rem 1.5rem"],["formControlName","Users","selectionType","hierarchy",3,"primaryNodes","allowFilter","showSelectionOptions","selectionOptionsLabel","matchFilterOnParents"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 5859 `),n(2,"div",1),e(3,` 5860 `),n(4,"div",2),e(5,` 5861 `),n(6,"qware-hierarchy-picker",3),I(7,"translate"),e(8,` 5862 `),a(),e(9,` 5863 `),a(),e(10,` 5864 `),a(),e(11,` 5865`),a()),o&2&&(p("formGroup",i.form),l(6),q("selectionOptionsLabel",y(7,6,"LOCATION.USER_SELECT")),p("primaryNodes",i.userTreeNodes)("allowFilter",!0)("showSelectionOptions",!0)("matchFilterOnParents",!0))},dependencies:[se,ge,Ri,Te,De,ie],encapsulation:2})}return r})();var Nb=["attachments"];function Ob(r,d){if(r&1&&(e(0,` 5866 `),n(1,"small",5),e(2,` 5867 `),n(3,"div",6),e(4),a(),e(5,` 5868 `),a(),e(6,` 5869 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Fb(r,d){if(r&1&&(e(0,` 5870 `),G(1,Ob,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Attachments)}}var Hr=(()=>{class r{attachments;disableAllControls=!1;docs=[];form;location;submitted=!1;validationErrors;docsChanged=new Yt;setDocs(t){t instanceof Event||this.docsChanged.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-attachments"]],viewQuery:function(o,i){if(o&1&&X(Nb,7),o&2){let s;Y(s=Q())&&(i.attachments=s.first)}},inputs:{disableAllControls:"disableAllControls",docs:"docs",form:"form",location:"location",submitted:"submitted",validationErrors:"validationErrors"},outputs:{docsChanged:"docsChanged"},standalone:!1,decls:14,vars:5,consts:[["attachments",""],[1,"grid"],[1,"col-12"],[1,"relative",2,"padding","0.75rem 1rem 1.5rem"],[3,"docsChanged","form","docs","entity","disableAllControls"],[1,"validation-error"],["translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 5871 `),n(2,"div",2),e(3,` 5872 `),n(4,"div",3),e(5,` 5873 `),n(6,"qware-attachments",4,0),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(8,` 5874 `),a(),e(9,` 5875 `),_(10,Fb,3,0),a(),e(11,` 5876 `),a(),e(12,` 5877`),a(),e(13,` 5878`)}o&2&&(l(6),p("form",i.form)("docs",i.docs)("entity",i.location)("disableAllControls",i.disableAllControls),l(4),f(i.validationErrors&&i.validationErrors.Attachments&&i.form.controls.Documents.untouched?10:-1))},dependencies:[ta,$],encapsulation:2})}return r})();var Mb=()=>({standalone:!0}),Ub=r=>({numItems:r});function Pb(r,d){if(r&1){let t=b();e(0,` 5879 `),n(1,"div",10),e(2,` 5880 `),n(3,"label"),e(4,` 5881 `),n(5,"span"),e(6),I(7,"translate"),a(),e(8,` 5882 `),a(),e(9,` 5883 `),n(10,"p-checkbox",11),h("onChange",function(i){E(t);let s=m(2);return S(s.setEventScheduleChanged(i))}),a(),e(11,` 5884 `),a(),e(12,` 5885 `)}r&2&&(l(6),v(y(7,2,"LOCATION.ENABLE_EVENT_SCHEDULING")),l(4),p("binary",!0))}
5885function Gb(r,d){if(r&1&&(e(0,` 5886 `),n(1,"span",13),e(2),I(3,"translate"),a(),e(4,` 5887 `)),r&2){let t=m(3);l(2),K(` 5888 `,$e(3,1,"LOCATION.SET_AS_STOREROOM_SUBTEXT",pe(4,Ub,t.inventoryItemCount())),` 5889 `)}}function kb(r,d){if(r&1){let t=b();e(0,` 5890 `),n(1,"div",10),e(2,` 5891 `),n(3,"label"),e(4,` 5892 `),n(5,"span"),e(6),I(7,"translate"),_(8,Gb,5,6),a(),e(9,` 5893 `),a(),e(10,` 5894 `),n(11,"p-checkbox",12),h("onChange",function(i){E(t);let s=m(2);return S(s.storeroomOnChange(i))}),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.isStoreroom,i)||(s.isStoreroom=i),S(i)}),e(12,` 5895 `),a(),e(13,` 5896 `),a(),e(14,` 5897 `)}if(r&2){let t=m(2);l(6),K("",y(7,6,"LOCATION.SET_AS_STOREROOM"),` 5898 `),l(2),f(t.inventoryItemCount()>0?8:-1),l(3),p("disabled",t.inventoryItemCount()>0&&t.isStoreroom())("ngModelOptions",ne(8,Mb))("binary",!0),H("ngModel",t.isStoreroom)}}function Vb(r,d){if(r&1&&(e(0,` 5899 `),n(1,"div",9),e(2,` 5900 `),_(3,Pb,13,4)(4,kb,15,9),a(),e(5,` 5901 `)),r&2){let t=m();l(3),f(t.hasEventsModule()?3:-1),l(),f(t.inventoryManagementDisabled()?-1:4)}}function qb(r,d){if(r&1&&(e(0,` 5902 `),n(1,"small",19),e(2,` 5903 `),n(3,"div",6),e(4),a(),e(5,` 5904 `),a(),e(6,` 5905 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Bb(r,d){if(r&1&&(e(0,` 5906 `),G(1,qb,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().Name)}}function Hb(r,d){if(r&1&&(e(0,` 5907 `),n(1,"div",14),e(2,` 5908 `),n(3,"div",3),e(4,` 5909 `),n(5,"p-floatlabel"),e(6,` 5910 `),R(7,"input",15),e(8,` 5911 `),n(9,"label",16),e(10,` 5912 `),n(11,"span",6),e(12,"LOCATION.NAME"),a(),n(13,"span",17),e(14," *"),a(),e(15,` 5913 `),a(),e(16,` 5914 `),a(),e(17,` 5915 `),n(18,"small",7),e(19,` 5916 `),n(20,"div",18),e(21,` 5917 LOCATION.ERROR.NAME_REQUIRED 5918 `),a(),e(22,` 5919 `),n(23,"div",8),e(24,` 5920 LOCATION.ERROR.NAME_LENGTH 5921 `),a(),e(25,` 5922 `),a(),e(26,` 5923 `),_(27,Bb,3,0),a(),e(28,` 5924 `),a(),e(29,` 5925 `)),r&2){let t,o,i=m();l(7),p("fluid",!0)("qwareFocus",i.autoFocus()),l(11),p("hidden",i.form().controls.Name.valid||i.form().controls.Name.pristine&&!i.submitted()),l(2),p("hidden",!((t=i.form().controls.Name.errors)!=null&&t.required)),l(3),p("hidden",!((o=i.form().controls.Name.errors)!=null&&o.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Name&&i.form().controls.Name.untouched?27:-1)}}function Wb(r,d){if(r&1&&(e(0,` 5926 `),n(1,"small",19),e(2,` 5927 `),n(3,"div",6),e(4),a(),e(5,` 5928 `),a(),e(6,` 5929 `)),r&2){let t=d.$implicit;l(4),v(t)}}function jb(r,d){if(r&1&&(e(0,` 5930 `),G(1,Wb,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Description)}}function Yb(r,d){if(r&1&&(e(0,` 5931 `),n(1,"small",19),e(2,` 5932 `),n(3,"div",6),e(4),a(),e(5,` 5933 `),a(),e(6,` 5934 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Qb(r,d){if(r&1&&(e(0,` 5935 `),G(1,Yb,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().LocationTypeId)}}function Kb(r,d){if(r&1){let t=b();e(0,` 5936 `),n(1,"div",20),e(2,` 5937 `),n(3,"qware-hierarchy-picker",21),I(4,"translate"),h("changed",function(i){E(t);let s=m();return S(s.locationTypeChanged(i))}),e(5,` 5938 `),a(),e(6,` 5939 `),n(7,"div"),e(8,` 5940 `),n(9,"small",7),e(10,` 5941 `),n(11,"div",22),e(12,` 5942 LOCATION.ERROR.LOCATIONTYPE_REQUIRED 5943 `),a(),e(13,` 5944 `),a(),e(14,` 5945 `),n(15,"small",7),e(16,` 5946 `),n(17,"div",23),e(18,` 5947 LOCATION.ERROR.LOCATION_CREATED_NEEDS_PARENT 5948 `),a(),e(19,` 5949 `),a(),e(20,` 5950 `),_(21,Qb,3,0),a(),e(22,` 5951 `),a(),e(23,` 5952 `)}if(r&2){let t,o,i=m();l(3),q("label",y(4,9,"LOCATION.LOCATION_TYPE")),p("primaryNodes",i.locationTypeTreeNodes())("requiredMark",!0)("showExpandAllButton",!0),l(6),p("hidden",i.form().controls.LocationTypeId.valid||i.form().controls.LocationTypeId.pristine&&!i.submitted()),l(2),p("hidden",!((t=i.form().controls.LocationTypeId.errors)!=null&&t.required)),l(4),p("hidden",i.form().controls.LocationTypeId.valid||i.form().controls.LocationTypeId.pristine&&!i.submitted()),l(2),p("hidden",!((o=i.form().controls.LocationTypeId.errors)!=null&&o.forbiddenLocationTypeSelection)),l(4),f(i.validationErrors()&&i.validationErrors().LocationTypeId&&i.form().controls.LocationTypeId.untouched?21:-1)}}function $b(r,d){r&1&&(e(0,` 5953 `),n(1,"div",14),e(2,` 5954 `),n(3,"div",3),e(4,` 5955 `),n(5,"p-floatlabel"),e(6,` 5956 `),R(7,"input",24),e(8,` 5957 `),n(9,"label",25),e(10,` 5958 `),n(11,"span",6),e(12,"LOCATION.LATITUDE"),a(),e(13,` 5959 `),a(),e(14,` 5960 `),a(),e(15,` 5961 `),a(),e(16,` 5962 `),a(),e(17,` 5963 `)),r&2&&(l(7),p("fluid",!0))}function zb(r,d){r&1&&(e(0,` 5964 `),n(1,"div",26),e(2,` 5965 `),n(3,"div",3),e(4,` 5966 `),n(5,"p-floatlabel"),e(6,` 5967 `),R(7,"input",27),e(8,` 5968 `),n(9,"label",28),e(10,` 5969 `),n(11,"span",6),e(12,"LOCATION.LONGITUDE"),a(),e(13,` 5970 `),a(),e(14,` 5971 `),a(),e(15,` 5972 `),a(),e(16,` 5973 `),a(),e(17,` 5974 `)),r&2&&(l(7),p("fluid",!0))}function Xb(r,d){if(r&1&&(e(0,` 5975 `),n(1,"small",19),e(2,` 5976 `),n(3,"div",6),e(4),a(),e(5,` 5977 `),a(),e(6,` 5978 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Zb(r,d){if(r&1&&(e(0,` 5979 `),G(1,Xb,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().Address)}}function Jb(r,d){if(r&1&&(e(0,` 5980 `),n(1,"div",29),e(2,` 5981 `),n(3,"div",3),e(4,` 5982 `),n(5,"p-floatlabel"),e(6,` 5983 `),R(7,"input",30),e(8,` 5984 `),n(9,"label",31),e(10,` 5985 `),n(11,"span",6),e(12,"LOCATION.ADDRESS"),a(),e(13,` 5986 `),a(),e(14,` 5987 `),a(),e(15,` 5988 `),n(16,"small",7),e(17,` 5989 `),n(18,"div",32),e(19,` 5990 LOCATION.ERROR.ADDRESS_LENGTH 5991 `),a(),e(20,` 5992 `),a(),e(21,` 5993 `),_(22,Zb,3,0),a(),e(23,` 5994 `),a(),e(24,` 5995 `)),r&2){let t,o=m();l(),Bt(o.isBulkEdit()?"second-column":"first-column"),l(6),p("fluid",!0),l(9),p("hidden",o.form().controls.Address.valid||o.form().controls.Address.pristine&&!o.submitted()),l(2),p("hidden",!((t=o.form().controls.Address.errors)!=null&&t.maxLength)),l(4),f(o.validationErrors()&&o.validationErrors().Address&&o.form().controls.Address.untouched?22:-1)}}function ey(r,d){if(r&1&&(e(0,` 5996 `),n(1,"small",19),e(2,` 5997 `),n(3,"div",6),e(4),a(),e(5,` 5998 `),a(),e(6,` 5999 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ty(r,d){if(r&1&&(e(0,` 6000 `),G(1,ey,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().Capacity)}}function iy(r,d){if(r&1&&(e(0,` 6001 `),n(1,"div",29),e(2,` 6002 `),n(3,"div",3),e(4,` 6003 `),n(5,"p-floatlabel"),e(6,` 6004 `),R(7,"input",33),e(8,` 6005 `),n(9,"label",34),e(10,` 6006 `),n(11,"span",6),e(12,"LOCATION.CAPACITY"),a(),e(13,` 6007 `),a(),e(14,` 6008 `),a(),e(15,` 6009 `),n(16,"small",7),e(17,` 6010 `),n(18,"div",35),e(19,` 6011 LOCATION.ERROR.CAPACITY_LENGTH 6012 `),a(),e(20,` 6013 `),n(21,"div",36),e(22,` 6014 LOCATION.ERROR.CAPACITY_FORMAT 6015 `),a(),e(23,` 6016 `),a(),e(24,` 6017 `),_(25,ty,3,0),a(),e(26,` 6018 `),a(),e(27,` 6019 `)),r&2){let t,o,i=m();l(),Bt(i.isBulkEdit()?"first-column":"second-column"),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.Capacity.valid||i.form().controls.Capacity.pristine&&!i.submitted()),l(2),p("hidden",!((t=i.form().controls.Capacity.errors)!=null&&t.maxLength)),l(3),p("hidden",!((o=i.form().controls.Capacity.errors)!=null&&o.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().Capacity&&i.form().controls.Capacity.untouched?25:-1)}}function ny(r,d){if(r&1&&(e(0,` 6020 `),n(1,"small",19),e(2,` 6021 `),n(3,"div",6),e(4),a(),e(5,` 6022 `),a(),e(6,` 6023 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ay(r,d){if(r&1&&(e(0,` 6024 `),G(1,ny,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().SquareFootage)}}function ry(r,d){if(r&1&&(e(0,` 6025 `),n(1,"div",29),e(2,` 6026 `),n(3,"div",3),e(4,` 6027 `),n(5,"p-floatlabel"),e(6,` 6028 `),R(7,"input",37),e(8,` 6029 `),n(9,"label",38),e(10,` 6030 `),n(11,"span",6),e(12,"LOCATION.SQUARE_FOOTAGE"),a(),e(13,` 6031 `),a(),e(14,` 6032 `),a(),e(15,` 6033 `),n(16,"small",7),e(17,` 6034 `),n(18,"div",39),e(19,` 6035 LOCATION.ERROR.SQUARE_FOOTAGE_LENGTH 6036 `),a(),e(20,` 6037 `),n(21,"div",40),e(22,` 6038 LOCATION.ERROR.SQUARE_FOOTAGE_FORMAT 6039 `),a(),e(23,` 6040 `),a(),e(24,` 6041 `),_(25,ay,3,0),a(),e(26,` 6042 `),a(),e(27,` 6043 `)),r&2){let t,o,i=m();l(),Bt(i.isBulkEdit()?"second-column":"first-column"),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.SquareFootage.valid||i.form().controls.SquareFootage.pristine&&!i.submitted()),l(2),p("hidden",!((t=i.form().controls.SquareFootage.errors)!=null&&t.maxLength)),l(3),p("hidden",!((o=i.form().controls.SquareFootage.errors)!=null&&o.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().SquareFootage&&i.form().controls.SquareFootage.untouched?25:-1)}}var Wr=(()=>{class r{authService=te(de);autoFocus=ee(!0);form=ee.required();inventoryItemCount=ee(0);isBulkEdit=ee(!1);isStoreroom=bn(!1);locationTypeTreeNodes=ee([]);submitted=ee(!1);validationErrors=ee();eventSchedulingChanged=Dt();isStoreroomChanged=Dt();locationTypeChange=Dt();textareaFocusChange=Dt();selectedLocationType=D(void 0);inventoryManagementDisabled=D(!1);hasEventsModule=D(!1);hasGisModule=D(!1);constructor(){this.inventoryManagementDisabled.set(!this.authService.qwareSubscription?.inventoryManagement),this.hasEventsModule.set(this.authService.tenant.EventsModule),this.hasGisModule.set(this.authService.tenant.GisModule)}locationTypeChanged(t){t&&t.node&&(this.selectedLocationType.set(t.node[0]),this.locationTypeChange.emit(t))}textareaFocus(t){this.textareaFocusChange.emit(t)}storeroomOnChange(t){t&&t.checked!==void 0&&(this.isStoreroomChanged.emit(t.checked),this.form().markAsDirty())}setEventScheduleChanged(t){this.eventSchedulingChanged.emit(t.checked)}static \u0275fac=function(o){return new(o||r)};
6043static \u0275cmp=B({type:r,selectors:[["qware-location-details"]],inputs:{autoFocus:[1,"autoFocus"],form:[1,"form"],inventoryItemCount:[1,"inventoryItemCount"],isBulkEdit:[1,"isBulkEdit"],isStoreroom:[1,"isStoreroom"],locationTypeTreeNodes:[1,"locationTypeTreeNodes"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{isStoreroom:"isStoreroomChange",eventSchedulingChanged:"eventSchedulingChanged",isStoreroomChanged:"isStoreroomChanged",locationTypeChange:"locationTypeChange",textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:37,vars:18,consts:[[1,"grid",3,"formGroup"],[1,"grid","zipper"],[1,"col-12","lg:col-6","md:col-6","field-container",2,"padding-bottom","0 !important"],[1,"medium-input"],["tabindex","2","id","qware.location.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.location.details.label.description","for","qware.location.details.textarea.description"],["translate",""],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"flex-inline","align-right","full-width"],[1,"toggle"],["formControlName","EventScheduling",3,"onChange","binary"],[3,"onChange","ngModelChange","disabled","ngModelOptions","binary","ngModel"],[1,"toggle-subtext"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],["id","qware.location.details.input.name","tabindex","1","variant","filled","type","text","pInputText","","name","Name","formControlName","Name",3,"fluid","qwareFocus"],["id","qware.location.details.label.name","for","qware.location.details.input.name"],[1,"required-mark"],["id","qware.location.details.error.name-req","translate","",3,"hidden"],[1,"validation-error"],[1,"col-12",2,"padding","0 1.5rem 1.75rem","margin-top","-0.75rem"],["formControlName","LocationTypeId","selectionType","single",3,"changed","primaryNodes","label","requiredMark","showExpandAllButton"],["id","qware.location.details.error.LocationType-req","translate","",3,"hidden"],["id","qware.location.details.error.LocationType-noParentLocation","translate","",3,"hidden"],["id","qware.location.details.input.latitude","variant","filled","type","text","pInputText","","name","Latitude","formControlName","Latitude",3,"fluid"],["id","qware.location.details.label.latitude","for","qware.location.details.input.latitude"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.location.details.input.longitude","variant","filled","type","text","pInputText","","name","Longitude","formControlName","Longitude",3,"fluid"],["id","qware.location.details.label.longitude","for","qware.location.details.input.longitude"],[1,"col-12","lg:col-6","md:col-6","field-container"],["id","qware.location.details.input.address","tabindex","3","variant","filled","type","text","pInputText","","name","Address","formControlName","Address",3,"fluid"],["id","qware.location.details.label.address","for","qware.location.details.input.address"],["id","qware.location.details.error.Address-length","translate","",3,"hidden"],["id","qware.location.details.input.capacity","tabindex","4","variant","filled","type","text","pInputText","","name","Capacity","formControlName","Capacity",3,"fluid"],["id","qware.location.details.label.capacity","for","qware.location.details.input.capacity"],["id","qware.location.details.error.Capacity-length","translate","",3,"hidden"],["id","qware.location.details.error.Capacity-format","translate","",3,"hidden"],["id","qware.location.details.input.SquareFootage","tabindex","5","variant","filled","type","text","pInputText","","name","SquareFootage","formControlName","SquareFootage",3,"fluid"],["id","qware.location.details.label.SquareFootage","for","qware.location.details.input.SquareFootage"],["id","qware.location.details.error.SquareFootage-length","translate","",3,"hidden"],["id","qware.location.details.error.SquareFootage-format","translate","",3,"hidden"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 6044 `),_(2,Vb,6,2),n(3,"div",1),e(4,` 6045 `),_(5,Hb,30,6),n(6,"div",2),e(7,` 6046 `),n(8,"div",3),e(9,` 6047 `),n(10,"p-floatlabel"),e(11,` 6048 `),n(12,"textarea",4),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),a(),e(13,` 6049 `),n(14,"label",5),e(15,` 6050 `),n(16,"span",6),e(17,"LOCATION.DESCRIPTION"),a(),e(18,` 6051 `),a(),e(19,` 6052 `),a(),e(20,` 6053 `),n(21,"small",7),e(22,` 6054 `),n(23,"div",8),e(24,` 6055 LOCATION.ERROR.DESCRIPTION_LENGTH 6056 `),a(),e(25,` 6057 `),a(),e(26,` 6058 `),_(27,jb,3,0),a(),e(28,` 6059 `),a(),e(29,` 6060 6061 `),_(30,Kb,24,11)(31,$b,18,1)(32,zb,18,1)(33,Jb,25,6)(34,iy,28,7)(35,ry,28,7),a(),e(36,` 6062`),a()),o&2){let s,c,u,x;p("formGroup",i.form()),l(2),f(i.hasEventsModule()||!i.inventoryManagementDisabled()?2:-1),l(3),f(i.isBulkEdit()?-1:5),l(),Bt(i.isBulkEdit()?"first-column":"second-column"),l(6),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(9),p("hidden",i.form().controls.Description.valid||i.form().controls.Description.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.Description.errors)!=null&&s.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Description&&i.form().controls.Description.untouched?27:-1),l(3),f(i.isBulkEdit()?-1:30),l(),f(i.hasGisModule()&&i.form().controls.Latitude.value&&!i.isBulkEdit()?31:-1),l(),f(i.hasGisModule()&&i.form().controls.Longitude.value&&!i.isBulkEdit()?32:-1),l(),f((c=(c=i.selectedLocationType())==null?null:c.data.address)!==null&&c!==void 0&&c||(c=i.form().get("EventScheduling"))!=null&&c.value?33:-1),l(),f((u=(u=i.selectedLocationType())==null?null:u.data.capacity)!==null&&u!==void 0&&u||(u=i.form().get("EventScheduling"))!=null&&u.value?34:-1),l(),f((x=(x=i.selectedLocationType())==null?null:x.data.squareFootage)!==null&&x!==void 0&&x||(x=i.form().get("EventScheduling"))!=null&&x.value?35:-1)}},dependencies:[yt,Ne,je,Ae,se,ge,Le,Ri,ye,Te,De,ri,$,ie],styles:[".toggle[_ngcontent-%COMP%]{display:flex;padding:.5rem 1.5rem}.toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{margin-right:.25rem;font-weight:700}.toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%] .toggle-subtext[_ngcontent-%COMP%]{font-style:italic;font-size:var(--p-font-size-body3)}"],changeDetection:0})}return r})();function oy(r,d){if(r&1&&(e(0,` 6063 `),n(1,"small",6),e(2,` 6064 `),n(3,"div",7),e(4),a(),e(5,` 6065 `),a(),e(6,` 6066 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ly(r,d){if(r&1&&(e(0,` 6067 `),G(1,oy,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.ParentId)}}var jr=(()=>{class r{form;locationTreeNodes=[];submitted=!1;validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-parent-location"]],inputs:{form:"form",locationTreeNodes:"locationTreeNodes",submitted:"submitted",validationErrors:"validationErrors"},standalone:!1,decls:18,vars:8,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],[2,"padding","1rem 1rem 1.5rem"],["formControlName","ParentId","selectionType","single",3,"primaryNodes","requiredMark","allowFilter","showExpandAllButton"],[1,"validation-error",3,"hidden"],["id","qware.location.details.error.ParentId-req","translate","",3,"hidden"],[1,"validation-error"],["translate",""]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 6068 `),n(2,"div",1),e(3,` 6069 `),n(4,"div",2),e(5,` 6070 `),n(6,"qware-hierarchy-picker",3),e(7,` 6071 `),a(),e(8,` 6072 `),n(9,"small",4),e(10,` 6073 `),n(11,"div",5),e(12,` 6074 LOCATION.ERROR.PARENT_REQUIRED 6075 `),a(),e(13,` 6076 `),a(),e(14,` 6077 `),_(15,ly,3,0),a(),e(16,` 6078 `),a(),e(17,` 6079`),a()),o&2&&(p("formGroup",i.form),l(6),p("primaryNodes",i.locationTreeNodes)("requiredMark",!0)("allowFilter",!0)("showExpandAllButton",!0),l(3),p("hidden",i.form.controls.ParentId.valid||i.form.controls.ParentId.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.ParentId.errors!=null&&i.form.controls.ParentId.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.ParentId&&i.form.controls.ParentId.untouched?15:-1))},dependencies:[se,ge,Ri,Te,De,$],encapsulation:2})}return r})();var lm=He(Hn());var sy=["dt"],sm=(r,d)=>d.field;function dy(r,d){r&1&&(e(0,` 6080 `),n(1,"span",21),e(2,"expand_less"),a(),e(3,` 6081 `))}function py(r,d){r&1&&(e(0,` 6082 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 6083 `))}function my(r,d){if(r&1&&(e(0,` 6084 `),n(1,"th"),e(2,` 6085 `),n(3,"span",14),e(4),a(),e(5,` 6086 `),a(),e(6,` 6087 `)),r&2){let t=d.$implicit;l(4),v(t.header)}}function cy(r,d){if(r&1&&(e(0,` 6088 `),n(1,"tr"),e(2,` 6089 `),G(3,my,7,1,null,null,sm),a(),e(5,` 6090 `)),r&2){let t=d.$implicit;l(3),k(t)}}function uy(r,d){if(r&1&&(e(0,` 6091 `),n(1,"span"),e(2),a(),e(3,` 6092 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(2),v(i.getFullDayOfWeek(o[t.field]))}}function _y(r,d){if(r&1&&(e(0,` 6093 `),n(1,"span"),e(2),I(3,"currency"),a(),e(4,` 6094 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(2),v($e(3,1,o[t.field],i.currencyType()))}}function Ey(r,d){if(r&1&&(e(0,` 6095 `),n(1,"span"),e(2),I(3,"currency"),a(),e(4,` 6096 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(2),v($e(3,1,o[t.field],i.currencyType()))}}function Sy(r,d){r&1&&(e(0,` 6097 `),n(1,"span",21),e(2,"expand_less"),a(),e(3,` 6098 `))}function xy(r,d){r&1&&(e(0,` 6099 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 6100 `))}function fy(r,d){if(r&1){let t=b();e(0,` 6101 `),n(1,"p-inputnumber",28),j("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m().$implicit;return W(c[s.field],i)||(c[s.field]=i),S(i)}),h("ngModelChange",function(){E(t);let i=m(4);return S(i.ratePropertyChange())}),e(2,` 6102 `),_(3,Sy,4,0,"ng-template",null,2,A),e(5,` 6103 `),_(6,xy,4,0,"ng-template",null,3,A),e(8,` 6104 `),a(),e(9,` 6105 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),H("ngModel",o[t.field]),p("showButtons",!0)("min",0)("max",100)("fluid",!0)}}function hy(r,d){if(r&1&&(e(0),I(1,"percent")),r&2){let t=m(2).$implicit,o=m().$implicit;K(` 6106 `,y(1,1,o[t.field]/100),` 6107 `)}}function Cy(r,d){r&1&&(e(0,` 6108 `),n(1,"span"),e(2,` 6109 `),n(3,"p-cellEditor"),e(4,` 6110 `),_(5,fy,10,5,"ng-template",26),e(6,` 6111 `),_(7,hy,2,3,"ng-template",27),e(8,` 6112 `),a(),e(9,` 6113 `),a(),e(10,` 6114 `))}function vy(r,d){r&1&&(e(0,` 6115 `),n(1,"span",21),e(2,"expand_less"),a(),e(3,` 6116 `))}function gy(r,d){r&1&&(e(0,` 6117 `),n(1,"span",21),e(2,"expand_more"),a(),e(3,` 6118 `))}function Ty(r,d){if(r&1){let t=b();e(0,` 6119 `),n(1,"p-inputnumber",29),j("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m().$implicit;return W(c[s.field],i)||(c[s.field]=i),S(i)}),h("ngModelChange",function(){E(t);let i=m(4);return S(i.ratePropertyChange())}),e(2,` 6120 `),_(3,vy,4,0,"ng-template",null,2,A),e(5,` 6121 `),_(6,gy,4,0,"ng-template",null,3,A),e(8,` 6122 `),a(),e(9,` 6123 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit,i=m();l(),p("currency",i.currencyType()),H("ngModel",o[t.field]),p("showButtons",!0)("min",0)("fluid",!0)}}function Iy(r,d){if(r&1&&(e(0),I(1,"currency")),r&2){let t=m(2).$implicit,o=m().$implicit,i=m();K(` 6124 `,$e(1,1,o[t.field],i.currencyType()),` 6125 `)}}function by(r,d){r&1&&(e(0,` 6126 `),n(1,"span"),e(2,` 6127 `),n(3,"p-cellEditor"),e(4,` 6128 `),_(5,Ty,10,5,"ng-template",26),e(6,` 6129 `),_(7,Iy,2,4,"ng-template",27),e(8,` 6130 `),a(),e(9,` 6131 `),a(),e(10,` 6132 `))}function yy(r,d){if(r&1&&(e(0,` 6133 `),n(1,"td",23),e(2,` 6134 `),n(3,"span",24),e(4),a(),e(5,` 6135 `),n(6,"div",25),e(7,` 6136 `),n(8,"span"),e(9,` 6137 `),_(10,uy,4,1)(11,_y,5,4)(12,Ey,5,4)(13,Cy,11,0)(14,by,11,0),e(15,` 6138 `),a(),e(16,` 6139 `),a(),e(17,` 6140 `),a(),e(18,` 6141 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="DayOfWeek"?10:t==="AdjustedRateDay"?11:t==="AdjustedRateHourly"?12:t==="DiscountPercentage"?13:14)}}function Ay(r,d){if(r&1&&(e(0,` 6142 `),n(1,"tr",22),e(2,` 6143 `),G(3,yy,19,2,null,null,sm),a(),e(5,` 6144 `)),r&2){let t=d.columns;l(3),k(t)}}function Ry(r,d){if(r&1&&(e(0,` 6145 `),n(1,"tr"),e(2,` 6146 `),n(3,"td"),e(4,` 6147 `),n(5,"div",30),e(6,"SHARED.RECORDS_NOT_FOUND"),a(),e(7,` 6148 `),a(),e(8,` 6149 `),a(),e(9,` 6150 `)),r&2){let t=d.$implicit;l(3),Ve("colspan",t.length)}}var Yr=(()=>{class r{dt;
6150appSettingsService=te(dt);authService=te(de);formGroup=ee.required();allValuesLoaded=ee(!1);submitted=ee(!1);validationErrors=ee(void 0);selectedRateType=D(void 0);selectedDiscountType=D(void 0);rates=D([]);rateAmount=D(0);tableColumns=D([]);currencyType=D("USD");$valuesLoadedSignal=or(this.allValuesLoaded);rateTypeOptions=[{label:"Daily",value:"Daily"},{label:"Hourly",value:"Hourly"}];discountTypeOptions=[{label:"Fixed Amount",value:"Fixed Amount"},{label:"Percentage",value:"Percentage"}];constructor(){this.$valuesLoadedSignal.pipe(N(t=>t===!0)).subscribe(()=>{let o=this.formGroup().get("Rates")?.value;this.populateRates(o),this.calculateAdjustedRate(),this.configureTableColumns()})}ngOnInit(){this.appSettingsService.getAppSettings().pipe(N()).subscribe(t=>{this.currencyType.set(t.CurrencyType??"USD")})}rateTypeChanged(t){this.selectedRateType.set(t),this.configureTableColumns(),this.resetRates(),this.markDirty()}discountTypeChanged(t){this.selectedDiscountType.set(t),this.configureTableColumns(),this.resetRates(),this.markDirty()}ratePropertyChange(){this.calculateAdjustedRate(),this.markDirty()}baseRateChange(t){this.rateAmount.set(t.value),this.resetRates(),this.markDirty()}markDirty(){let t=this.formGroup(),o=this.rates();t.markAsDirty(),t.markAsTouched(),t.get("Rates")?.setValue(o)}configureTableColumns(){let t=[{field:"DayOfWeek",header:"LOCATION.DAY_OF_WEEK"}];this.selectedRateType()?.value==="Daily"?(t.splice(1,0,{field:"RatePerDay",header:"LOCATION.RATE_PER_DAY"}),t.splice(2,0,{field:"AdjustedRateDay",header:"LOCATION.ADJUSTED_RATE_DAY"})):(t.splice(1,0,{field:"RatePerHour",header:"LOCATION.RATE_PER_HOUR"}),t.splice(2,0,{field:"AdjustedRateHourly",header:"LOCATION.ADJUSTED_RATE_HOURLY"})),this.selectedDiscountType()?.value==="Fixed Amount"?t.splice(2,0,{field:"DiscountAmount",header:"LOCATION.DISCOUNT_AMOUNT"}):t.splice(2,0,{field:"DiscountPercentage",header:"LOCATION.DISCOUNT_PERCENTAGE"}),this.tableColumns.set(t)}populateRates(t){if(t&&t.length===7)this.selectedRateType.set(this.rateTypeOptions.filter(o=>o.value===t[0].RateType)[0]),this.selectedDiscountType.set(this.discountTypeOptions.filter(o=>o.value===t[0].DiscountType)[0]),this.configureTableColumns(),this.rates.set(t.sort((o,i)=>o.DayOfWeek-i.DayOfWeek));else{this.selectedRateType.set(this.rateTypeOptions[0]),this.selectedDiscountType.set(this.discountTypeOptions[0]);let o=[{DayOfWeek:0,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:1,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:2,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:3,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:4,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:5,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id},{DayOfWeek:6,RateType:"Daily",RatePerDay:0,RatePerHour:0,DiscountType:"Fixed Amount",DiscountAmount:0,DiscountPercentage:0,AdjustedRateDay:0,AdjustedRateHourly:0,TenantId:this.authService.tenant.Id}];this.rates.set(o)}}resetRates(){let t=[...this.rates()],o=this.selectedRateType();if(t&&t.length===7&&o){for(let i=0;i<7;i++)t[i].RateType=o?.value,t[i].RatePerDay=o?.value==="Daily"?this.rateAmount():0,t[i].AdjustedRateDay=0,t[i].RatePerHour=o?.value==="Hourly"?this.rateAmount():0,t[i].AdjustedRateHourly=0,t[i].DiscountType=this.selectedDiscountType()?.value,t[i].DiscountAmount=0,t[i].DiscountPercentage=0;this.calculateAdjustedRate(t)}}calculateAdjustedRate(t){t||(t=[...this.rates()]);let o=this.selectedRateType();if(this.selectedDiscountType()&&o)for(let s=0;s<7;s++)this.selectedDiscountType()?.value==="Fixed Amount"?(t[s].AdjustedRateDay=o?.value==="Daily"?t[s].RatePerDay-t[s].DiscountAmount:0,t[s].AdjustedRateHourly=o?.value==="Hourly"?t[s].RatePerHour-t[s].DiscountAmount:0):(t[s].AdjustedRateDay=o?.value==="Daily"?t[s].RatePerDay-t[s].RatePerDay*(t[s].DiscountPercentage/100):0,t[s].AdjustedRateHourly=o?.value==="Hourly"?t[s].RatePerHour-t[s].RatePerHour*(t[s].DiscountPercentage/100):0);this.rates.set(t)}getFullDayOfWeek(t){return(0,lm.default)().day(t).format("dddd")}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-rates"]],viewQuery:function(o,i){if(o&1&&X(sy,7),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},inputs:{formGroup:[1,"formGroup"],allValuesLoaded:[1,"allValuesLoaded"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:62,vars:14,consts:[["rateType",""],["discountType",""],["incrementbuttonicon",""],["decrementbuttonicon",""],["dt",""],[1,"grid","zipper"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["labelId","qware.location.rates.label.type","label","LOCATION.RATE_TYPE","elementId","qware.location.rates.type","id","qware.location.rates.type-e2e",3,"selectChange","options","singleSelect","selectedOption"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["labelId","qware.location.rates.label.discount-type","label","LOCATION.DISCOUNT_TYPE","elementId","qware.location.rates.discount-type","id","qware.location.rates.discount-type-e2e",3,"selectChange","options","singleSelect","selectedOption"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container",2,"padding-bottom","0 !important"],["mode","currency","inputId","qware.location.rates.rate-amount.input","variant","filled",1,"is-filled",3,"onInput","currency","ngModel","showButtons","min","fluid"],["for","qware.location.rates.rate-amount.input","id","qware.location.rates.rate-amount.input.label"],["translate",""],[1,"col-12","field-container"],[1,"medium-input",2,"margin-top","0"],["id","qware.location.rates.table","responsiveLayout","stack",3,"columns","value","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"material-icons"],[1,"responsive-border"],["pEditableColumn",""],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["pTemplate","input"],["pTemplate","output"],["suffix","%",3,"ngModelChange","ngModel","showButtons","min","max","fluid"],["mode","currency",3,"ngModelChange","currency","ngModel","showButtons","min","fluid"],["translate","",1,"no-results"]],template:function(o,i){if(o&1){let s=b();n(0,"div",5),e(1,` 6151 `),n(2,"div",6),e(3,` 6152 `),n(4,"div",7),e(5,` 6153 `),n(6,"qware-autocomplete",8,0),h("selectChange",function(u){return E(s),S(i.rateTypeChanged(u))}),e(8,` 6154 `),a(),e(9,` 6155 `),a(),e(10,` 6156 `),a(),e(11,` 6157 `),n(12,"div",9),e(13,` 6158 `),n(14,"div",7),e(15,` 6159 `),n(16,"qware-autocomplete",10,1),h("selectChange",function(u){return E(s),S(i.discountTypeChanged(u))}),e(18,` 6160 `),a(),e(19,` 6161 `),a(),e(20,` 6162 `),a(),e(21,` 6163 `),n(22,"div",11),e(23,` 6164 `),n(24,"div",7),e(25,` 6165 `),n(26,"p-floatlabel"),e(27,` 6166 `),n(28,"p-inputnumber",12),h("onInput",function(u){return E(s),S(i.baseRateChange(u))}),e(29,` 6167 `),_(30,dy,4,0,"ng-template",null,2,A),e(32,` 6168 `),_(33,py,4,0,"ng-template",null,3,A),e(35,` 6169 `),a(),e(36,` 6170 `),n(37,"label",13),e(38,` 6171 `),n(39,"span",14),e(40,"LOCATION.RATE_AMOUNT"),a(),e(41,` 6172 `),a(),e(42,` 6173 `),a(),e(43,` 6174 `),a(),e(44,` 6175 `),a(),e(45,` 6176 `),n(46,"div",15),e(47,` 6177 `),n(48,"div",16),e(49,` 6178 `),n(50,"p-table",17,4),e(52,` 6179 `),_(53,cy,6,0,"ng-template",18),e(54,` 6180 `),_(55,Ay,6,0,"ng-template",19),e(56,` 6181 `),_(57,Ry,10,1,"ng-template",20),e(58,` 6182 `),a(),e(59,` 6183 `),a(),e(60,` 6184 `),a(),e(61,` 6185`),a()}o&2&&(l(6),p("options",i.rateTypeOptions)("singleSelect",!0)("selectedOption",i.selectedRateType()),l(10),p("options",i.discountTypeOptions)("singleSelect",!0)("selectedOption",i.selectedDiscountType()),l(12),p("currency",i.currencyType())("ngModel",i.rateAmount())("showButtons",!0)("min",0)("fluid",!0),l(22),p("columns",i.tableColumns())("value",i.rates())("scrollable",!0))},dependencies:[Pe,Ne,se,Le,bi,wt,kt,ht,Nr,Or,$,bd,Ra],encapsulation:2,changeDetection:0})}return r})();var wy=["attachments"],Dy=(r,d)=>d.label;function Ly(r,d){r&1&&(e(0,` 6186 `),R(1,"p-stepper-separator",27),e(2,` 6187 `))}function Ny(r,d){if(r&1){let t=b();e(0,` 6188 `),n(1,"button",24),h("click",function(){let i=E(t).activateCallback,s=m(),c=s.$index,u=s.$count,x=m(2);return i(),S(x.isLastStep=c===u-1)}),e(2,` 6189 `),n(3,"span",25),e(4),a(),e(5,` 6190 `),n(6,"span",26),e(7),I(8,"translate"),a(),e(9,` 6191 `),a(),e(10,` 6192 `),_(11,Ly,3,0)}if(r&2){let t=m(),o=t.$implicit,i=t.$index,s=t.$count;l(4),v(o.value+1),l(3),v(y(8,3,o.label)),l(4),f(i!==s-1?11:-1)}}function Oy(r,d){if(r&1&&(e(0,` 6193 `),n(1,"p-step",23),e(2,` 6194 `),_(3,Ny,12,5,"ng-template",null,1,A),e(5,` 6195 `),a(),e(6,` 6196 `)),r&2){let t=d.$implicit,o=m(2);l(),ve("p-disabled",t.value>o.stepIndex),p("value",t.value)}}function Fy(r,d){if(r&1){let t=b();e(0,` 6197 `),n(1,"div",4),e(2,` 6198 `),n(3,"h3",5),e(4,` 6199 LOCATION.CREATE_LOCATION 6200 `),a(),e(5,` 6201 `),n(6,"p-stepper",6),j("valueChange",function(i){E(t);let s=m();
6201return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 6202 `),n(8,"p-step-list"),e(9,` 6203 `),G(10,Oy,7,3,null,null,Dy),a(),e(12,` 6204 `),n(13,"p-step-panels"),e(14,` 6205 `),n(15,"p-card"),e(16,` 6206 `),n(17,"div",7),e(18,` 6207 `),n(19,"h4",8),e(20,` 6208 LOCATION.DETAILS 6209 `),a(),e(21,` 6210 `),n(22,"qware-location-details",9),h("locationTypeChange",function(i){E(t);let s=m();return S(s.locationTypeChanged(i))}),j("isStoreroomChange",function(i){E(t);let s=m();return W(s.isStoreroom,i)||(s.isStoreroom=i),S(i)}),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))})("eventSchedulingChanged",function(i){E(t);let s=m();return S(s.eventSchedulingChanged(i))}),e(23,` 6211 `),a(),e(24,` 6212 `),a(),e(25,` 6213 `),n(26,"div",7),e(27,` 6214 `),n(28,"h4",10),e(29,` 6215 LOCATION.PARENT_LOCATION 6216 `),a(),e(30,` 6217 `),n(31,"qware-location-parent-location",11),e(32,` 6218 `),a(),e(33,` 6219 `),a(),e(34,` 6220 `),n(35,"div",7),e(36,` 6221 `),n(37,"h4",12),e(38,` 6222 LOCATION.ASSOCIATED_USERS 6223 `),a(),e(39,` 6224 `),n(40,"qware-location-associated-users",13),e(41,` 6225 `),a(),e(42,` 6226 `),a(),e(43,` 6227 `),n(44,"div",7),e(45,` 6228 `),n(46,"h4",14),e(47,` 6229 LOCATION.EVENT_ASSIGNMENTS 6230 `),a(),e(48,` 6231 `),n(49,"qware-location-assignments",15),e(50,` 6232 `),a(),e(51,` 6233 `),a(),e(52,` 6234 `),n(53,"div",7),e(54,` 6235 `),n(55,"h4",16),e(56,` 6236 LOCATION.RATES 6237 `),a(),e(57,` 6238 `),R(58,"qware-location-rates",17),e(59,` 6239 `),a(),e(60,` 6240 `),n(61,"div",7),e(62,` 6241 `),n(63,"h4",18),e(64,` 6242 LOCATION.ATTACHMENTS 6243 `),a(),e(65,` 6244 `),n(66,"qware-location-attachments",19,0),h("docsChanged",function(i){E(t);let s=m();return S(s.setDocs(i))}),e(68,` 6245 `),a(),e(69,` 6246 `),a(),e(70,` 6247 `),n(71,"div",20),e(72,` 6248 `),n(73,"p-button",21),I(74,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(75,` 6249 `),a(),e(76,` 6250 `),n(77,"p-button",22),I(78,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(79,` 6251 `),a(),e(80,` 6252 `),a(),e(81,` 6253 `),a(),e(82,` 6254 `),a(),e(83,` 6255 `),a(),e(84,` 6256 `),a(),e(85,` 6257 `)}if(r&2){let t,o,i,s,c,u,x,C=m();l(6),H("value",C.stepIndex),l(4),k(C.steps),l(7),p("hidden",((t=C.steps.at(C.stepIndex))==null?null:t.label)!=="LOCATION.DETAILS"),l(5),p("form",C.form.controls.Details)("submitted",C.submitted)("validationErrors",C.validationErrors)("locationTypeTreeNodes",C.locationTypeTreeNodes),H("isStoreroom",C.isStoreroom),l(4),p("hidden",((o=C.steps.at(C.stepIndex))==null?null:o.label)!=="LOCATION.PARENT_LOCATION"),l(5),p("form",C.form.controls.ParentLocation)("submitted",C.submitted)("validationErrors",C.validationErrors)("locationTreeNodes",C.locationTreeNodes),l(4),p("hidden",((i=C.steps.at(C.stepIndex))==null?null:i.label)!=="LOCATION.ASSOCIATED_USERS"),l(5),p("form",C.form.controls.AssociatedUsers)("submitted",C.submitted)("validationErrors",C.validationErrors)("userTreeNodes",C.userTreeNodes),l(4),p("hidden",((s=C.steps.at(C.stepIndex))==null?null:s.label)!=="LOCATION.EVENT_ASSIGNMENTS"),l(5),p("formGroup",C.form.controls.EventAssignments)("userOptions",C.userOptions)("validationErrors",C.validationErrors),l(4),p("hidden",((c=C.steps.at(C.stepIndex))==null?null:c.label)!=="LOCATION.RATES"),l(5),p("formGroup",C.form.controls.EventRates)("allValuesLoaded",C.isLoaded),l(3),p("hidden",((u=C.steps.at(C.stepIndex))==null?null:u.label)!=="LOCATION.ATTACHMENTS"),l(5),p("form",C.form.controls.Attachments)("submitted",C.submitted)("validationErrors",C.validationErrors)("docs",C.docs),l(7),q("label",y(74,34,C.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(78,36,
6257C.isLastStep?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(!((x=C.steps.at(C.stepIndex))==null||x.control==null)&&x.control.valid))}}var dm=(()=>{class r{attachmentService;authService;cacheService;eventService;fb;inventoryService;locationService;locationTypeService;toastService;responseService;route;router;translate;userService;userGroupService;attachments;displaySpinner=!0;docs=[];form;isEventAssignmentsStepOn=!1;isEventRatesStepOn=!1;isLoaded=!1;isLastStep=!1;isParentLocationStepOn=!1;isStoreroom=!1;locationTreeNodes=[];locationTypeTreeNodes=[];parentStepVisible=!0;stepIndex=0;steps=[];submitted=!1;subscriptions;textareaFocused=!1;userOptions=[];userTreeNodes=[];validationErrors;inventoryManagementDisabled=!0;hasEventsModule=!1;constructor(t,o,i,s,c,u,x,C,O,w,F,L,U,V,z){this.attachmentService=t,this.authService=o,this.cacheService=i,this.eventService=s,this.fb=c,this.inventoryService=u,this.locationService=x,this.locationTypeService=C,this.toastService=O,this.responseService=w,this.route=F,this.router=L,this.translate=U,this.userService=V,this.userGroupService=z,this.inventoryManagementDisabled=!this.authService.qwareSubscription?.inventoryManagement,this.hasEventsModule=this.authService.tenant.EventsModule}ngOnInit(){this.createForm(),ue([this.locationTypeService.getLocationTypes(this.authService.tenant.Id),this.locationService.getLocations(this.authService.tenant.Id),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1],s=t[2],c=t[3],u=o.filter(w=>w.State===M.ACTIVE),x=i.filter(w=>w.State===M.ACTIVE).map(w=>(w.LocationType=u.find(F=>F.Id===w.LocationTypeId),w.Icon=w.LocationType?.Icon,w.Parent=i.find(F=>F.Id===w.ParentId),w));this.form&&this.form.get("Details.LocationTypeId")?.setValidators([T.required,A0(x,u)]),this.locationTreeNodes=x.map(w=>this.locationService.convertToTreeNode(w,new Set(x.filter(F=>F.Id).map(F=>F.Id)))),this.locationTypeTreeNodes=u.map(w=>this.locationTypeService.convertToTreeNode(w));let C=s.filter(w=>w.State===M.ACTIVE&&!ci.includes(w.Name??"")),O=c.filter(w=>w.State===M.ACTIVE);this.userTreeNodes=Js.default.concat(C.map(w=>this.userGroupService.convertToTreeNode(w,!0)),O.map(w=>this.userService.convertToTreeNode(w))),this.userOptions=this.userService.removeSuperUsersIfNotSuperUser(c,this.authService.isSuperUser()).filter(w=>w.State===M.ACTIVE).map(w=>({label:w.fullNameWithEmail(),value:w})),this.steps=[{label:"LOCATION.DETAILS",value:0,control:this.form.get("Details")}],this.toggleParentLocationStep(),this.isLoaded=!0,this.displaySpinner=!1})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),LocationTypeId:this.fb.control(null,[T.required]),Address:this.fb.control("",[T.maxLength(re)]),Capacity:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),SquareFootage:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),EventScheduling:this.fb.control(!1),Latitude:this.fb.control(null),Longitude:this.fb.control(null)}),ParentLocation:this.fb.group({ParentId:this.fb.control(null)}),AssociatedUsers:this.fb.group({Users:this.fb.control([])}),EventAssignments:this.fb.group({Assignments:this.fb.control([],Qi.atLeastOneTrueForAll(["EmailNotifications","IsVoter","IsEditor"]))}),EventRates:this.fb.group({Rates:this.fb.control([])}),Attachments:this.fb.group({Documents:this.fb.control([])})})}locationTypeChanged(t){if(t&&t.node){let o,i=this.form.get("ParentLocation.ParentId");if(Js.default.isEmpty(t.node)||!t.node[0].parent?(this.toggleParentLocationStep(),i&&i.removeValidators([T.required])):(this.toggleParentLocationStep(!0),o=t.node[0].parent.data.id,this.locationTreeNodes.forEach(s=>{s.data.selectable=s.data.locationTypeId===o}),i&&i.setValidators([T.required])),i){let s=i.value;this.locationTreeNodes.find(u=>u.data.id===s)?.data.locationTypeId!==o&&this.form.get("ParentLocation.ParentId")?.setValue(""),i.updateValueAndValidity()}}}checkParentLocationsStep(t=!1){return t&&this.locationTypeTreeNodes&&this.locationTypeTreeNodes.length>0}toggleParentLocationStep(t=!1){this.isParentLocationStepOn=this.checkParentLocationsStep(t);let o=this.steps.findIndex(i=>i.label==="LOCATION.PARENT_LOCATION");this.isParentLocationStepOn?o===-1&&this.steps.splice(1,0,{label:"LOCATION.PARENT_LOCATION",value:1,control:this.form.get("ParentLocation")}):o>-1&&this.steps.splice(o,1),this.setAssociatedUsersStepIndex(),this.toggleEventAssignmentsStep(this.isEventAssignmentsStepOn)}setAssociatedUsersStepIndex(){let t=2;this.isParentLocationStepOn||t--;let o=this.steps.find(i=>i.label==="LOCATION.ASSOCIATED_USERS");o?o.value=t:this.steps.splice(t,0,{label:"LOCATION.ASSOCIATED_USERS",value:t,control:this.form.get("AssociatedUsers")})}eventSchedulingChanged(t){this.toggleEventAssignmentsStep(t)}toggleEventAssignmentsStep(t=!1){let o=3;this.isParentLocationStepOn||o--,this.isEventAssignmentsStepOn=t;let i=this.steps.findIndex(s=>s.label==="LOCATION.EVENT_ASSIGNMENTS");this.isEventAssignmentsStepOn?i===-1?this.steps.splice(o,0,{label:"LOCATION.EVENT_ASSIGNMENTS",value:o,c
6257ontrol:this.form.get("EventAssignments")}):this.steps[i].value=o:i>-1&&this.steps.splice(i,1),this.toggleEventRatesStep(t)}toggleEventRatesStep(t=!1){let o=4;this.isParentLocationStepOn||o--,this.isEventAssignmentsStepOn||o--,this.isEventRatesStepOn=t;let i=this.steps.findIndex(s=>s.label==="LOCATION.RATES");this.isEventRatesStepOn?i===-1?this.steps.splice(o,0,{label:"LOCATION.RATES",value:o,control:this.form.get("EventRates")}):this.steps[i].value=o:i>-1&&this.steps.splice(i,1),this.setAttachmentsStepIndex()}setAttachmentsStepIndex(){let t=5;this.isParentLocationStepOn||t--,this.isEventAssignmentsStepOn||t--,this.isEventRatesStepOn||t--;let o=this.steps.find(i=>i.label==="LOCATION.ATTACHMENTS");return o?o.value=t:this.steps.splice(t,0,{label:"LOCATION.ATTACHMENTS",value:t,control:this.form.get("Attachments")}),t}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../"+P.list],t)}else this.stepIndex--,this.isLastStep=!1}stepSubmit(t){this.steps[t]?.control?.valid&&(t<this.steps.length-1?(this.stepIndex++,this.isLastStep=this.stepIndex===this.steps.length-1):this.submitForm(new Cn().parseForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,this.subscriptions=this.attachmentService.upload().pipe(N(),we(o=>o===void 0?wi(()=>new Error("Upload error.")):(this.locationService.handleAttachmentUpload(o,t,this.docs,this.attachments.attachments),this.locationService.createLocation(t))),we(o=>(t.Id=o,!this.inventoryManagementDisabled&&o?this.inventoryService.setLocationsAsStorerooms([o],this.isStoreroom):Fe(o))),we(()=>{let o=t.Id;if(this.authService.tenant.EventsModule){let i=this.form.get("EventAssignments.Assignments")?.value;return i?.forEach(s=>{s.EntityId=o}),this.eventService.createOrUpdateAssignments(i)}else return Fe(o)}),we(()=>{let o=t.Id;if(this.authService.tenant.EventsModule){let i=this.form.get("EventRates.Rates")?.value;return i.forEach(s=>{s.LocationId=o}),this.eventService.createOrUpdateLocationRates(i)}else return Fe(o)})).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner=!1,this.responseService.onSuccess("LOCATION.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(i=>i.control),this.validationErrors)}}),this.fileUpload()):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}fileUpload(){this.attachments.attachments&&this.attachments.attachments.fileup.files.length>0?this.attachments.attachments.fileup.uploader():this.attachmentService.clearObservable()}setDocs(t){t instanceof Event||(this.docs=t)}updateTextAreaFocus(t){this.textareaFocused=t}ngOnDestroy(){this.subscriptions&&!this.subscriptions.closed&&this.subscriptions.unsubscribe()}static \u0275fac=function(o){return new(o||r)(g(ui),g(de),g(ei),g(oi),g(be),g(Wi),g(zt),g(yi),g(Se),g(Re),g(he),g(Be),g(le),g(ct),g(Tt))};static \u0275cmp=B({type:r,selectors:[["qware-location-create"]],viewQuery:function(o,i){if(o&1&&X(wy,5),o&2){let s;Y(s=Q())&&(i.attachments=s.first)}},standalone:!1,decls:7,vars:2,consts:[["attachments",""],["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.location.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.location.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"hidden"],["id","qware.location.create.details.label","translate","",1,"page-header"],[3,"locationTypeChange","isStoreroomChange","textareaFocusChange","eventSchedulingChanged","form","submitted","validationErrors","locationTypeTreeNodes","isStoreroom"],["id","qware.location.create.parent.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","locationTreeNodes"],["id","qware.location.create.users.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","userTreeNodes"],["id","qware.location.create.assignments.label","translate","",1,"page-header"],[3,"formGroup","userOptions","validationErrors"],["id","qware.location.create.rates.label","translate","",1,"page-header"],[3,"formGroup","allValuesLoaded"],["translate","","id","qware.location.create.attachments.label",1,"page-header"],[3,"docsCh
6257anged","form","submitted","validationErrors","docs"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.location.create-location.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.location.create-location.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[3,"value"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"],[1,"p-stepper-separator"]],template:function(o,i){o&1&&(n(0,"div",2),h("keydown.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(1,` 6258 `),n(2,"qware-spinner",3),e(3,` 6259 `),_(4,Fy,86,38),a(),e(5,` 6260`),a(),e(6,` 6261`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,ge,me,Te,ai,ti,ni,ii,nl,$,qr,Br,Hr,Wr,jr,Yr,ie],encapsulation:2})}return r})();var la=He(nt());var My=["actionsMenu"],Uy=["attachments"],Py=["shades"],Gy=["drawer"],ky=r=>({"lg:col-8":r}),Vy=()=>["0"],qy=()=>({width:"50vw"}),By=()=>({padding:"0 1.25rem 1.25rem"}),Hy=(r,d)=>d.Id;function Wy(r,d){r&1&&(e(0,` 6262 `),n(1,"span",32),e(2,"LOCATION.BULK_EDIT"),a(),e(3,` 6263 `))}function jy(r,d){r&1&&(e(0,` 6264 `),n(1,"span",32),e(2,"LOCATION.EDIT_LOCATION"),a(),e(3,` 6265 `))}function Yy(r,d){if(r&1&&(e(0,` 6266 `),n(1,"a",33),e(2,` 6267 `),n(3,"span",34),e(4),a(),e(5,` 6268 `),n(6,"span",35),e(7),a(),e(8,` 6269 `),a(),e(9,` 6270 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function Qy(r,d){r&1&&(e(0,` 6271 `),n(1,"span",37),e(2,"SHARED.ACTIONS"),a(),e(3,` 6272 `),n(4,"i",38),e(5,"expand_more"),a(),e(6,` 6273 `))}function Ky(r,d){if(r&1){let t=b();e(0,` 6274 `),n(1,"p-button",36),h("onClick",function(i){E(t),m();let s=Ee(14);return S(s.toggle(i))}),e(2,` 6275 `),_(3,Qy,7,0,"ng-template",null,5,A),e(5,` 6276 `),a(),e(6,` 6277 `)}r&2&&(l(),p("raised",!0))}function $y(r,d){if(r&1&&(e(0,` 6278 `),n(1,"a",33),e(2,` 6279 `),n(3,"span",34),e(4),a(),e(5,` 6280 `),n(6,"span",35),e(7),a(),e(8,` 6281 `),a(),e(9,` 6282 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function zy(r,d){if(r&1){let t=b();e(0,` 6283 `),n(1,"div",39),e(2,` 6284 `),n(3,"p-menu",40,6),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 6285 `),_(6,$y,10,2,"ng-template",null,1,A),e(8,` 6286 `),a(),e(9,` 6287 `),n(10,"p-button",41),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive.set(!c.isActive()))}),e(11,` 6288 `),n(12,"i",38),e(13,"more_vert"),a(),e(14,` 6289 `),a(),e(15,` 6290 `),a(),e(16,` 6291 `)}if(r&2){let t=m();l(3),p("model",t.moreItems())("popup",!0),l(7),p("rounded",!0)("text",!0)}}function Xy(r,d){r&1&&(e(0,` 6292 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6293 `))}function Zy(r,d){r&1&&(e(0,` 6294 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6295 `))}function Jy(r,d){if(r&1&&(e(0,` 6296 `),_(1,Xy,4,0)(2,Zy,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function eA(r,d){r&1&&(e(0,` 6297 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6298 `))}function tA(r,d){r&1&&(e(0,` 6299 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6300 `))}function iA(r,d){if(r&1&&(e(0,` 6301 `),_(1,eA,4,0)(2,tA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function nA(r,d){if(r&1&&(e(0,` 6302 `),n(1,"p-accordion-panel",42),e(2,` 6303 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,iA,3,1,"ng-template",null,3,A),e(8,` 6304 `),a(),e(9,` 6305 `),n(10,"p-accordion-content"),e(11,` 6306 `),n(12,"div",20),e(13,` 6307 `),n(14,"div",21),e(15,` 6308 `),n(16,"qware-location-parent-location",43),e(17,` 6309 `),a(),e(18,` 6310 `),a(),e(19,` 6311 `),a(),e(20,` 6312 `),a(),e(21,` 6313 `),a(),e(22,` 6314 `)),r&2){let t=m();l(4),K(` 6315 `,y(5,5,"LOCATION.PARENT_LOCATION"),` 6316 `),l(12),p("form",t.form.controls.ParentLocation)("submitted",t.submitted())("validationErrors",t.validationErrors())("locationTreeNodes",t.locationTreeNodes())}}function aA(r,d){r&1&&(e(0,` 6317 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6318 `))}function rA(r,d){r&1&&(e(0,` 6319 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6320 `))}
6320function oA(r,d){if(r&1&&(e(0,` 6321 `),_(1,aA,4,0)(2,rA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function lA(r,d){r&1&&(e(0,` 6322 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6323 `))}function sA(r,d){r&1&&(e(0,` 6324 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6325 `))}function dA(r,d){if(r&1&&(e(0,` 6326 `),_(1,lA,4,0)(2,sA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function pA(r,d){if(r&1&&(e(0,` 6327 `),n(1,"p-accordion-panel",44),e(2,` 6328 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,dA,3,1,"ng-template",null,3,A),e(8,` 6329 `),a(),e(9,` 6330 `),n(10,"p-accordion-content"),e(11,` 6331 `),n(12,"div",20),e(13,` 6332 `),n(14,"div",21),e(15,` 6333 `),n(16,"qware-location-assignments",45),e(17,` 6334 `),a(),e(18,` 6335 `),a(),e(19,` 6336 `),a(),e(20,` 6337 `),a(),e(21,` 6338 `),a(),e(22,` 6339 `)),r&2){let t=m();l(4),K(` 6340 `,y(5,4,"LOCATION.EVENT_ASSIGNMENTS"),` 6341 `),l(12),p("formGroup",t.form.controls.EventAssignments)("location",t.location())("userOptions",t.userAssignmentOptions())}}function mA(r,d){r&1&&(e(0,` 6342 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6343 `))}function cA(r,d){r&1&&(e(0,` 6344 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6345 `))}function uA(r,d){if(r&1&&(e(0,` 6346 `),_(1,mA,4,0)(2,cA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function _A(r,d){if(r&1&&(e(0,` 6347 `),n(1,"p-accordion-panel",46),e(2,` 6348 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,uA,3,1,"ng-template",null,3,A),e(8,` 6349 `),a(),e(9,` 6350 `),n(10,"p-accordion-content"),e(11,` 6351 `),n(12,"div",20),e(13,` 6352 `),n(14,"div",21),e(15,` 6353 `),R(16,"qware-location-rates",47),e(17,` 6354 `),a(),e(18,` 6355 `),a(),e(19,` 6356 `),a(),e(20,` 6357 `),a(),e(21,` 6358 `)),r&2){let t=m();l(4),K(` 6359 `,y(5,3,"LOCATION.RATES"),` 6360 `),l(12),p("formGroup",t.form.controls.EventRates)("allValuesLoaded",t.allValuesLoaded())}}function EA(r,d){r&1&&(e(0,` 6361 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6362 `))}function SA(r,d){r&1&&(e(0,` 6363 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6364 `))}function xA(r,d){if(r&1&&(e(0,` 6365 `),_(1,EA,4,0)(2,SA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function fA(r,d){if(r&1){let t=b();e(0,` 6366 `),n(1,"p-button",48),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 6367 `),a(),e(4,` 6368 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.enableSave())}}function hA(r,d){r&1&&(e(0,` 6369 `),n(1,"span",52),e(2,"LOCATION.SELECTED_LOCATIONS"),a(),e(3,` 6370 `))}function CA(r,d){r&1&&(e(0,` 6371 `),n(1,"span",52),e(2,"SHARED.AUDIT_LOG"),a(),e(3,` 6372 `))}function vA(r,d){if(r&1&&(e(0,` 6373 `),n(1,"div",51),e(2,` 6374 `),_(3,hA,4,0)(4,CA,4,0),a(),e(5,` 6375 `)),r&2){let t=m(2);l(3),f(t.isBulkEdit()?3:4)}}function gA(r,d){if(r&1&&(e(0,` 6376 `),n(1,"div",55),e(2,` 6377 `),n(3,"span"),e(4),a(),e(5,` 6378 `),a(),e(6,` 6379 `)),r&2){let t=d.$implicit;l(4),v(t.Name)}}function TA(r,d){if(r&1&&(e(0,` 6380 `),n(1,"div",54),e(2,` 6381 `),G(3,gA,7,1,null,null,Hy),a(),e(5,` 6382 `)),r&2){let t=m(3);l(3),k(t.bulkLocations())}}function IA(r,d){if(r&1){let t=b();e(0,` 6383 `),n(1,"div",56),e(2,` 6384 `),n(3,"qware-entity-history",57),j("parentSpinnerStateChange",function(i){E(t);let s=m(3);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(4,` 6385 `),a(),e(5,` 6386 `),a(),e(6,` 6387 `)}if(r&2){let t=m(3);l(3),p("createdText",t.historyCreatedText())("idMaps",t.historyIdMap())("nameMap",t.historyNameMap())("arrayProperties",t.historyArrayProperties())("entityType",t.entityType),H("parentSpinnerState",t.displayDrawerSpinner),p("blacklistProperties",t.historyBlacklist())}}function bA(r,d){if(r&1&&(e(0,` 6388 `),n(1,"qware-spinner",53),e(2,` 6389 `),_(3,TA,6,0)(4,IA,7,7),a(),e(5,` 6390 `)),r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(2),f(t.isBulkEdit()?3:4)}}function yA(r,d){if(r&1){let t=b();e(0,` 6391 `),n(1,"div",49),e(2,` 6392 `),n(3,"p-drawer",50,7),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar.set(!1))}),e(5,` 6393 `),_(6,vA,6,1,"ng-template",null,8,A),e(8,` 6394 `),_(9,bA,6,3,"ng-template",null,5,A),e(11,` 6395 `),a(),e(12,` 6396 `),a(),e(13,` 6397 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar()),l(2),H("visible",t.showSidebar),p("modal",t.showMask())("transitionOptions",t.sidebarOptions())("closeOnEscape",!1)}}var pm=(()=>{class r{actionsMenu;attachments;shades;drawer;authService=te(de);attachmentService=te(ui);
6397cacheService=te(ei);documentService=te(mn);eventService=te(oi);fb=te(be);inventoryService=te(Wi);locationService=te(zt);responseService=te(Re);route=te(he);router=te(Be);signalRService=te(B0);toastService=te(Se);translate=te(le);userGroupService=te(Tt);userService=te(ct);allValuesLoaded=D(!1);bulkLocations=D([]);displaySpinner=D(!0);docs=D([]);enableSave=Ye(()=>this.formValid()&&this.formDirty());eventSchedulingEnabled=D(!1);formDirty=D(!1);isActive=D(!1);isBulkEdit=D(!0);isStoreroom=D(!1);location=D(void 0);locationRates=D(new Map);moreItems=D([]);percentageComplete=D(0);showMask=D(!1);showProgressDialog=D(!1);showSidebar=D(!1);sidebarOptions=D(qe.REMOVE_ANIMATION);submitted=D(!1);updatedCount=D(0);userAssignmentOptions=D([]);userEnabledSidebar=D(!1);userOptions=D([]);userTreeNodes=D([]);validationErrors=D(void 0);formValid=D(!0);dialogBreaks=Fn;entityType=$o.LOCATION;form;bulkLocationIds=[];locsPerChunk=20;shadeFormGroups=[];signalRSubscription;subscriptions=[];actionItems=D([]);disableAllControls=D(!1);displayDrawerSpinner=D(!1);historyArrayProperties=D(["Users"]);historyBlacklist=D(new Set);historyCreatedText=D(void 0);historyIdMap=D(new Map);historyNameMap=D(new Map);inventoryItemCount=D(0);locationTreeNodes=D([]);locationTypeTreeNodes=D([]);auditLoggingDisabled=D(!0);hasEventsModule=D(!1);locationListRoute="../../"+P.location+"/"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};constructor(){this.signalRSubscription=this.signalRService.locationBulkProgressObservable$.subscribe(t=>{this.updateSaveProgress(t)}),this.hasEventsModule.set(this.authService.tenant.EventsModule)}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar.set(t||this.userEnabledSidebar()),this.showMask.set(window.innerWidth<Je.lgbreak),this.showMask()&&this.showSidebar()?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions.set(this.showSidebar()?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION)}ngOnInit(){this.configureRightDrawer(),this.bulkLocationIds=We.unstringify(localStorage.getItem(Oe.LOCATION_BULK_UPDATE_IDS)),this.translate.get(["LOCATION.SELECTED_LOCATIONS"]).pipe(N()).subscribe(t=>{this.moreItems.set([{label:t["LOCATION.SELECTED_LOCATIONS"],icon:"check_box",command:()=>this.toggleSidebar()}])}),this.createForm(),this.loadData()}ngOnDestroy(){this.subscriptions&&this.subscriptions.length>0&&this.subscriptions.forEach(t=>{t.closed||t.unsubscribe()}),this.signalRSubscription&&!this.signalRSubscription.closed&&this.signalRSubscription.unsubscribe()}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control({value:"",disabled:!0}),Description:this.fb.control("",[T.maxLength(ft)]),LocationTypeId:this.fb.control({value:null,disabled:!0}),Address:this.fb.control("",[T.maxLength(re)]),Capacity:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),SquareFootage:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),EventScheduling:this.fb.control(!1),Latitude:this.fb.control({value:null,disabled:!0}),Longitude:this.fb.control({value:null,disabled:!0})}),ParentLocation:this.fb.group({ParentId:this.fb.control({value:"",disabled:!0})}),AssociatedUsers:this.fb.group({Users:this.fb.control([])}),EventAssignments:this.fb.group({Assignments:this.fb.control([],Qi.atLeastOneTrueForAll(["EmailNotifications","IsVoter","IsEditor"]))}),EventRates:this.fb.group({Rates:this.fb.control([])}),Attachments:this.fb.group({Documents:this.fb.control([])})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("ParentLocation"),this.form.get("AssociatedUsers"),this.form.get("EventAssignments"),this.form.get("EventRates")],this.subscriptions.push(this.form.valueChanges.subscribe(()=>{this.formDirty.set(this.form.dirty),this.formValid.set(this.form.valid)}))}loadData(){let t=[this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id),this.locationService.getLocationsByIds(this.bulkLocationIds)];this.hasEventsModule()&&(t=t.concat([this.eventService.getAssignmentsByTenantAndType(this.authService.tenant.Id,"L
6397ocation"),this.eventService.getLocationRatesByIds(this.bulkLocationIds),this.userService.getUsers(this.authService.tenant.Id)])),ue([this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id),this.locationService.getLocationsByIds(this.bulkLocationIds),this.eventService.getAssignmentsByTenantAndType(this.authService.tenant.Id,"Location"),this.eventService.getLocationRatesByIds(this.bulkLocationIds),this.userService.getUsers(this.authService.tenant.Id)]).subscribe(o=>{let i=o[0],s=o[1],c=o[2],u=o[3]??[],x=o[4]??[],C=o[5]??[];c.forEach(Z=>{this.locationService.mapDocuments(Z)}),this.bulkLocations.set(c);let O=Object.assign(new Cn,c[0]),w=new Set(ci),F=i.filter(Z=>Z.State===M.ACTIVE&&!w.has(Z.Name??"")),L=s.filter(Z=>Z.State===M.ACTIVE);this.userOptions.set(this.userService.removeSuperUsersIfNotSuperUser(s,this.authService.isSuperUser()).filter(Z=>Z.State===M.ACTIVE&&Z.Type===Rt.INTERNAL).map(Z=>({label:Z.fullNameWithEmail(),value:Z})));let U=new Set(u.map(Z=>Z.UserId));this.userAssignmentOptions.set(this.userService.removeSuperUsersIfNotSuperUser(C,this.authService.isSuperUser()).filter(Z=>(Z.State===M.ACTIVE||U.has(Z.Id))&&Z.Type===Rt.INTERNAL).map(Z=>({label:Z.fullNameWithEmail(),value:Z}))),this.userTreeNodes.set(la.default.concat(F.map(Z=>this.userGroupService.convertToTreeNode(Z,!0)),L.map(Z=>this.userService.convertToTreeNode(Z))));let V=We.groupArryByProperty(x,"LocationId");this.locationRates.set(V);let z=[];O?.Documents&&z.push(O.Documents),O.EventScheduling=!1,O.EventAssignments=[],O.EventRates=[];for(let Z=1;Z!==this.bulkLocationIds.length;Z++){let fe=Object.assign(new Cn,c[Z]);fe.Description!==O.Description&&(O.Description=""),fe.Address!==O.Address&&(O.Address=""),fe.Capacity!==O.Capacity&&(O.Capacity=""),fe.SquareFootage!==O.SquareFootage&&(O.SquareFootage=""),We.getSymDiffValsFromPrimArrys(fe.UserIds,O.UserIds).length>0&&(O.UserIds=[]),fe.Documents&&z.push(fe.Documents)}let ce=z[0]??[];for(let Z=1;Z<z.length;Z++)ce=la.default.intersectionBy(ce,z[Z],"Id");O.Documents=ce,O.DocumentIds=ce.map(Z=>Z.Id),this.docs.set(O.Documents?la.default.sortBy(O.Documents,Z=>(Z.Name??"").toLowerCase()):[]),this.location.set(O),this.form.patchValue(new Cn().toForm(O)),this.form.markAsUntouched(),this.form.markAsPristine(),this.allValuesLoaded.set(!0),this.displaySpinner.set(!1)})}isDirty(){return this.form.dirty&&!this.submitted()}save(){if(!this.submitted())if(this.form.valid){this.submitted.set(!0),this.showProgressDialog.set(!0),this.updatedCount.set(0);let t=this.bulkLocations(),o=new Cn().parseForm(this.form.value);t.forEach(u=>{o.Description&&(u.Description=o.Description),o.Address&&(u.Address=o.Address),o.Capacity&&(u.Capacity=o.Capacity),o.SquareFootage&&(u.SquareFootage=o.SquareFootage),o.EventScheduling&&(u.EventScheduling=o.EventScheduling),o.UserIds&&o.UserIds.length>0&&(u.UserIds=o.UserIds)});let i=this.attachmentService.upload().pipe(N(),we(u=>{if(u===void 0)return wi(()=>new Error("Upload error."));{let x=this.docs()?this.docs().filter(C=>C.Id).map(C=>C.Id):[];return t.forEach(C=>{let O=[];this.location()?.DocumentIds&&(O=la.default.difference(C.DocumentIds,this.location()?.DocumentIds)),C.DocumentIds=x.concat(u,O)}),this.attachments.attachments.existingDocumentsChanged?this.documentService.updateDocuments(this.docs()):Fe("")}})),s=[];
6397la.default.chunk(t,this.locsPerChunk).forEach((u,x)=>{i=i.pipe(we(()=>{let C=[this.locationService.updateLocations(u)],O=u.map(w=>w.Id);if(this.isStoreroom()&&C.push(this.inventoryService.setLocationsAsStorerooms(O,!0)),o.EventAssignments&&o.EventAssignments.length>0){let w=[];O.forEach(F=>{o.EventAssignments?.forEach(L=>{let U=la.default.cloneDeep(L);U.EntityId=F,w.push(U)})}),C.push(this.eventService.createOrUpdateAssignments(w))}if(o.EventRates&&o.EventRates.length>0){let w=this.locationRates(),F=[];O.forEach(L=>{let U=w.get(L)??[];o.EventRates?.forEach(V=>{let z=U.find(Z=>Z.DayOfWeek===V.DayOfWeek),ce=la.default.cloneDeep(V);ce.LocationId=L,z&&(ce.Id=z.Id),F.push(ce)})}),C.push(this.eventService.createOrUpdateLocationRates(F))}return ue(C)}),we(C=>{let O=C[0]?C[0].status:void 0;s.push(O);let w=t.length<this.locsPerChunk?t.length:this.locsPerChunk;return this.updateSaveProgress(w*(x+1),!0),Fe(O)}))}),this.subscriptions.push(i.subscribe({next:()=>{setTimeout(()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.BULK_SAVE"),this.validationErrors.set(void 0);let u={relativeTo:this.route};this.router.navigate([this.locationListRoute],u)},1e3)},error:u=>{this.submitted.set(!1),this.showProgressDialog.set(!1),this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(u,this.form,this.shades,this.shadeFormGroups))}})),this.fileUpload()}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}updateSaveProgress(t,o=!1){this.updatedCount.update(i=>la.default.min([o?t:i+=t,this.bulkLocations().length])??0),this.percentageComplete.set(Math.ceil(this.updatedCount()/this.bulkLocations().length*100))}fileUpload(){this.attachments.attachments&&this.attachments.attachments.fileup.files.length>0?this.attachments.attachments.fileup.uploader():this.attachmentService.clearObservable()}toggleSidebar(){this.showSidebar.set(!this.showSidebar()),this.userEnabledSidebar.set(la.default.clone(this.showSidebar()))}setDocs(t){t instanceof Event||this.docs.set(t)}eventSchedulingChanged(t){this.eventSchedulingEnabled.set(t)}locationTypeChanged(t){}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-location-bulk-edit"]],viewQuery:function(o,i){if(o&1&&(X(My,7),X(Uy,7),X(Py,7),X(Gy,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.attachments=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:133,vars:70,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["attachments",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.location.edit",1,"grid"],["id","qware.location.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.location.edit.page-header",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.location.edit.actions-menu",3,"model","popup"],["id","qware.location.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.location.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"isStoreroomChange","locationTypeChange","eventSchedulingChanged","isStoreroomChanged","form","submitted","autoFocus","validationErrors","locationTypeTreeNodes","isStoreroom","inventoryItemCount","isBulkEdit"],["id","qware.location.edit.associated-users-shade","value","2"],[3,"form","submitted","validationErrors","userTreeNodes"],["id","qware.location.edit.attachments-shade","value","5"],[3,"docsChanged","form","submitted","validationErrors","docs","location","disableAllControls"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.location.edit.button.cancel",3,"routerLink","text","label"],["id","qware.location.edit.bulk-edit-progress-dialog",3,"visibleChange","header","visible","modal","closeOnEscape","draggable","resizable","closable","breakpoints","contentStyle"],[3,"value"],[1,"progress-info"],["translate",""],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.location.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.location.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.location.edit.parent-location-shade","value","1"],[3,"form","submitted","validationErrors","locationTreeNodes"],["id","qware.location.edit.assignments-shade","value","3"],[3,"formGroup","location","userOptions"],["id","qware.location.edit.rates-sha
6397de","value","4"],[3,"formGroup","allValuesLoaded"],["tabindex","999","type","button","id","qware.location.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.location.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.location.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.location.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"data-container"],[1,"data"],[1,"sidebar-content","no-apply"],[3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","entityType","parentSpinnerState","blacklistProperties"]],template:function(o,i){if(o&1){let s=b();n(0,"div",9),e(1,` 6398 `),n(2,"div",10),e(3,` 6399 `),n(4,"div",11),e(5,` 6400 `),n(6,"h3",12),e(7,` 6401 `),_(8,Wy,4,0)(9,jy,4,0),a(),e(10,` 6402 `),n(11,"div",13),e(12,` 6403 `),n(13,"p-menu",14,0),e(15,` 6404 `),_(16,Yy,10,2,"ng-template",null,1,A),e(18,` 6405 `),a(),e(19,` 6406 `),_(20,Ky,7,1),a(),e(21,` 6407 `),_(22,zy,17,4),a(),e(23,` 6408 `),n(24,"qware-spinner",15),e(25,` 6409 `),n(26,"p-card",16),e(27,` 6410 `),n(28,"qware-edit-lock",17),e(29,` 6411 `),n(30,"p-accordion",18,2),e(32,` 6412 `),n(33,"p-accordion-panel",19),e(34,`
6413 `),n(35,"p-accordion-header"),e(36),I(37,"translate"),_(38,Jy,3,1,"ng-template",null,3,A),e(40,` 6414 `),a(),e(41,` 6415 `),n(42,"p-accordion-content"),e(43,` 6416 `),n(44,"div",20),e(45,` 6417 `),n(46,"div",21),e(47,` 6418 `),n(48,"qware-location-details",22),j("isStoreroomChange",function(u){return E(s),W(i.isStoreroom,u)||(i.isStoreroom=u),S(u)}),h("locationTypeChange",function(u){return E(s),S(i.locationTypeChanged(u))})("eventSchedulingChanged",function(u){return E(s),S(i.eventSchedulingChanged(u))})("isStoreroomChanged",function(){return E(s),S(i.formDirty.set(!0))}),e(49,` 6419 `),a(),e(50,` 6420 `),a(),e(51,` 6421 `),a(),e(52,` 6422 `),a(),e(53,` 6423 `),a(),e(54,` 6424 `),_(55,nA,23,7),n(56,"p-accordion-panel",23),e(57,` 6425 `),n(58,"p-accordion-header"),e(59),I(60,"translate"),_(61,oA,3,1,"ng-template",null,3,A),e(63,` 6426 `),a(),e(64,` 6427 `),n(65,"p-accordion-content"),e(66,` 6428 `),n(67,"div",20),e(68,` 6429 `),n(69,"div",21),e(70,` 6430 `),n(71,"qware-location-associated-users",24),e(72,` 6431 `),a(),e(73,` 6432 `),a(),e(74,` 6433 `),a(),e(75,` 6434 `),a(),e(76,` 6435 `),a(),e(77,` 6436 `),_(78,pA,23,6)(79,_A,22,5),n(80,"p-accordion-panel",25),e(81,` 6437 `),n(82,"p-accordion-header"),e(83),I(84,"translate"),_(85,xA,3,1,"ng-template",null,3,A),e(87,` 6438 `),a(),e(88,` 6439 `),n(89,"p-accordion-content"),e(90,` 6440 `),n(91,"div",20),e(92,` 6441 `),n(93,"qware-location-attachments",26,4),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(95,` 6442 `),a(),e(96,` 6443 `),a(),e(97,` 6444 `),a(),e(98,` 6445 `),a(),e(99,` 6446 `),a(),e(100,` 6447 `),a(),e(101,` 6448 `),n(102,"div",27),e(103,` 6449 `),n(104,"p-button",28),I(105,"translate"),e(106,` 6450 `),a(),e(107,` 6451 `),_(108,fA,5,5),a(),e(109,` 6452 `),a(),e(110,` 6453 `),a(),e(111,` 6454 `),a(),e(112,` 6455 `),_(113,yA,14,6),a(),e(114,` 6456`),n(115,"p-dialog",29),I(116,"translate"),j("visibleChange",function(u){return E(s),W(i.showProgressDialog,u)||(i.showProgressDialog=u),S(u)}),e(117,` 6457 `),R(118,"p-progressBar",30),e(119,` 6458 `),n(120,"div",31),e(121,` 6459 `),n(122,"span"),e(123),a(),n(124,"span"),e(125," / "),a(),n(126,"span"),e(127),a(),e(128,"\xA0"),n(129,"span",32),e(130,"SHARED.UPDATES_COMPLETED"),a(),e(131,` 6460 `),a(),e(132,` 6461`),a()}if(o&2){let s,c;l(2),p("ngClass",pe(65,ky,!i.auditLoggingDisabled()||i.isBulkEdit())),l(6),f(i.isBulkEdit()?8:9),l(5),p("model",i.actionItems())("popup",!0),l(7),f(i.actionItems()&&i.actionItems().length>0?20:-1),l(2),f(i.auditLoggingDisabled()?-1:22),l(2),p("displaySpinner",i.displaySpinner()),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.location()!==void 0&&((s=i.location())==null?null:s.State)==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(67,Vy)),l(6),K(` 6462 `,y(37,55,"LOCATION.DETAILS"),` 6463 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted())("autoFocus",!1)("validationErrors",i.validationErrors())("locationTypeTreeNodes",i.locationTypeTreeNodes()),H("isStoreroom",i.isStoreroom),p("inventoryItemCount",i.inventoryItemCount())("isBulkEdit",i.isBulkEdit()),l(7),f(i.isBulkEdit()?-1:55),l(4),K(` 6464 `,y(60,57,"LOCATION.ASSOCIATED_USERS"),` 6465 `),l(12),p("form",i.form.controls.AssociatedUsers)("submitted",i.submitted())("validationErrors",i.validationErrors())("userTreeNodes",i.userTreeNodes()),l(7),f(i.hasEventsModule()&&i.eventSchedulingEnabled()?78:-1),l(),f(i.hasEventsModule()&&i.eventSchedulingEnabled()?79:-1),l(4),K(` 6466 `,y(84,59,"LOCATION.ATTACHMENTS"),` 6467 `),l(10),p("form",i.form.controls.Attachments)("submitted",i.submitted())("validationErrors",i.validationErrors())("docs",i.docs())("location",i.location())("disableAllControls",i.disableAllControls()),l(11),q("label",y(105,61,"SHARED.CANCEL")),p("routerLink",i.locationListRoute)("text",!0),l(4),f(((c=i.location())==null?null:c.State)!=="DELETED"?108:-1),l(5),f(!i.auditLoggingDisabled()||i.isBulkEdit()?113:-1),l(2),Pt(ne(68,qy)),q("header",y(116,63,"SHARED.SAVING")),H("visible",i.showProgressDialog),p("modal",!0)("closeOnEscape",!1)("draggable",!1)("resizable",!1)("closable",!1)("breakpoints",i.dialogBreaks)("contentStyle",ne(69,By)),l(3),p("value",i.percentageComplete()),l(5),v(i.updatedCount()),l(4),v(i.bulkLocations().length)}},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,wn,Lt,ge,lt,La,Gt,Ut,me,Te,ot,et,$,qr,Br,Hr,Wr,jr,Yr,ie],styles:[".data-container[_ngcontent-%COMP%]{padding:.25rem;font-size:var(--p-font-size-body2);line-height:1.5;max-height:calc(100% - 48px);overflow-y:auto}@media screen and (min-width: 992px){.data-container[_ngcontent-%COMP%]{height:calc(100% - 96px)}}.data-container[_ngcontent-%COMP%] .data[_ngcontent-%COMP%]{margin:.75rem;border:1px solid var(--p-surface-400);border-radius:4px;padding:1rem}"]})}return r})();var Qr=He(nt());var AA=["actionsMenu"],RA=["attachments"],wA=["shades"],DA=["drawer"],LA=r=>({"lg:col-8":r}),NA=()=>["0"],OA=()=>({width:"50vw"}),FA=()=>({padding:"0 1.25rem 1.25rem"}),MA=(r,d)=>d.Id;function UA(r,d){r&1&&(e(0,` 6468 `),n(1,"span",32),e(2,"LOCATION.BULK_EDIT"),a(),e(3,` 6469 `))}function PA(r,d){r&1&&(e(0,` 6470 `),n(1,"span",32),e(2,"LOCATION.EDIT_LOCATION"),a(),e(3,` 6471 `))}function GA(r,d){if(r&1&&(e(0,` 6472 `),n(1,"a",33),e(2,` 6473 `),n(3,"span",34),e(4),a(),e(5,` 6474 `),n(6,"span",35),e(7),a(),e(8,` 6475 `),a(),e(9,` 6476 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function kA(r,d){r&1&&(e(0,` 6477 `),n(1,"span",37),e(2,"SHARED.ACTIONS"),a(),e(3,` 6478 `),n(4,"i",38),e(5,"expand_more"),a(),e(6,` 6479 `))}function VA(r,d){if(r&1){let t=b();e(0,` 6480 `),n(1,"p-button",36),h("onClick",function(i){E(t),m();let s=Ee(14);return S(s.toggle(i))}),e(2,` 6481 `),_(3,kA,7,0,"ng-template",null,5,A),e(5,` 6482 `),a(),e(6,` 6483 `)}r&2&&(l(),p("raised",!0))}function qA(r,d){if(r&1&&(e(0,` 6484 `),n(1,"a",33),e(2,` 6485 `),n(3,"span",34),e(4),a(),e(5,` 6486 `),n(6,"span",35),e(7),a(),e(8,` 6487 `),a(),e(9,` 6488 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}
6488function BA(r,d){if(r&1){let t=b();e(0,` 6489 `),n(1,"div",39),e(2,` 6490 `),n(3,"p-menu",40,6),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 6491 `),_(6,qA,10,2,"ng-template",null,1,A),e(8,` 6492 `),a(),e(9,` 6493 `),n(10,"p-button",41),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive.set(!c.isActive()))}),e(11,` 6494 `),n(12,"i",38),e(13,"more_vert"),a(),e(14,` 6495 `),a(),e(15,` 6496 `),a(),e(16,` 6497 `)}if(r&2){let t=m();l(3),p("model",t.moreItems())("popup",!0),l(7),p("rounded",!0)("text",!0)}}function HA(r,d){r&1&&(e(0,` 6498 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6499 `))}function WA(r,d){r&1&&(e(0,` 6500 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6501 `))}function jA(r,d){if(r&1&&(e(0,` 6502 `),_(1,HA,4,0)(2,WA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function YA(r,d){r&1&&(e(0,` 6503 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6504 `))}function QA(r,d){r&1&&(e(0,` 6505 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6506 `))}function KA(r,d){if(r&1&&(e(0,` 6507 `),_(1,YA,4,0)(2,QA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function $A(r,d){if(r&1&&(e(0,` 6508 `),n(1,"p-accordion-panel",42),e(2,` 6509 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,KA,3,1,"ng-template",null,3,A),e(8,` 6510 `),a(),e(9,` 6511 `),n(10,"p-accordion-content"),e(11,` 6512 `),n(12,"div",20),e(13,` 6513 `),n(14,"div",21),e(15,` 6514 `),n(16,"qware-location-parent-location",43),e(17,` 6515 `),a(),e(18,` 6516 `),a(),e(19,` 6517 `),a(),e(20,` 6518 `),a(),e(21,` 6519 `),a(),e(22,` 6520 `)),r&2){let t=m();l(4),K(` 6521 `,y(5,5,"LOCATION.PARENT_LOCATION"),` 6522 `),l(12),p("form",t.form.controls.ParentLocation)("submitted",t.submitted())("validationErrors",t.validationErrors())("locationTreeNodes",t.locationTreeNodes())}}function zA(r,d){r&1&&(e(0,` 6523 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6524 `))}function XA(r,d){r&1&&(e(0,` 6525 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6526 `))}function ZA(r,d){if(r&1&&(e(0,` 6527 `),_(1,zA,4,0)(2,XA,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function JA(r,d){r&1&&(e(0,` 6528 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6529 `))}function e3(r,d){r&1&&(e(0,` 6530 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6531 `))}function t3(r,d){if(r&1&&(e(0,` 6532 `),_(1,JA,4,0)(2,e3,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function i3(r,d){if(r&1&&(e(0,` 6533 `),n(1,"p-accordion-panel",44),e(2,` 6534 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,t3,3,1,"ng-template",null,3,A),e(8,` 6535 `),a(),e(9,` 6536 `),n(10,"p-accordion-content"),e(11,` 6537 `),n(12,"div",20),e(13,` 6538 `),n(14,"div",21),e(15,` 6539 `),n(16,"qware-location-assignments",45),e(17,` 6540 `),a(),e(18,` 6541 `),a(),e(19,` 6542 `),a(),e(20,` 6543 `),a(),e(21,` 6544 `),a(),e(22,` 6545 `)),r&2){let t=m();l(4),K(` 6546 `,y(5,4,"LOCATION.EVENT_ASSIGNMENTS"),` 6547 `),l(12),p("formGroup",t.form.controls.EventAssignments)("location",t.location())("userOptions",t.userAssignmentOptions())}}function n3(r,d){r&1&&(e(0,` 6548 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6549 `))}function a3(r,d){r&1&&(e(0,` 6550 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6551 `))}function r3(r,d){if(r&1&&(e(0,` 6552 `),_(1,n3,4,0)(2,a3,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function o3(r,d){if(r&1&&(e(0,` 6553 `),n(1,"p-accordion-panel",46),e(2,` 6554 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,r3,3,1,"ng-template",null,3,A),e(8,` 6555 `),a(),e(9,` 6556 `),n(10,"p-accordion-content"),e(11,` 6557 `),n(12,"div",20),e(13,` 6558 `),n(14,"div",21),e(15,` 6559 `),R(16,"qware-location-rates",47),e(17,` 6560 `),a(),e(18,` 6561 `),a(),e(19,` 6562 `),a(),e(20,` 6563 `),a(),e(21,` 6564 `)),r&2){let t=m();l(4),K(` 6565 `,y(5,3,"LOCATION.RATES"),` 6566 `),l(12),p("formGroup",t.form.controls.EventRates)("allValuesLoaded",t.allValuesLoaded())}}function l3(r,d){r&1&&(e(0,` 6567 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 6568 `))}function s3(r,d){r&1&&(e(0,` 6569 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 6570 `))}
6570function d3(r,d){if(r&1&&(e(0,` 6571 `),_(1,l3,4,0)(2,s3,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function p3(r,d){if(r&1){let t=b();e(0,` 6572 `),n(1,"p-button",48),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 6573 `),a(),e(4,` 6574 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.enableSave())}}function m3(r,d){r&1&&(e(0,` 6575 `),n(1,"span",52),e(2,"LOCATION.SELECTED_LOCATIONS"),a(),e(3,` 6576 `))}function c3(r,d){r&1&&(e(0,` 6577 `),n(1,"span",52),e(2,"SHARED.AUDIT_LOG"),a(),e(3,` 6578 `))}function u3(r,d){if(r&1&&(e(0,` 6579 `),n(1,"div",51),e(2,` 6580 `),_(3,m3,4,0)(4,c3,4,0),a(),e(5,` 6581 `)),r&2){let t=m(2);l(3),f(t.isBulkEdit()?3:4)}}function _3(r,d){if(r&1&&(e(0,` 6582 `),n(1,"div",55),e(2,` 6583 `),n(3,"span"),e(4),a(),e(5,` 6584 `),a(),e(6,` 6585 `)),r&2){let t=d.$implicit;l(4),v(t.Name)}}function E3(r,d){if(r&1&&(e(0,` 6586 `),n(1,"div",54),e(2,` 6587 `),G(3,_3,7,1,null,null,MA),a(),e(5,` 6588 `)),r&2){let t=m(3);l(3),k(t.bulkLocations())}}function S3(r,d){if(r&1){let t=b();e(0,` 6589 `),n(1,"div",56),e(2,` 6590 `),n(3,"qware-entity-history",57),j("parentSpinnerStateChange",function(i){E(t);let s=m(3);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(4,` 6591 `),a(),e(5,` 6592 `),a(),e(6,` 6593 `)}if(r&2){let t=m(3);l(3),p("createdText",t.historyCreatedText())("idMaps",t.historyIdMap())("nameMap",t.historyNameMap())("arrayProperties",t.historyArrayProperties())("entityType",t.entityType),H("parentSpinnerState",t.displayDrawerSpinner),p("blacklistProperties",t.historyBlacklist())}}function x3(r,d){if(r&1&&(e(0,` 6594 `),n(1,"qware-spinner",53),e(2,` 6595 `),_(3,E3,6,0)(4,S3,7,7),a(),e(5,` 6596 `)),r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(2),f(t.isBulkEdit()?3:4)}}function f3(r,d){if(r&1){let t=b();e(0,` 6597 `),n(1,"div",49),e(2,` 6598 `),n(3,"p-drawer",50,7),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar.set(!1))}),e(5,` 6599 `),_(6,u3,6,1,"ng-template",null,8,A),e(8,` 6600 `),_(9,x3,6,3,"ng-template",null,5,A),e(11,` 6601 `),a(),e(12,` 6602 `),a(),e(13,` 6603 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar()),l(2),H("visible",t.showSidebar),p("modal",t.showMask())("transitionOptions",t.sidebarOptions())("closeOnEscape",!1)}}var mm=(()=>{class r{authService;attachmentService;cacheService;confirmationService;fb;inventoryService;gisService;locationService;locationTypeService;responseService;route;router;toastService;translate;userGroupService;userService;eventService;actionsMenu;attachments;shades;drawer;displayDrawerSpinner=D(!1);displaySpinner=D(!0);enableSave=Ye(()=>this.formValid()&&this.formDirty());formDirty=D(!1);isBulkEdit=D(!1);isStoreroom=D(!1);actionItems=D([]);allDocuments=D([]);allInventoryItems=D([]);allLocations=D([]);allUsers=D([]);allValuesLoaded=D(!1);disableAllControls=D(!1);docs=D([]);eventSchedulingEnabled=D(!1);historyArrayProperties=D(["Users"]);historyBlacklist=D(el.LOCATION_EDIT);historyCreatedText=D(void 0);historyIdMap=D(new Map);historyNameMap=D(new Map);inventoryItemCount=D(0);isActive=D(!1);location=D(void 0);locationTreeNodes=D([]);locationTypeTreeNodes=D([]);moreItems=D([]);showMask=D(!1);showSidebar=D(!1);sidebarOptions=D(qe.REMOVE_ANIMATION);submitted=D(!1);updatedCount=D(0);userAssignmentOptions=D([]);userEnabledSidebar=D(!1);userOptions=D([]);userTreeNodes=D([]);validationErrors=D(void 0);formValid=D(!0);dialogBreaks=Fn;entityType=$o.LOCATION;form;locationTypes=[];locations=[];parentLocation;relatedLocationType;shadeFormGroups=[];subscriptions=[];superUserUserIds=[];translations={};bulkLocations=D([]);percentageComplete=D(0);showProgressDialog=D(!1);auditLoggingDisabled=D(!0);hasEventsModule=D(!1);inventoryManagementDisabled=!0;hasGisModule=!1;canAccessGis=!1;gisMapRoute;locationListRoute="../../../"+P.location+"/"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};constructor(t,o,i,s,c,u,x,C,O,w,F,L,U,V,z,ce,Z){this.authService=t,this.attachmentService=o,this.cacheService=i,this.confirmationService=s,this.fb=c,this.inventoryService=u,this.gisService=x,this.locationService=C,this.locationTypeService=O,this.responseService=w,this.route=F,this.router=L,this.toastService=U,this.translate=V,this.userGroupService=z,this.userService=ce,this.eventService=Z,this.hasEventsModule.set(this.authService.tenant.EventsModule),this.hasGisModule=this.authService.tenant.GisModule,this.canAccessGis=this.authService.userHasPrivilege(ae.CAN_ACCESS_GIS),this.auditLoggingDisabled.set(!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()),this.inventoryManagementDisabled=!this.authService.qwareSubscription?.inventoryManagement,this.gisMapRoute="../../../../../gis/"+this.authService.tenantKey}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar.set(t||this.userEnabledSidebar()),this.showMask.set(window.innerWidth<Je.lgbreak),this.showMask()&&this.showSidebar()?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions.set(this.showSidebar()?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION)}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}inventoryCountInStoreroom(){return this.inventoryManagementDisabled?Fe():this.inventoryService.getStorerooms(this.route.
6603snapshot.params.id).pipe(da(t=>{let o=this.allInventoryItems().filter(i=>!!t.find(s=>s.InventoryId===i.Id)&&i.State!==M.DELETED).length;this.inventoryItemCount.set(o)}))}loadData(){let t=[this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.LOCATION","LOCATION.SHOW_ON_MAP","LOCATION.NAVIGATE_TO","LOCATION.STREET_VIEW"]).pipe(N()),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id),this.locationTypeService.getLocationTypes(this.authService.tenant.Id),this.locationService.getLocations(this.authService.tenant.Id),this.locationService.getLocation(this.route.snapshot.params.id)];this.inventoryManagementDisabled||(t=t.concat([this.inventoryService.searchInventory(),this.inventoryService.isTenantStoreroom(this.route.snapshot.params.id)])),this.hasEventsModule()&&(t=t.concat([this.eventService.getAssignments(this.route.snapshot.params.id),this.eventService.getLocationRates(this.route.snapshot.params.id),this.userService.getUsers(this.authService.tenant.Id)])),ue(t).pipe(we(o=>{this.translations=o[0];let i=o[1],s=o[2],c=o[3],u=o[4],x=o[5];this.allInventoryItems.set(o[6]??[]),this.isStoreroom.set(o[7]??!1);let C=o[8]??[],O=o[9]??[],w=o[10]??[];this.moreItems.set([{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}]);let F=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableLocation()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableLocation()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteLocation()}];x?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&F.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreLocation()}),this.hasGisModule&&x.GisLayerId&&x.GisFeatureId&&(this.canAccessGis&&F.push({id:"show-on-map.action",label:this.translations["LOCATION.SHOW_ON_MAP"],icon:"pin_drop",command:()=>this.navigateToMap(x.GisLayerId,x.GisFeatureId)}),x.Latitude&&x.Longitude&&(F.push({id:"navigate-to.action",label:this.translations["LOCATION.NAVIGATE_TO"],icon:"navigation",command:()=>this.gisService.openGoogleMapTab("nav",[x.Longitude,x.Latitude])}),F.push({id:"street-view.action",label:this.translations["LOCATION.STREET_VIEW"],icon:"streetview",command:()=>this.gisService.openGoogleMapTab("street",[x.Longitude,x.Latitude])}))),this.actionItems.set(F.filter(Z=>x?.State===M.DISABLED?Z.id!=="disable.action":x?.State===M.DELETED?Z.id!=="disable.action"&&Z.id!=="enable.action"&&Z.id!=="delete.action":Z.id!=="enable.action"));let L=i.filter(Z=>Z.State===M.ACTIVE&&!ci.includes(Z.Name??"")),U=s.filter(Z=>Z.State===M.ACTIVE);this.userOptions.set(this.userService.removeSuperUsersIfNotSuperUser(s,this.authService.isSuperUser()).filter(Z=>Z.State===M.ACTIVE&&Z.Type===Rt.INTERNAL).map(Z=>({label:Z.fullNameWithEmail(),value:Z})));let V=C.map(Z=>Z.UserId);this.userAssignmentOptions.set(this.userService.removeSuperUsersIfNotSuperUser(w,this.authService.isSuperUser()).filter(Z=>(Z.State===M.ACTIVE||V.includes(Z.Id))&&Z.Type===Rt.INTERNAL).map(Z=>({label:Z.fullNameWithEmail(),value:Z}))),this.locationTypes=c.filter(Z=>Z.State===M.ACTIVE),this.allLocations.set(u),this.locations=u.filter(Z=>Z.State===M.ACTIVE).map(Z=>(Z.LocationType=c.find(fe=>fe.Id===Z.LocationTypeId),Z.Icon=Z.LocationType?.Icon,Z.Parent=u.find(fe=>fe.Id===Z.ParentId),Z));let z=Object.assign(new Cn,x);if(this.location.set(z),this.locationService.mapDocuments(z),this.docs.set(z.Documents?Qr.default.sortBy(Qr.default.cloneDeep(z.Documents),Z=>(Z.Name??"").toLowerCase()):[]),this.relatedLocationType=x.LocationType,this.eventSchedulingEnabled.set(z?.EventScheduling??!1),x.EventAssignments=C,x.EventRates=O,this.setHistoryParams(),!this.locationTypes.find(Z=>Z.Id===x.LocationTypeId)){let Z=c.find(fe=>fe.Id===x.LocationTypeId);for(;Z;)this.locationTypes.indexOf(Z)===-1&&this.locationTypes.push(Z),Z=c.find(fe=>fe.Id===Z?.ParentId)}if(!this.locations.find(Z=>Z.Id===x.ParentId)){let Z=u.find(fe=>fe.Id===x.ParentId);for(;Z;)this.locations.indexOf(x)===-1&&this.locations.push(Z),Z=u.find(fe=>fe.Id===Z?.ParentId)}x.UserIds?.forEach(Z=>{if(!U.find(fe=>fe.UserId===Z)){let fe=s.find(Me=>Me.UserId===Z);if(fe){if(U.push(fe),!L.find(Me=>Me.Id===fe.UserGroupId)){let Me=i.find(ke=>ke.Id===fe.UserGroupId);Me&&L.push(Me)}}else this.superUserUserIds.push(Z)}}),this.locationTreeNodes.set(this.locations.map(Z=>this.locationService.convertToTreeNode(Z,new Set(this.locations.filter(fe=>fe.Id).map(fe=>fe.Id)))));let ce=u.filter(Z=>Z.ParentId===x.Id).length>0;return this.locationTypeTreeNodes.set(this.locationTypes.map(Z=>this.locationTypeService.convertToTreeNode(Z,!ce))),this.userTreeNodes.set(Qr.default.concat(L.map(Z=>this.userGroupService.convertToTreeNode(Z,!0)),U.map(Z=>this.userService.convertToTreeNode(Z)))),this.parentLocation=x.Parent,this.form.patchValue(new Cn().toForm(x)),ce&&this.form.get("Details.LocationTypeId")?.disable(),this.allValuesLoaded.set(!0),this.form.markAsUntouched(),this.form.markAsPristine(),x.State==="DELETED"&&this.form.disable(),this.inventoryCountInStoreroom()})).subscribe({next:()=>this.displaySpinner.set(!1),error:o=>{this.responseService.onDataError(o,this.locationListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),LocationTypeId:this.fb.control(null,[T.required]),Address:this.fb.control("",[T.maxLength(re)]),Capacity:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),SquareFootage:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),EventScheduling:this.fb.control(!1),Latitude:this.fb.control({value:null,disabled:!0}),Longitude:this.fb.control({value:null,disabled:!0})}),ParentLocation:this.fb.group({ParentId:this.fb.control("")}),AssociatedUsers:this.fb.group({Users:this.fb.control([])}),EventAssignments:this.fb.group({Assignments:this.fb.control([],Qi.atLeastOneTrueForAll(["EmailNotifications","IsVoter","IsEditor"]))}),EventRates:this.fb.group({Rates:this.fb.control([])}),Attachments:this.fb.group({Documents:this.fb.control([])})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("ParentLocation"),this.form.get("AssociatedUsers"),this.form.get("EventAssignments"),this.form.get("EventRates")],this.subscriptions.push(this.form.valueChanges.subscribe(()=>{this.formDirty.set(this.form.dirty),this.formValid.set(this.form.valid)}))}setHistoryParams(){this.historyCreatedText.set(this.translations["AUDIT.LOCATION"]+' "'+this.location()?.Name+'"');let t=new Map;t.set("ParentId",[this.allLocations(),"Id","Name"]),t.set("LocationTypeId",[this.locationTypes,"Id","Name"]),this.historyIdMap.set(t);let o=new Map;o.set("Address","LOCATION.ADDRESS"),o.set("Attachments","LOCATION.ATTACHMENTS"),o.set("Capacity","LOCATION.CAPACITY"),o.set("Description","
6603LOCATION.DESCRIPTION"),o.set("DocumentIds","LOCATION.ATTACHMENTS"),o.set("LocationTypeId","LOCATION.LOCATION_TYPE"),o.set("Name","LOCATION.NAME"),o.set("ParentId","LOCATION.PARENT_LOCATION"),o.set("SquareFootage","LOCATION.SQUARE_FOOTAGE"),o.set("Users","LOCATION.ASSOCIATED_USERS"),o.set("EventScheduling","LOCATION.EVENT_SCHEDULING"),o.set("IS_STOREROOM","LOCATION.SET_AS_STOREROOM"),this.historyNameMap.set(o)}isDirty(){return this.form.dirty&&!this.submitted()}save(){if(!this.submitted())if(this.form.valid){this.submitted.set(!0),this.displaySpinner.set(!0);let t=this.location(),o=new Cn().parseForm(this.form.value);o.Id=t?.Id,o.TenantId=this.authService.tenant.Id,o.State=t?.State??M.ACTIVE,o.UserIds=Qr.default.union(o.UserIds,this.superUserUserIds),o.Latitude=t?.Latitude,o.Longitude=t?.Longitude,o.GisLayerId=t?.GisLayerId,o.GisFeatureId=t?.GisFeatureId,this.form.get("Details.LocationTypeId")?.disabled&&(o.LocationTypeId=t?.LocationTypeId),this.subscriptions.push(this.attachmentService.upload().pipe(N(),we(i=>i===void 0?wi(()=>new Error("Upload error.")):this.locationService.handleAttachmentUpload(i,o,this.docs(),this.attachments.attachments)),we(()=>this.locationService.updateLocation(o)),we(()=>{if(this.authService.tenant.EventsModule&&t?.Id){let i=this.form.get("EventAssignments.Assignments")?.value??[];return i.forEach(s=>{s.EntityId=t.Id}),this.eventService.createOrUpdateAssignments(i,t.Id)}return Fe("")}),we(()=>!this.inventoryManagementDisabled&&t?.Id?this.inventoryService.setLocationsAsStorerooms([t.Id],this.isStoreroom()):Fe("")),we(()=>{if(this.authService.tenant.EventsModule&&t?.Id){let i=this.form.get("EventRates.Rates")?.value??[];return i.forEach(s=>{s.LocationId=t.Id}),this.eventService.createOrUpdateLocationRates(i)}return Fe([])})).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.SAVE",this.locationListRoute,this.route)},error:i=>{this.submitted.set(!1),this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i,this.form,this.shades,this.shadeFormGroups))}})),this.fileUpload()}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableLocation(){this.actionsMenu.hide();let t=this.location();this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:t?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"disablePromptDialog",header:o["SHARED.DISABLE_HEADER"],message:o["SHARED.DISABLE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.locationService.disableLocation(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.DISABLE",this.locationListRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}enableLocation(){this.actionsMenu.hide();let t=this.location();this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE","SHARED.ERROR_LABEL","SHARED.DISABLED_PARENT","LOCATION.ERROR.DISABLED_LOCATION_TYPE"],{entity:t?.Name,locationType:this.relatedLocationType?.Name}).pipe(N()).subscribe(o=>{this.parentLocation&&this.parentLocation.State===M.DISABLED?this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.DISABLED_PARENT"]):this.relatedLocationType&&this.relatedLocationType.State===M.DISABLED?this.toastService.error(o["SHARED.ERROR_LABEL"],o["LOCATION.ERROR.DISABLED_LOCATION_TYPE"]):this.confirmationService.confirm({key:"enablePromptDialog",header:o["SHARED.ENABLE_HEADER"],message:o["SHARED.ENABLE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.locationService.enableLocation(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.ENABLE",this.locationListRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}deleteLocation(){this.actionsMenu.hide();let t=this.location();this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:t?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"deletePromptDialog",header:o["SHARED.DELETE_HEADER"],message:o["SHARED.DELETE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.locationService.deleteLocation(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.DELETE",this.locationListRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}restoreLocation(){this.actionsMenu.hide();let t=this.location();this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:t?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"restorePromptDialog",header:o["SHARED.RESTORE_HEADER"],message:o["SHARED.RESTORE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.locationService.restoreLocation(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_LOCATIONS),this.displaySpinner.set(!1),this.responseService.onSuccess("LOCATION.SUCCESS.RESTORE",this.locationListRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}navigateToMap(t,o){let i={relativeTo:this.route,queryParams:{layerId:t,featureId:o}};this.router.navigate([this.gisMapRoute],i)}fileUpload(){this.attachments.attachments&&this.attachments.attachments.fileup.files.length>0?this.attachments.attachments.fileup.uploader():this.attachmentService.clearObservable()}toggleSidebar(){let t=this.showSidebar();this.showSidebar.set(!t),this.userEnabledSidebar.set(Qr.default.clone(t))}ngOnDestroy(){this.subscriptions&&this.subscriptions.length>0&&this.subscriptions.forEach(t=>{t.closed||t.unsubscribe()})}setDocs(t){t instanceof Event||this.docs.set(t)}locationTypeChanged(t){if(t?.node&&t.node[0]){let o=t.node[0].data.parentId;
6603this.locationTreeNodes().forEach(c=>{c.data.selectable=c.data.id!==this.location()?.Id&&c.data.locationTypeId===o});let i=this.form.get("ParentLocation.ParentId")?.value;this.locationTreeNodes().find(c=>c.data.id===i)?.data.locationTypeId!==o&&this.form.get("ParentLocation.ParentId")?.setValue(null),this.form.get("ParentLocation.ParentId")?.setValidators(o!==void 0?[T.required]:[]),this.form.get("ParentLocation.ParentId")?.updateValueAndValidity()}}eventSchedulingChanged(t){this.eventSchedulingEnabled.set(t)}static \u0275fac=function(o){return new(o||r)(g(de),g(ui),g(ei),g(mt),g(be),g(Wi),g(y0),g(zt),g(yi),g(Re),g(he),g(Be),g(Se),g(le),g(Tt),g(ct),g(oi))};static \u0275cmp=B({type:r,selectors:[["qware-location-edit"]],viewQuery:function(o,i){if(o&1&&(X(AA,7),X(RA,7),X(wA,7),X(DA,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.attachments=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:133,vars:70,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["attachments",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.location.edit",1,"grid"],["id","qware.location.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.location.edit.page-header",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.location.edit.actions-menu",3,"model","popup"],["id","qware.location.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.location.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"isStoreroomChange","locationTypeChange","eventSchedulingChanged","isStoreroomChanged","form","submitted","autoFocus","validationErrors","locationTypeTreeNodes","isStoreroom","inventoryItemCount","isBulkEdit"],["id","qware.location.edit.associated-users-shade","value","2"],[3,"form","submitted","validationErrors","userTreeNodes"],["id","qware.location.edit.attachments-shade","value","5"],[3,"docsChanged","form","submitted","validationErrors","docs","location","disableAllControls"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.location.edit.button.cancel",3,"routerLink","text","label"],["id","qware.location.edit.bulk-edit-progress-dialog",3,"visibleChange","header","visible","modal","closeOnEscape","draggable","resizable","closable","breakpoints","contentStyle"],[3,"value"],[1,"progress-info"],["translate",""],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.location.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.location.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.location.edit.parent-location-shade","value","1"],[3,"form","submitted","validationErrors","locationTreeNodes"],["id","qware.location.edit.assignments-shade","value","3"],[3,"formGroup","location","userOptions"],["id","qware.location.edit.rates-shade","value","4"],[3,"formGroup","allValuesLoaded"],["tabindex","999","type","button","id","qware.location.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.location.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.location.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.location.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"data-container"],[1,"data"],[1,"sidebar-content","no-apply"],[3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","entityType","parentSpinnerState","blacklistProperties"]
6603],template:function(o,i){if(o&1){let s=b();n(0,"div",9),e(1,` 6604 `),n(2,"div",10),e(3,` 6605 `),n(4,"div",11),e(5,` 6606 `),n(6,"h3",12),e(7,` 6607 `),_(8,UA,4,0)(9,PA,4,0),a(),e(10,` 6608 `),n(11,"div",13),e(12,` 6609 `),n(13,"p-menu",14,0),e(15,` 6610 `),_(16,GA,10,2,"ng-template",null,1,A),e(18,` 6611 `),a(),e(19,` 6612 `),_(20,VA,7,1),a(),e(21,` 6613 `),_(22,BA,17,4),a(),e(23,` 6614 `),n(24,"qware-spinner",15),e(25,` 6615 `),n(26,"p-card",16),e(27,` 6616 `),n(28,"qware-edit-lock",17),e(29,` 6617 `),n(30,"p-accordion",18,2),e(32,` 6618 `),n(33,"p-accordion-panel",19),e(34,` 6619 `),n(35,"p-accordion-header"),e(36),I(37,"translate"),_(38,jA,3,1,"ng-template",null,3,A),e(40,` 6620 `),a(),e(41,` 6621 `),n(42,"p-accordion-content"),e(43,` 6622 `),n(44,"div",20),e(45,` 6623 `),n(46,"div",21),e(47,` 6624 `),n(48,"qware-location-details",22),j("isStoreroomChange",function(u){return E(s),W(i.isStoreroom,u)||(i.isStoreroom=u),S(u)}),h("locationTypeChange",function(u){return E(s),S(i.locationTypeChanged(u))})("eventSchedulingChanged",function(u){return E(s),S(i.eventSchedulingChanged(u))})("isStoreroomChanged",function(){return E(s),S(i.formDirty.set(!0))}),e(49,` 6625 `),a(),e(50,` 6626 `),a(),e(51,` 6627 `),a(),e(52,` 6628 `),a(),e(53,` 6629 `),a(),e(54,` 6630 `),_(55,$A,23,7),n(56,"p-accordion-panel",23),e(57,` 6631 `),n(58,"p-accordion-header"),e(59),I(60,"translate"),_(61,ZA,3,1,"ng-template",null,3,A),e(63,` 6632 `),a(),e(64,` 6633 `),n(65,"p-accordion-content"),e(66,` 6634 `),n(67,"div",20),e(68,` 6635 `),n(69,"div",21),e(70,` 6636 `),n(71,"qware-location-associated-users",24),e(72,` 6637 `),a(),e(73,` 6638 `),a(),e(74,` 6639 `),a(),e(75,` 6640 `),a(),e(76,` 6641 `),a(),e(77,` 6642 `),_(78,i3,23,6)(79,o3,22,5),n(80,"p-accordion-panel",25),e(81,` 6643 `),n(82,"p-accordion-header"),e(83),I(84,"translate"),_(85,d3,3,1,"ng-template",null,3,A),e(87,` 6644 `),a(),e(88,` 6645 `),n(89,"p-accordion-content"),e(90,` 6646 `),n(91,"div",20),e(92,` 6647 `),n(93,"qware-location-attachments",26,4),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(95,` 6648 `),a(),e(96,` 6649 `),a(),e(97,` 6650 `),a(),e(98,` 6651 `),a(),e(99,` 6652 `),a(),e(100,` 6653 `),a(),e(101,` 6654 `),n(102,"div",27),e(103,` 6655 `),n(104,"p-button",28),I(105,"translate"),e(106,` 6656 `),a(),e(107,` 6657 `),_(108,p3,5,5),a(),e(109,` 6658 `),a(),e(110,` 6659 `),a(),e(111,` 6660 `),a(),e(112,` 6661 `),_(113,f3,14,6),a(),e(114,` 6662`),n(115,"p-dialog",29),I(116,"translate"),j("visibleChange",function(u){return E(s),W(i.showProgressDialog,u)||(i.showProgressDialog=u),S(u)}),e(117,` 6663 `),R(118,"p-progressBar",30),e(119,` 6664 `),n(120,"div",31),e(121,` 6665 `),n(122,"span"),e(123),a(),n(124,"span"),e(125," / "),a(),n(126,"span"),e(127),a(),e(128,"\xA0"),n(129,"span",32),e(130,"SHARED.UPDATES_COMPLETED"),a(),e(131,` 6666 `),a(),e(132,` 6667`),a()}if(o&2){let s,c;l(2),p("ngClass",pe(65,LA,!i.auditLoggingDisabled()||i.isBulkEdit())),l(6),f(i.isBulkEdit()?8:9),l(5),p("model",i.actionItems())("popup",!0),l(7),f(i.actionItems()&&i.actionItems().length>0?20:-1),l(2),f(i.auditLoggingDisabled()?-1:22),l(2),p("displaySpinner",i.displaySpinner()),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.location()!==void 0&&((s=i.location())==null?null:s.State)==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(67,NA)),l(6),K(` 6668 `,y(37,55,"LOCATION.DETAILS"),` 6669 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted())("autoFocus",!1)("validationErrors",i.validationErrors())("locationTypeTreeNodes",i.locationTypeTreeNodes()),H("isStoreroom",i.isStoreroom),p("inventoryItemCount",i.inventoryItemCount())("isBulkEdit",i.isBulkEdit()),l(7),f(i.isBulkEdit()?-1:55),l(4),K(` 6670 `,y(60,57,"LOCATION.ASSOCIATED_USERS"),` 6671 `),l(12),p("form",i.form.controls.AssociatedUsers)("submitted",i.submitted())("validationErrors",i.validationErrors())("userTreeNodes",i.userTreeNodes()),l(7),f(i.hasEventsModule()&&i.eventSchedulingEnabled()?78:-1),l(),f(i.hasEventsModule()&&i.eventSchedulingEnabled()?79:-1),l(4),K(` 6672 `,y(84,59,"LOCATION.ATTACHMENTS"),` 6673 `),l(10),p("form",i.form.controls.Attachments)("submitted",i.submitted())("validationErrors",i.validationErrors())("docs",i.docs())("location",i.location())("disableAllControls",i.disableAllControls()),l(11),q("label",y(105,61,"SHARED.CANCEL")),p("routerLink",i.locationListRoute)("text",!0),l(4),f(((c=i.location())==null?null:c.State)!=="DELETED"?108:-1),l(5),f(!i.auditLoggingDisabled()||i.isBulkEdit()?113:-1),l(2),Pt(ne(68,OA)),q("header",y(116,63,"SHARED.SAVING")),H("visible",i.showProgressDialog),p("modal",!0)("closeOnEscape",!1)("draggable",!1)("resizable",!1)("closable",!1)("breakpoints",i.dialogBreaks)("contentStyle",ne(69,FA)),l(3),p("value",i.percentageComplete()),l(5),v(i.updatedCount()),l(4),v(i.bulkLocations().length)}},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,wn,Lt,ge,lt,La,Gt,Ut,me,Te,ot,et,$,qr,Br,Hr,Wr,jr,Yr,ie],styles:[".data-container[_ngcontent-%COMP%]{padding:.25rem;font-size:var(--p-font-size-body2);line-height:1.5;max-height:calc(100% - 48px);overflow-y:auto}@media screen and (min-width: 992px){.data-container[_ngcontent-%COMP%]{height:calc(100% - 96px)}}.data-container[_ngcontent-%COMP%] .data[_ngcontent-%COMP%]{margin:.75rem;border:1px solid var(--p-surface-400);border-radius:4px;padding:1rem}"]})}return r})();var cm=He(nt());var h3=()=>({raised:!0});function C3(r,d){if(r&1){let t=b();e(0,` 6674 `),n(1,"div",8),e(2,` 6675 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 6676 `),n(7,"p-toggleswitch",9),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 6677 `),a(),e(9,` 6678 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function v3(r,d){r&1&&(e(0,` 6679 `),n(1,"i",12),e(2,"add"),a(),e(3,` 6680 `))}function g3(r,d){if(r&1&&(e(0,` 6681 `),n(1,"i",12),e(2),a(),e(3,` 6682 `)),r&2){let t=m().$implicit;l(2),v(t.icon)}}function T3(r,d){if(r&1&&(e(0,` 6683 `),n(1,"div",13),e(2,` 6684 `),R(3,"p-badge",14),e(4,` 6685 `),n(5,"p-button",15),e(6,` 6686 `),_(7,g3,4,1),a(),e(8,` 6687 `),a(),e(9,` 6688 `)),r&2){let t=d.$implicit;l(3),p("value",t.label),l(2),q("routerLink",t.routerLink),p("text",!0)("rounded",!0)("raised",!0),l(2),f(t.icon?7:-1)}}
6688function I3(r,d){if(r&1&&(e(0,` 6689 `),n(1,"div",10),e(2,` 6690 `),n(3,"p-speeddial",11),e(4,` 6691 `),_(5,v3,4,0,"ng-template",null,1,A),e(7,` 6692 `),_(8,T3,10,6,"ng-template",null,2,A),e(10,` 6693 `),a(),e(11,` 6694 `),a(),e(12,` 6695 `)),r&2){let t=m();l(3),p("model",t.addMenuItems)("buttonProps",ne(3,h3))("mask",!0)}}function b3(r,d){if(r&1&&(e(0,` 6696 `),n(1,"div",10),e(2,` 6697 `),n(3,"p-button",16),e(4,` 6698 `),n(5,"i",12),e(6,"add"),a(),e(7,` 6699 `),a(),e(8,` 6700 `),a(),e(9,` 6701 `)),r&2){let t=m();l(3),q("routerLink",t.locationCreateRoute),p("raised",!0)}}var um=(()=>{class r{authService;locationService;locationTypeService;route;router;toastService;translate;actionItems=D([]);displaySpinner=D(!0);addMenuItems=[];allLocations=[];locationTreeNodes=[];showDeleted=!1;storageKey=Oe.LOCATIONS_FILTER_STORAGE_KEY;canViewDeleted=!1;isSuperUser=!1;locationEditRoute="../"+P.edit;locationCreateRoute="../"+P.create;uploadLocationsRoute="../"+P.uploadLocations;selectedLocationIds=[];constructor(t,o,i,s,c,u,x){this.authService=t,this.locationService=o,this.locationTypeService=i,this.route=s,this.router=c,this.toastService=u,this.translate=x,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED),this.isSuperUser=this.authService.userHasPrivilege(ae.IS_SUPER_USER)}ngOnInit(){ue([this.translate.get(["LOCATION.IMPORT_LOCATIONS","LOCATION.CREATE_LOCATION","SHARED.BULK_UPDATE"]).pipe(N()),this.locationService.getLocations(this.authService.tenant.Id),this.locationTypeService.getLocationTypes(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1],s=t[2];i.forEach(u=>{u.LocationType=s.find(x=>x.Id===u.LocationTypeId),u.LocationType&&(u.Icon=u.LocationType.Icon),u.Parent=i.find(x=>x.Id===u.ParentId)}),this.allLocations=cm.default.sortBy(i,u=>(u.Name??"").toLowerCase());let c=this.filterLocations(this.allLocations);this.locationTreeNodes=c.map(u=>this.locationService.convertToTreeNode(u,new Set(c.filter(x=>x.Id).map(x=>x.Id)))),this.addMenuItems=[{id:"createLocation",label:o["LOCATION.CREATE_LOCATION"],icon:"place",routerLink:this.locationCreateRoute},{id:"uploadLocation",label:o["LOCATION.IMPORT_LOCATIONS"],icon:"file_upload",routerLink:this.uploadLocationsRoute}],this.actionItems.set([{label:o["SHARED.BULK_UPDATE"],icon:"edit",command:()=>this.bulkUpdate()}]),(!i||i.length===0)&&this.displaySpinner.set(!1)})}createNav(){let t={relativeTo:this.route};this.router.navigate(["../"+P.create],t)}filterLocations(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}bulkUpdate(){let t={relativeTo:this.route};this.selectedLocationIds.length===0?this.translate.get(["SHARED.ERROR_LABEL","LOCATION.ERROR.SELECT_LOCATIONS_TO_UPDATE"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["LOCATION.ERROR.SELECT_LOCATIONS_TO_UPDATE"])}):this.selectedLocationIds.length===1?this.router.navigate(["..",P.edit,this.selectedLocationIds[0]],t):(localStorage.setItem(Oe.LOCATION_BULK_UPDATE_IDS,We.stringify(this.selectedLocationIds)),this.router.navigate(["..",P.bulkEdit],t))}toggleShowDeleted(){let t=this.filterLocations(this.allLocations);this.locationTreeNodes=t.map(o=>this.locationService.convertToTreeNode(o,new Set(t.filter(i=>i.Id).map(i=>i.Id))))}onSelectionChanged(t=[]){typeof t=="string"&&(t=[t]),this.selectedLocationIds=t}static \u0275fac=function(o){return new(o||r)(g(de),g(zt),g(yi),g(he),g(Be),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-location-list"]],standalone:!1,decls:21,vars:14,consts:[["spinner",""],["icon",""],["item",""],[1,"align-items-center","flex-inline","col-12"],["translate","","id","qware.location.list.page-header",1,"page-header"],[1,"col-12",2,"padding-top","0"],["id","qware.location.list.spinner",3,"displaySpinner"],["selectionType","multiple","checkboxPosition","left",3,"parentSpinnerStateChange","changed","primaryNodes","allowFilter","showExpandAllButton","editRoute","searchFilterStorageKey","removeDeleted","removeDisabled","parentSpinnerState","actionItems","showSelectedOnlySwitch","matchFilterOnParents"],[1,"show-deleted-switch"],["id","qware.location.list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],[1,"bottom-right-button"],["direction","up","buttonClassName","fab-button","id","qware.component.multiaction-fab",3,"model","buttonProps","mask"],[1,"material-icons"],[1,"create-navigation"],[1,"raised",3,"value"],["type","button","severity","secondary","styleClass","icon-only-button p-s
6701peeddial-action",3,"text","rounded","raised","routerLink"],["severity","primary","styleClass","fab-button","id","qware.location.list.create-button",3,"raised","routerLink"]],template:function(o,i){if(o&1){let s=b();n(0,"div"),e(1,` 6702 `),n(2,"div",3),e(3,` 6703 `),n(4,"h3",4),e(5,` 6704 LOCATION.LOCATION_MANAGEMENT 6705 `),a(),e(6,` 6706 `),_(7,C3,10,4),a(),e(8,` 6707 `),n(9,"div",5),e(10,` 6708 `),n(11,"qware-spinner",6,0),e(13,` 6709 `),n(14,"qware-hierarchy-picker",7),j("parentSpinnerStateChange",function(u){return E(s),W(i.displaySpinner,u)||(i.displaySpinner=u),S(u)}),h("changed",function(u){let x;return E(s),S(i.onSelectionChanged((x=u.ids)!==null&&x!==void 0?x:[]))}),e(15,` 6710 `),a(),e(16,` 6711 `),_(17,I3,13,4)(18,b3,10,2),a(),e(19,` 6712 `),a(),e(20,` 6713`),a()}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(4),p("displaySpinner",i.displaySpinner()),l(3),p("primaryNodes",i.locationTreeNodes)("allowFilter",!0)("showExpandAllButton",!0)("editRoute",i.locationEditRoute)("searchFilterStorageKey",i.storageKey)("removeDeleted",!1)("removeDisabled",!1),H("parentSpinnerState",i.displaySpinner),p("actionItems",i.actionItems())("showSelectedOnlySwitch",!0)("matchFilterOnParents",!0),l(3),f(i.isSuperUser?17:18))},dependencies:[Da,oe,se,Le,Ri,me,qa,et,Ai,$,ie],encapsulation:2})}return r})();var _m=He(Hn()),di=He(nt());var y3=["upload"],A3=()=>({raised:!0}),R3=()=>({width:"50vw"}),Ul=r=>({value:r}),w3=(r,d)=>({colName:r,value:d}),D3=r=>({colName:r}),L3=(r,d,t)=>({colName:r,max:d,value:t}),N3=r=>({"wide-fields":r}),O3=r=>({count:r}),F3=()=>({width:"16px",height:"16px"}),M3=(r,d,t)=>({success:r,failed:d,skipped:t}),Em=(r,d)=>d.field;function U3(r,d){r&1&&(e(0,` 6714 `),n(1,"span",11),e(2,"add"),a(),e(3,` 6715 `))}function P3(r,d){if(r&1){let t=b();e(0,` 6716 `),n(1,"div",12),e(2,` 6717 `),n(3,"p-button",13),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(5,` 6718 `),a(),e(6,` 6719 `),a(),e(7,` 6720 `)}if(r&2){let t=m();l(3),q("label",y(4,3,"SHARED.SAVE_RECORDS")),p("raised",!0)("disabled",t.duplicateRows&&t.duplicateRows.length>0||t.rowsWithInvalidData&&t.rowsWithInvalidData.length>0||t.colsWithInvalidHeaders&&t.colsWithInvalidHeaders.length>0)}}function G3(r,d){if(r&1&&(e(0,` 6721 `),n(1,"div",14),e(2,` 6722 `),n(3,"span",15),e(4,"UPLOAD.VALIDATION.ROWS_NOT_UNIQUE"),a(),n(5,"span",16),e(6),I(7,"json"),a(),e(8,` 6723 `),a(),e(9,` 6724 `)),r&2){let t=m();l(6),K(" ",y(7,1,t.duplicateRows),"")}}function k3(r,d){if(r&1&&(e(0,` 6725 `),n(1,"div",14),e(2,` 6726 `),n(3,"span",15),e(4,"UPLOAD.VALIDATION.ROWS_INVALID_DATA"),a(),n(5,"span",17),e(6),I(7,"json"),a(),e(8,` 6727 `),a(),e(9,` 6728 `)),r&2){let t=m();l(6),K(" ",y(7,1,t.rowsWithInvalidData),"")}}function V3(r,d){if(r&1&&(e(0,` 6729 `),n(1,"th"),e(2,` 6730 `),n(3,"div"),e(4),a(),e(5,` 6731 `),a(),e(6,` 6732 `)),r&2){let t=d.$implicit;l(4),v(t.field)}}function q3(r,d){if(r&1&&(e(0,` 6733 `),n(1,"tr"),e(2,` 6734 `),R(3,"th",21),e(4,` 6735 `),n(5,"th"),e(6,"Row Number"),a(),e(7,` 6736 `),G(8,V3,7,1,null,null,Em),a(),e(10,` 6737 `)),r&2){let t=d.$implicit;l(8),k(t)}}function B3(r,d){if(r&1){let t=b();e(0,` 6738 `),n(1,"input",27),h("blur",function(){E(t);let i=m(2).$implicit,s=m(),c=s.$implicit,u=s.rowIndex,x=m(2);return S(x.validityCheck(c,u,i))})("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),a(),e(2,` 6739 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("fluid",!0)("ngModel",o[t.field]&&(o[t.field].label!=null&&o[t.field].label.includes("FIELD_ERROR"))?o[t.field].value[0]:o[t.field])}}function H3(r,d){r&1&&(e(0,` 6740 `),n(1,"span",23),e(2,"expand_less"),a(),e(3,` 6741 `))}function W3(r,d){r&1&&(e(0,` 6742 `),n(1,"span",23),e(2,"expand_more"),a(),e(3,` 6743 `))}function j3(r,d){if(r&1){let t=b();e(0,` 6744 `),n(1,"p-inputnumber",28),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 6745 `),_(3,H3,4,0,"ng-template",null,3,A),e(5,` 6746 `),_(6,W3,4,0,"ng-template",null,4,A),e(8,` 6747 `),a(),e(9,` 6748 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?void 0:o[t.field])("minFractionDigits",0)("step",0)("fluid",!0)}}function Y3(r,d){if(r&1){let t=b();e(0,` 6749 `),n(1,"qware-autocomplete",29),h("selectChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 6750 `),a(),e(3,` 6751 `)}if(r&2){let t=m(2).$implicit,o=m(),i=o.$implicit,s=o.rowIndex;l(),p("id",t.field+(s+1))("singleSelect",!0)("options",t.options)("selectedOption",!(i[t.field]==null||i[t.field].label==null)&&i[t.field].label.includes("FIELD_ERROR")?void 0:i[t.field])("material",!1)("forceSelection",!0)}}
6751function Q3(r,d){if(r&1){let t=b();e(0,` 6752 `),n(1,"textarea",30),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2," "),a(),e(3,` 6753 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("rows",3)("cols",30)("autoResize",!0)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?o[t.field].value[0]:o[t.field])("fluid",!0)}}function K3(r,d){if(r&1&&(e(0,` 6754 `),_(1,B3,3,2)(2,j3,10,4)(3,Y3,4,6)(4,Q3,4,5),e(5,` 6755 `)),r&2){let t,o=m().$implicit;l(),f((t=o.valType)==="input"?1:t==="number"?2:t==="single-select"?3:t==="multiline"?4:-1)}}function $3(r,d){if(r&1&&(e(0,` 6756 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6757 `)),r&2){let t=m().$implicit;l(2),K(` 6758 `,$e(3,1,"UPLOAD.ERROR.INVALID_REFERENCE_VALUE",pe(4,Ul,t)),` 6759 `)}}function z3(r,d){if(r&1&&(e(0,` 6760 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6761 `)),r&2){let t=m().$implicit;l(2),K(` 6762 `,$e(3,1,"UPLOAD.ERROR.INVALID_VALUE",pe(4,Ul,t)),` 6763 `)}}function X3(r,d){if(r&1&&(e(0,` 6764 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6765 `)),r&2){let t=m(2).$implicit,o=m(3).$implicit;l(2),K(` 6766 `,$e(3,1,"UPLOAD.ERROR.MISSING_VALUE_WITH_VALUE",Kn(4,w3,o.field,t)),` 6767 `)}}function Z3(r,d){if(r&1&&(e(0,` 6768 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6769 `)),r&2){let t=m(5).$implicit;l(2),K(` 6770 `,$e(3,1,"UPLOAD.ERROR.MISSING_VALUE",pe(4,D3,t.field)),` 6771 `)}}function J3(r,d){if(r&1&&(e(0,` 6772 `),n(1,"span"),e(2,` 6773 `),e(3,` 6774 `),_(4,X3,5,7)(5,Z3,5,6),a(),e(6,` 6775 `)),r&2){let t=m(4).$implicit,o=m().$implicit;l(4),f(o[t.field]!=null&&o[t.field].value[0]?4:-1),l(),f(o[t.field]!=null&&o[t.field].value[0]?-1:5)}}function eR(r,d){if(r&1&&(e(0,` 6776 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6777 `)),r&2){let t=m().$implicit,o=m(3).$implicit;l(2),K(` 6778 `,$e(3,1,"UPLOAD.ERROR.INVALID_LENGTH_MAX",er(4,L3,o.field,o.max,t)),` 6779 `)}}function tR(r,d){if(r&1&&(e(0,` 6780 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6781 `)),r&2){let t=m().$implicit;l(2),K(` 6782 `,$e(3,1,"UPLOAD.ERROR.PARENT_NOT_VALID",pe(4,Ul,t)),` 6783 `)}}function iR(r,d){if(r&1&&(e(0,` 6784 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6785 `)),r&2){let t=m().$implicit;l(2),K(` 6786 `,$e(3,1,"UPLOAD.ERROR.PARENT_NOT_VALID_FOR_SELECTED_TYPE",pe(4,Ul,t)),` 6787 `)}}function nR(r,d){r&1&&(e(0,` 6788 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 6789 `)),r&2&&(l(2),K(` 6790 `,y(3,1,"UPLOAD.ERROR.PARENT_REQUIRED"),` 6791 `))}function aR(r,d){if(r&1&&(e(0,` 6792 `),n(1,"p"),e(2,` 6793 `),e(3,` 6794 `),_(4,$3,5,6)(5,z3,5,6)(6,J3,7,2)(7,eR,5,8)(8,tR,5,6)(9,iR,5,6)(10,nR,5,3),a(),e(11,` 6795 `)),r&2){let t=m(3).$implicit,o=m().$implicit,i=m(2);l(4),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_REFERENCE_VALUE?4:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_VALUE?5:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.VALUE_REQUIRED?6:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_LENGTH_MAX?7:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.PARENT_NOT_VALID?8:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.PARENT_NOT_VALID_FOR_SELECTED_TYPE?9:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.PARENT_REQUIRED?10:-1)}}function rR(r,d){if(r&1&&(e(0,` 6796 `),n(1,"div",31),e(2,`
6797 `),G(3,aR,12,7,null,null,Zi),a(),e(5,` 6798 `)),r&2){let t=m(2).$implicit,o=m().$implicit;l(3),k(o[t.field].value)}}function oR(r,d){if(r&1&&(e(0,` 6799 `),n(1,"span"),e(2),a(),e(3,` 6800 `)),r&2){let t=m(3).$implicit,o=m().rowIndex,i=m(2);l(2),K(` 6801 `,i.labelMap.get(o+t.field),` 6802 `)}}function lR(r,d){if(r&1&&(e(0,` 6803 `),n(1,"div"),e(2,` 6804 `),n(3,"div",32),e(4,` 6805 `),_(5,oR,4,1),a(),e(6,` 6806 `),a(),e(7,` 6807 `)),r&2){let t=m(2).$implicit,o=m().rowIndex,i=m(2);l(3),p("ngClass",pe(2,N3,t.field==="Description")),l(2),f(i.labelMap.get(o+t.field)?5:-1)}}function sR(r,d){if(r&1&&(e(0,` 6808 `),_(1,rR,6,0)(2,lR,8,4)),r&2){let t=m().$implicit,o=m().$implicit;l(),f(o[t.field]&&o[t.field].label&&o[t.field].label.includes("FIELD_ERROR")?1:-1),l(),f(((o[t.field]==null?null:o[t.field].label)||"").includes("FIELD_ERROR")?-1:2)}}function dR(r,d){if(r&1&&(e(0,` 6809 `),n(1,"td",24),e(2,` 6810 `),n(3,"p-cellEditor"),e(4,` 6811 `),_(5,K3,6,1,"ng-template",25),e(6,` 6812 `),_(7,sR,3,2,"ng-template",26),e(8,` 6813 `),a(),e(9,` 6814 `),a(),e(10,` 6815 `)),r&2){let t=d.$implicit;l(),p("pEditableColumnDisabled",t.field==="ParentLocation"||t.field==="Name")}}function pR(r,d){if(r&1){let t=b();e(0,` 6816 `),n(1,"tr"),e(2,` 6817 `),n(3,"td"),e(4,` 6818 `),n(5,"p-button",22),h("onClick",function(){let i=E(t).rowIndex,s=m(2);return S(s.removeLocation(i))}),e(6,` 6819 `),n(7,"i",23),e(8,"close"),a(),e(9,` 6820 `),a(),e(10,` 6821 `),a(),e(11,` 6822 `),n(12,"td"),e(13),a(),e(14,` 6823 `),G(15,dR,11,1,null,null,Em),a(),e(17,` 6824 `)}if(r&2){let t=d.columns,o=d.rowIndex;l(5),p("rounded",!0)("text",!0),l(8),v(o+2),l(2),k(t)}}function mR(r,d){if(r&1&&(e(0,` 6825 `),n(1,"p-table",18,2),e(3,` 6826 `),_(4,q3,11,0,"ng-template",19),e(5,` 6827 `),_(6,pR,18,3,"ng-template",20),e(7,` 6828 `),a(),e(8,` 6829 `)),r&2){let t=m();l(),p("value",t.uploadedItems)("columns",t.tableColumns)("paginator",!0)("pageLinks",10)("rows",20)}}function cR(r,d){r&1&&(e(0,` 6830 `),R(1,"p-progressSpinner",34),e(2,` 6831 `)),r&2&&(l(),Pt(ne(2,F3)))}function uR(r,d){if(r&1&&(e(0,` 6832 `),n(1,"span",35),e(2),I(3,"translate"),a(),e(4,` 6833 `)),r&2){let t=m().$implicit;l(),p("ngClass",er(4,M3,t.responseCode==="SUCCESS",t.responseCode==="FAILED"||t.responseCode==="FAILURE",t.responseCode==="SKIPPED")),l(),v(y(3,2,"UPLOAD."+t.responseCode))}}function _R(r,d){if(r&1&&(e(0,` 6834 `),n(1,"div"),e(2,` 6835 `),n(3,"div",33),e(4,` 6836 `),n(5,"span"),e(6),a(),e(7,` 6837 `),n(8,"span"),e(9),I(10,"translate"),_(11,cR,3,3)(12,uR,5,8),a(),e(13,` 6838 `),a(),e(14,` 6839 `),a(),e(15,` 6840 `)),r&2){let t=d.$implicit,o=d.$index;l(6),K("Level ",o+1," Locations: "),l(3),K("",$e(10,4,"UPLOAD.LOCATION_UPLOAD_COUNT",pe(7,O3,t.count)),`\xA0 6841 `),l(2),f(t.responseCode?-1:11),l(),f(t.responseCode?12:-1)}}var Sm=(()=>{class r{appSettingsService;authService;locationService;locationTypeService;toastService;translate;upload;displaySpinner=D(!1);colsWithInvalidHeaders=[];dialogBreaks=Fn;duplicateRows=[];isProgressBarClosable=!1;labelMap=new Map;progressData=[];rowsWithInvalidData=[];showProgressBar=!1;tableColumns=[];uploadedItems=[];uploadErrorEnum=St;uploadProgressTitle="Upload Progress";allLocations=[];allLocationTypes=[];dupeCheckingFields=["Name","Description","LocationType","ParentLocation","Capacity","SquareFootage","Address"];leveledLocationTypes=new Map;timezone;translations={};validExistingParentLocations=[];validUploadedParentLocations;constructor(t,o,i,s,c,u){this.appSettingsService=t,this.authService=o,this.locationService=i,this.locationTypeService=s,this.toastService=c,this.translate=u}ngOnInit(){ue([this.translate.get(["UPLOAD.LOCATION_UPLOAD_TEMPLATE","UPLOAD.LOCATION_TEMPLATE_INSTRUCTIONS","UPLOAD.LOCATION_TEMPLATE_EXAMPLES","UPLOAD.UPLOAD_PROGRESS_TITLE","UPLOAD.ERROR.LOCATION_UPLOAD_ERROR","SHARED.ERROR_LABEL","UPLOAD.SUCCESSFUL.LOCATION_UPLOAD_SUCCESSFUL","SHARED.SUCCESSFUL","SHARED.SUCCESS"]).pipe(N()),this.appSett
6841ingsService.getAppSettings().pipe(N()),this.locationService.getLocations(this.authService.tenant.Id),this.locationTypeService.getLocationTypes(this.authService.tenant.Id)]).subscribe(t=>{this.translations=t[0];let o=t[1];this.allLocations=t[2],this.allLocationTypes=t[3],this.timezone=o.Timezone??"",this.uploadProgressTitle=this.translations["UPLOAD.UPLOAD_PROGRESS_TITLE"];let i=this.allLocationTypes.filter(c=>c.State===M.ACTIVE);i.forEach(c=>{this.allLocationTypes.filter(O=>O.ParentId===c.Id).length===0&&this.leveledLocationTypes.set(0,di.default.concat(this.leveledLocationTypes.get(0)??[],c.Id));let x=1,C=this.allLocationTypes.find(O=>O.Id===c.ParentId);for(;C!==void 0;)x++,C=this.allLocationTypes.find(O=>O.Id===C?.ParentId);this.leveledLocationTypes.set(x,di.default.concat(this.leveledLocationTypes.get(x)??[],c.Id))}),this.validExistingParentLocations=this.allLocations.filter(c=>!(this.leveledLocationTypes.get(0)??[]).includes(c.LocationTypeId)&&c.State===M.ACTIVE),this.validExistingParentLocations.forEach(c=>{let u=this.validExistingParentLocations.find(x=>x.Id===c.ParentId);for(c.LocationHierarchy=c.Name;u!==void 0;)c.LocationHierarchy+=" // "+u.Name,u=this.validExistingParentLocations.find(x=>x.Id===u?.ParentId)}),this.allLocationTypes.forEach(c=>{let u=this.allLocationTypes.find(x=>x.Id===c.ParentId);for(c.LocationTypeHierarchy=c.Name;u!==void 0;)c.LocationTypeHierarchy+=" // "+u.Name,u=this.allLocationTypes.find(x=>x.Id===u?.ParentId)});let s=di.default.sortBy(i.map(c=>({label:c.LocationTypeHierarchy,value:c.Id})),c=>(c.label??"").toLowerCase());this.tableColumns=[{field:"Name",header:"LOCATION.NAME",required:!0,max:re},{field:"Description",header:"LOCATION.DESCRIPTION",valType:"multiline",max:ft},{field:"LocationType",header:"LOCATION.LOCATION_TYPE",valType:"single-select",options:s,required:!0},{field:"ParentLocation",header:"LOCATION.PARENT_LOCATION"},{field:"Capacity",header:"LOCATION.CAPACITY",valType:"number",max:re},{field:"SquareFootage",header:"LOCATION.SQUARE_FOOTAGE",valType:"number",max:re},{field:"Address",header:"LOCATION.ADDRESS",valType:"input",max:re}],this.displaySpinner.set(!1)})}onUpload(t){this.displaySpinner.set(!0),this.labelMap.clear();let o=new FileReader;o.readAsText(t.files[0]),o.onload=i=>{let s=i.target.result.split(/\r\n|\n/),c=[],u=this.readLine(s[0]);this.rowsWithInvalidData=[],this.duplicateRows=[];let x=[],C=0;s.forEach((O,w)=>{if(w>0&&O!==""){O=O.replace("'","!*!*!").replace('""',"@&@&@");let F=this.readLine(O),L=new Cn,U=!1,V=!1;if(F){for(let z in F)F.hasOwnProperty(z)&&(F[z]=F[z].replace("!*!*!","'").replace("@&@&@",'""'));u?.forEach((z,ce)=>{U=U||F[ce]!==null&&F[ce]!==void 0;let Z=this.tableColumns.find(Me=>Me.field?.toLowerCase()===z.toLowerCase()),fe=F[ce]??"";if(Z)if(L[z])this.colsWithInvalidHeaders.push(z);else{if(Z.valType==="single-select"&&Z.field!=="ParentLocation"){let ke=Z.options.find(Xt=>Xt.label?.toLowerCase()===fe.toLowerCase());ke||(ke=Z.options.find(Xt=>Xt.value.toLowerCase()===fe.toLowerCase())),ke?L[z]=ke:fe?L[z]={label:"FIELD_ERROR_"+St.INVALID_REFERENCE_VALUE,value:[fe]}:Z.required&&(L[z]={label:"FIELD_ERROR_"+St.VALUE_REQUIRED,value:[fe]})}else{let ke;switch(z){case"Name":fe?Z.max&&fe.length>Z.max?ke=St.INVALID_LENGTH:L[z]=fe:ke=St.VALUE_REQUIRED;break;case"Description":fe&&Z.max&&fe.length>Z.max?ke=St.INVALID_LENGTH:L[z]=fe;break;case"Capacity":case"SquareFootage":let Xt=parseInt(fe,10);fe&&fe!==""&&Number.isNaN(Xt)?ke=St.INVALID_VALUE:fe&&Z.max&&fe.length>Z.max?ke=St.INVALID_LENGTH:L[z]=Number.isNaN(Xt)?"":Xt.toString();break;case"Address":fe&&Z.max&&fe.length>Z.max?ke=St.INVALID_LENGTH:L[z]=fe;break;default:L[z]=fe}ke&&(V=!0,L[z]={label:"FIELD_ERROR_"+ke,value:[fe]})}let Me=this.getLabel(Z,di.default.clone(L[z]));this.labelMap.set((w-1).toString()+Z.field,Me)}else x=di.default.uniq(di.default.concat(x,[z]))})}else C++;U&&(c.push(L),V&&this.rowsWithInvalidData.push(w+1-C))}}),x.length>0&&this.translate.get(["SHARED.ERROR_LABEL","UPLOAD.ERROR.INVALID_COLUMN"],{colNames:x.join(", ")}).pipe(N()).subscribe(O=>{this.toastService.error(O["SHARED.ERROR_LABEL"],O["UPLOAD.ERROR.INVALID_COLUMN"])}),C>0&&this.translate.get(["SHARED.ERROR_LABEL","UPLOAD.ERROR.PARSE_ERROR"]).pipe(N()).subscribe(O=>{this.toastService.error(O["SHARED.ERROR_LABEL"],O["UPLOAD.ERROR.PARSE_ERROR"])}),this.validityCheck(c),this.uploadedItems=di.default.concat([],c),this.duplicateCheck(),this.upload.clear(),this.displaySpinner.set(!1)},o.onerror=()=>{console.log("Error occured while reading the file")}}duplicateCheck(){let t=[],o=this.uploadedItems.map(i=>{let s=di.default.pick(i,this.dupeCheckingFields);
6841return di.default.keys(s).forEach(c=>{let u=s[c];s[c]=u?.label?.includes("FIELD_ERROR")?u.value[0]:u}),s});o.forEach(i=>{let s=o.reduce((c,u,x)=>(di.default.isEqual(i,u)&&!di.default.flatten(t).includes(x+2)&&(c[0]=di.default.concat(c[0]??[],x+2)),c),[]);s[0]&&s[0].length>1&&t.push(s[0])}),this.duplicateRows=t.map(i=>"("+i.join(", ")+")")}validityCheck(t,o,i){t&&di.default.isArray(t)?this.validateParentage(t,!0):i?.field==="LocationType"?(this.validateParentage(this.uploadedItems,!0),t=this.uploadedItems,o=void 0):t=[t],t.forEach((s,c)=>{c=o??c;let u=!1;if(Object.values(s).filter(C=>C&&C.label&&C.label?.includes("FIELD_ERROR")).length>0&&(u=!0),i){let C=s[i.field];C=di.default.clone(C&&C.value?C.value[0]:C),i.max&&!i.min&&C&&C.length>i.max&&(u=!0,s[i.field]={label:"FIELD_ERROR_"+St.INVALID_LENGTH_MAX,value:[C]}),this.tableColumns.filter(w=>w.required).map(w=>w.field).forEach(w=>{C=s[w],C=di.default.clone(C&&C.value?C.value[0]:C),(C==null||C==="")&&(u=!0,s[w]={label:"FIELD_ERROR_"+St.VALUE_REQUIRED,value:[void 0]})})}u&&!this.rowsWithInvalidData.includes(c+2)&&this.rowsWithInvalidData.push(c+2),!u&&c!==void 0&&(this.rowsWithInvalidData=this.rowsWithInvalidData.filter(C=>C!==c+2))}),this.rowsWithInvalidData=di.default.sortBy(this.rowsWithInvalidData,s=>s),this.dupeCheckingFields.includes(i?.field)&&this.duplicateCheck()}validateParentage(t,o=!1){(!this.validUploadedParentLocations||o)&&(this.validUploadedParentLocations=t.filter(c=>{let u=this.allLocationTypes.find(x=>x.Id===c.LocationType?.value);return u&&!(this.leveledLocationTypes.get(0)??[]).includes(u?.Id)&&!c.Name.label?.includes("FIELD_ERROR")&&!c.ParentLocation.label?.includes("FIELD_ERROR")}).map(c=>{let u=c.ParentLocation?c.Name+" // "+c.ParentLocation:c.Name;return c.LocationHierarchy=u,c}));let i=this.validUploadedParentLocations.concat(this.validExistingParentLocations),s=i.map(c=>c.LocationHierarchy);t.forEach(c=>{let u=c.ParentLocation?.value?c.ParentLocation?.value[0]:c.ParentLocation;if(u!==""&&!s.includes(u))c.ParentLocation={label:"FIELD_ERROR_"+St.PARENT_NOT_VALID,value:[u]};else{let x=!0,C=i.filter(w=>w.LocationHierarchy===u),O=this.allLocationTypes.find(w=>w.Id===c.LocationType?.value);for(;O!==void 0&&C.length>0&&x;){let F=this.allLocationTypes.filter(U=>C.find(V=>V.LocationTypeId===U.Id||V.LocationType?.value===U.Id)).find(U=>U.Id===O?.ParentId),L=C.find(U=>U.LocationTypeId===F?.Id||U.LocationType?.value===F?.Id);x=!!F,C=i.filter(U=>U.LocationHierarchy===L?.ParentLocation),O=F}!c.LocationType||c.LocationType.label?.includes("FIELD_ERROR")||!x?c.ParentLocation={label:"FIELD_ERROR_"+St.PARENT_NOT_VALID_FOR_SELECTED_TYPE,value:[u]}:!(this.leveledLocationTypes.get(1)??[]).includes(c.LocationType?.value)&&u===""?c.ParentLocation={label:"FIELD_ERROR_"+St.PARENT_REQUIRED,value:[u]}:c.ParentLocation?.label?.includes("FIELD_ERROR")&&(c.ParentLocation=c.ParentLocation?.value[0])}})}getLabel(t,o){return o?.label?.includes("FIELD_ERROR")?"":t.valType==="single-select"&&t.options&&o?t.options?.find(s=>s.value===o?.value)?.label:o?.toString()??""}setItem(t,o,i,s){let c=s??void 0;t[i.field]=c;let u=this.getLabel(i,di.default.clone(c));this.labelMap.set(o.toString()+i.field,u),this.validityCheck(t,o,i)}removeLocation(t){this.uploadedItems.splice(t,1),this.uploadedItems=di.default.cloneDeep(this.uploadedItems),this.rowsWithInvalidData.includes(t+2)&&di.default.remove(this.rowsWithInvalidData,o=>o===t+2),this.rowsWithInvalidData=this.rowsWithInvalidData.map(o=>o>t+2?o-1:o),this.duplicateCheck(),this.validityCheck(this.uploadedItems)}downloadExcelFile(){let t=[];t[0]=[Object({v:this.translations["UPLOAD.LOCATION_TEMPLATE_INSTRUCTIONS"]})],t[1]=this.tableColumns.map(x=>x.field),t[2]=this.translations["UPLOAD.LOCATION_TEMPLATE_EXAMPLES"];let o=t[1].map((x,C)=>{let O=x.length,w=t[2][C]?t[2][C].length:0;return w>O?w:O}),i=Ba.aoa_to_sheet(t);i["!margins"]={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer
6841:.3},i["!rows"]=t.map(()=>Object({hpx:20})),i["!cols"]=o.map(x=>Object({wpx:x*6>90?x*6<300?x*6:300:90}));let s=Ba.book_new();Ba.book_append_sheet(s,i);let c=We.formatDate(_m.default.tz("UTC"),this.timezone??""),u=this.translations["UPLOAD.LOCATION_UPLOAD_TEMPLATE"];ml(s,u+" "+c+".xlsx")}save(){this.rowsWithInvalidData=[],this.duplicateRows=[],this.progressData=[];let t=di.default.cloneDeep(this.uploadedItems).map(c=>(c.State=M.ACTIVE,c.TenantId=this.authService.tenant.Id,c.LocationType=c.LocationType?.value,c)),o,i=0,s=Array.from(this.leveledLocationTypes.keys()).filter(c=>c!==0).sort();s.forEach(c=>{let u=this.leveledLocationTypes.get(c);if(u&&u.length>0){let x=t.filter(C=>u.includes(C.LocationType));x.length>0&&(this.progressData.push({count:x.length,responseCode:void 0}),o===void 0?(o=this.locationService.uploadLocationCsv(x),this.displaySpinner.set(!0)):(this.displaySpinner.set(!1),this.showProgressBar=!0,o=o.pipe(we(C=>{let O=C.Result,w=this.progressData[i];return w&&(w.responseCode=di.default.isObject(O)&&Object.values(O).flat().length===0?"SUCCESS":"FAILURE"),i++,this.locationService.uploadLocationCsv(x)}))))}}),o&&o.subscribe({next:c=>{let u=c.Result,x=!0;if(s.length>1){let C=this.progressData[this.progressData.length-1];C&&(C.responseCode=di.default.isObject(u)&&Object.values(u).flat().length===0?"SUCCESS":"FAILURE"),x=!this.progressData.map(O=>O.responseCode).some(O=>O==="FAILURE"),this.isProgressBarClosable=!0}x?this.toastService.success(this.translations["SHARED.SUCCESS"],this.translations["UPLOAD.SUCCESSFUL.LOCATION_UPLOAD_SUCCESSFUL"],0,!0):this.toastService.error(this.translations["SHARED.ERROR_LABEL"],this.translations["UPLOAD.ERROR.LOCATION_UPLOAD_ERROR"]),this.displaySpinner.set(!1)},error:c=>{if(s.length>1){let u;this.progressData.forEach((x,C)=>{x.responseCode!=="SUCCESS"?u===C-1?x.responseCode="FAILED":x.responseCode="SKIPPED":u=C}),this.isProgressBarClosable=!0}this.toastService.error(this.translations["SHARED.ERROR_LABEL"],this.translations["UPLOAD.ERROR.LOCATION_UPLOAD_ERROR"]),console.log(c),this.displaySpinner.set(!1)}})}readLine(t){let o=We.parseCsvLine(t);return o&&(o=o.map(i=>i.trim())),o}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(zt),g(yi),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-location-upload"]],viewQuery:function(o,i){if(o&1&&X(y3,7),o&2){let s;Y(s=Q())&&(i.upload=s.first)}},standalone:!1,decls:29,vars:25,consts:[["upload",""],["chooseicon",""],["dt",""],["incrementbuttonicon",""],["decrementbuttonicon",""],["id","qware.location.upload.spinner",3,"displaySpinner"],[1,"toolbar"],[1,"flex-inline"],["id","upload-button","mode","basic","name","locationUpload","accept",".csv",1,"file-uploader",3,"uploadHandler","auto","customUpload","chooseLabel","chooseButtonProps"],["id","template-button",3,"onClick","label","raised"],[3,"visibleChange","onHide","visible","breakpoints","modal","closable","header","draggable"],[1,"material-icons",2,"padding","0.25rem 0"],[2,"margin-left","auto"],["id","save-button",3,"onClick","label","raised","disabled"],[1,"upload-feedback"],["translate",""],["id","dupe-row-errors"],["id","data-errors"],["id","upload-table","responsiveLayout","scroll",3,"value","columns","paginator","pageLinks","rows"],["pTemplate","header"],["pTemplate","body"],[2,"width","58px"],["type","button","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],["pEditableColumn","",2,"max-width","100%",3,"pEditableColumnDisabled"],["pTemplate","input"],["pTemplate","output"],["pInputText","","type","text",3,"blur","ngModelChange","fluid","ngModel"],["mode","decimal",3,"ngModelChange","ngModel","minFractionDigits","step","fluid"],["appendTo","body",3,"selectChange","id","singleSelect","options","selectedOption","material","forceSelection"],["pTextarea","",3,"ngModelChange","rows","cols","autoResize","ngModel","fluid"],[1,"field-error"],["qwareTruncate","",3,"ngClass"],[1,"progress-data"],["styleClass","progress-spinner","strokeWidth","4"],[3,"ngClass"]],template:function(o,i){if(o&1){let s=b();n(0,"qware-spinner",5),e(1,` 6842 `),n(2,"div",6),e(3,` 6843 `),n(4,"div",7),e(5,` 6844 `),n(6,"p-fileupload",8,0),I(8,"translate"),h("uploadHandler",function(u){return E(s),S(i.onUpload(u))}),e(9,` 6845 `),_(10,U3,4,0,"ng-template",null,1,A),e(12,` 6846 `),a(),e(13,` 6847 `),n(14,"p-button",9),I(15,"translate"),h("onClick",function(){return E(s),S(i.downloadExcelFile())}),e(16,` 6848 `),a(),e(17,` 6849 `),_(18,P3,8,5),a(),e(19,` 6850 `),_(20,G3,10,3)(21,k3,10,3),a(),e(22,` 6851 `),_(23,mR,9,5),n(24,"p-dialog",10),j("visibleChange",function(u){return E(s),W(i.showProgressBar,u)||(i.showProgressBar=u),S(u)}),h("onHide",function(){return E(s),S(i.isProgressBarClosable=!1)}),e(25,` 6852 `),G(26,_R,16,9,null,null,Zi),a(),e(28,` 6853`),a()}o&2&&(p("displaySpinner",i.displaySpinner()),l(6),q("chooseLabel",y(8,19,"LOCATION.UPLOAD_LOCATIONS")),p("auto",!0)("customUpload",!0)("chooseButtonProps",ne(23,A3)),l(8),q("label",y(15,21,"UPLOAD.DOWNLOAD_TEMPLATE")),p("raised",!0),l(4),f(i.uploadedItems&&i.uploadedItems.length>0?18:-1),l(2),f(i.duplicateRows&&i.duplicateRows.length>0?20:-1),l(),f(i.rowsWithInvalidData&&i.rowsWithInvalidData.length>0?21:-1),l(2),f(i.uploadedItems&&i.uploadedItems.length>0?23:-1),l(),Pt(ne(24,R3)),H("visible",i.showProgressBar),p("breakpoints",i.dialogBreaks)("modal",!0)("closable",i.isProgressBarClosable)("header",i.uploadProgressTitle)("draggable",!1),l(2),k(i.progressData))},dependencies:[Pe,oe,Qe,wn,gr,Ae,se,Le,bi,ye,x0,wt,me,kt,ht,Nr,Or,ri,$,Go,ie],styles:[`qware-location-upload .toolbar{margin-bottom:.5rem}@media screen and (max-width: 992px){qware-location-upload .toolbar{padding:0 1rem}}qware-location-upload .toolbar .file-uploader{margin:0 .5rem .5rem 0}
6853qware-location-upload .toolbar .upload-feedback{margin:.5rem 0}qware-location-upload .field-error{background:tomato;font-weight:700;border-radius:4px;padding:.25rem;white-space:normal;cursor:pointer}qware-location-upload .wide-fields{max-width:300px}qware-location-upload .p-inputtext{min-width:160px}qware-location-upload .p-dialog .p-dialog-content{padding:0 .75rem .75rem;border-bottom-left-radius:4px;border-bottom-right-radius:4px}qware-location-upload .p-dialog .p-dialog-content>div{padding:.5rem}qware-location-upload .p-dialog .p-dialog-content>div>div>span:nth-of-type(1){font-weight:700}qware-location-upload .p-dialog .p-dialog-content>div>div>span:nth-of-type(2)>span{font-size:12px;font-weight:700}qware-location-upload .p-dialog .p-dialog-content>div>div>span:nth-of-type(2)>span.success{color:green}qware-location-upload .p-dialog .p-dialog-content>div>div>span:nth-of-type(2)>span.failed{color:red}qware-location-upload .p-dialog .p-dialog-content>div>div>span:nth-of-type(2)>span.skipped{color:#ff0}qware-location-upload .progress-spinner .p-progress-spinner-circle{animation:custom-progress-spinner-dash 1.5s ease-in-out infinite,custom-progress-spinner-color 6s ease-in-out infinite}@keyframes custom-progress-spinner-color{to,0%{stroke:var(--p-accent-50)}40%{stroke:var(--p-accent-50)}66%{stroke:var(--p-accent-50)}80%,90%{stroke:var(--p-accent-50)}} 6854`],encapsulation:2})}return r})();var hm=He(nt());function ER(r,d){if(r&1&&(e(0,` 6855 `),n(1,"small",17),e(2,` 6856 `),n(3,"div",5),e(4),a(),e(5,` 6857 `),a(),e(6,` 6858 `)),r&2){let t=d.$implicit;l(4),v(t)}}function SR(r,d){if(r&1&&(e(0,` 6859 `),G(1,ER,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function xR(r,d){if(r&1&&(e(0,` 6860 `),n(1,"small",17),e(2,` 6861 `),n(3,"div",5),e(4),a(),e(5,` 6862 `),a(),e(6,` 6863 `)),r&2){let t=d.$implicit;l(4),v(t)}}function fR(r,d){if(r&1&&(e(0,` 6864 `),G(1,xR,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Description)}}var Pl=(()=>{class r{autoFocus=!0;form;submitted=!1;validationErrors;textareaFocusChange=new Yt;textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-service-area-details"]],inputs:{autoFocus:"autoFocus",form:"form",submitted:"submitted",validationErrors:"validationErrors"},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:70,vars:16,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.service-area.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"qwareFocus","fluid"],["id","qware.service-area.details.label.name","for","qware.service-area.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.service-area.details.error.name-req","translate","",3,"hidden"],["id","qware.service-area.details.error.name-length","translate","",3,"hidden"],["id","qware.service-area.create.primary",1,"flex-inline","flex-space-between","medium-input"],["id","qware.service-area.create.primary.checkbox"],["name","SetAsPrimary","formControlName","SetAsPrimary",3,"tabindex","binary"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","2","id","qware.service-area.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.service-area.details.label.description","for","qware.service-area.details.textarea.description"],["translate","",3,"hidden"],[1,"validation-error"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 6865 `),n(2,"div",1),e(3,` 6866 `),n(4,"div",2),e(5,` 6867 `),n(6,"p-floatlabel"),e(7,` 6868 `),R(8,"input",3),e(9,` 6869 `),n(10,"label",4),e(11,` 6870 `),n(12,"span",5),e(13,"SERVICEAREA.NAME"),a(),n(14,"span",6),e(15," *"),a(),e(16,` 6871 `),a(),e(17,` 6872 `),a(),e(18,` 6873 `),n(19,"small",7),e(20,` 6874 `),n(21,"div",8),e(22,` 6875 SERVICEAREA.ERROR.NAME_REQUIRED 6876 `),a(),e(23,` 6877 `),n(24,"div",9),e(25,` 6878 SERVICEAREA.ERROR.NAME_LENGTH 6879 `),a(),e(26,` 6880 `),a(),e(27,` 6881 `),_(28,SR,3,0),a(),e(29,` 6882 `),n(30,"div",10),e(31,` 6883 `),n(32,"label"),e(33,` 6884 `),n(34,"span",5),e(35,"SERVICEAREA.SET_AS_PRIMARY"),a(),e(36,` 6885 `),a(),e(37,` 6886 `),n(38,"span",11),e(39,` 6887 `),R(40,"p-checkbox",12),e(41,` 6888 `),a(),e(42,` 6889 `),a(),e(43,` 6890 `),a(),e(44,` 6891 `),n(45,"div",13),e(46,` 6892 `),n(47,"div",2),e(48,` 6893 `),n(49,"p-floatlabel"),e(50,` 6894 `),n(51,"textarea",14),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(52," "),a(),e(53,` 6895 `),n(54,"label",15),e(55,`
6896 `),n(56,"span",5),e(57,"SERVICEAREA.DESCRIPTION"),a(),e(58,` 6897 `),a(),e(59,` 6898 `),a(),e(60,` 6899 `),n(61,"small",7),e(62,` 6900 `),n(63,"div",16),e(64,` 6901 SERVICEAREA.ERROR.DESCRIPTION_LENGTH 6902 `),a(),e(65,` 6903 `),a(),e(66,` 6904 `),_(67,fR,3,0),a(),e(68,` 6905 `),a(),e(69,` 6906`),a()),o&2&&(p("formGroup",i.form),l(8),p("qwareFocus",i.autoFocus)("fluid",!0),l(11),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?28:-1),l(12),p("tabindex",3)("binary",!0),l(11),p("rows",3)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",i.form.controls.Description.valid||i.form.controls.Description.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Description.errors!=null&&i.form.controls.Description.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Description&&i.form.controls.Description.untouched?67:-1))},dependencies:[yt,Ne,je,Ae,se,ge,ye,Te,De,ri,$],styles:[".text-box[_ngcontent-%COMP%]{min-height:77px}"]})}return r})();var Gl=(()=>{class r{form;submitted=!1;userTreeNodes=[];validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-service-area-users-association"]],inputs:{form:"form",submitted:"submitted",userTreeNodes:"userTreeNodes",validationErrors:"validationErrors"},standalone:!1,decls:12,vars:9,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],[1,"single-layer",2,"padding","1rem 1rem 1.5rem"],["formControlName","Users","selectionType","hierarchy",3,"primaryNodes","requiredMark","allowFilter","showSelectionOptions","selectionOptionsLabel","matchFilterOnParents"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 6907 `),n(2,"div",1),e(3,` 6908 `),n(4,"div",2),e(5,` 6909 `),n(6,"qware-hierarchy-picker",3),I(7,"translate"),e(8,` 6910 `),a(),e(9,` 6911 `),a(),e(10,` 6912 `),a(),e(11,` 6913`),a()),o&2&&(p("formGroup",i.form),l(6),q("selectionOptionsLabel",y(7,7,"SERVICEAREA.USER_SELECT")),p("primaryNodes",i.userTreeNodes)("requiredMark",!0)("allowFilter",!0)("showSelectionOptions",!0)("matchFilterOnParents",!0))},dependencies:[se,ge,Ri,Te,De,ie],encapsulation:2})}return r})();function hR(r,d){if(r&1){let t=b();e(0,` 6914 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 6915 `),n(3,"span",16),e(4),a(),e(5,` 6916 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 6917 `),a(),e(10,` 6918 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"SERVICEAREA.DETAILS"))}}function CR(r,d){if(r&1){let t=b();e(0,` 6919 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 6920 `),n(3,"span",16),e(4),a(),e(5,` 6921 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 6922 `),a(),e(10,` 6923 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"SERVICEAREA.ASSOCIATED_USERS"))}}function vR(r,d){if(r&1){let t=b();e(0,` 6924 `),n(1,"div",3),e(2,` 6925 `),n(3,"h3",4),e(4,` 6926 SERVICEAREA.CREATE_SERVICE_AREA 6927 `),a(),e(5,` 6928 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 6929 `),n(8,"p-step-list"),e(9,` 6930 `),n(10,"p-step",6),e(11,` 6931 `),_(12,hR,11,4,"ng-template",null,0,A),e(14,` 6932 `),a(),e(15,` 6933 `),n(16,"p-step",6),e(17,` 6934 `),_(18,CR,11,4,"ng-template",null,0,A),e(20,` 6935 `),a(),e(21,` 6936 `),a(),e(22,` 6937 `),n(23,"p-step-panels"),e(24,` 6938 `),n(25,"p-card"),e(26,` 6939 `),n(27,"div",7),e(28,` 6940 `),n(29,"h4",8),e(30,` 6941 SERVICEAREA.DETAILS 6942 `),a(),e(31,` 6943 `),n(32,"qware-service-area-details",9),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))}),e(33,` 6944 `),a(),e(34,` 6945 `),a(),e(35,` 6946 `),n(36,"div",7),e(37,` 6947 `),n(38,"h4",10),e(39,` 6948 SERVICEAREA.ASSOCIATED_USERS 6949 `),a(),e(40,` 6950 `),n(41,"qware-service-area-users-association",11),e(42,` 6951 `),a(),e(43,` 6952 `),a(),e(44,` 6953 `),n(45,"div",12),e(46,` 6954 `),n(47,"p-button",13),I(48,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(49,` 6955 `),a(),e(50,` 6956 `),n(51,"p-button",14),I(52,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(53,` 6957 `),a(),e(54,` 6958 `),a(),e(55,` 6959 `),a(),e(56,` 6960 `),a(),e(57,` 6961 `),a(),e(58,` 6962 `),a(),e(59,` 6963 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex===0),p("value",1),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.Details)("submitted",t.submitted)("validationErrors",t.validationErrors),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.AssociatedUsers)("submitted",t.submitted)("validationErrors",t.validationErrors)("userTreeNodes",t.userTreeNodes),l(6),q("label",y(48,19,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(52,21,t.stepIndex===1?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.stepFormGroups[t.stepIndex]!=null&&t.stepFormGroups[t.stepIndex].valid))}}var Cm=(()=>{class r{authService;cacheService;fb;responseService;route;router;serviceAreaService;toastService;translate;userGroupService;userService;displaySpinner=!0;form;isLoaded=!1;serviceAreaSteps=[];stepFormGroups=[];stepIndex=0;submitted=!1;textareaFocused=!1;userTreeNodes=[];validationErrors;constructor(t,o,i,s,c,u,x,C,O,w,F){this.authService=t,this.cacheService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.serviceAreaService=x,this.toastService=C,this.translate=O,this.userGroupService=w,this.userService=F}ngOnInit(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),SetAsPrimary:this.fb.control(!1)}),AssociatedUsers:this.fb.group({Users:this.fb.control([])})}),this.stepFormGroups=[this.form.get("Details"),this.form.get("AssociatedUsers")],ue([this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1],s=o.filter(u=>u.State===M.ACTIVE&&!ci.includes(u.Name??"")),c=i.filter(u=>u.State===M.ACTIVE);this.userTreeNodes=hm.default.concat(s.map(u=>this.userGroupService.convertToTreeNode(u,!0)),c.map(u=>this.userService.convertToTreeNode(u))),this.isLoaded=!0,this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../"+P.list],t)}else this.stepIndex--}stepSubmit(t){this.stepFormGroups[this.stepIndex]?.valid&&(t<1?this.stepIndex++:this.submitForm(new oo().parseForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,this.serviceAreaService.createServiceArea(t).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.stepFormGroups,this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(be),g(Re),g(he),g(Be),g(_i),g(Se),g(le),g(Tt),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-service-area-create"]],standalone:!1,decls:6,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.service-area.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.service-area.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.service-area.create.details.label","translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors"],["id","qware.service-area.createusers.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","userTreeNodes"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.service-area.create-service-area.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.service-area.create-service-area.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("key
6963down.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(1,` 6964 `),n(2,"qware-spinner",2),e(3,` 6965 `),_(4,vR,60,23),a(),e(5,` 6966`),a()),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,Pl,Gl,ie],encapsulation:2})}return r})();var Co=He(nt());var gR=["actionsMenu"],TR=["shades"],IR=["drawer"],bR=r=>({"lg:col-8":r}),yR=()=>["0"];function AR(r,d){if(r&1&&(e(0,` 6967 `),n(1,"a",26),e(2,` 6968 `),n(3,"span",27),e(4),a(),e(5,` 6969 `),n(6,"span",28),e(7),a(),e(8,` 6970 `),a(),e(9,` 6971 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function RR(r,d){r&1&&(e(0,` 6972 `),n(1,"span",30),e(2,"SHARED.ACTIONS"),a(),e(3,` 6973 `),n(4,"i",31),e(5,"expand_more"),a(),e(6,` 6974 `))}function wR(r,d){if(r&1){let t=b();e(0,` 6975 `),n(1,"p-button",29),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 6976 `),_(3,RR,7,0,"ng-template",null,4,A),e(5,` 6977 `),a(),e(6,` 6978 `)}r&2&&(l(),p("raised",!0))}function DR(r,d){if(r&1&&(e(0,` 6979 `),n(1,"a",26),e(2,` 6980 `),n(3,"span",27),e(4),a(),e(5,` 6981 `),n(6,"span",28),e(7),a(),e(8,` 6982 `),a(),e(9,` 6983 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function LR(r,d){if(r&1){let t=b();e(0,` 6984 `),n(1,"div",32),e(2,` 6985 `),n(3,"p-menu",33,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 6986 `),_(6,DR,10,2,"ng-template",null,1,A),e(8,` 6987 `),a(),e(9,` 6988 `),n(10,"p-button",34),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 6989 `),n(12,"i",31),e(13,"more_vert"),a(),e(14,` 6990 `),a(),e(15,` 6991 `),a(),e(16,` 6992 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function NR(r,d){r&1&&(e(0,` 6993 `),n(1,"i",31),e(2,"expand_less"),a(),e(3,` 6994 `))}function OR(r,d){r&1&&(e(0,` 6995 `),n(1,"i",31),e(2,"expand_more"),a(),e(3,` 6996 `))}function FR(r,d){if(r&1&&(e(0,` 6997 `),_(1,NR,4,0)(2,OR,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function MR(r,d){r&1&&(e(0,` 6998 `),n(1,"i",31),e(2,"expand_less"),a(),e(3,` 6999 `))}function UR(r,d){r&1&&(e(0,` 7000 `),n(1,"i",31),e(2,"expand_more"),a(),e(3,` 7001 `))}function PR(r,d){if(r&1&&(e(0,` 7002 `),_(1,MR,4,0)(2,UR,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function GR(r,d){if(r&1){let t=b();e(0,` 7003 `),n(1,"p-button",35),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 7004 `),a(),e(4,` 7005 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function kR(r,d){r&1&&(e(0,` 7006 `),n(1,"div",38),e(2,` 7007 `),n(3,"span",39),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 7008 `),a(),e(6,` 7009 `))}function VR(r,d){if(r&1){let t=b();e(0,` 7010 `),n(1,"qware-spinner",40),e(2,` 7011 `),n(3,"div",41),e(4,` 7012 `),n(5,"qware-entity-history",42),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 7013 `),a(),e(7,` 7014 `),a(),e(8,` 7015 `),a(),e(9,` 7016 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function qR(r,d){if(r&1){let t=b();e(0,` 7017 `),n(1,"div",36),e(2,` 7018 `),n(3,"p-drawer",37,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 7019 `),_(6,kR,7,0,"ng-template",null,7,A),e(8,` 7020 `),_(9,VR,10,7,"ng-template",null,4,A),e(11,` 7021 `),a(),e(12,` 7022 `),a(),e(13,` 7023 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var vm=(()=>{class r{authService;cacheService;confirmationService;fb;responseService;route;serviceAreaService;toastService;translate;userGroupService;userService;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];displaySpinner=!0;form;historyArrayProperties=["Users"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;moreItems=[];serviceArea;showMask=!1;showSidebar=!0;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;userTreeNodes=[];validationErrors;auditLoggingDisabled=!0;serviceAreaLimit;serviceAreaListRoute="../../../"+P.serviceArea+"/"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};shadeFormGroups=[];superUserUserIds=[];translations={};constructor(t,o,i,s,c,u,x,C,O,w,F){this.authService=t,this.cacheService=o,this.confirmationService=i,this.fb=s,this.responseService=c,this.route=u,this.serviceAreaService=x,this.toastService=C,this.translate=O,this.userGroupService=w,this.userService=F,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.serviceAreaLimit=this.authService.qwareSubscription?.serviceAreaLimit}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.SERVICE_AREA"]).pipe(N()),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id),this.serviceAreaService.getServiceArea(this.route.
7023snapshot.params.id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1],i=t[2];this.serviceArea=t[3],this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"alt_list",command:()=>this.toggleSidebar()}];let s=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableServiceArea()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableServiceArea()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteServiceArea()}];this.serviceArea?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&s.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreServiceArea()}),this.actionItems=s.filter(x=>this.serviceArea?.State===M.DISABLED?x.id!=="disable.action":this.serviceArea?.State===M.DELETED?x.id!=="disable.action"&&x.id!=="enable.action"&&x.id!=="delete.action":x.id!=="enable.action");let c=o.filter(x=>x.State===M.ACTIVE&&!ci.includes(x.Name??"")),u=i.filter(x=>x.State===M.ACTIVE);this.serviceArea?.UserIds?.forEach(x=>{if(!u.find(C=>C.UserId===x)){let C=i.find(O=>O.UserId===x);if(C){if(u.push(C),!c.find(O=>O.Id===C.UserGroupId)){let O=c.find(w=>w.Id===C.UserGroupId);O&&c.push(O)}}else this.superUserUserIds.push(x)}}),this.userTreeNodes=Co.default.concat(c.map(x=>this.userGroupService.convertToTreeNode(x,!0)),u.map(x=>this.userService.convertToTreeNode(x))),this.setHistoryParams(),this.form?.patchValue(new oo().toForm(this.serviceArea)),this.serviceArea.State==="DELETED"&&this.form?.disable(),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.serviceAreaListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),SetAsPrimary:this.fb.control(!1)}),AssociatedUsers:this.fb.group({Users:this.fb.control([])})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("AssociatedUsers")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.SERVICE_AREA"]+' "'+this.serviceArea?.Name+'"',this.historyIdMap=new Map;let t=new Map;t.set("Name","SERVICEAREA.NAME"),t.set("Description","SERVICEAREA.DESCRIPTION"),t.set("IsPrimary","SERVICEAREA.IS_PRIMARY"),t.set("Users","SERVICEAREA.ASSOCIATED_USERS"),this.historyNameMap=t}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form?.valid){this.submitted=!0,this.displaySpinner=!0;let t=new oo().parseForm(this.form.value);t.Id=this.serviceArea?.Id,t.TenantId=this.authService.tenant.Id,t.State=this.serviceArea?.State??M.ACTIVE,t.UserIds=Co.default.union(t.UserIds,this.superUserUserIds),t.CustomLayouts=this.serviceArea?.CustomLayouts,this.serviceAreaService.updateServiceArea(t).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.SAVE",this.serviceAreaListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableServiceArea(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.serviceArea?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.serviceArea?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.serviceAreaService.disableServiceArea(this.serviceArea.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.DISABLE",this.serviceAreaListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableServiceArea(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.serviceArea?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.serviceArea?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.serviceAreaService.enableServiceArea(this.serviceArea.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.ENABLE",this.serviceAreaListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteServiceArea(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.serviceArea?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.serviceArea?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.serviceAreaService.deleteServiceArea(this.serviceArea.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.DELETE",this.serviceAreaListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreServiceArea(){this.actionsMenu.hide();let t=this.authService.tenant.ServiceAreaCount;t&&Co.default.isNumber(this.serviceAreaLimit)&&t>=this.serviceAreaLimit?this.translate.get(["SHARED.ERROR_LABEL","SUBSCRIPTION.ERROR.SERVICE_AREA_LIMIT_REACHED"],{limit:this.serviceAreaLimit}).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SUBSCRIPTION.ERROR.SERVICE_AREA_LIMIT_REACHED"])}):this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.serviceArea?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"restorePromptDialog",header:o["SHARED.RESTORE_HEADER"],message:o["SHARED.RESTORE_MESSAGE"],accept:()=>{this.serviceArea?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.serviceAreaService.restoreServiceArea(this.serviceArea.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_SERVICE_AREAS),this.displaySpinner=!1,this.responseService.onSuccess("SERVICEAREA.SUCCESS.RESTORE",this.serviceAreaListRoute,this.route)},error:i=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Co.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(mt),g(be),g(Re),g(he),g(_i),g(Se),g(le),g(Tt),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-service-area-edit"]],viewQuery:function(o,i){if(o&1&&(X(gR,7),X(TR,7),X(IR,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:90,vars:35,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.service-area.edit",1,"grid"],["id","qware.service-area.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.service-area.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.service-area.edit.actions-menu",3,"model","popup"],["id","qware.service-area.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.service-area.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"form","submitted","validationErrors","autoFocus"],["id","qware.service-area.edit.settings-shade","value","1"],[3,"form","submitted","validationErrors","userTreeNodes"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.service-area.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.service-area.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.service-area.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.service-area.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.service-area.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.service-area.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.service-area.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","serviceArea",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){o&1&&(n(0,"div",8),e(1,` 7024 `),n(2,"div",9),e(3,`
7025 `),n(4,"div",10),e(5,` 7026 `),n(6,"h3",11),e(7,` 7027 SERVICEAREA.EDIT_SERVICE_AREA 7028 `),a(),e(8,` 7029 `),n(9,"div",12),e(10,` 7030 `),n(11,"p-menu",13,0),e(13,` 7031 `),_(14,AR,10,2,"ng-template",null,1,A),e(16,` 7032 `),a(),e(17,` 7033 `),_(18,wR,7,1),a(),e(19,` 7034 `),_(20,LR,17,4),a(),e(21,` 7035 `),n(22,"qware-spinner",14),e(23,` 7036 `),n(24,"p-card",15),e(25,` 7037 `),n(26,"qware-edit-lock",16),e(27,` 7038 `),n(28,"p-accordion",17,2),e(30,` 7039 `),n(31,"p-accordion-panel",18),e(32,` 7040 `),n(33,"p-accordion-header"),e(34),I(35,"translate"),_(36,FR,3,1,"ng-template",null,3,A),e(38,` 7041 `),a(),e(39,` 7042 `),n(40,"p-accordion-content"),e(41,` 7043 `),n(42,"div",19),e(43,` 7044 `),n(44,"div",20),e(45,` 7045 `),n(46,"qware-service-area-details",21),e(47,` 7046 `),a(),e(48,` 7047 `),a(),e(49,` 7048 `),a(),e(50,` 7049 `),a(),e(51,` 7050 `),a(),e(52,` 7051 `),n(53,"p-accordion-panel",22),e(54,` 7052 `),n(55,"p-accordion-header"),e(56),I(57,"translate"),_(58,PR,3,1,"ng-template",null,3,A),e(60,` 7053 `),a(),e(61,` 7054 `),n(62,"p-accordion-content"),e(63,` 7055 `),n(64,"div",19),e(65,` 7056 `),n(66,"div",20),e(67,` 7057 `),n(68,"qware-service-area-users-association",23),e(69,` 7058 `),a(),e(70,` 7059 `),a(),e(71,` 7060 `),a(),e(72,` 7061 `),a(),e(73,` 7062 `),a(),e(74,` 7063 `),a(),e(75,` 7064 `),a(),e(76,` 7065 `),n(77,"div",24),e(78,` 7066 `),n(79,"p-button",25),I(80,"translate"),e(81,` 7067 `),a(),e(82,` 7068 `),_(83,GR,5,5),a(),e(84,` 7069 `),a(),e(85,` 7070 `),a(),e(86,` 7071 `),a(),e(87,` 7072 `),_(88,qR,14,6),a(),e(89,` 7073`)),o&2&&(l(2),p("ngClass",pe(32,bR,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.serviceArea!==void 0&&i.serviceArea.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(34,yR)),l(6),K(` 7074 `,y(35,26,"SERVICEAREA.DETAILS"),` 7075 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("autoFocus",!1),l(10),K(` 7076 `,y(57,28,"SERVICEAREA.ASSOCIATED_USERS"),` 7077 `),l(12),p("form",i.form.controls.AssociatedUsers)("submitted",i.submitted)("validationErrors",i.validationErrors)("userTreeNodes",i.userTreeNodes),l(11),q("label",y(80,30,"SHARED.CANCEL")),p("routerLink",i.serviceAreaListRoute)("text",!0),l(4),f((i.serviceArea==null?null:i.serviceArea.State)!=="DELETED"?83:-1),l(5),f(i.auditLoggingDisabled?-1:88))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,Pl,Gl,ie],encapsulation:2})}return r})();var BR=["dt"],HR=r=>({"disabled-row":r}),gm=(r,d)=>d.field;function WR(r,d){if(r&1){let t=b();e(0,` 7078 `),n(1,"div",17),e(2,` 7079 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 7080 `),n(7,"p-toggleswitch",18),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 7081 `),a(),e(9,` 7082 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function jR(r,d){if(r&1&&(e(0,` 7083 `),R(1,"p-sortIcon",21),e(2,` 7084 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function YR(r,d){if(r&1&&(e(0,` 7085 `),n(1,"th",19),e(2,` 7086 `),n(3,"span",20),e(4),a(),e(5,` 7087 `),_(6,jR,3,1),a(),e(7,` 7088 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function QR(r,d){if(r&1&&(e(0,` 7089 `),n(1,"tr"),e(2,` 7090 `),G(3,YR,8,3,null,null,gm),a(),e(5,` 7091 `)),r&2){let t=d.$implicit;l(3),k(t)}}function KR(r,d){r&1&&(e(0,` 7092 `),n(1,"span",26),e(2,"SHARED.DISABLED"),a(),e(3,` 7093 `))}function $R(r,d){r&1&&(e(0,` 7094 `),n(1,"span",26),e(2,"SHARED.DELETED"),a(),e(3,` 7095 `))}function zR(r,d){if(r&1&&(e(0,` 7096 `),n(1,"span"),e(2,` 7097 `),n(3,"a",25),e(4),a(),e(5,` 7098 `),_(6,KR,4,0)(7,$R,4,0),a(),e(8,` 7099 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(3),gt("routerLink","",i.serviceAreaEditRoute,"/",o.Id,""),l(),v(o[t.field]),l(2),f(o.State==="DISABLED"?6:-1),l(),f(o.State==="DELETED"?7:-1)}}function XR(r,d){if(r&1&&(e(0,` 7100 `),n(1,"span"),e(2),a(),e(3,` 7101 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function ZR(r,d){if(r&1&&(e(0,` 7102 `),n(1,"td"),e(2,` 7103 `),n(3,"span",23),e(4),a(),e(5,` 7104 `),n(6,"div",24),e(7,` 7105 `),n(8,"span"),e(9,` 7106 `),_(10,zR,9,6)(11,XR,4,1),e(12,` 7107 `),a(),e(13,` 7108 `),a(),e(14,` 7109 `),a(),e(15,` 7110 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:11)}}function JR(r,d){if(r&1&&(e(0,` 7111 `),n(1,"tr",22),e(2,` 7112 `),G(3,ZR,16,2,null,null,gm),a(),e(5,` 7113 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,HR,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function ew(r,d){r&1&&(e(0,` 7114 `),n(1,"div",27),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 7115 `))}function tw(r,d){r&1&&(e(0,` 7116 `),n(1,"div",27),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 7117 `))}function iw(r,d){if(r&1&&(e(0,` 7118 `),n(1,"tr"),e(2,` 7119 `),n(3,"td"),e(4,` 7120 `),_(5,ew,4,0)(6,tw,4,0),a(),e(7,` 7121 `),a(),e(8,` 7122 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:6)}}var Tm=(()=>{class r{authService;serviceAreaService;dt;displayedAreas=[];displaySpinner=!0;generalFilter="";isActive=!1;privilegesEnum=ae;searchEnabled=!1;searchResults=!1;selectedServiceAreas=[];serviceAreas=[];showDeleted=!1;tableColumns=[{field:"Name",header:"SERVICEAREA.NAME"},{field:"Description",header:"SERVICEAREA.DESCRIPTION"}];canViewDeleted=!1;serviceAreaCreateRoute="../"+P.create;serviceAreaEditRoute="../"+P.edit;constructor(t,o){this.authService=t,this.serviceAreaService=o,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED)}ngOnInit(){this.serviceAreaService.getServiceAreas(this.authService.tenant.Id).subscribe(o=>{this.serviceAreas=o,this.displayedAreas=this.filterServiceAreas(this.serviceAreas),this.displayedAreas.length===0?this.searchResults=!1:this.detectFilter(),this.displaySpinner=!1});let t=localStorage.getItem(Oe.SA_FILTER_STORAGE_KEY);t&&(this.generalFilter=t,this.generalFilterOnChange())}generalFilterOnChange(){localStorage.setItem(Oe.SA_FILTER_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt.filterGlobal(this.generalFilter,"contains")}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}filterServiceAreas(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}toggleShowDeleted(){this.displayedAreas=this.filterServiceAreas(this.serviceAreas)}static \u0275fac=function(o){return new(o||r)(g(de),g(_i))};static \u0275cmp=B({type:r,selectors:[["qware-service-area-list"]],viewQuery:function(o,i){if(o&1&&X(BR,7),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},standalone:!1,decls:52,vars:19,consts:[["dt",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.service-areas.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.service-areas.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"col-12","data-grid"],["id","qware.service-areas.list.spinner",3,"displaySpinner"],["id","qware.service-areas.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"selectionChange","onFilter","columns","value","selection","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button","id","qware.service-areas.list.create-button",3,"raised","routerLink"],[1,"show-deleted-switch"],["id","qware.service-areas.list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],[3,"pSortableColumn"],["translate",""],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.service-areas.list.table.service-area-name",3,"routerLink"],["translate","",1,"badge"],["translate","",1,"no-results"]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 7123 `),n(2,"div",2),e(3,` 7124 `),n(4,"h3",3),e(5,` 7125 SERVICEAREA.SERVICE_AREA_MANAGEMENT 7126 `),a(),e(6,` 7127 `),_(7,WR,10,4),a(),e(8,` 7128 `),n(9,"div",4),e(10,` 7129 `),n(11,"div",5),e(12,` 7130 `),n(13,"p-iconfield",6),e(14,` 7131 `),n(15,"p-inputicon"),e(16,` 7132 `),n(17,"span",7),e(18,"search"),a(),e(19,` 7133 `),a(),e(20,` 7134 `),n(21,"input",8),I(22,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 7135 `),a(),e(24,` 7136 `),a(),e(25,` 7137 `),a(),e(26,` 7138 `),n(27,"div",9),e(28,` 7139 `),n(29,"qware-spinner",10),e(30,` 7140 `),n(31,"p-table",11,0),j("selectionChange",function(u){return E(s),W(i.selectedServiceAreas,u)||(i.selectedServiceAreas=u),S(u)}),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(33,` 7141 `),_(34,QR,6,0,"ng-template",12),e(35,` 7142 `),_(36,JR,6,4,"ng-template",13),e(37,` 7143 `),_(38,iw,9,2,"ng-template",14),e(39,` 7144 `),a(),e(40,` 7145 `),a(),e(41,` 7146 `),a(),e(42,` 7147 `),n(43,"div",15),e(44,` 7148 `),n(45,"p-button",16),e(46,` 7149 `),n(47,"i",7),e(48,"add"),a(),e(49,` 7150 `),a(),e(50,` 7151 `),a(),e(51,` 7152`),a()}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(12),q("placeholder",y(22,17,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(8),p("displaySpinner",i.displaySpinner),l(2),p("columns",i.tableColumns)("value",i.displayedAreas),H("selection",i.selectedServiceAreas),p("sortOrder",1)("paginator",!0)("pageLinks",5)("rows",10)("scrollable",!0),l(14),q("routerLink",i.serviceAreaCreateRoute),p("raised",!0))},dependencies:[Pe,oe,Qe,je,Ae,se,Le,pi,mi,ye,me,kt,et,ht,ji,Yi,cn,Ai,$,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0!important}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{display:flex!important;position:relative!important;margin:0!important;width:100%}"]})}return r})();var Bl=He(nt());var nw=(r,d)=>d.Id;function aw(r,d){if(r&1){let t=b();e(0,` 7153 `),n(1,"div",3),e(2,` 7154 `),n(3,"div",4),e(4,` 7155 `),n(5,"span"),e(6),a(),e(7,` 7156 `),a(),e(8,` 7157 `),n(9,"div",5),e(10,` 7158 `),n(11,"qware-autocomplete",6),h("selectChange",function(i){let s=E(t).$index,c=m();return S(c.layoutChanged(i,s))})("unselectChange",function(i){let s=E(t).$index,c=m();return S(c.layoutChanged(i,s))}),e(12,` 7159 `),a(),e(13,` 7160 `),a(),e(14,` 7161 `),a(),e(15,` 7162 `)}if(r&2){let t=d.$implicit,o=d.$index,i=m();l(6),v(t.Name),l(5),p("singleSelect",!0)("tabindex",i.tabIndexStart+o)("options",i.cflSelections())("formControlName","CFLayoutInput"+o)("defaultOption",i.noLayout()
7162)}}var kl=(()=>{class r{fb=te(kd);allValuesLoaded=ee(!1);assignedCustomFieldLayouts=ee([]);cflSelections=ee([]);customFieldLayouts=ee([]);form=ee.required();serviceAreas=ee([]);submitted=ee(!1);validationErrors=ee(void 0);customFieldPairings=[];tabIndexStart=100;noLayout=Ye(()=>{let t=this.cflSelections();return t&&t.length>0?t.find(o=>o.value===void 0):void 0});layoutForm=Ye(()=>{let t=this.form().get("CustomFieldLayoutPairs")?.value,o=this.cflSelections(),i=this.noLayout(),s=this.serviceAreas();if(!s||s.length===0)return this.fb.group({});let c=[...this.assignedCustomFieldLayouts()];t&&(this.customFieldPairings=t,this.customFieldPairings.forEach(x=>{let C=o.find(O=>O.value===x[Object.keys(x)[0]].Name);C?c.push(C):i&&c.push(i)}));let u=this.fb.group({});for(let x=0;x<s.length;x++)u.addControl("CFLayoutInput"+x,new wa("")),c.length>0?u.get("CFLayoutInput"+x)?.setValue(c[x]):(u.get("CFLayoutInput"+x)?.setValue(i),i&&this.layoutChanged(i,x,!1));return u});layoutChanged(t,o,i=!0){let s={},c=this.serviceAreas(),u=this.customFieldLayouts(),x=c[o].Id,C=t.label,O=u.find(F=>F.Name===C);if(x&&(s[x]=O??{}),this.customFieldPairings.length>0){let F;this.customFieldPairings.forEach((L,U)=>{Object.keys(L).findIndex(z=>z===x)!==-1&&(F=U)}),F!==void 0&&F>=0?this.customFieldPairings[F]=s:this.customFieldPairings.push(s)}else this.customFieldPairings.push(s);let w=this.form();w.get("CustomFieldLayoutPairs")?.setValue(this.customFieldPairings),i&&w.markAsDirty()}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-status-custom-fields"]],inputs:{allValuesLoaded:[1,"allValuesLoaded"],assignedCustomFieldLayouts:[1,"assignedCustomFieldLayouts"],cflSelections:[1,"cflSelections"],customFieldLayouts:[1,"customFieldLayouts"],form:[1,"form"],serviceAreas:[1,"serviceAreas"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:10,vars:1,consts:[[1,"grid",2,"margin","1rem 1.5rem 2rem",3,"formGroup"],["translate","",1,"cf-layout-label","standalone-label"],[1,"col-12","sa-table"],[1,"sa-row","flex-inline"],["qwareTruncate",""],[1,"cf-dropdown"],["labelId","qware.status.label.custom-fields","label","STATUS.CUSTOM_FIELD_LAYOUT","elementId","qware.status.custom-fields",3,"selectChange","unselectChange","singleSelect","tabindex","options","formControlName","defaultOption"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 7163 `),n(2,"label",1),e(3,` 7164 STATUS.SELECT_CUSTOM_FIELD_LAYOUTS 7165 `),a(),e(4,` 7166 `),n(5,"div",2),e(6,` 7167 `),G(7,aw,16,6,null,null,nw),a(),e(9,` 7168`),a()),o&2&&(p("formGroup",i.layoutForm()),l(7),k(i.serviceAreas()))},dependencies:[se,ge,wt,kt,Te,De,$],styles:[".cf-layout-label[_ngcontent-%COMP%]{margin-bottom:2px}.sa-table[_ngcontent-%COMP%]{border:1px solid var(--p-surface-400);padding:0;background-color:var(--p-surface-100)}.sa-table[_ngcontent-%COMP%] .sa-row[_ngcontent-%COMP%]:not(:last-child){border-bottom:1px solid var(--p-surface-400)}.sa-row[_ngcontent-%COMP%]{padding:1rem 1.5rem;justify-content:space-between;align-items:center}@media screen and (max-width: 576px){.sa-row[_ngcontent-%COMP%]{padding:.75rem 1.5rem 1.5rem;display:block}}.sa-row[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:first-child{padding:.5rem 0;flex-basis:50%}.cf-dropdown[_ngcontent-%COMP%]{max-width:400px;width:100%;margin-top:.5rem;margin-left:1rem}@media screen and (max-width: 576px){.cf-dropdown[_ngcontent-%COMP%]{margin-top:2rem;margin-left:0;max-width:100%}}"],changeDetection:0})}return r})();function rw(r,d){if(r&1&&(e(0,` 7169 `),n(1,"small",23),e(2,` 7170 `),n(3,"div",5),e(4),a(),e(5,` 7171 `),a(),e(6,` 7172 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ow(r,d){if(r&1&&(e(0,` 7173 `),G(1,rw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function lw(r,d){r&1&&(e(0,` 7174 `),n(1,"span",24),e(2,"expand_more"),a(),e(3,` 7175 `))}function sw(r,d){if(r&1&&(e(0,` 7176 `),n(1,"small",23),e(2,` 7177 `),n(3,"div",5),e(4),a(),e(5,` 7178 `),a(),e(6,` 7179 `)),r&2){let t=d.$implicit;l(4),v(t)}}function dw(r,d){if(r&1&&(e(0,` 7180 `),G(1,sw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Type)}}function pw(r,d){if(r&1&&(e(0,` 7181 `),n(1,"small",23),e(2,` 7182 `),n(3,"div",5),e(4),a(),e(5,` 7183 `),a(),e(6,` 7184 `)),r&2){let t=d.$implicit;l(4),v(t)}}function mw(r,d){if(r&1&&(e(0,` 7185 `),G(1,pw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Color)}}function cw(r,d){if(r&1&&(e(0,` 7186 `),n(1,"div",25),e(2,` 7187 `),n(3,"label",26),e(4,` 7188 SHARED.PREVIEW 7189 `),a(),e(5,` 7190 `),R(6,"div",27),e(7,` 7191 `),n(8,"label",28),e(9),a(),e(10,` 7192 `),a(),e(11,` 7193 `)),r&2){let t=m();l(6),ga("background-color",t.form.controls.Color.value),l(3),K(` 7194 (`,t.form.controls.Color.value,`) 7195 `)}}function uw(r,d){if(r&1&&(e(0,` 7196 `),n(1,"small",23),e(2,` 7197 `),n(3,"div",5),e(4),a(),e(5,` 7198 `),a(),e(6,` 7199 `)),r&2){let t=d.$implicit;l(4),v(t)}}function _w(r,d){if(r&1&&(e(0,` 7200 `),G(1,uw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Description)}}var Vl=(()=>{class r{autoFocus=!0;form;submitted=!1;typeOptions=[];validationErrors;textareaFocusChange=new Yt;textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-status-details"]],inputs:{autoFocus:"autoFocus",form:"form",submitted:"submitted",typeOptions:"typeOptions",validationErrors:"validationErrors"},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:109,vars:26,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.status.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"qwareFocus","fluid"],["id","qware.status.details.label.name","for","qware.status.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.status.details.error.
7200name-req","translate","",3,"hidden"],["id","qware.status.details.error.name-length","translate","",3,"hidden"],["id","qware.status.details.dropdown.type","variant","filled","formControlName","Type",3,"tabindex","options","fluid"],["pTemplate","dropdownicon"],["id","qware.status.details.label.type","for","qware.status.details.dropdown.type"],["translate","",3,"hidden"],[1,"medium-input","flex-inline","align-items-center"],[1,"flex-column"],["id","qware.status.details.label.color",1,"color-picker-label","standalone-label"],["formControlName","Color",3,"inline"],["id","qware.status.details.error.Color-req","translate","",3,"hidden"],["id","qware.status.details.error.Color-length","translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","2","id","qware.status.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.status.details.label.description","for","qware.status.details.textarea.description"],[1,"validation-error"],[1,"material-icons"],[1,"preview-box"],["id","qware.status.details.label.color","translate","",1,"color-picker-label","preview","standalone-label"],[1,"color-picker-preview"],["id","qware.status.details.label.color",1,"color-picker-label","preview","standalone-label"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 7201 `),n(2,"div",1),e(3,` 7202 `),n(4,"div",2),e(5,` 7203 `),n(6,"p-floatlabel"),e(7,` 7204 `),R(8,"input",3),e(9,` 7205 `),n(10,"label",4),e(11,` 7206 `),n(12,"span",5),e(13,"STATUS.NAME"),a(),n(14,"span",6),e(15," *"),a(),e(16,` 7207 `),a(),e(17,` 7208 `),a(),e(18,` 7209 `),n(19,"small",7),e(20,` 7210 `),n(21,"div",8),e(22,` 7211 STATUS.ERROR.NAME_REQUIRED 7212 `),a(),e(23,` 7213 `),n(24,"div",9),e(25,` 7214 STATUS.ERROR.NAME_LENGTH 7215 `),a(),e(26,` 7216 `),a(),e(27,` 7217 `),_(28,ow,3,0),a(),e(29,` 7218 `),n(30,"div",2),e(31,` 7219 `),n(32,"p-floatlabel"),e(33,` 7220 `),n(34,"p-select",10),e(35,` 7221 `),_(36,lw,4,0,"ng-template",11),e(37,` 7222 `),a(),e(38,` 7223 `),n(39,"label",12),e(40,` 7224 `),n(41,"span",5),e(42,"STATUS.TYPE"),a(),n(43,"span",6),e(44," *"),a(),e(45,` 7225 `),a(),e(46,` 7226 `),a(),e(47,` 7227 `),n(48,"small",7),e(49,` 7228 `),n(50,"div",13),e(51,` 7229 STATUS.ERROR.TYPE_REQUIRED 7230 `),a(),e(52,` 7231 `),a(),e(53,` 7232 `),_(54,dw,3,0),a(),e(55,` 7233 `),n(56,"div",14),e(57,` 7234 `),n(58,"div",15),e(59,` 7235 `),n(60,"label",16),e(61,` 7236 `),n(62,"span",5),e(63,"STATUS.COLOR"),a(),n(64,"span",6),e(65," *"),a(),e(66,` 7237 `),a(),e(67,` 7238 `),R(68,"p-colorpicker",17),e(69,` 7239 `),n(70,"small",7),e(71,` 7240 `),n(72,"div",18),e(73,` 7241 STATUS.ERROR.COLOR_REQUIRED 7242 `),a(),e(74,` 7243 `),n(75,"div",19),e(76,` 7244 STATUS.ERROR.COLOR_LENGTH 7245 `),a(),e(77,` 7246 `),a(),e(78,` 7247 `),_(79,mw,3,0),a(),e(80,` 7248 `),_(81,cw,12,3),a(),e(82,` 7249 `),a(),e(83,` 7250 `),n(84,"div",20),e(85,` 7251 `),n(86,"div",2),e(87,` 7252 `),n(88,"p-floatlabel"),e(89,` 7253 `),n(90,"textarea",21),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(91," "),a(),e(92,` 7254 `),n(93,"label",22),e(94,` 7255 `),n(95,"span",5),e(96,"STATUS.DESCRIPTION"),a(),e(97,` 7256 `),a(),e(98,` 7257 `),a(),e(99,` 7258 `),n(100,"small",7),e(101,` 7259 `),n(102,"div",13),e(103,` 7260 STATUS.ERROR.DESCRIPTION_LENGTH 7261 `),a(),e(104,` 7262 `),a(),e(105,` 7263 `),_(106,_w,3,0),a(),e(107,` 7264 `),a(),e(108,` 7265`),a()),o&2&&(p("formGroup",i.form),l(8),p("qwareFocus",i.autoFocus)("fluid",!0),l(11),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?28:-1),l(6),p("tabindex",3)("options",i.typeOptions)("fluid",!0),l(14),p("hidden",i.form.controls.Type.valid||i.form.controls.Type.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Type.errors!=null&&i.form.controls.Type.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.Type&&i.form.controls.Type.untouched?54:-1),l(14),p("inline",!0),l(2),p("hidden",i.form.controls.Color.valid||i.form.controls.Color.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Color.errors!=null&&i.form.controls.Color.errors.required)),l(3),p("hidden",!(i.form.controls.Color.errors!=null&&i.form.controls.Color.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Color&&i.form.controls.Color.untouched?79:-1),l(2),f(i.form.controls.Color.value?81:-1),l(9),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",i.form.controls.Description.valid||i.form.controls.Description.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Description.errors!=null&&i.form.controls.Description.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Description&&i.form.controls.Description.untouched?106:-1))},dependencies:[Pe,Sl,Ne,je,Ae,se,ge,ye,Te,De,it,ri,$],styles:[".color-picker-label[_ngcontent-%COMP%]{margin-bottom:2px}.color-picker-label.preview[_ngcontent-%COMP%]{margin-left:1rem}.color-picker-preview[_ngcontent-%COMP%]{margin-left:1rem;height:20px;width:60px;border:1px solid var(--p-surface-400);border-radius:4px}.text-box[_ngcontent-%COMP%]{min-height:93px}"]})}return r})();var mr=He(nt());var Ew=["bodyDropdown"],Sw=["subjectDropdown"],ym=r=>({value:r}),Am=()=>({standalone:!0});function xw(r,d){if(r&1&&(e(0,` 7266 `),n(1,"small",36),e(2,` 7267 `),n(3,"div",10),e(4),a(),e(5,` 7268 `),a(),e(6,` 7269 `)),r&2){let t=d.$implicit;l(4),v(t)}}function fw(r,d){if(r&1&&(e(0,` 7270 `),G(1,xw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().EscalationDays)}}function hw(r,d){if(r&1&&(e(0,` 7271 `),n(1,"div",37),e(2,` 7272 `),n(3,"label"),e(4,` 7273 `),n(5,"span",10),e(6,"STATUS.DEDUCT_INVENTORY_NOTIFICATION"),a(),e(7,` 7274 `),a(),e(8,` 7275 `),n(9,"span",38),e(10,` 7276 `),n(11,"p-checkbox",39),e(12,` 7277 `),a(),e(13,` 7278 `),a(),e(14,` 7279 `),a(),e(15,` 7280 `)),r&2){let t=m();l(11),p("tabindex",t.tabIndexStart()+1)("binary",!0)}}function Cw(r,d){if(r&1&&(e(0,` 7281 `),n(1,"div",40),e(2,` 7282 `),n(3,"label"),e(4,` 7283 `),n(5,"span",10),e(6,"STATUS.SHOW_DUE_DATE"),a(),e(7,` 7284 `),a(),e(8,` 7285 `),n(9,"span",41),e(10,` 7286 `),n(11,"p-checkbox",42),e(12,` 7287 `),a(),e(13,` 7288 `),a(),e(14,` 7289 `),a(),e(15,` 7290 `)),r&2){let t=m();l(11),p("tabindex",t.tabIndexStart()+3)("binary",!0)}}function vw(r,d){if(r&1&&(e(0,` 7291 `),n(1,"div",43),e(2,` 7292 `),n(3,"label"),e(4,` 7293 `),n(5,"span",10),e(6,"STATUS.SHOW_PRIORITY"),a(),e(7,` 7294 `),a(),e(8,` 7295 `),n(9,"span",44),e(10,` 7296 `),n(11,"p-checkbox",45),e(12,` 7297 `),a(),e(13,` 7298 `),a(),e(14,` 7299 `),a(),e(15,` 7300 `)),r&2){let t=m();l(11),p("tabindex",t.tabIndexStart()+4)("binary",!0)}}function gw(r,d){if(r&1&&(e(0,` 7301 `),n(1,"div",46),e(2,` 7302 `),n(3,"label"),e(4,` 7303 `),n(5,"span",10),e(6,"STATUS.REQUIRE_LABOR_HOURS"),a(),e(7,` 7304 `),a(),e(8,` 7305 `),n(9,"span",47),e(10,` 7306 `),n(11,"p-checkbox",48),e(12,` 7307 `),a(),e(13,` 7308 `),a(),e(14,` 7309 `),a(),e(15,` 7310 `)),r&2){let t=m();l(11),p("tabindex",t.tabIndexStart()+5)("binary",!0)}}function Tw(r,d){if(r&1&&(e(0,` 7311 `),n(1,"small",36),e(2,` 7312 `),n(3,"div",10),e(4),a(),e(5,` 7313 `),a(),e(6,` 7314 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Iw(r,d){if(r&1&&(e(0,` 7315 `),G(1,Tw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().StatusNotificationGroups)}}function bw(r,d){r&1&&(e(0,` 7316 `),n(1,"span",49),e(2," *"),a(),e(3,` 7317 `))}function yw(r,d){r&1&&(e(0,` 7318 `),n(1,"span",53),e(2,"expand_more"),a(),e(3,` 7319 `))}function Aw(r,d){if(r&1){let t=b();e(0,` 7320 `),n(1,"span",50),e(2,` 7321 `),n(3,"p-select",51,3),I(5,"translate"),h("ngModelChange",function(i){E(t);let s=m();return S(s.selectedCustomField.set(i))})("onChange",function(){E(t);let i=m();return S(i.selectChanged("subject"))}),e(6,` 7322 `),_(7,yw,4,0,"ng-template",52),e(8,` 7323 `),a(),e(9,` 7324 `),a(),e(10,` 7325 `)}if(r&2){let t=m();l(3),q("placeholder",y(5,5,"MERGE_FIELDS.SELECT")),p("options",t.workOrderSubjectFields())("ngModel",t.selectedCustomField())("ngModelOptions",ne(7,Am))("fluid",!0)}}function Rw(r,d){if(r&1&&(e(0,` 7326 `),n(1,"small",36),e(2,` 7327 `),n(3,"div",10),e(4),a(),e(5,` 7328 `),a(),e(6,` 7329 `)),r&2){let t=d.$implicit;l(4),v(t)}}function ww(r,d){if(r&1&&(e(0,` 7330 `),G(1,Rw,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Subject)}}function Dw(r,d){r&1&&(e(0,` 7331 `),n(1,"span",49),e(2," *"),a(),e(3,` 7332 `))}function Lw(r,d){r&1&&(e(0,` 7333 `),n(1,"span",53),e(2,"expand_more"),a(),e(3,` 7334 `))}function Nw(r,d){if(r&1){let t=b();e(0,` 7335 `),n(1,"span",54),e(2,` 7336 `),e(3,`
7337 `),R(4,"select",55),e(5,` 7338 `),R(6,"select",56),e(7,` 7339 `),a(),e(8,` 7340 `),n(9,"span",54),e(10,` 7341 `),e(11,` 7342 `),R(12,"button",57),e(13,` 7343 `),R(14,"button",58),e(15,` 7344 `),R(16,"button",59),e(17,` 7345 `),a(),e(18,` 7346 `),n(19,"span",54),e(20,` 7347 `),e(21,` 7348 `),R(22,"button",60),e(23,` 7349 `),R(24,"button",61),e(25,` 7350 `),R(26,"button",62),e(27,` 7351 `),R(28,"button",63),e(29,` 7352 `),a(),e(30,` 7353 `),n(31,"span",54),e(32,` 7354 `),e(33,` 7355 `),R(34,"button",64),e(35,` 7356 `),a(),e(36,` 7357 `),e(37,` 7358 `),n(38,"span",54),e(39,` 7359 `),R(40,"button",65),e(41,` 7360 `),a(),e(42,` 7361 `),n(43,"span",50),e(44,` 7362 `),n(45,"p-select",66,4),I(47,"translate"),h("ngModelChange",function(i){E(t);let s=m();return S(s.selectedCustomField.set(i))})("onChange",function(){E(t);let i=m();return S(i.selectChanged("body"))}),e(48,` 7363 `),_(49,Lw,4,0,"ng-template",52),e(50,` 7364 `),a(),e(51,` 7365 `),a(),e(52,` 7366 `)}if(r&2){let t=m();l(45),q("placeholder",y(47,5,"MERGE_FIELDS.SELECT")),p("options",t.workOrderBodyFields())("ngModel",t.selectedCustomField())("ngModelOptions",ne(7,Am))("fluid",!0)}}function Ow(r,d){if(r&1&&(e(0,` 7367 `),n(1,"small",36),e(2,` 7368 `),n(3,"div",10),e(4),a(),e(5,` 7369 `),a(),e(6,` 7370 `)),r&2){let t=d.$implicit;l(4),v(t)}}function Fw(r,d){if(r&1&&(e(0,` 7371 `),G(1,Ow,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Body)}}var ql=(()=>{class r{bodyDropdown;subjectDropdown;editors;allValuesLoaded=ee(!1);form=ee.required();submitted=ee(!1);userGroupOptions=ee([]);validationErrors=ee(void 0);textareaFocusChange=Dt();dueDateEnabled=D(!1);emailRequired=D(!1);priorityEnabled=D(!1);selectedCustomField=D(void 0);tabIndexStart=D(200);workOrderBodyFields=D([]);workOrderSubjectFields=D([]);customFieldsDisabled=D(!0);guestWorkRequestsDisabled=D(!0);inventoryManagementDisabled=D(!0);laborHoursDisabled=D(!0);appSettingsService=te(dt);authService=te(de);customFieldService=te($t);translate=te(le);constructor(){this.customFieldsDisabled.set((this.authService.qwareSubscription?.customFieldsPerLayoutLimit??0)===0),this.inventoryManagementDisabled.set(!this.authService.qwareSubscription?.inventoryManagement),this.laborHoursDisabled.set(!this.authService.qwareSubscription?.laborHours),this.guestWorkRequestsDisabled.set(!this.authService.qwareSubscription?.guestWorkRequests),Bn(()=>{this.allValuesLoaded()&&Cd(()=>{this.setEmailFieldsRequired()})})}ngOnInit(){ue([this.translate.get(["MERGE_FIELDS.SELECT","MERGE_FIELDS.WO_NUMBER","MERGE_FIELDS.DESCRIPTION","MERGE_FIELDS.WO_TYPE","MERGE_FIELDS.SERVICE_AREA","MERGE_FIELDS.STATUS","MERGE_FIELDS.COMPLETED_DATE","MERGE_FIELDS.CREATION_DATE","MERGE_FIELDS.LOCATIONS","MERGE_FIELDS.CREATED_BY","MERGE_FIELDS.ASSIGNED_TO","MERGE_FIELDS.MOD_DATE","MERGE_FIELDS.MOD_BY","MERGE_FIELDS.LINK_TO_WO","MERGE_FIELDS.COMMENTS","MERGE_FIELDS.DUE_DATE","MERGE_FIELDS.ASSETS","MERGE_FIELDS.PRIORITY","MERGE_FIELDS.GUEST_EMAIL","MERGE_FIELDS.GUEST_NAME","MERGE_FIELDS.GUEST_PHONE","MERGE_FIELDS.REQUESTER"]).pipe(N()),this.customFieldsDisabled()?Fe([]):this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id),this.appSettingsService.getAppSettings().pipe(N())]).subscribe(t=>{let o=t[0],i=t[1],s=t[2],c=[{label:o["MERGE_FIELDS.ASSIGNED_TO"],value:"[ASSIGNED_TO]"},{label:o["MERGE_FIELDS.COMPLETED_DATE"],value:"[COMPLETED_DATE]"},{label:o["MERGE_FIELDS.CREATED_BY"],value:"[CREATED_BY]"},{label:o["MERGE_FIELDS.CREATION_DATE"],value:"[CREATION_DATE]"}];s.DueDate&&(c.push({label:o["MERGE_FIELDS.DUE_DATE"],value:"[DUE_DATE]"}),this.dueDateEnabled.set(!0)),!this.guestWorkRequestsDisabled()&&s.WorkOrderGuestForm&&(c.push({label:o["MERGE_FIELDS.GUEST_EMAIL"],value:"[GUEST_EMAIL]"}),c.push({label:o["MERGE_FIELDS.GUEST_NAME"],value:"[GUEST_NAME]"}),c.push({label:o["MERGE_FIELDS.GUEST_PHONE"],value:"[GUEST_PHONE_NUMBER]"})),c.push({label:o["MERGE_FIELDS.MOD_BY"],value:"[MODIFIED_BY]"}),c.push({label:o["MERGE_FIELDS.MOD_DATE"],value:"[MODIFICATION_DATE]"}),s.Priority&&(c.push({label:o["MERGE_FIELDS.PRIORITY"],value:"[PRIORITY]"}),this.priorityEnabled.set(!0)),c.push({label:o["MERGE_FIELDS.REQUESTER"],value:"[REQUESTER]"}),c.push({label:o["MERGE_FIELDS.SERVICE_AREA"],value:"[SERVICE_AREA]"}),c.push({label:o["MERGE_FIELDS.STATUS"],value:"[STATUS]"}),c.push({label:o["MERGE_FIELDS.WO_NUMBER"],value:"[WORK_ORDER_NUMBER]"}),c.push({label:o["MERGE_FIELDS.WO_TYPE"],value:"[WORK_ORDER_TYPE]"});let u=mr.default.concat(c,[{label:o["MERGE_FIELDS.ASSETS"],value:"[ASSETS]"},{label:o["MERGE_FIELDS.COMMENTS"],value:"[COMMENTS]"},{label:o["MERGE_FIELDS.DESCRIPTION"],value:"[DESCRIPTION]"},{label:o["MERGE_FIELDS.LINK_TO_WO"],value:"[WORK_ORDER_LINK]"},{label:o["MERGE_FIELDS.LOCATIONS"],value:"[LOCATIONS]"}]);u=mr.default.sortBy(u,C=>(C.label??"").toLowerCase());let x=mr.default.sortBy(mr.default.uniqBy(mr.default.flatten(i.filter(C=>C.Type==="WORKORDERS").map(C=>(C.Fields??[]).filter(O=>O.State===M.ACTIVE))),"ParentId"),C=>(C.Name??"").toLowerCase()).map(C=>({label:C.Name,value:this.customFieldService.formatMergeField(C.Name??"")}));this.workOrderSubjectFields.set(c),this.workOrderBodyFields.set(mr.default.concat(u,x))})}setEmailFieldsRequired(){let t=this.form(),o=t.get("StatusNotificationGroups")?.value,i=(t.get("SendEmailToRequestor")?.value||t.get("SendEmailToRequestorSupervisor")?.value||t.get("SendEmailToAssignees")?.value)&&o&&(o?.length??0)>0;return this.updateFormControls(i??!1),i??!1}
7371ngAfterViewInit(){this.editors.forEach(t=>{t.quill?.options.container.firstChild.addEventListener("blur",()=>{this.textareaFocusChange.emit(!1)})})}emailOptionChanged(){this.setEmailFieldsRequired()}updateFormControls(t){this.emailRequired.set(t);let o=this.form();t?(o.get("Subject")?.setValidators([T.required,T.maxLength(fi)]),o.get("Body")?.setValidators([T.required,T.maxLength(Kt)])):(o.get("Subject")?.setValidators(T.maxLength(fi)),o.get("Body")?.setValidators(T.maxLength(Kt))),o.get("Subject")?.updateValueAndValidity(),o.get("Body")?.updateValueAndValidity(),o.updateValueAndValidity()}selectChanged(t){let o=this.selectedCustomField();if(o){let i=t==="subject"?this.editors.toArray()[0].quill:this.editors.toArray()[1].quill,s=0,c=i.history.quill.selection.savedRange;c&&(c.length===0?s=c.index:(s=c.index,i.deleteText(c.index,c.length))),i.insertText(s,o,"user"),i.setSelection(i.getText(0).length),i.focus(),this.bodyDropdown.updateModel(void 0),this.subjectDropdown.updateModel(void 0)}}textareaFocus(){this.textareaFocusChange.emit(!0)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-status-settings"]],viewQuery:function(o,i){if(o&1&&(X(Ew,5),X(Sw,5),X(Jt,5)),o&2){let s;Y(s=Q())&&(i.bodyDropdown=s.first),Y(s=Q())&&(i.subjectDropdown=s.first),Y(s=Q())&&(i.editors=s)}},inputs:{allValuesLoaded:[1,"allValuesLoaded"],form:[1,"form"],submitted:[1,"submitted"],userGroupOptions:[1,"userGroupOptions"],validationErrors:[1,"validationErrors"]},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:155,vars:42,consts:[["subjectEditor",""],["header",""],["bodyEditor",""],["subjectDropdown",""],["bodyDropdown",""],[1,"grid",3,"formGroup"],[1,"col-12"],[1,"medium-input",3,"hidden"],["id","qware.status.details.input.escalationDays","type","text","pInputText","","name","EscalationDays","formControlName","EscalationDays","variant","filled",3,"tabindex","fluid","qwareFocus"],["id","qware.status.details.label.escalationDays","for",""],["translate",""],[1,"validation-error",3,"hidden"],["id","qware.status.details.error.escdays-length","translate","",3,"hidden"],["id","qware.status.details.error.escdays-format","translate","",3,"hidden"],["id","qware.status.showCompletedDate",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.showCompletedDate.checkbox"],["name","ShowCompletedDate","formControlName","ShowCompletedDate",3,"tabindex","binary"],["id","qware.status.sendEmailToAssignee",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.sendEmailToAssignees.checkbox"],["name","SendEmailToAssignees","formControlName","SendEmailToAssignees",3,"onChange","tabindex","binary"],["id","qware.status.sendEmailToRequestor",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.sendEmailToRequestor.checkbox"],["name","SendEmailToRequestor","formControlName","SendEmailToRequestor",3,"onChange","tabindex","binary"],["id","qware.status.sendEmailToRequestorSupervisor",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.sendEmailToRequestorSupervisor.checkbox"],["name","SendEmailToRequestorSupervisor","formControlName","SendEmailToRequestorSupervisor",3,"onChange","tabindex","binary"],[1,"medium-input"],["id","qware.status-e2e.statusNotificationGroups","formControlName","StatusNotificationGroups","labelId","qware.status.label.statusNotificationGroups","label","STATUS.EMAIL_RECIPIENTS_USER_GROUPS","elementId","qware.status.statusNotificationGroups",3,"selectChange","unselectChange","tabindex","options","virtualScroll","virtualScrollItemSize"],["id","qware.status.label.subject",1,"standalone-label"],["id","qware.status.details.subject.editor","formControlName","Subject",3,"onTextChange"],["id","qware.status.details.error.subject-length","translate","",3,"hidden","translateParams"],["id","qware.status.details.error.subject-req","translate","",3,"hidden"],["id","qware.status.label.body",1,"standalone-label"],["id","qware.status.details.body.editor","formControlName","Body",3,"onTextChange"],["id","qware.status.details.error.body-length","translate","",3,"hidden","translateParams"],["id","qware.status.details.error.body-req","translate","",3,"hidden"],[1,"validation-error"],["id","qware.status.deductInventoryNotification",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.deductInventoryNotification.checkbox"],["name","DeductInventoryNotification","formControlName","DeductInventoryNotification",3,"tabindex","binary"],["id","qware.status.showDueDate",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.showDueDate.checkbox"],["name","ShowDueDate","formControlName","ShowDueDate",3,"tabindex","binary"],["id","qware.status.showPriority",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.showPriority.checkbox"],["name","ShowPriority","formControlName","ShowPriority",3,"tabindex","binary"],["id","qware.status.requireLaborHours",1,"flex-inline","flex-space-between","medium-input"],["id","qware.status.requireLaborHours.checkbox"],["name","RequireLaborHours","formControlName","RequireLaborHours",3,"tabindex","binary"],[1,"required-mark"],[1,"ql-formats","merge-field"],["id","qware.status.details.dropdown.subject.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid"],["pTemplate","dropdownicon"],[1,"material-icons"],[1,"ql-formats"],[1,"ql-color"],[1,"ql-background"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"],[1,"ql-link"],[1,"ql-clean"],["id","qware.status.details.dropdown.body.fields",3,"ngModelChange","onChange","placeholder","options","ngModel","ngModelOptions","fluid"]],template:function(o,i){if(o&1){let s=b();n(0,"div",5),e(1,` 7372 `),n(2,"div",6),e(3,` 7373 `),e(4,` 7374 `),n(5,"div",7),e(6,` 7375 `),R(7,"input",8),e(8,` 7376 `),n(9,"label",9),e(10,` 7377 `),n(11,"span",10),e(12,"STATUS.ESCALATION_DAYS"),a(),e(13,` 7378 `),a(),e(14,` 7379 `),n(15,"small",11),e(16,` 7380 `),n(17,"div",12),e(18,` 7381 STATUS.ERROR.ESCALATIONDAYS_LENGTH 7382 `),a(),e(19,` 7383 `),n(20,"div",13),e(21,` 7384 STATUS.ERROR.ESCALATIONDAYS_FORMAT 7385 `),a(),e(22,` 7386 `),a(),e(23,` 7387 `),_(24,fw,3,0),a(),e(25,` 7388 `),a(),e(26,` 7389 7390 `),n(27,"div",6),e(28,` 7391 `),_(29,hw,16,2),n(30,"div",14),e(31,` 7392 `),n(32,"label"),e(33,` 7393 `),n(34,"span",10),e(35,"STATUS.SHOW_COMPLETED_DATE"),a(),e(36,` 7394 `),a(),e(37,` 7395 `),n(38,"span",15),e(39,` 7396 `),n(40,"p-checkbox",16),e(41,` 7397 `),a(),e(42,` 7398 `),a(),e(43,` 7399 `),a(),e(44,` 7400 7401 `),_(45,Cw,16,2)(46,vw,16,2)(47,gw,16,2),n(48,"div",17),e(49,` 7402 `),n(50,"label"),e(51,` 7403 `),n(52,"span",10),e(53,"STATUS.SEND_EMAIL_TO_ASSIGNEES"),a(),e(54,` 7404 `),a(),e(55,` 7405 `),n(56,"span",18),e(57,` 7406 `),n(58,"p-checkbox",19),h("onChange",function(){return E(s),S(i.emailOptionChanged())}),e(59,` 7407 `),a(),e(60,` 7408 `),a(),e(61,` 7409 `),a(),e(62,` 7410 7411 `),n(63,"div",20),e(64,` 7412 `),n(65,"label"),e(66,` 7413 `),n(67,"span",10),e(68,"STATUS.SEND_EMAIL_TO_REQUESTOR"),a(),e(69,` 7414 `),a(),e(70,` 7415 `),n(71,"span",21),e(72,` 7416 `),n(73,"p-checkbox",22),h("onChange",function(){return E(s),S(i.emailOptionChanged())}),e(74,` 7417 `),a(),e(75,` 7418 `),a(),e(76,` 7419 `),a(),e(77,` 7420 7421 `),n(78,"div",23),e(79,` 7422 `),n(80,"label"),e(81,` 7423 `),n(82,"span",10),e(83,"STATUS.SEND_EMAIL_TO_SUPERVISOR"),a(),e(84,` 7424 `),a(),e(85,` 7425 `),n(86,"span",24),e(87,` 7426 `),n(88,"p-checkbox",25),h("onChange",function(){return E(s),S(i.emailOptionChanged())}),e(89,` 7427 `),a(),e(90,` 7428 `),a(),e(91,` 7429 `),a(),e(92,` 7430 7431 `),n(93,"div",26),e(94,` 7432 `),n(95,"qware-autocomplete",27),h("selectChange",function(){return E(s),S(i.emailOptionChanged())})("unselectChange",function(){return E(s),S(i.emailOptionChanged())}),e(96,` 7433 `),a(),e(97,` 7434 `),_(98,Iw,3,0),a(),e(99,` 7435 7436 `),n(100,"div",26),e(101,` 7437 `),n(102,"label",28),e(103,` 7438 `),n(104,"span",10),e(105,"STATUS.SUBJECT"),a(),e(106,` 7439 `),_(107,bw,4,0),a(),e(108,` 7440 `),n(109,"p-editor",29,0),h("onTextChange",function(){return E(s),S(i.textareaFocus())}),e(111,` 7441 `),_(112,Aw,11,8,"ng-template",null,1,A),e(114,` 7442 `),a(),e(115,` 7443 `),n(116,"small",11),e(117,` 7444 `),n(118,"div",30),e(119,` 7445 STATUS.ERROR.SUBJECT_LENGTH 7446 `),a(),e(120,` 7447 `),n(121,"div",31),e(122,` 7448 STATUS.ERROR.SUBJECT_REQUIRED 7449 `),a(),e(123,` 7450 `),a(),e(124,` 7451 `),_(125,ww,3,0),a(),e(126,` 7452 7453 `),n(127,"div",26),e(128,` 7454 `),n(129,"label",32),e(130,` 7455 `),n(131,"span",10),e(132,"STATUS.BODY"),a(),e(133,` 7456 `),_(134,Dw,4,0),a(),e(135,` 7457 `),n(136,"p-editor",33,2),h("onTextChange",function(){return E(s),S(i.textareaFocus())}),e(138,` 7458 `),_(139,Nw,53,8,"ng-template",null,1,A),e(141,` 7459 `),a(),e(142,`
7460 `),n(143,"small",11),e(144,` 7461 `),n(145,"div",34),e(146,` 7462 STATUS.ERROR.BODY_LENGTH 7463 `),a(),e(147,` 7464 `),n(148,"div",35),e(149,` 7465 STATUS.ERROR.BODY_REQUIRED 7466 `),a(),e(150,` 7467 `),a(),e(151,` 7468 `),_(152,Fw,3,0),a(),e(153,` 7469 `),a(),e(154,` 7470`),a()}if(o&2){let s,c,u,x,C,O;p("formGroup",i.form()),l(5),p("hidden",!0),l(2),p("tabindex",i.tabIndexStart())("fluid",!0)("qwareFocus",!0),l(8),p("hidden",i.form().controls.EscalationDays.valid||i.form().controls.EscalationDays.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.EscalationDays.errors)!=null&&s.maxlength)),l(3),p("hidden",!((c=i.form().controls.EscalationDays.errors)!=null&&c.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().EscalationDays&&i.form().controls.EscalationDays.untouched?24:-1),l(5),f(i.inventoryManagementDisabled()?-1:29),l(11),p("tabindex",i.tabIndexStart()+2)("binary",!0),l(5),f(i.dueDateEnabled()?45:-1),l(),f(i.priorityEnabled()?46:-1),l(),f(i.laborHoursDisabled()?-1:47),l(11),p("tabindex",i.tabIndexStart()+6)("binary",!0),l(15),p("tabindex",i.tabIndexStart()+7)("binary",!0),l(15),p("tabindex",i.tabIndexStart()+8)("binary",!0),l(7),p("tabindex",i.tabIndexStart()+9)("options",i.userGroupOptions())("virtualScroll",!0)("virtualScrollItemSize",38),l(3),f(i.validationErrors()&&i.validationErrors().StatusNotificationGroups&&i.form().controls.StatusNotificationGroups.untouched?98:-1),l(9),f(i.emailRequired()?107:-1),l(9),p("hidden",i.form().controls.Subject.valid||i.form().controls.Subject.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.Subject.errors)!=null&&u.maxlength))("translateParams",pe(38,ym,i.form().controls.Subject.value)),l(3),p("hidden",!((x=i.form().controls.Subject.errors)!=null&&x.required)),l(4),f(i.validationErrors()&&i.validationErrors().Subject&&i.form().controls.Subject.untouched?125:-1),l(9),f(i.emailRequired()?134:-1),l(9),p("hidden",i.form().controls.Body.valid||i.form().controls.Body.pristine&&!i.submitted()),l(2),p("hidden",!((C=i.form().controls.Body.errors)!=null&&C.maxlength))("translateParams",pe(40,ym,i.form().controls.Body.value)),l(3),p("hidden",!((O=i.form().controls.Body.errors)!=null&&O.required)),l(4),f(i.validationErrors()&&i.validationErrors().Body&&i.form().controls.Body.untouched?152:-1)}},dependencies:[Pe,yt,Jt,je,Ae,se,ge,Le,ye,wt,Te,De,it,$,ie],encapsulation:2,changeDetection:0})}return r})();function Mw(r,d){if(r&1){let t=b();e(0,` 7471 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 7472 `),n(3,"span",18),e(4),a(),e(5,` 7473 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 7474 `),a(),e(10,` 7475 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"SHARED.DETAILS"))}}function Uw(r,d){if(r&1){let t=b();e(0,` 7476 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 7477 `),n(3,"span",18),e(4),a(),e(5,` 7478 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 7479 `),a(),e(10,` 7480 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"STATUS.CUSTOM_FIELDS"))}}function Pw(r,d){if(r&1){let t=b();e(0,` 7481 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 7482 `),n(3,"span",18),e(4),a(),e(5,` 7483 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 7484 `),a(),e(10,` 7485 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"STATUS.SETTINGS"))}}function Gw(r,d){if(r&1){let t=b();e(0,` 7486 `),n(1,"div",3),e(2,` 7487 `),n(3,"h3",4),e(4,` 7488 STATUS.CREATE_STATUS 7489 `),a(),e(5,` 7490 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 7491 `),n(8,"p-step-list"),e(9,` 7492 `),n(10,"p-step",6),e(11,` 7493 `),_(12,Mw,11,4,"ng-template",null,0,A),e(14,` 7494 `),a(),e(15,` 7495 `),n(16,"p-step",6),e(17,` 7496 `),_(18,Uw,11,4,"ng-template",null,0,A),e(20,` 7497 `),a(),e(21,` 7498 `),n(22,"p-step",6),e(23,` 7499 `),_(24,Pw,11,4,"ng-template",null,0,A),e(26,` 7500 `),a(),e(27,` 7501 `),a(),e(28,` 7502 `),n(29,"p-step-panels"),e(30,` 7503 `),n(31,"p-card"),e(32,` 7504 `),n(33,"div",7),e(34,` 7505 `),n(35,"h4",8),e(36,` 7506 STATUS.DETAILS 7507 `),a(),e(37,` 7508 `),n(38,"qware-status-details",9),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))}),e(39,` 7509 `),a(),e(40,` 7510 `),a(),e(41,` 7511 `),n(42,"div",7),e(43,` 7512 `),n(44,"h4",10),e(45,` 7513 STATUS.CUSTOM_FIELDS 7514 `),a(),e(46,` 7515 `),n(47,"qware-status-custom-fields",11),e(48,` 7516 `),a(),e(49,` 7517 `),a(),e(50,` 7518 `),n(51,"div",7),e(52,` 7519 `),n(53,"h4",12),e(54,` 7520 STATUS.SETTINGS 7521 `),a(),e(55,` 7522 `),n(56,"qware-status-settings",13),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))}),e(57,` 7523 `),a(),e(58,` 7524 `),a(),e(59,` 7525 `),n(60,"div",14),e(61,` 7526 `),n(62,"p-button",15),I(63,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(64,` 7527 `),a(),e(65,` 7528 `),n(66,"p-button",16),I(67,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(68,` 7529 `),a(),e(69,` 7530 `),a(),e(70,` 7531 `),a(),e(71,` 7532 `),a(),e(72,` 7533 `),a(),e(73,` 7534 `),a(),e(74,` 7535 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex!==1),p("value",1),l(6),ve("p-disabled",t.stepIndex!==2),p("value",2),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.Details)("submitted",t.submitted)("validationErrors",t.validationErrors)("typeOptions",t.typeOptions),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.CustomFields)("submitted",t.submitted)("validationErrors",t.validationErrors)("cflSelections",t.cflSelections)("serviceAreas",t.serviceAreas)("customFieldLayouts",t.customFieldLayouts),l(4),p("hidden",t.stepIndex!==2),l(5),p("form",t.form.controls.Settings)("submitted",t.submitted)("validationErrors",t.validationErrors)("userGroupOptions",t.userGroupOptions),l(6),q("label",y(63,30,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(67,32,t.stepIndex===2?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.stepFormGroups[t.stepIndex]!=null&&t.stepFormGroups[t.stepIndex].valid))}}var wm=(()=>{class r{authService;cacheService;customFieldService;fb;responseService;route;router;serviceAreaService;statusService;toastService;translate;userGroupService;cflSelections=[];customFieldLayouts=[];displaySpinner=!0;form;isLoaded=!1;serviceAreas=[];stepFormGroups=[];stepIndex=0;submitted=!1;textareaFocused=!1;typeOptions=[];userGroupOptions=[];validationErrors;customFieldsDisabled=!0;hasEventModule=!1;constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.authService=t,this.cacheService=o,this.customFieldService=i,this.fb=s,this.responseService=c,this.route=u,this.router=x,this.serviceAreaService=C,this.statusService=O,this.toastService=w,this.translate=F,this.userGroupService=L,this.customFieldsDisabled=(this.authService.qwareSubscription?.customFieldsPerLayoutLimit??0)===0,this.hasEventModule=this.authService.tenant.EventsModule}ngOnInit(){ue([this.translate.get(["STATUS.WORK_ORDERS_TYPE","STATUS.EVENTS_TYPE","STATUS.NO_LAYOUT"]).pipe(N()),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.customFieldsDisabled?Fe([]):this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id)]).subscribe(t=>{let o=t[0],i=t[1],s=t[2],c=t[3];this.typeOptions.push({label:o["STATUS.WORK_ORDERS_TYPE"],value:Li.WORK_ORDERS}),this.userGroupOptions=i.filter(u=>u.State===M.ACTIVE&&!ci.includes(u.Name??"")).map(u=>({label:u.Name,value:u.Id})),this.serviceAreas=s.filter(u=>u.State===M.ACTIVE),this.customFieldLayouts=c.filter(u=>u.State===M.ACTIVE&&u.Type==="WORKORDERS"),this.cflSelections.push({label:o["STATUS.NO_LAYOUT"],value:void 0}),this.customFieldLayouts.map(u=>{this.cflSelections.push({label:u.Name,value:u.Name})}),this.createForm(),this.isLoaded=!0,this.displaySpinner=!1})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),Type:this.fb.control(null,T.required),Color:this.fb.control("#ff0000",[T.required,T.maxLength(re)])}),CustomFields:this.fb.group({CustomFieldLayoutPairs:this.fb.control(null)}),Settings:this.fb.group({EscalationDays:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),DeductInventoryNotification:this.fb.control(!1),ShowCompletedDate:this.fb.control(!1),ShowPriority:this.fb.control(!0),ShowDueDate:this.fb.control(!0),RequireLaborHours:this.fb.control(!1),SendEmailToAssignees:this.fb.control(!1),SendEmailToRequestor:this.fb.control(!1),SendEmailToRequestorSupervisor:this.fb.control(!1),StatusNotificationGroups:this.fb.control([]),Subject:this.fb.control("",T.maxLength(fi)),Body:this.fb.control("",T.maxLength(Kt))})}),this.stepFormGroups=[this.form.get("Details"),this.form.get("CustomFields"),this.form.get("Settings")]}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../"+P.list],t)}else this.stepIndex--}stepSubmit(t){this.stepFormGroups[this.stepIndex]?.valid&&(t<2?this.stepIndex++:this.submitForm(new Rr().parseForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.StatusNotificationGroupIds=t.StatusNotificationGroupIds?.map(o=>o.value),t.TenantId=this.authService.tenant.Id,this.statusService.createStatus(t).pipe(we(o=>{let i=[];t?.CustomFieldLayoutPairs&&(i=this.customFieldService.layoutPairDictToObjArray(t.CustomFieldLayoutPairs));let s=[];return Bl.default.each(i,c=>{if(c&&c.Layout&&c.Layout.Id){let u=Bl.default.find(this.serviceAreas,{Id:c.ServiceAreaId});u?.CustomLayouts&&(u.CustomLayouts[o]=c.Layout,s.push(this.serviceAreaService.updateServiceArea(u)))}}),Bl.default.size(s)>0?ue(s):Fe([])})).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.stepFormGroups,this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g($t),g(be),g(Re),g(he),g(Be),g(_i),g(Oi),g(Se),g(le),g(Tt))};static \u0275cmp=B({type:r,selectors:[["qware-status-create"]],standalone:!1,decls:7,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.status.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.status.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.status.create.details.label","translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors","typeOptions"],["id","qware.status.create.custom-fields.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","cflSelections","serviceAreas","customFieldLayouts"],["id","qware.status.create.settings.label","translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors","userGroupOptions"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.status.create-status.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.status.create-status.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("key
7535down.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(1,` 7536 `),n(2,"qware-spinner",2),e(3,` 7537 `),_(4,Gw,75,34),a(),e(5,` 7538`),a(),e(6,` 7539`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,kl,Vl,ql,ie],encapsulation:2})}return r})();var Ca=He(nt());var kw=["actionsMenu"],Vw=["shades"],qw=["drawer"],Bw=r=>({"lg:col-8":r}),Hw=()=>["0"];function Ww(r,d){if(r&1&&(e(0,` 7540 `),n(1,"a",24),e(2,` 7541 `),n(3,"span",25),e(4),a(),e(5,` 7542 `),n(6,"span",26),e(7),a(),e(8,` 7543 `),a(),e(9,` 7544 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function jw(r,d){r&1&&(e(0,` 7545 `),n(1,"span",28),e(2,"SHARED.ACTIONS"),a(),e(3,` 7546 `),n(4,"i",29),e(5,"expand_more"),a(),e(6,` 7547 `))}function Yw(r,d){if(r&1){let t=b();e(0,` 7548 `),n(1,"p-button",27),h("onClick",function(i){E(t),m();let s=Ee(4);return S(s.toggle(i))}),e(2,` 7549 `),_(3,jw,7,0,"ng-template",null,4,A),e(5,` 7550 `),a(),e(6,` 7551 `)}r&2&&(l(),p("raised",!0))}function Qw(r,d){if(r&1&&(e(0,` 7552 `),n(1,"div",22),e(2,` 7553 `),n(3,"p-menu",23,2),e(5,` 7554 `),_(6,Ww,10,2,"ng-template",null,3,A),e(8,` 7555 `),a(),e(9,` 7556 `),_(10,Yw,7,1),a(),e(11,` 7557 `)),r&2){let t=m();l(3),p("model",t.actionItems)("popup",!0),l(7),f(t.actionItems&&t.actionItems.length>0?10:-1)}}function Kw(r,d){if(r&1&&(e(0,` 7558 `),n(1,"a",24),e(2,` 7559 `),n(3,"span",25),e(4),a(),e(5,` 7560 `),n(6,"span",26),e(7),a(),e(8,` 7561 `),a(),e(9,` 7562 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function $w(r,d){if(r&1){let t=b();e(0,` 7563 `),n(1,"div",30),e(2,` 7564 `),n(3,"p-menu",31,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 7565 `),_(6,Kw,10,2,"ng-template",null,3,A),e(8,` 7566 `),a(),e(9,` 7567 `),n(10,"p-button",32),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 7568 `),n(12,"i",29),e(13,"more_vert"),a(),e(14,` 7569 `),a(),e(15,` 7570 `),a(),e(16,` 7571 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function zw(r,d){r&1&&(e(0,` 7572 `),n(1,"i",29),e(2,"expand_less"),a(),e(3,` 7573 `))}function Xw(r,d){r&1&&(e(0,` 7574 `),n(1,"i",29),e(2,"expand_more"),a(),e(3,` 7575 `))}function Zw(r,d){if(r&1&&(e(0,` 7576 `),_(1,zw,4,0)(2,Xw,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function Jw(r,d){r&1&&(e(0,` 7577 `),n(1,"i",29),e(2,"expand_less"),a(),e(3,` 7578 `))}function eD(r,d){r&1&&(e(0,` 7579 `),n(1,"i",29),e(2,"expand_more"),a(),e(3,` 7580 `))}function tD(r,d){if(r&1&&(e(0,` 7581 `),_(1,Jw,4,0)(2,eD,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function iD(r,d){if(r&1&&(e(0,` 7582 `),n(1,"p-accordion-panel",33),e(2,` 7583 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,tD,3,1,"ng-template",null,1,A),e(8,` 7584 `),a(),e(9,` 7585 `),n(10,"p-accordion-content"),e(11,` 7586 `),n(12,"div",17),e(13,` 7587 `),n(14,"div",18),e(15,` 7588 `),n(16,"qware-status-custom-fields",34),e(17,` 7589 `),a(),e(18,` 7590 `),a(),e(19,` 7591 `),a(),e(20,` 7592 `),a(),e(21,` 7593 `),a(),e(22,` 7594 `)),r&2){let t=m();l(4),K(` 7595 `,y(5,9,"STATUS.CUSTOM_FIELDS"),` 7596 `),l(12),p("form",t.form.controls.CustomFields)("submitted",t.submitted)("validationErrors",t.validationErrors)("cflSelections",t.cflSelections)("serviceAreas",t.serviceAreas)("customFieldLayouts",t.customFieldLayouts)("allValuesLoaded",t.allValuesLoaded)("assignedCustomFieldLayouts",t.assignedCustomFieldLayouts)}}function nD(r,d){r&1&&(e(0,` 7597 `),n(1,"i",29),e(2,"expand_less"),a(),e(3,` 7598 `))}function aD(r,d){r&1&&(e(0,` 7599 `),n(1,"i",29),e(2,"expand_more"),a(),e(3,` 7600 `))}function rD(r,d){if(r&1&&(e(0,` 7601 `),_(1,nD,4,0)(2,aD,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function oD(r,d){if(r&1&&(e(0,` 7602 `),n(1,"p-accordion-panel",35),e(2,` 7603 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,rD,3,1,"ng-template",null,1,A),e(8,` 7604 `),a(),e(9,` 7605 `),n(10,"p-accordion-content"),e(11,` 7606 `),n(12,"div",17),e(13,` 7607 `),n(14,"div",18),e(15,`
7608 `),n(16,"qware-status-settings",36),e(17,` 7609 `),a(),e(18,` 7610 `),a(),e(19,` 7611 `),a(),e(20,` 7612 `),a(),e(21,` 7613 `),a(),e(22,` 7614 `)),r&2){let t=m();l(4),K(` 7615 `,y(5,6,"STATUS.SETTINGS"),` 7616 `),l(12),p("form",t.form.controls.Settings)("submitted",t.submitted)("validationErrors",t.validationErrors)("userGroupOptions",t.userGroupOptions)("allValuesLoaded",t.allValuesLoaded)}}function lD(r,d){if(r&1){let t=b();e(0,` 7617 `),n(1,"p-button",37),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 7618 `),a(),e(4,` 7619 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function sD(r,d){r&1&&(e(0,` 7620 `),n(1,"div",40),e(2,` 7621 `),n(3,"span",41),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 7622 `),a(),e(6,` 7623 `))}function dD(r,d){if(r&1){let t=b();e(0,` 7624 `),n(1,"qware-spinner",42),e(2,` 7625 `),n(3,"div",43),e(4,` 7626 `),n(5,"qware-entity-history",44),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 7627 `),a(),e(7,` 7628 `),a(),e(8,` 7629 `),a(),e(9,` 7630 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function pD(r,d){if(r&1){let t=b();e(0,` 7631 `),n(1,"div",38),e(2,` 7632 `),n(3,"p-drawer",39,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 7633 `),_(6,sD,7,0,"ng-template",null,7,A),e(8,` 7634 `),_(9,dD,10,7,"ng-template",null,4,A),e(11,` 7635 `),a(),e(12,` 7636 `),a(),e(13,` 7637 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var Dm=(()=>{class r{authService;cacheService;confirmationService;customFieldService;fb;responseService;route;serviceAreaService;statusService;toastService;translate;userGroupService;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];allValuesLoaded=!1;assignedCustomFieldLayouts=[];cflSelections=[];customFieldLayouts=[];displaySpinner=!0;form;historyArrayProperties=["StatusNotificationGroups"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;isStatusEvent=!1;moreItems=[];returnToCustomFieldList=!1;serviceAreas=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;status;submitted=!1;typeOptions=[];userEnabledSidebar=!1;userGroupOptions=[];validationErrors;auditLoggingDisabled=!0;customFieldsDisabled=!0;workOrderStatusLimit;hasEventModule=!1;customFieldListRoute="../../../"+P.customField+"/"+P.list;statusListRoute="../../../"+P.status+"/"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};shadeFormGroups=[];translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.authService=t,this.cacheService=o,this.confirmationService=i,this.customFieldService=s,this.fb=c,this.responseService=u,this.route=x,this.serviceAreaService=C,this.statusService=O,this.toastService=w,this.translate=F,this.userGroupService=L,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.customFieldsDisabled=(this.authService.qwareSubscription?.customFieldsPerLayoutLimit??0)===0,this.workOrderStatusLimit=this.authService.qwareSubscription?.workOrderStatusLimit,this.hasEventModule=this.authService.tenant.EventsModule}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer();
7637let t=localStorage.getItem(Oe.REDIRECT_FROM_PAGE);localStorage.removeItem(Oe.REDIRECT_FROM_PAGE),t==="CUSTOM_FIELD"&&(this.returnToCustomFieldList=!0),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["STATUS.WORK_ORDERS_TYPE","STATUS.EVENTS_TYPE","STATUS.NO_LAYOUT","SHARED.DISABLED","SHARED.DELETED","SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.STATUS"]).pipe(N()),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.statusService.getStatus(this.route.snapshot.params.id),this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.customFieldsDisabled?Fe([]):this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1],i=t[2];this.serviceAreas=t[3].filter(x=>x.State===M.ACTIVE);let s=t[4];this.isStatusEvent=i.Type===Li.EVENTS,this.isStatusEvent&&(this.form.get("Settings.ShowPriority")?.setValue(!1),this.form.get("Settings.ShowDueDate")?.setValue(!1)),this.historyIdMap=new Map,this.typeOptions=[{label:this.translations["STATUS.WORK_ORDERS_TYPE"],value:Li.WORK_ORDERS}],this.hasEventModule&&this.typeOptions.unshift({label:this.translations["STATUS.EVENTS_TYPE"],value:Li.EVENTS}),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let c=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableStatus()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableStatus()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteStatus()}];i.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&c.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreStatus()}),this.actionItems=c.filter(x=>i.State===M.DISABLED?x.id!=="disable.action":i.State===M.DELETED?x.id!=="disable.action"&&x.id!=="enable.action"&&x.id!=="delete.action":x.id!=="enable.action"),this.userGroupOptions=o.filter(x=>x.State===M.ACTIVE&&!ci.includes(x.Name??"")).map(x=>({label:x.Name,value:x.Id}));let u=[];i?.StatusNotificationGroupIds&&(u=Array.apply([],i.StatusNotificationGroupIds)),i.StatusNotificationGroupIds=this.userGroupOptions.filter(x=>u.indexOf(x.value)>-1),this.serviceAreas.forEach(x=>{if(x.CustomLayouts&&i.Id){let C=x.CustomLayouts[i.Id];if(C){let O=C?.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":C?.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.assignedCustomFieldLayouts.push({label:C?.Name+O,value:C?.Name})}else this.assignedCustomFieldLayouts.push({label:this.translations["STATUS.NO_LAYOUT"],value:void 0})}}),this.cflSelections.push({label:this.translations["STATUS.NO_LAYOUT"],value:void 0}),this.customFieldLayouts=s.filter(x=>x.State===M.ACTIVE&&x.Type==="WORKORDERS"),this.customFieldLayouts.map(x=>{this.cflSelections.push({label:x.Name,value:x.Name})}),i.StatusNotificationGroups?.forEach(x=>{if(!this.userGroupOptions.find(C=>C.value===x.Id)){let C=o.find(w=>w.Id===x.Id);C||(C=x);let O=C.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":C.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";i.StatusNotificationGroupIds?.push({label:C.Name+O,value:C.Id})}}),this.status=Object.assign(new Rr,i),this.setHistoryParams(),this.form.patchValue(new Rr().toForm(this.status)),this.form.markAsPristine(),this.form.markAsUntouched(),this.status.State==="DELETED"&&this.form.disable(),this.status.Type===Li.EVENTS&&(this.form.get("Details.Name")?.disable(),this.form.get("Details.Name")?.clearValidators()),this.allValuesLoaded=!0,this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Description:this.fb.control("",[T.maxLength(ft)]),Type:this.fb.control({value:"",disabled:!0},T.required),Color:this.fb.control("",[T.required,T.maxLength(re)])}),CustomFields:this.fb.group({CustomFieldLayoutPairs:this.fb.control(null)}),Settings:this.fb.group({EscalationDays:this.fb.control("",[T.maxLength(re),T.pattern("[0-9]*")]),DeductInventoryNotification:this.fb.control(!1),ShowCompletedDate:this.fb.control(!1),ShowPriority:this.fb.control(!0),ShowDueDate:this.fb.control(!0),RequireLaborHours:this.fb.control(!1),SendEmailToAssignees:this.fb.control(!1),SendEmailToRequestor:this.fb.control(!1),SendEmailToRequestorSupervisor:this.fb.control(!1),StatusNotificationGroups:this.fb.control([]),Subject:this.fb.control("",T.maxLength(fi)),Body:this.fb.control("",T.maxLength(Kt))})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("CustomFields"),this.form.get("Settings")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.STATUS"]+' "'+this.status?.Name+'"';let t=new Map;t.set("AssociatedEntity",[this.serviceAreas,"Id","Name"]),t.set("StatusNotificationGroups",[this.userGroupOptions,"value","label"]),this.historyIdMap=t;let o=new Map;o.set("Name","STATUS.NAME"),o.set("Description","STATUS.DESCRIPTION"),o.set("Color","STATUS.COLOR"),o.set("Subject","STATUS.SUBJECT"),o.set("Body","STATUS.BODY"),o.set("EscalationDays","STATUS.ESCALATION_DAYS"),o.set("DeductInventoryNoticiation","STATUS.DEDUCT_INVENTORY_NOTIFICATION"),o.set("ShowCompletedDate","STATUS.SHOW_COMPLETED_DATE"),o.set("SendEmailToAssignees","STATUS.SEND_EMAIL_TO_ASSIGNEES"),o.set("SendEmailToRequestor","STATUS.SEND_EMAIL_TO_REQUESTOR"),o.set("SendEmailToRequestorSupervisor","STATUS.SEND_EMAIL_TO_SUPERVISOR"),o.set("LayoutName","STATUS.CUSTOM_FIELD_LAYOUT"),o.set("StatusNotificationGroups","STATUS.EMAIL_RECIPIENTS_USER_GROUPS"),this.historyNameMap=o}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Rr().parseForm(this.form.getRawValue());t.Id=this.status?.Id,t.TenantId=this.authService.tenant.Id,t.Category=this.status?.Category,t.State=this.status?.State??M.ACTIVE,t.StatusNotificationGroupIds=t.StatusNotificationGroupIds?.map(o=>o.value),this.statusService.updateStatus(t).pipe(we(()=>{let o=[];t.CustomFieldLayoutPairs&&(o=this.customFieldService.layoutPairDictToObjArray(t.CustomFieldLayoutPairs));let i=Ca.default.filter(this.serviceAreas,c=>{let u=Ca.default.map(o,"ServiceAreaId");return Ca.default.includes(u,c.Id)}),s=[];return Ca.default.each(i,c=>{let u=Ca.default.find(o,{ServiceAreaId:c.Id});c.CustomLayouts&&t.Id&&u?.Layout&&(u.Layout.Id?c.CustomLayouts[t.Id]=u.Layout:delete c.CustomLayouts[t.Id]),s.push(this.serviceAreaService.updateServiceArea(c))}),Ca.default.size(s)>0?ue(s):Fe([])})).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.SAVE",this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableStatus(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.status?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.status?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.statusService.disableStatus(this.status.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.DISABLE",this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableStatus(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.status?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.status?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.statusService.enableStatus(this.status.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.ENABLE",this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteStatus(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.status?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.status?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.statusService.deleteStatus(this.status.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.DELETE",this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreStatus(){this.actionsMenu.hide();let t=this.authService.tenant.WorkOrderStatusCount;t&&Ca.default.isNumber(this.workOrderStatusLimit)&&t>=this.workOrderStatusLimit?this.translate.get(["SHARED.ERROR_LABEL","SUBSCRIPTION.ERROR.WORK_ORDER_STATUS_LIMIT_REACHED"],{limit:this.workOrderStatusLimit}).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SUBSCRIPTION.ERROR.WORK_ORDER_STATUS_LIMIT_REACHED"])}):this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.status?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"restorePromptDialog",header:o["SHARED.RESTORE_HEADER"],message:o["SHARED.RESTORE_MESSAGE"],accept:()=>{this.status?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.statusService.restoreStatus(this.status.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_STATUSES),this.displaySpinner=!1,this.responseService.onSuccess("STATUS.SUCCESS.RESTORE",this.returnToCustomFieldList?this.customFieldListRoute:this.statusListRoute,this.route)},error:i=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Ca.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(mt),g($t),g(be),g(Re),g(he),g(_i),g(Oi),g(Se),g(le),g(Tt))};static \u0275cmp=B({type:r,selectors:[["qware-status-edit"]],viewQuery:function(o,i){if(o&1&&(X(kw,5),X(Vw,7),X(qw,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:60,vars:29,consts:[["shades",""],["toggleicon",""],["actionsMenu",""],["item",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.status.edit",1,"grid"],["id","qware.status.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.status.edit.page-header","translate","",1,"page-header"],["id","qware.status.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.status.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"form","submitted","validationErrors","typeOptions","autoFocus"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.status.edit.button.cancel",3,"routerLink","text","label"],[1,"top-indent-large","actions-container"],["id","qware.status.edit.edit.actions-menu",3,"model","popup"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.status.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.status.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.status.edit.custom-fields-shade","value","1"],[3,"form","submitted","validationErrors","cflSelections","serviceAreas","customFieldLayouts","all
7637ValuesLoaded","assignedCustomFieldLayouts"],["id","qware.status.edit.settings-shade","value","2"],[3,"form","submitted","validationErrors","userGroupOptions","allValuesLoaded"],["tabindex","999","type","button","id","qware.status.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.status.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.status.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.status.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","status",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","arrayProperties","parentSpinnerState"]],template:function(o,i){o&1&&(n(0,"div",8),e(1,` 7638 `),n(2,"div",9),e(3,` 7639 `),n(4,"div",10),e(5,` 7640 `),n(6,"h3",11),e(7,` 7641 STATUS.EDIT_STATUS 7642 `),a(),e(8,` 7643 `),_(9,Qw,12,3)(10,$w,17,4),a(),e(11,` 7644 `),n(12,"qware-spinner",12),e(13,` 7645 `),n(14,"p-card",13),e(15,` 7646 `),n(16,"qware-edit-lock",14),e(17,` 7647 `),n(18,"p-accordion",15,0),e(20,` 7648 `),n(21,"p-accordion-panel",16),e(22,` 7649 `),n(23,"p-accordion-header"),e(24),I(25,"translate"),_(26,Zw,3,1,"ng-template",null,1,A),e(28,` 7650 `),a(),e(29,` 7651 `),n(30,"p-accordion-content"),e(31,` 7652 `),n(32,"div",17),e(33,` 7653 `),n(34,"div",18),e(35,` 7654 `),n(36,"qware-status-details",19),e(37,` 7655 `),a(),e(38,` 7656 `),a(),e(39,` 7657 `),a(),e(40,` 7658 `),a(),e(41,` 7659 `),a(),e(42,` 7660 `),_(43,iD,23,11)(44,oD,23,8),a(),e(45,` 7661 `),a(),e(46,` 7662 `),n(47,"div",20),e(48,` 7663 `),n(49,"p-button",21),I(50,"translate"),e(51,` 7664 `),a(),e(52,` 7665 `),_(53,lD,5,5),a(),e(54,` 7666 `),a(),e(55,` 7667 `),a(),e(56,` 7668 `),a(),e(57,` 7669 `),_(58,pD,14,6),a(),e(59,` 7670`)),o&2&&(l(2),p("ngClass",pe(26,Bw,!i.auditLoggingDisabled)),l(7),f(i.isStatusEvent?-1:9),l(),f(i.auditLoggingDisabled?-1:10),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.status!==void 0&&i.status.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(28,Hw)),l(6),K(` 7671 `,y(25,22,"STATUS.DETAILS"),` 7672 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("typeOptions",i.typeOptions)("autoFocus",!1),l(7),f(!i.customFieldsDisabled&&!i.isStatusEvent?43:-1),l(),f(i.isStatusEvent?-1:44),l(5),q("label",y(50,24,"SHARED.CANCEL")),p("routerLink",i.returnToCustomFieldList?i.customFieldListRoute:i.statusListRoute)("text",!0),l(4),f((i.status==null?null:i.status.State)!=="DELETED"?53:-1),l(5),f(i.auditLoggingDisabled?-1:58))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,kl,Vl,ql,ie],encapsulation:2})}return r})();var mD=["dt"],cD=r=>({"disabled-row":r}),Lm=(r,d)=>d.field;function uD(r,d){if(r&1){let t=b();e(0,` 7673 `),n(1,"div",15),e(2,` 7674 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 7675 `),n(7,"p-toggleswitch",16),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 7676 `),a(),e(9,` 7677 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function _D(r,d){if(r&1&&(e(0,` 7678 `),R(1,"p-sortIcon",19),e(2,` 7679 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function ED(r,d){if(r&1&&(e(0,` 7680 `),n(1,"th",17),e(2,` 7681 `),n(3,"span",18),e(4),a(),e(5,` 7682 `),_(6,_D,3,1),a(),e(7,` 7683 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function SD(r,d){if(r&1&&(e(0,` 7684 `),n(1,"tr"),e(2,` 7685 `),G(3,ED,8,3,null,null,Lm),a(),e(5,` 7686 `)),r&2){let t=d.$implicit;l(3),k(t)}}function xD(r,d){r&1&&(e(0,` 7687 `),n(1,"span",24),e(2,"SHARED.DISABLED"),a(),e(3,` 7688 `))}function fD(r,d){r&1&&(e(0,` 7689 `),n(1,"span",24),e(2,"SHARED.DELETED"),a(),e(3,` 7690 `))}function hD(r,d){if(r&1&&(e(0,` 7691 `),n(1,"span"),e(2,` 7692 `),n(3,"a",23),e(4),a(),e(5,` 7693 `),_(6,xD,4,0)(7,fD,4,0),a(),e(8,` 7694 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(3),gt("routerLink","",i.statusEditRoute,"/",o.Id,""),l(),v(o[t.field]),l(2),f(o.State==="DISABLED"?6:-1),l(),f(o.State==="DELETED"?7:-1)}}function CD(r,d){if(r&1&&(e(0,` 7695 `),n(1,"div",25),e(2,` 7696 `),R(3,"div",26),e(4,` 7697 `),n(5,"span",27),e(6),a(),e(7,` 7698 `),a(),e(8,` 7699 `)),r&2){let t=m().$implicit,o=m().$implicit;l(3),ga("background-color",o[t.field]),l(3),K("(",o[t.field],")")}}function vD(r,d){if(r&1&&(e(0,` 7700 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 7701 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(y(3,1,"STATUS."+o[t.field]))}}function gD(r,d){if(r&1&&(e(0,` 7702 `),n(1,"span"),e(2),a(),e(3,` 7703 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function TD(r,d){if(r&1&&(e(0,` 7704 `),n(1,"td"),e(2,` 7705 `),n(3,"span",21),e(4),a(),e(5,` 7706 `),n(6,"div",22),e(7,` 7707 `),n(8,"span"),e(9,` 7708 `),_(10,hD,9,6)(11,CD,9,3)(12,vD,5,3)(13,gD,4,1),e(14,` 7709 `),a(),e(15,` 7710 `),a(),e(16,` 7711 `),a(),e(17,` 7712 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:t==="Color"?11:t==="Type"?12:13)}}function ID(r,d){if(r&1&&(e(0,` 7713 `),n(1,"tr",20),e(2,` 7714 `),G(3,TD,18,2,null,null,Lm),a(),e(5,` 7715 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,cD,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function bD(r,d){r&1&&(e(0,` 7716 `),n(1,"div",28),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 7717 `))}function yD(r,d){r&1&&(e(0,` 7718 `),n(1,"div",28),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 7719 `))}function AD(r,d){if(r&1&&(e(0,` 7720 `),n(1,"tr"),e(2,` 7721 `),n(3,"td"),e(4,` 7722 `),_(5,bD,4,0)(6,yD,4,0),a(),e(7,` 7723 `),a(),e(8,` 7724 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:6)}}function RD(r,d){if(r&1&&(e(0,` 7725 `),n(1,"div",29),e(2,` 7726 `),n(3,"p-button",30),e(4,` 7727 `),n(5,"i",7),e(6,"add"),a(),e(7,` 7728 `),a(),e(8,` 7729 `),a(),e(9,` 7730 `)),r&2){let t=m();l(3),q("routerLink",t.statusCreateRoute),p("raised",!0)}}var Nm=(()=>{class r{authService;statusService;dt;allStatuses=[];displaySpinner=!0;generalFilter="";isActive=!1;privilegesEnum=ae;statuses=[];searchEnabled=!1;searchResults=!1;selectedStatuses=[];showDeleted=!1;tableColumns=[{field:"Name",header:"STATUS.NAME"},{field:"Color",header:"STATUS.COLOR"},{field:"Type",header:"STATUS.TYPE"},{field:"Description",header:"STATUS.DESCRIPTION"}];hasEventsModule=!1;workOrderStatusLimit;canViewDeleted=!1;statusCreateRoute="../"+P.create;statusEditRoute="../"+P.edit;constructor(t,o){this.authService=t,this.statusService=o,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED),this.workOrderStatusLimit=this.authService.qwareSubscription?.workOrderStatusLimit,this.hasEventsModule=this.authService.tenant.EventsModule}ngOnInit(){this.statusService.getStatuses(this.authService.tenant.Id).subscribe(o=>{this.allStatuses=o,this.statuses=this.filterStatuses(this.allStatuses),this.statuses.length===0?this.searchResults=!1:this.detectFilter(),this.displaySpinner=!1});let t=localStorage.getItem(Oe.STATUS_FILTER_STORAGE_KEY);t&&(this.generalFilter=t,this.generalFilterOnChange())}generalFilterOnChange(){localStorage.setItem(Oe.STATUS_FILTER_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt.filterGlobal(this.generalFilter,"contains")}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}filterStatuses(t){return t.filter(o=>(o.State!==M.DELETED||this.showDeleted)&&(o.Type!==Li.EVENTS||this.hasEventsModule))}toggleShowDeleted(){this.statuses=this.filterStatuses(this.allStatuses)}static \u0275fac=function(o){return new(o||r)(g(de),g(Oi))};static \u0275cmp=B({type:r,selectors:[["qware-status-list"]],viewQuery:function(o,i){if(o&1&&X(mD,7),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},standalone:!1,decls:44,vars:18,consts:[["dt",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.status.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.status.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"col-12","data-grid"],["id","qware.status.list.spinner",3,"displaySpinner"],["id","qware.status.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"selectionChange","onFilter","columns","value","selection","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"show-deleted-switch"],["id","qware.status-list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],[3,"pSortableColumn"],["translate",""],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.status.list.table.status-name",3,"routerLink"],["translate","",1,"badge"],[1,"flex-inline","flex-row","align-items-center"],[1,"color-box"],["id","qware.status.list.table.status-color",1,"hex-subtitle"],["translate","",1,"no-results"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button","id","qware.status.list.create-button",3,"raised","routerLink"]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 7731 `),n(2,"div",2),e(3,` 7732 `),n(4,"h3",3),e(5,` 7733 STATUS.STATUS_MANAGEMENT 7734 `),a(),e(6,` 7735 `),_(7,uD,10,4),a(),e(8,` 7736 `),n(9,"div",4),e(10,` 7737 `),n(11,"div",5),e(12,` 7738 `),n(13,"p-iconfield",6),e(14,` 7739 `),n(15,"p-inputicon"),e(16,` 7740 `),n(17,"span",7),e(18,"search"),a(),e(19,` 7741 `),a(),e(20,` 7742 `),n(21,"input",8),I(22,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 7743 `),a(),e(24,` 7744 `),a(),e(25,` 7745 `),a(),e(26,` 7746 `),n(27,"div",9),e(28,` 7747 `),n(29,"qware-spinner",10),e(30,` 7748 `),n(31,"p-table",11,0),j("selectionChange",function(u){return E(s),W(i.selectedStatuses,u)||(i.selectedStatuses=u),S(u)}),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(33,` 7749 `),_(34,SD,6,0,"ng-template",12),e(35,` 7750 `),_(36,ID,6,4,"ng-template",13),e(37,` 7751 `),_(38,AD,9,2,"ng-template",14),e(39,` 7752 `),a(),e(40,` 7753 `),a(),e(41,` 7754 `),a(),e(42,` 7755 `),_(43,RD,10,2),a()}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(12),q("placeholder",y(22,16,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(8),p("displaySpinner",i.displaySpinner),l(2),p("columns",i.tableColumns)("value",i.statuses),H("selection",i.selectedStatuses),p("sortOrder",1)("paginator",!0)("pageLinks",5)("rows",10)("scrollable",!0),l(12),f(i.workOrderStatusLimit!==0?43:-1))},dependencies:[Pe,oe,Qe,je,Ae,se,Le,pi,mi,ye,me,kt,et,ht,ji,Yi,cn,Ai,$,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0!important}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{display:flex!important;position:relative!important;margin:0!important;width:100%}.hex-subtitle[_ngcontent-%COMP%]{font-size:var(--p-font-size-body3);padding-left:.5rem}
7755.color-box[_ngcontent-%COMP%]{width:1.5rem;height:1.5rem;border:1px solid rgba(0,0,0,.25);border-radius:50%}"]})}return r})();var Om=He(nt());var wD=["actionsMenu"],DD=["dt"],LD=["listViewDropdown"],ND=r=>({"disabled-row":r}),OD=()=>({raised:!0}),Fm=(r,d)=>d.field,FD=(r,d)=>d.Id;function MD(r,d){if(r&1){let t=b();e(0,` 7756 `),n(1,"div",27),e(2,` 7757 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 7758 `),n(7,"p-toggleswitch",28),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),a(),e(8,` 7759 `),a(),e(9,` 7760 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted)}}function UD(r,d){r&1&&(e(0,` 7761 `),n(1,"span",13),e(2,"expand_more"),a(),e(3,` 7762 `))}function PD(r,d){r&1&&(e(0,` 7763 `),n(1,"span",13),e(2,"search"),a(),e(3,` 7764 `))}function GD(r,d){if(r&1&&(e(0,` 7765 `),n(1,"a",29),e(2,` 7766 `),n(3,"span",30),e(4),a(),e(5,` 7767 `),n(6,"span",31),e(7),a(),e(8,` 7768 `),a(),e(9,` 7769 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function kD(r,d){if(r&1&&(e(0,` 7770 `),R(1,"p-sortIcon",34),e(2,` 7771 `)),r&2){let t=m().$implicit;l(),p("field",t.sortField)}}function VD(r,d){if(r&1&&(e(0,` 7772 `),n(1,"th",32),e(2,` 7773 `),n(3,"span",33),e(4),a(),e(5,` 7774 `),_(6,kD,3,1),a(),e(7,` 7775 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.pSortableColumnDisabled?void 0:t.sortField),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function qD(r,d){if(r&1&&(e(0,` 7776 `),n(1,"tr"),e(2,` 7777 `),G(3,VD,8,3,null,null,Fm),a(),e(5,` 7778 `)),r&2){let t=d.$implicit;l(3),k(t)}}function BD(r,d){if(r&1&&(e(0,` 7779 `),n(1,"a",38),e(2),a(),e(3,` 7780 `)),r&2){let t=m(2).$implicit,o=m().$implicit,i=m();l(),gt("routerLink","",i.checklistEditRoute,"/",o.Id,""),l(),v(o[t.field])}}function HD(r,d){r&1&&(e(0,` 7781 `),n(1,"span",39),e(2,"SHARED.DISABLED"),a(),e(3,` 7782 `))}function WD(r,d){r&1&&(e(0,` 7783 `),n(1,"span",39),e(2,"SHARED.DELETED"),a(),e(3,` 7784 `))}function jD(r,d){if(r&1&&(e(0,` 7785 `),n(1,"span"),e(2,` 7786 `),_(3,BD,4,4)(4,HD,4,0)(5,WD,4,0),a(),e(6,` 7787 `)),r&2){let t=m(2).$implicit,o=m();l(3),f(o.selectedViewOption==="AllChecklists"?3:-1),l(),f(t.State==="DISABLED"?4:-1),l(),f(t.State==="DELETED"?5:-1)}}function YD(r,d){if(r&1&&(e(0,` 7788 `),n(1,"a",40),e(2),a(),e(3,` 7789 `)),r&2){let t=m(2).$implicit,o=m().$implicit,i=m();l(),gt("routerLink","",i.taskEditRoute,"/",o.Id,""),l(),v(o[t.field])}}function QD(r,d){r&1&&(e(0,` 7790 `),n(1,"span",39),e(2,"SHARED.DISABLED"),a(),e(3,` 7791 `))}function KD(r,d){r&1&&(e(0,` 7792 `),n(1,"span",39),e(2,"SHARED.DELETED"),a(),e(3,` 7793 `))}function $D(r,d){if(r&1&&(e(0,` 7794 `),n(1,"span"),e(2,` 7795 `),_(3,YD,4,4)(4,QD,4,0)(5,KD,4,0),a(),e(6,` 7796 `)),r&2){let t=m(2).$implicit,o=m();l(3),f(o.selectedViewOption==="AllTasks"?3:-1),l(),f(t.State==="DISABLED"?4:-1),l(),f(t.State==="DELETED"?5:-1)}}function zD(r,d){if(r&1){let t=b();e(0,` 7797 `),n(1,"a",41),h("click",function(){E(t);let i=m(6);return S(i.navClick())}),e(2),a(),e(3,` 7798 `)}if(r&2){let t=m().$implicit,o=m(5);l(),gt("routerLink","",o.checklistEditRoute,"/",t.Id,""),l(),v(t.Name)}}function XD(r,d){if(r&1){let t=b();e(0,` 7799 `),n(1,"a",41),h("click",function(){E(t);let i=m(6);return S(i.navClick())}),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 7800 `)}if(r&2){let t=m().$implicit,o=m(5);l(),gt("routerLink","",o.checklistEditRoute,"/",t.Id,""),l(),v(t.Name)}}function ZD(r,d){if(r&1&&(e(0,` 7801 `),_(1,zD,4,4)(2,XD,7,4)),r&2){let t=d.$index,o=d.$count;l(),f(t===o-1?1:2)}}function JD(r,d){if(r&1&&(e(0,` 7802 `),n(1,"span"),e(2,` 7803 `),G(3,ZD,3,1,null,null,FD),a(),e(5,` 7804 `)),r&2){let t=m(3).$implicit;l(3),k(t.Checklists)}}function eL(r,d){if(r&1&&(e(0,` 7805 `),n(1,"span"),e(2),a(),e(3,` 7806 `)),r&2){let t=m(2).$implicit,o=m().$implicit;l(2),v(o[t.field])}}function tL(r,d){if(r&1&&(e(0,` 7807 `),n(1,"div"),e(2,` 7808 `),_(3,JD,6,0)(4,eL,4,1),a(),e(5,` 7809 `)),r&2){let t=m().$implicit,o=m(2);l(3),f(o.selectedViewOption==="AllTasks"&&t.header?3:-1),l(),f(t.header?-1:4)}}function iL(r,d){if(r&1&&(e(0,` 7810 `),n(1,"span"),e(2),a(),e(3,` 7811 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function nL(r,d){if(r&1&&(e(0,` 7812 `),n(1,"td"),e(2,` 7813 `),n(3,"span",36),e(4),a(),e(5,` 7814 `),n(6,"div",37),e(7,` 7815 `),_(8,jD,7,3)(9,$D,7,3)(10,tL,6,2)(11,iL,4,1),e(12,` 7816 `),a(),e(13,` 7817 `),a(),e(14,` 7818 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(4),f((t=o.field)==="Name"?8:t==="Description"?9:t==="AssociatedNames"?10:11)}}function aL(r,d){if(r&1&&(e(0,` 7819 `),n(1,"tr",35),e(2,` 7820 `),G(3,nL,15,2,null,null,Fm),a(),e(5,` 7821 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,ND,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function rL(r,d){r&1&&(e(0,` 7822 `),n(1,"div",42),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 7823 `))}function oL(r,d){r&1&&(e(0,` 7824 `),n(1,"div",42),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 7825 `))}function lL(r,d){if(r&1&&(e(0,` 7826 `),n(1,"tr"),e(2,` 7827 `),n(3,"td"),e(4,` 7828 `),_(5,rL,4,0)(6,oL,4,0),a(),e(7,` 7829 `),a(),e(8,` 7830 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:-1),l(),f(o.generalFilter?-1:6)}}function sL(r,d){r&1&&(e(0,` 7831 `),n(1,"i",13),e(2,"add"),a(),e(3,` 7832 `))}function dL(r,d){if(r&1&&(e(0,` 7833 `),n(1,"i",13),e(2),a(),e(3,` 7834 `)),r&2){let t=m().$implicit;l(2),v(t.icon)}}function pL(r,d){if(r&1&&(e(0,` 7835 `),n(1,"div",45),e(2,` 7836 `),R(3,"p-badge",46),e(4,` 7837 `),n(5,"p-button",47),e(6,` 7838 `),_(7,dL,4,1),a(),e(8,` 7839 `),a(),e(9,` 7840 `)),r&2){let t=d.$implicit;l(3),p("value",t.label),l(2),q("routerLink",t.routerLink),p("text",!0)("rounded",!0)("raised",!0),l(2),f(t.icon?7:-1)}}function mL(r,d){if(r&1&&(e(0,` 7841 `),n(1,"div",43),e(2,` 7842 `),n(3,"p-speeddial",44),e(4,` 7843 `),_(5,sL,4,0,"ng-template",null,6,A),e(7,`
7844 `),_(8,pL,10,6,"ng-template",null,4,A),e(10,` 7845 `),a(),e(11,` 7846 `),a(),e(12,` 7847 `)),r&2){let t=m();l(3),p("model",t.addMenuItems)("buttonProps",ne(3,OD))("mask",!0)}}var Mm=(()=>{class r{appSettingsService;authService;checklistService;datePipe;taskService;translate;actionsMenu;dt;listViewDropdown;addMenuItems=[];allChecklists=[];allTasks=[];displaySpinner=!0;taskColumns=[];generalFilter="";isActive=!1;checklistColumns=[];listViewOptions=[];moreItems=[];PrivilegesEnum=ae;searchEnabled=!1;searchResults=!1;selectedViewOption;showDeleted=!1;tableColumns=[];tableData=[];timezone;totalChecklistRecords=0;totalTaskRecords=0;translations={};taskLimit;canViewDeleted=!1;taskCreateRoute="../../"+P.task+"/"+P.create;taskEditRoute="../../"+P.task+"/"+P.edit;checklistCreateRoute="../../"+P.checklist+"/"+P.create;checklistEditRoute="../../"+P.checklist+"/"+P.edit;constructor(t,o,i,s,c,u){this.appSettingsService=t,this.authService=o,this.checklistService=i,this.datePipe=s,this.taskService=c,this.translate=u,this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED)}ngOnInit(){this.taskLimit=1e5,this.taskColumns=[{field:"Description",header:"CHECKLIST.TASK.DESCRIPTION",sortField:"Description"},{field:"VerificationFieldType",header:"CHECKLIST.TASK.VERIFICATION_FIELD_TYPE",sortField:"VerificationFieldType"},{field:"AssociatedNames",header:"CHECKLIST.TASK.ASSOCIATED_CHECKLISTS",pSortableColumnDisabled:!0}],this.checklistColumns=[{field:"Name",width:"30%",header:"CHECKLIST.NAME",sortField:"Name"},{field:"CreatedDateString",width:"30%",header:"CHECKLIST.CREATED_DATE",sortField:"CreatedDateUTC"},{field:"CreatedByUserName",width:"30%",header:"CHECKLIST.CREATED_USER",sortField:"CreatedByUserName"}];let t=this.buildTaskFilter(),o=this.buildChecklistFilter(),i=[this.translate.get(["CHECKLIST.TYPES.ASSET","CHECKLIST.TYPES.WORKORDER","CHECKLIST.TYPES.UNKNOWN","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.DATE","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.MULTIPLE_SELECT","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.BOOLEAN","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.MULTIPLE_SELECT","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.SINGLE_SELECT","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.NUMBER","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.UNKNOWN","CHECKLIST.TASK.VERIFICATION_FIELD_TYPES.INPUT","CHECKLIST.TASK.CREATE_TASK","CHECKLIST.CREATE_CHECKLIST","CHECKLIST.TASK.ALL_TASKS","CHECKLIST.ALL_CHECKLISTS","SHARED.SEARCH"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N()),this.taskService.searchAllTasks(t),this.checklistService.searchAllChecklists(o)];ue(i).subscribe(c=>{this.translations=c[0];let u=c[1];this.totalTaskRecords=c[2].TotalResults||0,this.allTasks=c[2].Results,this.totalChecklistRecords=c[3].TotalResults||0,this.allChecklists=c[3].Results,this.timezone=u?.Timezone,this.allTasks.forEach(C=>{C.VerificationFieldType=this.translations["CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+C.VerificationFieldType],C.AssociatedNames=Om.default.join(C.Checklists?.map(O=>O.Name),` 7848`)}
7848),this.allChecklists.forEach(C=>{C.CreatedDateString=this.datePipe.transform(Vt.convertToAppTimezone(this.timezone??"",!0,C.CreatedDateUTC),"MMM dd, yyyy h:mm a")}),this.addMenuItems=[{id:"createTask",label:this.translations["CHECKLIST.TASK.CREATE_TASK"],icon:"check",routerLink:this.taskCreateRoute},{id:"createChecklist",label:this.translations["CHECKLIST.CREATE_CHECKLIST"],icon:"checklist",routerLink:this.checklistCreateRoute}],this.listViewOptions=[{label:this.translations["CHECKLIST.TASK.ALL_TASKS"],value:"AllTasks"},{label:this.translations["CHECKLIST.ALL_CHECKLISTS"],value:"AllChecklists"}],this.moreItems=[{label:this.translations["SHARED.SEARCH"],icon:"search",command:()=>this.enableSearch()}];let x=localStorage.getItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY);x?this.selectedViewOption=x:this.selectedViewOption="AllTasks",this.tableColumns=this.selectedViewOption==="AllChecklists"?this.checklistColumns:this.taskColumns,this.listViewOnChange(!1)});let s=window.localStorage.getItem(Oe.CHANGE_FILTER_STORAGE_KEY);s&&(this.generalFilter=s,this.generalFilterOnChange())}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}generalFilterOnChange(){localStorage.setItem(Oe.CHECKLIST_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt.filterGlobal(this.generalFilter,"contains")}enableSearch(){this.searchEnabled=!this.searchEnabled,this.searchEnabled||(this.generalFilter="",this.generalFilterOnChange())}listViewOnChange(t){switch(this.displaySpinner=!0,this.searchResults=!1,this.selectedViewOption){case"AllChecklists":localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllChecklists"),this.tableColumns=this.checklistColumns,this.tableData=this.filterItems(this.allChecklists),this.dt._sortField="Name";break;case"AllTasks":default:localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllTasks"),this.tableColumns=this.taskColumns,this.tableData=this.filterTasks(this.allTasks),this.dt._sortField="Description";break}t&&(this.generalFilter=""),this.generalFilterOnChange(),this.displaySpinner=!1}filterItems(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}filterTasks(t){return t.filter(o=>o.State!==M.DELETED||this.showDeleted)}toggleShowDeleted(){let t=this.selectedViewOption==="AllChecklists";this.tableData=t?this.filterItems(this.allChecklists):this.filterTasks(this.allTasks)}navClick(){localStorage.setItem(Oe.REDIRECT_FROM_PAGE,"CHECKLIST")}buildTaskFilter(){let t=new u0;return t.PageNumber=1,t.PageSize=1e3,t.SortColumn={Field:"Description",Type:"String",ValueType:"String"},t.SortDirection=1,t}buildChecklistFilter(){let t=new n0;return t.PageNumber=1,t.PageSize=1e3,t}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(Ha),g(Aa),g(Pn),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-task-list"]],viewQuery:function(o,i){if(o&1&&(X(wD,5),X(DD,7),X(LD,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.dt=s.first),Y(s=Q())&&(i.listViewDropdown=s.first)}},standalone:!1,features:[yn([Aa])],decls:77,vars:23,consts:[["listViewDropdown",""],["dropdownicon",""],["filtericon",""],["moreMenu",""],["item",""],["dt",""],["icon",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.task.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.task.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"flex-inline","list-view-control-container"],["translate","",1,"list-view-label"],["id","qware.task.list.list-view-ddl",1,"list-view-dropdown",3,"ngModelChange","onChange","options","ngModel"],[1,"more-container"],["id","qware.task.list.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"col-12","data-grid"],["id","qware.task.list.spinner",3,"displaySpinner"],["id","qware.task.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"onFilter","columns","value","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"show-deleted-switch"],["id","qware.task-list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],[3,"pSortableColumn"],["translate",""],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.task.list.table.checklist-name",3,"routerLink"],["translate","",1,"badge"],["id","qware.task.list.table.task-name",3,"routerLink"],[3,"click","routerLink"],["translate","",1,"no-results"],[1,"bottom-right-button"],["direction","up","buttonClassName","fab-button","id","qware.component.multiaction-fab",3,"model","buttonProps","mask"],[1,"create-navigation"],[1,"raised",3,"value"],["type","button","severity","secondary","styleClass","icon-only-button p-s
7848peeddial-action",3,"text","rounded","raised","routerLink"]],template:function(o,i){if(o&1){let s=b();n(0,"div",7),e(1,` 7849 `),n(2,"div",8),e(3,` 7850 `),n(4,"h3",9),e(5,` 7851 CHECKLIST.CHECKLIST_MANAGEMENT 7852 `),a(),e(6,` 7853 `),_(7,MD,10,4),a(),e(8,` 7854 `),n(9,"div",10),e(10,` 7855 `),n(11,"div",11),e(12,` 7856 `),n(13,"p-iconfield",12),e(14,` 7857 `),n(15,"p-inputicon"),e(16,` 7858 `),n(17,"span",13),e(18,"search"),a(),e(19,` 7859 `),a(),e(20,` 7860 `),n(21,"input",14),I(22,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 7861 `),a(),e(24,` 7862 `),a(),e(25,` 7863 `),n(26,"div",15),e(27,` 7864 `),n(28,"div",16),e(29,` 7865 SHARED.LIST_VIEW 7866 `),a(),e(30,` 7867 `),n(31,"p-select",17,0),j("ngModelChange",function(u){return E(s),W(i.selectedViewOption,u)||(i.selectedViewOption=u),S(u)}),h("onChange",function(){return E(s),S(i.listViewOnChange(!0))}),e(33,` 7868 `),_(34,UD,4,0,"ng-template",null,1,A),e(36,` 7869 `),_(37,PD,4,0,"ng-template",null,2,A),e(39,` 7870 `),a(),e(40,` 7871 `),a(),e(41,` 7872 `),n(42,"div",18),e(43,` 7873 `),n(44,"p-menu",19,3),h("click",function(){E(s);let u=Ee(45);return S(u.hide())}),e(46,` 7874 `),_(47,GD,10,2,"ng-template",null,4,A),e(49,` 7875 `),a(),e(50,` 7876 `),n(51,"p-button",20),h("onClick",function(u){return E(s),Ee(45).toggle(u),S(i.isActive=!i.isActive)}),e(52,` 7877 `),n(53,"i",13),e(54,"more_vert"),a(),e(55,` 7878 `),a(),e(56,` 7879 `),a(),e(57,` 7880 `),a(),e(58,` 7881 `),n(59,"div",21),e(60,` 7882 `),n(61,"qware-spinner",22),e(62,` 7883 `),n(63,"p-table",23,5),h("onFilter",function(){return E(s),S(i.detectFilter())}),e(65,` 7884 `),_(66,qD,6,0,"ng-template",24),e(67,` 7885 `),_(68,aL,6,4,"ng-template",25),e(69,` 7886 `),_(70,lL,9,3,"ng-template",26),e(71,` 7887 `),a(),e(72,` 7888 `),a(),e(73,` 7889 `),a(),e(74,` 7890 `),_(75,mL,13,4),a(),e(76,` 7891`)}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(12),q("placeholder",y(22,21,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(10),p("options",i.listViewOptions),H("ngModel",i.selectedViewOption),l(13),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(10),p("displaySpinner",i.displaySpinner),l(2),p("columns",i.tableColumns)("value",i.tableData)("sortOrder",1)("paginator",!0)("pageLinks",3)("rows",10)("scrollable",!0),l(12),f(i.addMenuItems?75:-1))},dependencies:[Pe,Da,oe,Qe,je,Ae,se,Le,pi,mi,ye,lt,me,kt,ot,it,qa,et,ht,ji,Yi,cn,Ai,$,ie],encapsulation:2})}return r})();var cL=["selectionInput"],uL=()=>({standalone:!0});function _L(r,d){if(r&1&&(e(0,` 7892 `),n(1,"small",10),e(2,` 7893 `),n(3,"div",6),e(4),a(),e(5,` 7894 `),a(),e(6,` 7895 `)),r&2){let t=d.$implicit;l(4),v(t)}}function EL(r,d){if(r&1&&(e(0,` 7896 `),G(1,_L,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Description)}}function SL(r,d){r&1&&(e(0,` 7897 `),n(1,"span",15),e(2,"expand_more"),a(),e(3,` 7898 `))}function xL(r,d){if(r&1&&(e(0,` 7899 `),n(1,"small",10),e(2,` 7900 `),n(3,"div",6),e(4),a(),e(5,` 7901 `),a(),e(6,` 7902 `)),r&2){let t=d.$implicit;l(4),v(t)}}function fL(r,d){if(r&1&&(e(0,` 7903 `),G(1,xL,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.VerificationFieldType)}}function hL(r,d){if(r&1){let t=b();e(0,` 7904 `),n(1,"div",11),e(2,` 7905 `),n(3,"div",3),e(4,` 7906 `),n(5,"p-floatlabel"),e(6,` 7907 `),n(7,"p-select",12),h("onChange",function(i){E(t);let s=m();return S(s.typeChanged(i))}),e(8,` 7908 `),_(9,SL,4,0,"ng-template",13),e(10,` 7909 `),a(),e(11,` 7910 `),n(12,"label",14),e(13,` 7911 `),n(14,"span",6),e(15,"CHECKLIST.TASK.VERIFICATION_FIELD_TYPE"),a(),e(16,` 7912 `),n(17,"span",7),e(18," *"),a(),e(19,` 7913 `),a(),e(20,` 7914 `),a(),e(21,` 7915 `),n(22,"small",8),e(23,` 7916 `),n(24,"div",9),e(25,` 7917 CHECKLIST.TASK.ERROR.VERIFICATION_FIELD_TYPE_REQUIRED 7918 `),a(),e(26,` 7919 `),a(),e(27,` 7920 `),_(28,fL,3,0),a(),e(29,` 7921 `),a(),e(30,` 7922 `)}if(r&2){let t=m();l(7),p("tabindex",2)("autoDisplayFirst",!1)("options",t.taskVerificationFieldTypes)("fluid",!0),l(15),p("hidden",t.form.controls.VerificationFieldType.valid||t.form.controls.VerificationFieldType.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.VerificationFieldType.errors!=null&&t.form.controls.VerificationFieldType.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.VerificationFieldType&&t.form.controls.VerificationFieldType.untouched?28:-1)}}function CL(r,d){if(r&1&&(e(0,` 7923 `),n(1,"small",10),e(2,` 7924 `),n(3,"div",6),e(4),a(),e(5,` 7925 `),a(),e(6,` 7926 `)),r&2){let t=d.$implicit;l(4),v(t)}}function vL(r,d){if(r&1&&(e(0,` 7927 `),G(1,CL,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.FieldLabel)}}function gL(r,d){if(r&1&&(e(0,` 7928 `),n(1,"div",16),e(2,` 7929 `),n(3,"div",3),e(4,` 7930 `),n(5,"p-floatlabel"),e(6,` 7931 `),R(7,"input",17),e(8,` 7932 `),n(9,"label",18),e(10,` 7933 `),n(11,"span",6),e(12,"CHECKLIST.TASK.FIELD_LABEL"),a(),e(13,` 7934 `),n(14,"span",7),e(15," *"),a(),e(16,` 7935 `),a(),e(17,` 7936 `),a(),e(18,` 7937 `),n(19,"small",8),e(20,` 7938 `),n(21,"div",19),e(22,`CHECKLIST.TASK.ERROR.FIELD_LABEL_REQUIRED 7939 `),a(),e(23,` 7940 `),n(24,"div",20),e(25,`CHECKLIST.TASK.ERROR.FIELD_LABEL_LENGTH 7941 `),a(),e(26,` 7942 `),a(),e(27,` 7943 `),_(28,vL,3,0),a(),e(29,` 7944 `),a(),e(30,` 7945 `)),r&2){let t=m();l(7),p("fluid",!0)("qwareFocus",t.autoFocus),l(12),p("hidden",t.form.controls.FieldLabel.valid||t.form.controls.FieldLabel.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.FieldLabel.errors!=null&&t.form.controls.FieldLabel.errors.required)),l(3),p("hidden",!(t.form.controls.FieldLabel.errors!=null&&t.form.controls.FieldLabel.errors.maxlength)),l(4),f(t.validationErrors&&t.validationErrors.FieldLabel&&t.form.controls.FieldLabel.untouched?28:-1)}}function TL(r,d){if(r&1){let t=b();e(0,` 7946 `),n(1,"div",11),e(2,` 7947 `),n(3,"div",21),e(4,` 7948 `),n(5,"p-floatlabel"),e(6,` 7949 `),n(7,"input",22,0),j("ngModelChange",function(i){E(t);let s=m();return W(s.selectionName,i)||(s.selectionName=i),S(i)}
7949),h("keydown.enter",function(){E(t);let i=m();return S(i.addSelectionOption())}),a(),e(9,` 7950 `),n(10,"label",23),e(11,` 7951 `),n(12,"span",6),e(13,"CHECKLIST.TASK.SELECTION_NAME"),a(),e(14,` 7952 `),a(),e(15,` 7953 `),a(),e(16,` 7954 `),a(),e(17,` 7955 `),a(),e(18,` 7956 `)}if(r&2){let t=m();l(7),p("fluid",!0),H("ngModel",t.selectionName),p("ngModelOptions",ne(3,uL))}}function IL(r,d){if(r&1){let t=b();e(0,` 7957 `),n(1,"div",16),e(2,` 7958 `),n(3,"div",24),e(4,` 7959 `),n(5,"p-button",25),I(6,"translate"),h("onClick",function(){E(t);let i=m();return S(i.addSelectionOption())}),e(7,` 7960 `),a(),e(8,` 7961 `),n(9,"div",26),e(10,` 7962 `),n(11,"p-button",27),h("onClick",function(){E(t);let i=m();return S(i.sortSelectionsAlpha())}),e(12,` 7963 `),R(13,"img",28),e(14,` 7964 `),a(),e(15,` 7965 `),a(),e(16,` 7966 `),a(),e(17,` 7967 `),a(),e(18,` 7968 `)}if(r&2){let t,o=m();l(5),q("label",y(6,8,"CHECKLIST.TASK.ADD_SELECTION")),p("raised",!0)("disabled",!o.selectionName||o.selectionName===""),l(6),p("text",!0)("rounded",!0)("raised",!0)("hidden",((t=o.form.controls.Options.value==null?null:o.form.controls.Options.value.length)!==null&&t!==void 0?t:0)<2),l(2),p("src",o.sortOrder==="desc"?o.sortDe
7968scIcon:o.sortAscIcon,jt)}}function bL(r,d){if(r&1){let t=b();e(0,` 7969 `),n(1,"div"),e(2,` 7970 `),n(3,"div",31),e(4,` 7971 `),n(5,"div",32),e(6,` 7972 `),n(7,"i",33),e(8,"drag_handle"),a(),e(9,` 7973 `),a(),e(10,` 7974 `),n(11,"div",34),e(12,` 7975 `),n(13,"span"),e(14),a(),e(15,` 7976 `),n(16,"div",35),e(17,` 7977 `),n(18,"p-button",36),h("onClick",function(){let i=E(t).$index,s=m(2);return S(s.deleteSelection(i))}),e(19,` 7978 `),n(20,"i",15),e(21,"delete"),a(),e(22,` 7979 `),a(),e(23,` 7980 `),a(),e(24,` 7981 `),a(),e(25,` 7982 `),a(),e(26,` 7983 `),a(),e(27,` 7984 `)}if(r&2){let t=d.$implicit;l(14),v(t),l(4),p("rounded",!0)("text",!0)}}function yL(r,d){if(r&1&&(e(0,` 7985 `),n(1,"small",10),e(2,` 7986 `),n(3,"div",6),e(4),a(),e(5,` 7987 `),a(),e(6,` 7988 `)),r&2){let t=d.$implicit;l(4),v(t)}}function AL(r,d){if(r&1&&(e(0,` 7989 `),G(1,yL,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Options)}}function RL(r,d){if(r&1){let t=b();e(0,` 7990 `),n(1,"div",29),e(2,` 7991 `),n(3,"div",30),j("dragulaModelChange",function(i){E(t);let s=m();return W(s.selectionOptions,i)||(s.selectionOptions=i),S(i)}),e(4,` 7992 `),G(5,bL,28,3,null,null,Zi),a(),e(7,` 7993 `),n(8,"small",8),e(9,` 7994 `),n(10,"div",9),e(11,` 7995 CHECKLIST.TASK.ERROR.OPTION_REQUIRED 7996 `),a(),e(12,` 7997 `),a(),e(13,` 7998 `),_(14,AL,3,0),a(),e(15,` 7999 `)}if(r&2){let t=m();l(3),H("dragulaModel",t.selectionOptions),l(2),k(t.selectionOptions),l(3),p("hidden",t.form.controls.Options.valid||t.form.controls.Options.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Options.errors!=null&&t.form.controls.Options.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.Options&&t.form.controls.Options.untouched?14:-1)}}var Hl=(()=>{class r{dragulaService;message;taskService;translate;selectionInput;autoFocus=!0;editMode=!1;form;submitted=!1;validationErrors;textareaFocusChange=new Yt;parentSpinnerState=bn();taskVerificationFieldTypes=[];dragulaGroupName="SELECTIONOPTIONS";selectionName;selectionOptions=[];showFieldLabel=!1;showSelectionOptions=!1;sortAscIcon="../../../../../assets/icons/actions/sort_asc.svg";sortDescIcon="../../../../../assets/icons/actions/sort_desc.svg";sortOrder;dragulaSubs=new Vi;constructor(t,o,i,s){this.dragulaService=t,this.message=o,this.taskService=i,this.translate=s,this.dragulaService.createGroup(this.dragulaGroupName,{moves:(c,u,x)=>x?x.className==="drag-handle":!1}),this.dragulaSubs.add(t.drop(this.dragulaGroupName).subscribe(()=>{this.sortOrder="custom",this.form.get("Options")?.setValue(this.selectionOptions),this.markFormDirty()}))}ngOnInit(){let t=[];this.taskService.getTaskVerificationFieldTypes().pipe(we(o=>(t=o.filter(i=>i!=="UNKNOWN"&&i!=="NONE"),t.unshift("NONE"),this.translate.get(t.map(i=>"CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+i)).pipe(N())))).subscribe(o=>{let i=o;t&&t.length>0&&(this.taskVerificationFieldTypes=t.map(u=>({label:i["CHECKLIST.TASK.VERIFICATION_FIELD_TYPES."+u],value:u})));let s=this.form.get("VerificationFieldType")?.value;s&&this.typeChanged({originalEvent:new Event("click"),value:s});let c=this.form.get("Options")?.value;c&&c.length>0&&(this.selectionOptions=c),this.parentSpinnerState.set(!1)})}ngOnDestroy(){this.dragulaService.destroy("SELECTIONOPTIONS"),this.dragulaSubs&&!this.dragulaSubs.closed&&this.dragulaSubs.unsubscribe()}typeChanged(t){this.showSelectionOptions=t.value==="SINGLE_SELECT"||t.value==="MULTIPLE_SELECT",this.showFieldLabel=t.value!=="NONE",this.selectionName="";let o=this.form.get("FieldLabel");o&&(o.setValidators(this.showFieldLabel?T.required:[]),o.updateValueAndValidity());let i=this.form.get("Options");i&&(i.setValidators(this.showSelectionOptions?T.required:[]),this.editMode||(i?.setValue([]),this.selectionOptions=[]),i.updateValueAndValidity())}addSelectionOption(){this.sortOrder="custom",this.selectionName&&(this.selectionOptions.indexOf(this.selectionName)>-1?this.translate.get(["SHARED.ERROR_LABEL","CHECKLIST.TASK.ERROR.DUPLICATE_OPTION"]).pipe(N()).subscribe(t=>{this.message.warnTimeout(t["SHARED.ERROR_LABEL"],t["CHECKLIST.TASK.ERROR.DUPLICATE_OPTION"])}):this.selectionName.length>255?this.translate.get(["SHARED.ERROR_LABEL","CHECKLIST.TASK.ERROR.OPTION_LENGTH"]).pipe(N()).subscribe(t=>{this.message.warnTimeout(t["SHARED.ERROR_LABEL"],t["CHECKLIST.TASK.ERROR.OPTION_LENGTH"])}):(this.selectionOptions.push(this.selectionName),this.form.get("Options")?.setValue(this.selectionOptions),this.selectionName=void 0,this.selectionInput.nativeElement.focus(),this.markFormDirty()))}sortSelectionsAlpha(){let t=this.form.get("Options");
7999if(t){let o=[];this.sortOrder==="asc"?(this.sortOrder="desc",o=t.value.sort((i,s)=>i.localeCompare(s)).reverse()):(this.sortOrder="asc",o=t.value.sort((i,s)=>i.localeCompare(s))),t.setValue(o),this.selectionOptions=o,this.markFormDirty()}}deleteSelection(t){this.sortOrder="custom",this.selectionOptions.splice(t,1),this.form.get("Options")?.setValue(this.selectionOptions),this.markFormDirty()}textareaFocus(t){this.textareaFocusChange.emit(t)}markFormDirty(){this.form.markAsDirty(),this.form.markAsTouched()}static \u0275fac=function(o){return new(o||r)(g(Dn),g(Se),g(Pn),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-task-details"]],viewQuery:function(o,i){if(o&1&&X(cL,5),o&2){let s;Y(s=Q())&&(i.selectionInput=s.first)}},inputs:{autoFocus:"autoFocus",editMode:"editMode",form:"form",submitted:"submitted",validationErrors:"validationErrors",parentSpinnerState:[1,"parentSpinnerState"]},outputs:{textareaFocusChange:"textareaFocusChange",parentSpinnerState:"parentSpinnerStateChange"},standalone:!1,decls:42,vars:14,consts:[["selectionInput",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-12","md:col-12","field-container"],[1,"medium-input"],["tabindex","1","id","qware.task.details.textarea.description","pTextarea","","variant","filled","formControlName","Description",1,"text-box",3,"focus","blur","rows","fluid","cols","autoResize"],["id","qware.custom-field.details.label.description","for","qware.task.details.textarea.description"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"validation-error"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],["inputId","qware.task.details.dropdown.verification-field-type","formControlName","VerificationFieldType","variant","filled","id","qware.task.details.dropdown.verification-field-type-e2e",3,"onChange","tabindex","autoDisplayFirst","options","fluid"],["pTemplate","dropdownicon"],["id","qware.custom-field.details.label.field-type","for","qware.task.details.dropdown.verification-field-type"],[1,"material-icons"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.task.details.input.field-label","tabindex","3","type","text","pInputText","","name","FieldLabel","formControlName","FieldLabel","variant","filled",3,"fluid","qwareFocus"],["id","qware.task.details.label.field-label","for","qware.task.details.input.field-label"],["id","qware.task.details.error.field-label-req","translate","",3,"hidden"],["id","qware.task.details.error.field-label-length","translate","",3,"hidden"],[1,"medium-input",2,"margin-bottom","0"],["id","qware.task.details.input.selection-name","tabindex","4","type","text","pInputText","","name","Selection Name","variant","filled",3,"ngModelChange","keydown.enter","fluid","ngModel","ngModelOptions"],["id","qware.task.details.label.selection-name","for","qware.task.details.input.selection-name"],[1,"add-selection-container","flex-inline","flex-space-between"],["tabindex","5","id","qware.task.button.add","type","button",3,"onClick","raised","label","disabled"],[1,"sort-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded","raised","hidden"],[3,"src"],[1,"col-12","selection-options"],["dragula","SELECTIONOPTIONS",3,"dragulaModelChange","dragulaModel"],[1,"selection-option"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline","flex-space-between"],[1,"delete-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"]],template:function(o,i){o&1&&(n(0,"div",1),e(1,` 8000 `),e(2,` 8001 `),n(3,"div",2),e(4,` 8002 `),n(5,"div",3),e(6,` 8003 `),n(7,"p-floatlabel"),e(8,` 8004 `),n(9,"textarea",4),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(10," "),a(),e(11,` 8005 `),n(12,"label",5),e(13,` 8006 `),n(14,"span",6),e(15,"CHECKLIST.TASK.DESCRIPTION"),a(),e(16,` 8007 `),n(17,"span",7),e(18," *"),a(),e(19,` 8008 `),a(),e(20,` 8009 `),a(),e(21,` 8010 `),n(22,"small",8),e(23,` 8011 `),n(24,"div",9),e(25,` 8012 CHECKLIST.TASK.ERROR.DESCRIPTION_REQUIRED 8013 `),a(),e(26,` 8014 `),n(27,"div",9),e(28,` 8015 CHECKLIST.TASK.ERROR.DESCRIPTION_LENGTH 8016 `),a(),e(29,` 8017 `),a(),e(30,` 8018 `),_(31,EL,3,0),a(),e(32,` 8019 `),a(),e(33,` 8020 `),e(34,`
8021 8022 `),e(35,` 8023 `),_(36,hL,31,7)(37,gL,31,6)(38,TL,19,4)(39,IL,19,10)(40,RL,16,4),a(),e(41,` 8024`)),o&2&&(p("formGroup",i.form),l(9),p("rows",0)("fluid",!0)("cols",30)("autoResize",!0),l(13),p("hidden",i.form.controls.Description.valid||i.form.controls.Description.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Description.errors!=null&&i.form.controls.Description.errors.required)),l(3),p("hidden",!(i.form.controls.Description.errors!=null&&i.form.controls.Description.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Description&&i.form.controls.Description.untouched?31:-1),l(5),f(i.taskVerificationFieldTypes&&i.taskVerificationFieldTypes.length>0?36:-1),l(),f(i.showFieldLabel?37:-1),l(),f(i.showSelectionOptions?38:-1),l(),f(i.showSelectionOptions?39:-1),l(),f(i.showSelectionOptions?40:-1))},dependencies:[Pe,oe,pn,Ne,je,Ae,se,ge,Le,ye,Te,De,it,ri,$,ie],styles:[`qware-task-details .text-box{min-height:93px!important}qware-task-details .add-selection-container{margin:0 1rem}qware-task-details .delete-button{margin-top:-.75rem;pointer-events:none;flex:1 1 auto}qware-task-details .delete-button button{float:right;pointer-events:initial}qware-task-details .selection-options{padding:.5rem 1.5rem}qware-task-details .selection-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}body>.gu-mirror .selection-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:#fff}body>.gu-mirror .delete-button{margin-top:-.75rem;pointer-events:none;flex:1 1 auto}body>.gu-mirror .delete-button button{float:right;pointer-events:initial}.warning-icon{vertical-align:middle} 8025`],encapsulation:2})}return r})();var Pm=(()=>{class r{authService;fb;responseService;route;router;taskService;toastService;translate;displaySpinner=!1;isLoaded=!1;submitted=!1;taskForm;textareaFocused=!1;validationErrors;constructor(t,o,i,s,c,u,x,C){this.authService=t,this.fb=o,this.responseService=i,this.route=s,this.router=c,this.taskService=u,this.toastService=x,this.translate=C}ngOnInit(){this.taskForm=this.fb.group({Description:this.fb.control("",[T.required,T.maxLength(ft)]),VerificationFieldType:this.fb.control(null,T.required),FieldLabel:this.fb.control("",[T.maxLength(re)]),Options:this.fb.control([])})}isDirty(){return this.taskForm.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllTasks"),this.router.navigate(["../../"+P.checklist+"/"+P.list],t)}saveForm(){if(!this.submitted)if(this.taskForm.valid){let t=this.taskForm.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.CreatedByUserId=this.authService.currentUserId,t.
8025UpdatedByUserId=this.authService.currentUserId,t.State=M.ACTIVE,this.taskService.createOrUpdateTask(t).subscribe({next:()=>{localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllTasks"),this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.CREATE","../../"+P.checklist+"/"+P.list,this.route,{description:t.Description})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.taskForm)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t.get("SHARED.ERROR_LABEL"),t.get("SHARED.ERROR.FAILED_VALIDATION"))})}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(de),g(be),g(Re),g(he),g(Be),g(Pn),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-task-create"]],standalone:!1,decls:29,vars:13,consts:[[1,"col-12",3,"keydown.enter"],["id","qware.task.create.spinner",3,"displaySpinner"],[1,"form-container"],["translate","","id","qware.task.create.page-header",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors"],[1,"flex-inline","align-right","action-bar",2,"margin-top","0.5rem"],["tabindex","1000","id","qware.task.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.task.general.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"]],template:function(o,i){o&1&&(n(0,"div",0),h("keydown.enter",function(){return i.textareaFocused?void 0:i.saveForm()}),e(1,` 8026 `),n(2,"qware-spinner",1),e(3,` 8027 `),n(4,"div",2),e(5,` 8028 `),n(6,"h3",3),e(7,` 8029 CHECKLIST.TASK.CREATE_TASK 8030 `),a(),e(8,` 8031 `),n(9,"p-card"),e(10,` 8032 `),n(11,"qware-task-details",4),h("textareaFocusChange",function(c){return i.updateTextAreaFocus(c)}),e(12,` 8033 `),a(),e(13,` 8034 `),n(14,"div",5),e(15,` 8035 `),n(16,"p-button",6),I(17,"translate"),h("onClick",function(){return i.goBack()}),e(18,` 8036 `),a(),e(19,` 8037 `),n(20,"p-button",7),I(21,"translate"),h("onClick",function(){return i.saveForm()})("keydown.enter",function(c){return c.preventDefault()}),e(22,` 8038 `),a(),e(23,` 8039 `),a(),e(24,` 8040 `),a(),e(25,` 8041 `),a(),e(26,` 8042 `),a(),e(27,` 8043`),a(),e(28,` 8044`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(9),p("form",i.taskForm)("submitted",i.submitted)("validationErrors",i.validationErrors),l(5),q("label",y(17,9,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(21,11,"SHARED.SAVE")),p("text",!0)("disabled",!i.taskForm.valid||!i.taskForm.dirty))},dependencies:[oe,Ie,me,$,Hl,ie],encapsulation:2})}return r})();var ed=He(nt());var wL=["actionsMenu"],DL=["drawer"],LL=r=>({"lg:col-8":r});function NL(r,d){if(r&1&&(e(0,` 8045 `),n(1,"a",19),e(2,` 8046 `),n(3,"span",20),e(4),a(),e(5,` 8047 `),n(6,"span",21),e(7),a(),e(8,` 8048 `),a(),e(9,` 8049 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function OL(r,d){r&1&&(e(0,` 8050 `),n(1,"span",23),e(2,"SHARED.ACTIONS"),a(),e(3,` 8051 `),n(4,"i",24),e(5,"expand_more"),a(),e(6,` 8052 `))}function FL(r,d){if(r&1){let t=b();e(0,` 8053 `),n(1,"p-button",22),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 8054 `),_(3,OL,7,0,"ng-template",null,3,A),e(5,` 8055 `),a(),e(6,` 8056 `)}r&2&&(l(),p("raised",!0))}function ML(r,d){if(r&1&&(e(0,` 8057 `),n(1,"a",19),e(2,` 8058 `),n(3,"span",20),e(4),a(),e(5,` 8059 `),n(6,"span",21),e(7),a(),e(8,` 8060 `),a(),e(9,` 8061 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function UL(r,d){if(r&1){let t=b();e(0,` 8062 `),n(1,"div",25),e(2,` 8063 `),n(3,"p-menu",26,4),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 8064 `),_(6,ML,10,2,"ng-template",null,1,A),e(8,` 8065 `),a(),e(9,` 8066 `),n(10,"p-button",27),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 8067 `),n(12,"i",24),e(13,"more_vert"),a(),e(14,` 8068 `),a(),e(15,` 8069 `),a(),e(16,` 8070 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function PL(r,d){if(r&1){let t=b();e(0,`
8071 `),n(1,"qware-task-details",28),j("parentSpinnerStateChange",function(i){E(t);let s=m();return W(s.displaySpinner,i)||(s.displaySpinner=i),S(i)}),e(2,` 8072 `),a(),e(3,` 8073 `)}if(r&2){let t=m();l(),p("form",t.taskForm)("submitted",t.submitted)("autoFocus",!1)("validationErrors",t.validationErrors)("editMode",!0),H("parentSpinnerState",t.displaySpinner)}}function GL(r,d){r&1&&(e(0,` 8074 `),n(1,"div",31),e(2,` 8075 `),n(3,"span",32),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 8076 `),a(),e(6,` 8077 `))}function kL(r,d){if(r&1){let t=b();e(0,` 8078 `),n(1,"qware-spinner",33),e(2,` 8079 `),n(3,"div",34),e(4,` 8080 `),n(5,"qware-entity-history",35),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 8081 `),a(),e(7,` 8082 `),a(),e(8,` 8083 `),a(),e(9,` 8084 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function VL(r,d){if(r&1){let t=b();e(0,` 8085 `),n(1,"div",29),e(2,` 8086 `),n(3,"p-drawer",30,5),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 8087 `),_(6,GL,7,0,"ng-template",null,6,A),e(8,` 8088 `),_(9,kL,10,7,"ng-template",null,3,A),e(11,` 8089 `),a(),e(12,` 8090 `),a(),e(13,` 8091 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var Gm=(()=>{class r{authService;confirmationService;fb;responseService;route;router;taskService;toastService;translate;actionsMenu;drawer;displayDrawerSpinner=D(!1);actionItems=[];displaySpinner=!0;task;taskForm;historyArrayProperties=["Options"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;isLoaded=!1;moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;validationErrors;auditLoggingDisabled=!0;canRestoreDeleted=!1;taskListRoute="../../../"+P.checklist+"/"+P.list;translations={};constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.confirmationService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.taskService=x,this.toastService=C,this.translate=O,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.canRestoreDeleted=this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.TASK"]).pipe(N()),this.taskService.getTask(this.authService.tenant.Id,this.route.snapshot.params.id)]).subscribe({next:t=>{this.translations=t[0],this.task=t[1],this.taskForm.patchValue(ed.default.cloneDeep(this.task)),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let o=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableTask()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableTask()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteTask()}];this.task?.State===M.DELETED&&this.canRestoreDeleted&&o.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreTask()}),this.actionItems=o.filter(i=>this.task?.State===M.DISABLED?i.id!=="disable.action":this.task?.State===M.DELETED?i.id!=="disable.action"&&i.id!=="enable.action"&&i.id!=="delete.action":i.id!=="enable.action"),this.setHistoryParams(),this.task?.State==="DELETED"&&this.taskForm.disable(),this.isLoaded=!0},error:t=>{this.responseService.onDataError(t,this.taskListRoute,this.route)}})}createForm(){this.taskForm=this.fb.group({Description:this.fb.control("",[T.required,T.maxLength(ft)]),VerificationFieldType:this.fb.control({value:null,disabled:!0},T.required),FieldLabel:this.fb.control("",[T.maxLength(re)]),Options:this.fb.control([])})}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.TASK"]+' "'+this.task?.Description+'"',this.historyIdMap=new Map;let t=new Map;t.set("Description","CHECKLIST.TASK.DESCRIPTION"),this.historyNameMap=t}isDirty(){return this.taskForm.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllTasks"),this.router.navigate([this.taskListRoute],t)}save(){if(!this.submitted)if(this.taskForm.valid){let t=this.taskForm.value;this.submitted=!0,this.displaySpinner=!0,t.TenantId=this.authService.tenant.Id,t.State=this.task?.State??M.ACTIVE,t.Id=this.task?.Id,t.VerificationFieldType=this.task?.VerificationFieldType,t.CreatedByUserId=this.task?.CreatedByUserId,t.CreatedDateUTC=this.task?.CreatedDateUTC,t.
8091UpdatedByUserId=this.authService.currentUserId,t.UpdatedDateUTC=new Date,this.taskService.createOrUpdateTask(t).subscribe({next:()=>{localStorage.setItem(Oe.CHECKLIST_LIST_VIEW_STORAGE_KEY,"AllTasks"),this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.SAVE",this.taskListRoute,this.route,{description:t.Description})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.taskForm)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableTask(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.task?.Description}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.task&&(this.displaySpinner=!0,this.submitted=!0,this.task.State=M.DISABLED,this.taskService.createOrUpdateTask(this.task).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.DISABLE",this.taskListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableTask(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.task?.Description}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.task&&(this.displaySpinner=!0,this.submitted=!0,this.task.State=M.ACTIVE,this.taskService.createOrUpdateTask(this.task).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.ENABLE",this.taskListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteTask(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.task?.Description}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.task&&(this.displaySpinner=!0,this.submitted=!0,this.task.State=M.DELETED,this.taskService.createOrUpdateTask(this.task).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.DELETE",this.taskListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreTask(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.task?.Description}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.task&&(this.displaySpinner=!0,this.submitted=!0,this.task.State=M.ACTIVE,this.taskService.createOrUpdateTask(this.task).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("CHECKLIST.TASK.SUCCESS.RESTORE",this.taskListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=ed.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(de),g(mt),g(be),g(Re),g(he),g(Be),g(Pn),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-task-edit"]],viewQuery:function(o,i){if(o&1&&(X(wL,7),X(DL,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:50,vars:20,consts:[["actionsMenu",""],["item",""],["spinner",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.task.edit",1,"grid"],["id","qware.task.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.task.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.task.edit.edit.actions-menu",3,"model","popup"],["id","qware.task.edit.spinner",3,"displaySpinner"],[1,"custom-field-form"],[3,"lockEditing"],[1,"flex-inline","align-right","action-bar",2,"margin-top","0.5rem"],["tabindex","1000","type","button","severity","secondary","id","qware.task.edit.button.cancel",3,"click","text","label"],["tabindex","999","type","button","id","qware.task.edit.button.save",3,"click","text","disabled","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.task.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.task.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[3,"parentSpinnerStateChange","form","submitted","autoFocus","validationErrors","editMode","parentSpinnerState"],["id","qware.task.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.task.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.task.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","task",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",7),e(1,` 8092 `),n(2,"div",8),e(3,`
8093 `),n(4,"div",9),e(5,` 8094 `),n(6,"h3",10),e(7,` 8095 CHECKLIST.TASK.EDIT_TASK 8096 `),a(),e(8,` 8097 `),n(9,"div",11),e(10,` 8098 `),n(11,"p-menu",12,0),e(13,` 8099 `),_(14,NL,10,2,"ng-template",null,1,A),e(16,` 8100 `),a(),e(17,` 8101 `),_(18,FL,7,1),a(),e(19,` 8102 `),_(20,UL,17,4),a(),e(21,` 8103 `),n(22,"qware-spinner",13,2),e(24,` 8104 `),n(25,"p-card"),e(26,` 8105 `),n(27,"div",14),e(28,` 8106 `),n(29,"qware-edit-lock",15),e(30,` 8107 `),_(31,PL,4,6),a(),e(32,` 8108 `),a(),e(33,` 8109 `),n(34,"div",16),e(35,` 8110 `),n(36,"p-button",17),I(37,"translate"),h("click",function(){return E(s),S(i.goBack())}),e(38,` 8111 `),a(),e(39,` 8112 `),n(40,"p-button",18),I(41,"translate"),h("click",function(){return E(s),S(i.save())}),e(42,` 8113 `),a(),e(43,` 8114 `),a(),e(44,` 8115 `),a(),e(45,` 8116 `),a(),e(46,` 8117 `),a(),e(47,` 8118 `),_(48,VL,14,6),a(),e(49,` 8119`)}o&2&&(l(2),p("ngClass",pe(18,LL,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(7),p("lockEditing",i.task!==void 0&&i.task.State==="DELETED"),l(2),f(i.isLoaded?31:-1),l(5),q("label",y(37,14,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(41,16,"SHARED.SAVE")),p("text",!0)("disabled",!i.taskForm.dirty||!i.taskForm.valid),l(8),f(i.auditLoggingDisabled?-1:48))},dependencies:[oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,$,Hl,ie],encapsulation:2})}return r})();var Wl=(()=>{class r{form;submitted=!1;validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-tenant-addons"]],inputs:{form:"form",submitted:"submitted",validationErrors:"validationErrors"},standalone:!1,decls:27,vars:5,consts:[[1,"grid",3,"formGroup"],[1,"col-12"],["id","qware.tenant.create.module.events",1,"medium-input","flex-inline","flex-space-between"],["translate",""],["id","qware.tenant.create.module.checkbox.events"],["name","EventsModule","formControlName","EventsModule",3,"tabindex","binary"],["id","qware.tenant.create.module.gis",1,"medium-input","flex-inline","flex-space-between"],["id","qware.tenant.create.module.checkbox.gis"],["name","GisModule","formControlName","GisModule",3,"tabindex","binary"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 8120 `),n(2,"div",1),e(3,` 8121 `),n(4,"div",2),e(5,` 8122 `),n(6,"label",3),e(7,"MODULES.EVENTS"),a(),e(8,` 8123 `),n(9,"span",4),e(10,` 8124 `),R(11,"p-checkbox",5),e(12,` 8125 `),a(),e(13,` 8126 `),a(),e(14,` 8127 `),n(15,"div",6),e(16,` 8128 `),n(17,"label",3),e(18,"MODULES.GIS"),a(),e(19,` 8129 `),n(20,"span",7),e(21,` 8130 `),R(22,"p-checkbox",8),e(23,` 8131 `),a(),e(24,` 8132 `),a(),e(25,` 8133 `),a(),e(26,` 8134`),a()),o&2&&(p("formGroup",i.form),l(11),p("tabindex",7)("binary",!0),l(11),p("tabindex",8)("binary",!0))},dependencies:[yt,se,ge,Te,De,$],encapsulation:2})}return r})();function qL(r,d){if(r&1&&(e(0,` 8135 `),n(1,"small",18),e(2,` 8136 `),n(3,"div",6),e(4),a(),e(5,` 8137 `),a(),e(6,` 8138 `)),r&2){let t=d.$implicit;l(4),v(t)}}function BL(r,d){if(r&1&&(e(0,` 8139 `),G(1,qL,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Name)}}function HL(r,d){if(r&1&&(e(0,` 8140 `),n(1,"small",18),e(2,` 8141 `),n(3,"div",6),e(4),a(),e(5,` 8142 `),a(),e(6,` 8143 `)),r&2){let t=d.$implicit;l(4),v(t)}}function WL(r,d){if(r&1&&(e(0,` 8144 `),G(1,HL,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Key)}}var jl=(()=>{class r{autoFocus=!0;form;submitted=!1;validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-tenant-details"]],inputs:{autoFocus:"autoFocus",form:"form",submitted:"submitted",validationErrors:"validationErrors"},standalone:!1,decls:63,vars:13,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.tenant.create.input.name"],["tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"fluid","qwareFocus"],["id","qware.tenant.create.label.name","for","qware.tenant.create.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.tenant.create.input.name.error.required","translate","",3,"hidden"],["id","qware.tenant.create.input.name.error.length","translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.tenant.create.input.ke
8144y"],["tabindex","2","type","text","pInputText","","name","Key","formControlName","Key","variant","filled",3,"fluid"],["id","qware.tenant.create.label.key","for","qware.tenant.create.input.key"],["id","qware.tenant.create.input.key.error.required","translate","",3,"hidden"],["id","qware.tenant.create.input.key.error.length","translate","",3,"hidden"],["id","qware.tenant.create.input.key.error.invalid","translate","",3,"hidden"],[1,"validation-error"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 8145 `),n(2,"div",1),e(3,` 8146 `),n(4,"div",2),e(5,` 8147 `),n(6,"p-floatlabel",3),e(7,` 8148 `),R(8,"input",4),e(9,` 8149 `),n(10,"label",5),e(11,` 8150 `),n(12,"span",6),e(13,"TENANT.NAME"),a(),n(14,"span",7),e(15," *"),a(),e(16,` 8151 `),a(),e(17,` 8152 `),a(),e(18,` 8153 `),n(19,"small",8),e(20,` 8154 `),n(21,"div",9),e(22,` 8155 TENANT.ERROR.NAME_REQUIRED 8156 `),a(),e(23,` 8157 `),n(24,"div",10),e(25,` 8158 TENANT.ERROR.NAME_LENGTH 8159 `),a(),e(26,` 8160 `),a(),e(27,` 8161 `),_(28,BL,3,0),a(),e(29,` 8162 `),a(),e(30,` 8163 `),n(31,"div",11),e(32,` 8164 `),n(33,"div",2),e(34,` 8165 `),n(35,"p-floatlabel",12),e(36,` 8166 `),R(37,"input",13),e(38,` 8167 `),n(39,"label",14),e(40,` 8168 `),n(41,"span",6),e(42,"TENANT.KEY"),a(),n(43,"span",7),e(44," *"),a(),e(45,` 8169 `),a(),e(46,` 8170 `),a(),e(47,` 8171 `),n(48,"small",8),e(49,` 8172 `),n(50,"div",15),e(51,` 8173 TENANT.ERROR.KEY_REQUIRED 8174 `),a(),e(52,` 8175 `),n(53,"div",16),e(54,` 8176 TENANT.ERROR.KEY_LENGTH 8177 `),a(),e(55,` 8178 `),n(56,"div",17),e(57,` 8179 TENANT.ERROR.KEY_ALPHA 8180 `),a(),e(58,` 8181 `),a(),e(59,` 8182 `),_(60,WL,3,0),a(),e(61,` 8183 `),a(),e(62,` 8184`),a()),o&2&&(p("formGroup",i.form),l(8),p("fluid",!0)("qwareFocus",i.autoFocus),l(11),p("hidden",i.form.controls.Name.valid||i.form.controls.Name.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.required)),l(3),p("hidden",!(i.form.controls.Name.errors!=null&&i.form.controls.Name.errors.maxlength)),l(4),f(i.validationErrors&&i.validationErrors.Name&&i.form.controls.Name.untouched?28:-1),l(9),p("fluid",!0),l(11),p("hidden",i.form.controls.Key.valid||i.form.controls.Key.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.Key.errors!=null&&i.form.controls.Key.errors.required)),l(3),p("hidden",!(i.form.controls.Key.errors!=null&&i.form.controls.Key.errors.minlength)&&!(i.form.controls.Key.errors!=null&&i.form.controls.Key.errors.maxlength)),l(3),p("hidden",!(i.form.controls.Key.errors!=null&&i.form.controls.Key.errors.pattern)),l(4),f(i.validationErrors&&i.validationErrors.Key&&i.form.controls.Key.untouched?60:-1))},dependencies:[Ne,je,Ae,se,ge,ye,Te,De,$],encapsulation:2})}return r})();function jL(r,d){r&1&&(e(0,` 8185 `),n(1,"span",13),e(2,"expand_more"),a(),e(3,` 8186 `))}function YL(r,d){if(r&1&&(e(0,` 8187 `),n(1,"small",14),e(2,` 8188 `),n(3,"div",7),e(4),a(),e(5,` 8189 `),a(),e(6,` 8190 `)),r&2){let t=d.$implicit;l(4),v(t)}}function QL(r,d){if(r&1&&(e(0,` 8191 `),G(1,YL,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Subscription)}}function KL(r,d){r&1&&(e(0,` 8192 `),n(1,"span",13),e(2,"expand_more"),a(),e(3,` 8193 `))}function $L(r,d){if(r&1&&(e(0,` 8194 `),n(1,"small",14),e(2,` 8195 `),n(3,"div",7),e(4),a(),e(5,` 8196 `),a(),e(6,` 8197 `)),r&2){let t=d.$implicit;l(4),v(t)}}function zL(r,d){if(r&1&&(e(0,` 8198 `),G(1,$L,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.BillFrequency)}}function XL(r,d){r&1&&(e(0,` 8199 `),n(1,"span",13),e(2,"event"),a(),e(3,` 8200 `))}function ZL(r,d){if(r&1&&(e(0,` 8201 `),n(1,"small",14),e(2,` 8202 `),n(3,"div",7),e(4),a(),e(5,` 8203 `),a(),e(6,` 8204 `)),r&2){let t=d.$implicit;l(4),v(t)}}function JL(r,d){if(r&1&&(e(0,` 8205 `),G(1,ZL,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.BillingDateUTC)}}var Yl=(()=>{class r{autoFocus=!0;form;freqOptions=[];submitted=!1;subOptions=[];validationErrors;static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-tenant-subscription"]],inputs:{autoFocus:"autoFocus",form:"form",freqOptions:"freqOptions",submitted:"submitted",subOptions:"subOptions",validationErrors:"validationErrors"},standalone:!1,decls:71,vars:14,consts:[["dropdownicon",""],["triggericon",""],[1,"grid",3,"formGroup"],[1,"col-12"],[1,"medium-input"],["inputId","qware.tenant.subscription.dropdown.sub","formControlName","Subscription","variant","filled","id","qware.tenant.subscription.dropdown.sub-e2e",3,"tabindex","options","fluid"],["id","qware.tenant.subscription.label.sub","for","qware.tenant.subscription.dropdown.sub"],["translate",""],[1,"required-mark"],["inputId","qware.tenant.subscription.dropdown.bill-freq","formControlName","BillFrequency","variant","filled","id","qware.tenant.subscription.dropdown.bill-freq-e2e",3,"tabindex","options","fluid"],["id","qware.tenant.subscription.label.bill-freq","for","qware.tenant.subscription.dropdown.bill-freq"],["id","qware.tenant.subscription.calendar.bill-date-e2e","inputId","qware.tenant.subscription.calendar.bill-date","formControlName","BillingDateUTC","variant","filled",1,"is-filled",3,"tabindex","showIcon","showButtonBar","fluid"],["id","qware.tenant.subscription.label.bill-date","for","qware.tenant.subscription.calendar.bill-date"],[1,"material-icons"],[1,"validation-error"]],template:function(o,i){o&1&&(n(0,"div",2),e(1,` 8206 `),n(2,"div",3),e(3,`
8207 `),n(4,"div",4),e(5,` 8208 `),n(6,"p-floatlabel"),e(7,` 8209 `),n(8,"p-select",5),e(9,` 8210 `),_(10,jL,4,0,"ng-template",null,0,A),e(12,` 8211 `),a(),e(13,` 8212 `),n(14,"label",6),e(15,` 8213 `),n(16,"span",7),e(17,"TENANT.SUBSCRIPTION"),a(),e(18,` 8214 `),n(19,"span",8),e(20," *"),a(),e(21,` 8215 `),a(),e(22,` 8216 `),a(),e(23,` 8217 `),_(24,QL,3,0),a(),e(25,` 8218 `),n(26,"div",4),e(27,` 8219 `),n(28,"p-floatlabel"),e(29,` 8220 `),n(30,"p-select",9),e(31,` 8221 `),_(32,KL,4,0,"ng-template",null,0,A),e(34,` 8222 `),a(),e(35,` 8223 `),n(36,"label",10),e(37,` 8224 `),n(38,"span",7),e(39,"TENANT.BILLING.BILLING_FREQUENCY"),a(),e(40,` 8225 `),n(41,"span",8),e(42," *"),a(),e(43,` 8226 `),a(),e(44,` 8227 `),a(),e(45,` 8228 `),_(46,zL,3,0),a(),e(47,` 8229 `),n(48,"div",4),e(49,` 8230 `),n(50,"p-floatlabel"),e(51,` 8231 `),n(52,"p-datepicker",11),e(53,` 8232 `),_(54,XL,4,0,"ng-template",null,1,A),e(56,` 8233 `),a(),e(57,` 8234 `),n(58,"label",12),e(59,` 8235 `),n(60,"span",7),e(61,"TENANT.BILLING.BILLING_DATE"),a(),e(62,` 8236 `),n(63,"span",8),e(64," *"),a(),e(65,` 8237 `),a(),e(66,` 8238 `),a(),e(67,` 8239 `),_(68,JL,3,0),a(),e(69,` 8240 `),a(),e(70,` 8241`),a()),o&2&&(p("formGroup",i.form),l(8),p("tabindex",3)("options",i.subOptions)("fluid",!0),l(16),f(i.validationErrors&&i.validationErrors.Subscription&&i.form.controls.Subscription.untouched?24:-1),l(6),p("tabindex",4)("options",i.freqOptions)("fluid",!0),l(16),f(i.validationErrors&&i.validationErrors.BillFrequency&&i.form.controls.BillFrequency.untouched?46:-1),l(6),p("tabindex",5)("showIcon",!0)("showButtonBar",!0)("fluid",!0),l(16),f(i.validationErrors&&i.validationErrors.BillingDateUTC&&i.form.controls.BillingDateUTC.untouched?68:-1))},dependencies:[Jn,Ne,se,ge,Te,De,it,$],encapsulation:2})}return r})();function eN(r,d){if(r&1){let t=b();e(0,` 8242 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8243 `),n(3,"span",17),e(4),a(),e(5,` 8244 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8245 `),a(),e(10,` 8246 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANT.DETAILS"))}}function tN(r,d){if(r&1){let t=b();e(0,` 8247 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8248 `),n(3,"span",17),e(4),a(),e(5,` 8249 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8250 `),a(),e(10,` 8251 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANT.SUBSCRIPTION"))}}function iN(r,d){if(r&1){let t=b();e(0,` 8252 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8253 `),n(3,"span",17),e(4),a(),e(5,` 8254 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8255 `),a(),e(10,` 8256 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANT.ADD_ONS"))}}function nN(r,d){if(r&1){let t=b();e(0,` 8257 `),n(1,"div",3),e(2,` 8258 `),n(3,"h3",4),e(4,` 8259 TENANT.CREATE_TENANT 8260 `),a(),e(5,` 8261 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 8262 `),n(8,"p-step-list"),e(9,` 8263 `),n(10,"p-step",6),e(11,` 8264 `),_(12,eN,11,4,"ng-template",null,0,A),e(14,` 8265 `),a(),e(15,` 8266 `),n(16,"p-step",6),e(17,` 8267 `),_(18,tN,11,4,"ng-template",null,0,A),e(20,` 8268 `),a(),e(21,` 8269 `),n(22,"p-step",6),e(23,` 8270 `),_(24,iN,11,4,"ng-template",null,0,A),e(26,` 8271 `),a(),e(27,` 8272 `),a(),e(28,` 8273 `),n(29,"p-step-panels"),e(30,` 8274 `),n(31,"p-card"),e(32,` 8275 `),n(33,"div",7),e(34,` 8276 `),n(35,"h4",8),e(36,` 8277 TENANT.DETAILS 8278 `),a(),e(37,` 8279 `),R(38,"qware-tenant-details",9),e(39,` 8280 `),a(),e(40,` 8281 `),n(41,"div",7),e(42,` 8282 `),n(43,"h4",10),e(44,` 8283 TENANT.SUBSCRIPTION 8284 `),a(),e(45,` 8285 `),n(46,"qware-tenant-subscription",11),e(47,` 8286 `),a(),e(48,` 8287 `),a(),e(49,` 8288 `),n(50,"div",7),e(51,` 8289 `),n(52,"h4",12),e(53,` 8290 TENANT.ADD_ONS 8291 `),a(),e(54,` 8292 `),R(55,"qware-tenant-addons",9),e(56,` 8293 `),a(),e(57,` 8294 `),n(58,"div",13),e(59,` 8295 `),n(60,"p-button",14),I(61,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(62,` 8296 `),a(),e(63,` 8297 `),n(64,"p-button",15),I(65,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(66,` 8298 `),a(),e(67,` 8299 `),a(),e(68,` 8300 `),a(),e(69,` 8301 `),a(),e(70,` 8302 `),a(),e(71,` 8303 `),a(),e(72,` 8304 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1),l(6),ve("p-disabled",t.stepIndex<2),p("value",2),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.Details)("submitted",t.submitted)("validationErrors",t.validationErrors),l(3),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.Subscription)("submitted",t.submitted)("validationErrors",t.validationErrors)("subOptions",t.subOptions)("freqOptions",t.billingFrequencyOptions),l(4),p("hidden",t.stepIndex!==2),l(5),p("form",t.form.controls.AddOns)("submitted",t.submitted)("validationErrors",t.validationErrors),l(5),q("label",y(61,27,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(65,29,t.stepIndex===2?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.stepFormGroups[t.stepIndex]!=null&&t.stepFormGroups[t.stepIndex].valid))}}var Bm=(()=>
8304{class r{appSettingsService;fb;responseService;route;router;tenantService;toastService;translate;billingFrequencyOptions=[];displaySpinner=!0;form;isLoaded=!1;stepFormGroups=[];stepIndex=0;submitted=!1;subOptions=[];validationErrors;tenantListRoute="../"+P.tenantList;timezone;translations={};constructor(t,o,i,s,c,u,x,C){this.appSettingsService=t,this.fb=o,this.responseService=i,this.route=s,this.router=c,this.tenantService=u,this.toastService=x,this.translate=C,this.form=this.fb.group({Details:this.fb.group({Key:this.fb.control("",[T.required,T.minLength(Xo),T.maxLength(Zo),T.pattern("^[a-zA-Z0-9]*")]),Name:this.fb.control("",[T.required,T.maxLength(re)])}),Subscription:this.fb.group({Subscription:this.fb.control(0,[T.required]),BillFrequency:this.fb.control("Yearly",[T.required]),BillingDateUTC:this.fb.control(null,[T.required])}),AddOns:this.fb.group({EventsModule:this.fb.control(!1),GisModule:this.fb.control(!1)})})}ngOnInit(){this.stepFormGroups=[this.form.get("Details"),this.form.get("Subscription"),this.form.get("AddOns")],ue([this.translate.get(["TENANT.DETAILS","TENANT.SUBSCRIPTION","TENANT.ADD_ONS","SUBSCRIPTION.0","SUBSCRIPTION.1","SUBSCRIPTION.2","TENANT.BILLING.MONTHLY","TENANT.BILLING.YEARLY"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N())]).subscribe(t=>{this.translations=t[0];let o=t[1];this.timezone=o.Timezone??"",this.billingFrequencyOptions=[{label:this.translations["TENANT.BILLING.MONTHLY"],value:"Monthly"},{label:this.translations["TENANT.BILLING.YEARLY"],value:"Yearly"}],this.subOptions=[{label:this.translations["SUBSCRIPTION.0"],value:0},{label:this.translations["SUBSCRIPTION.1"],value:1},{label:this.translations["SUBSCRIPTION.2"],value:2}],this.isLoaded=!0,this.displaySpinner=!1})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../"+P.tenantList],t)}else this.stepIndex--}stepSubmit(t){this.stepFormGroups[this.stepIndex]?.valid&&(t<2?this.stepIndex++:this.onSubmit(new Ar().parseForm(this.form.value,this.timezone??""),this.form.valid))}onSubmit(t,o){this.validationErrors={},this.submitted||(o?(this.submitted=!0,this.displaySpinner=!0,t.Key=t.Key.toUpperCase(),this.tenantService.createTenant(t).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("TENANT.SUCCESS.CREATE","../"+P.tenantList,this.route,{key:t.Key,name:t.Name})},error:i=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i,this.form),this.stepIndex=We.getValidationErrorIndex(this.stepFormGroups,this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(i=>{this.toastService.error(i["SHARED.ERROR_LABEL"],i["SHARED.ERROR.FAILED_VALIDATION"])}))}static \u0275fac=function(o){return new(o||r)(g(dt),g(be),g(Re),g(he),g(Be),g($i),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-tenant-create"]],standalone:!1,decls:7,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.tenant.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.tenant.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["translate","","id","qware.tenant.create.details.label",1,"page-header"],[3,"form","submitted","validationErrors"],["translate","","id","qware.tenant.create.subscription.label",1,"page-header"],[3,"form","submitted","validationErrors","subOptions","freqOptions"],["translate","","id","qware.tenant.create.addons.label",1,"page-header"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.tenant.create-tenant.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.tenant.create-tenant.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("keydown.enter",function(){return i.stepSubmit(i.stepIndex)}),e(1,` 8305 `),n(2,"qware-spinner",2),e(3,` 8306 `),_(4,nN,73,31),a(),e(5,` 8307`),a(),e(6,` 8308`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,Wl,jl,Yl,ie],encapsulation:2})}return r})();var Hm=He(nt());var aN=["actionsMenu"],rN=["shades"],oN=["drawer"],lN=r=>({"lg:col-8":r}),sN=()=>["0","1","2"];function dN(r,d){if(r&1&&(e(0,` 8309 `),n(1,"a",28),e(2,` 8310 `),n(3,"span",29),e(4),a(),e(5,` 8311 `),n(6,"span",30),e(7),a(),e(8,` 8312 `),a(),e(9,` 8313 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function pN(r,d){r&1&&(e(0,` 8314 `),n(1,"span",32),e(2,"SHARED.ACTIONS"),a(),e(3,` 8315 `),n(4,"i",33),e(5,"expand_more"),a(),e(6,` 8316 `))}function mN(r,d){if(r&1){let t=b();e(0,` 8317 `),n(1,"p-button",31),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 8318 `),_(3,pN,7,0,"ng-template",null,4,A),e(5,` 8319 `),a(),e(6,` 8320 `)}r&2&&(l(),p("raised",!0))}function cN(r,d){if(r&1&&(e(0,` 8321 `),n(1,"a",28),e(2,` 8322 `),n(3,"span",29),e(4),a(),e(5,` 8323 `),n(6,"span",30),e(7),a(),e(8,` 8324 `),a(),e(9,` 8325 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function uN(r,d){if(r&1){let t=b();e(0,` 8326 `),n(1,"div",34),e(2,` 8327 `),n(3,"p-menu",35,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 8328 `),_(6,cN,10,2,"ng-template",null,1,A),e(8,` 8329 `),a(),e(9,` 8330 `),n(10,"p-button",36),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 8331 `),n(12,"i",33),e(13,"more_vert"),a(),e(14,` 8332 `),a(),e(15,` 8333 `),a(),e(16,` 8334 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function _N(r,d){r&1&&(e(0,` 8335 `),n(1,"i",33),e(2,"expand_less"),a(),e(3,` 8336 `))}function EN(r,d){r&1&&(e(0,` 8337 `),n(1,"i",33),e(2,"expand_more"),a(),e(3,` 8338 `))}function SN(r,d){if(r&1&&(e(0,` 8339 `),_(1,_N,4,0)(2,EN,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function xN(r,d){r&1&&(e(0,` 8340 `),n(1,"i",33),e(2,"expand_less"),a(),e(3,` 8341 `))}function fN(r,d){r&1&&(e(0,` 8342 `),n(1,"i",33),e(2,"expand_more"),a(),e(3,` 8343 `))}function hN(r,d){if(r&1&&(e(0,` 8344 `),_(1,xN,4,0)(2,fN,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function CN(r,d){r&1&&(e(0,` 8345 `),n(1,"i",33),e(2,"expand_less"),a(),e(3,` 8346 `))}function vN(r,d){r&1&&(e(0,` 8347 `),n(1,"i",33),e(2,"expand_more"),a(),e(3,` 8348 `))}function gN(r,d){if(r&1&&(e(0,` 8349 `),_(1,CN,4,0)(2,vN,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function TN(r,d){r&1&&(e(0,` 8350 `),n(1,"div",39),e(2,` 8351 `),n(3,"span",40),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 8352 `),a(),e(6,` 8353 `))}function IN(r,d){if(r&1){let t=b();e(0,` 8354 `),n(1,"qware-spinner",41),e(2,` 8355 `),n(3,"div",42),e(4,` 8356 `),n(5,"qware-entity-history",43),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 8357 `),a(),e(7,` 8358 `),a(),e(8,` 8359 `),a(),e(9,` 8360 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap),H("parentSpinnerState",t.displayDrawerSpinner)}}function bN(r,d){if(r&1){let t=b();e(0,` 8361 `),n(1,"div",37),e(2,` 8362 `),n(3,"p-drawer",38,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 8363 `),_(6,TN,7,0,"ng-template",null,7,A),e(8,`
8364 `),_(9,IN,10,6,"ng-template",null,4,A),e(11,` 8365 `),a(),e(12,` 8366 `),a(),e(13,` 8367 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var Wm=(()=>{class r{appSettingsService;authService;confirmationService;fb;responseService;route;tenantService;toastService;translate;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];billingFrequencyOptions=[];displaySpinner=!0;form;historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;subOptions=[];tenant;userEnabledSidebar=!1;validationErrors;auditLoggingDisabled=!0;tenantListRoute="../../../"+P.tenantList;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};shadeFormGroups=[];timezone;translations={};constructor(t,o,i,s,c,u,x,C,O){this.appSettingsService=t,this.authService=o,this.confirmationService=i,this.fb=s,this.responseService=c,this.route=u,this.tenantService=x,this.toastService=C,this.translate=O,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLE","SHARED.ENABLE","SHARED.AUDIT_LOG","AUDIT.TENANT","SUBSCRIPTION.0","SUBSCRIPTION.1","SUBSCRIPTION.2","TENANT.BILLING.MONTHLY","TENANT.BILLING.YEARLY"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N()),this.tenantService.getTenant(this.route.snapshot.params.id)]).subscribe({next:t=>{this.translations=t[0];let o=t[1];this.tenant=t[2],this.timezone=o.Timezone??"",this.subOptions=[{label:this.translations["SUBSCRIPTION.0"],value:0},{label:this.translations["SUBSCRIPTION.1"],value:1},{label:this.translations["SUBSCRIPTION.2"],value:2}],this.billingFrequencyOptions=[{label:this.translations["TENANT.BILLING.MONTHLY"],value:"Monthly"},{label:this.translations["TENANT.BILLING.YEARLY"],value:"Yearly"}],this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}],this.actionItems=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableTenant()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableTenant()}],this.actionItems=this.actionItems.filter(i=>i.id!==(this.tenant?.State===M.DISABLED?"disable.action":"enable.action")),this.tenant=Object.assign(new Ar,this.tenant),this.setHistoryParams(),this.form.patchValue(new Ar().toForm(this.tenant,this.timezone??"")),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.tenantListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Key:this.fb.control("",[T.required,T.minLength(Xo),T.maxLength(Zo),T.pattern("^[a-zA-Z0-9]*")]),Name:this.fb.control("",[T.required,T.maxLength(re)])}),Subscription:this.fb.group({Subscription:this.fb.control(0,[T.required]),BillFrequency:this.fb.control("Yearly",[T.required]),BillingDateUTC:this.fb.control(null,[T.required])}),AddOns:this.fb.group({EventsModule:this.fb.control(!1),GisModule:this.fb.control(!1)})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("Subscription"),this.form.get("AddOns")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.TENANT"]+' "'+this.tenant?.Name+'"',this.historyIdMap=new Map;let t=new Map;t.set("Name","TENANT.NAME"),t.set("Key","TENANT.KEY"),t.set("WorkOrdersModule","MODULES.WORK_ORDERS"),t.set("PreventativeMaintenanceModule","MODULES.WORK_ORDER_SCHEDULES"),t.set("InventoryModule","MODULES.INVENTORY"),t.set("AssetsModule","MODULES.ASSETS"),t.set("EventsModule","MODULES.EVENTS"),this.historyNameMap=t}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Ar().parseForm(this.form.value,this.timezone??"");this.tenant?.Id&&(t.Id=this.tenant.Id),t.State=this.tenant?.State??M.ACTIVE,this.tenantService.updateTenant(t).subscribe({next:()=>{if(t.Id===this.authService.tenant.Id){let o=this.authService.tenant;o.Name=t.Name,o.Key=t.Key,o.SubLevel=t.SubLevel,o.EventsModule=t.EventsModule,this.authService.tenant=o}this.displaySpinner=!1,this.responseService.onSuccess("TENANT.SUCCESS.SAVE",this.tenantListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableTenant(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.tenant?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.tenant?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.tenantService.disableTenant(this.tenant.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("TENANT.SUCCESS.DISABLE",this.tenantListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableTenant(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.tenant?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.tenant?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.tenantService.enableTenant(this.tenant.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("TENANT.SUCCESS.ENABLE",this.tenantListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Hm.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(mt),g(be),g(Re),g(he),g($i),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-tenant-edit"]],viewQuery:function(o,i){if(o&1&&(X(aN,7),X(rN,7),X(oN,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:111,vars:45,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.tenant.edit",1,"grid"],["id","qware.tenant.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.tenant.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.tenant.edit.actions-menu",3,"model","popup"],["id","qware.tenant.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"dt","multiple","value"],["id","qware.tenant.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"form","submitted","validationErrors","autoFocus"],["id","qware.tenant.edit.subscription-shade","value","1"],[3,"form","submitted","validationErrors","subOptions","freqOptions"],["id","qware.tenant.edit.addons-shade","value","2"],[3,"form","submitted","validationErrors"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.tenant.edit.button.cancel",3,"routerLink","text","label"],["tabindex","999","type","button","id","qware.tenant.edit.button.save",3,"onClick","text","disabled","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.tenant.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.tenant.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.tenant.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.tenant.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.tenant.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","tenant",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),e(1,` 8368 `),n(2,"div",9),e(3,`
8369 `),n(4,"div",10),e(5,` 8370 `),n(6,"h3",11),e(7,` 8371 TENANT.EDIT_TENANT 8372 `),a(),e(8,` 8373 `),n(9,"div",12),e(10,` 8374 `),n(11,"p-menu",13,0),e(13,` 8375 `),_(14,dN,10,2,"ng-template",null,1,A),e(16,` 8376 `),a(),e(17,` 8377 `),_(18,mN,7,1),a(),e(19,` 8378 `),_(20,uN,17,4),a(),e(21,` 8379 `),n(22,"qware-spinner",14),e(23,` 8380 `),n(24,"p-card",15),e(25,` 8381 `),n(26,"p-accordion",16,2),e(28,` 8382 `),n(29,"p-accordion-panel",17),e(30,` 8383 `),n(31,"p-accordion-header"),e(32),I(33,"translate"),_(34,SN,3,1,"ng-template",null,3,A),e(36,` 8384 `),a(),e(37,` 8385 `),n(38,"p-accordion-content"),e(39,` 8386 `),n(40,"div",18),e(41,` 8387 `),n(42,"div",19),e(43,` 8388 `),n(44,"qware-tenant-details",20),e(45,` 8389 `),a(),e(46,` 8390 `),a(),e(47,` 8391 `),a(),e(48,` 8392 `),a(),e(49,` 8393 `),a(),e(50,` 8394 `),n(51,"p-accordion-panel",21),e(52,` 8395 `),n(53,"p-accordion-header"),e(54),I(55,"translate"),_(56,hN,3,1,"ng-template",null,3,A),e(58,` 8396 `),a(),e(59,` 8397 `),n(60,"p-accordion-content"),e(61,` 8398 `),n(62,"div",18),e(63,` 8399 `),n(64,"div",19),e(65,` 8400 `),n(66,"qware-tenant-subscription",22),e(67,` 8401 `),a(),e(68,` 8402 `),a(),e(69,` 8403 `),a(),e(70,` 8404 `),a(),e(71,` 8405 `),a(),e(72,` 8406 `),n(73,"p-accordion-panel",23),e(74,` 8407 `),n(75,"p-accordion-header"),e(76),I(77,"translate"),_(78,gN,3,1,"ng-template",null,3,A),e(80,` 8408 `),a(),e(81,` 8409 `),n(82,"p-accordion-content"),e(83,` 8410 `),n(84,"div",18),e(85,` 8411 `),n(86,"div",19),e(87,` 8412 `),R(88,"qware-tenant-addons",24),e(89,` 8413 `),a(),e(90,` 8414 `),a(),e(91,` 8415 `),a(),e(92,` 8416 `),a(),e(93,` 8417 `),a(),e(94,` 8418 `),n(95,"div",25),e(96,` 8419 `),n(97,"p-button",26),I(98,"translate"),e(99,` 8420 `),a(),e(100,` 8421 `),n(101,"p-button",27),I(102,"translate"),h("onClick",function(){return E(s),S(i.save())}),e(103,` 8422 `),a(),e(104,` 8423 `),a(),e(105,` 8424 `),a(),e(106,` 8425 `),a(),e(107,` 8426 `),a(),e(108,` 8427 `),_(109,bN,14,6),a(),e(110,` 8428`)}o&2&&(l(2),p("ngClass",pe(42,lN,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(44,sN)),l(6),K(` 8429 `,y(33,32,"TENANT.DETAILS"),` 8430 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("autoFocus",!1),l(10),K(` 8431 `,y(55,34,"TENANT.SUBSCRIPTION"),` 8432 `),l(12),p("form",i.form.controls.Subscription)("submitted",i.submitted)("validationErrors",i.validationErrors)("subOptions",i.subOptions)("freqOptions",i.billingFrequencyOptions),l(10),K(` 8433 `,y(77,36,"TENANT.ADD_ONS"),` 8434 `),l(12),p("form",i.form.controls.AddOns)("submitted",i.submitted)("validationErrors",i.validationErrors),l(9),q("label",y(98,38,"SHARED.CANCEL")),p("routerLink",i.tenantListRoute)("text",!0),l(4),q("label",y(102,40,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.dirty||!i.form.valid),l(8),f(i.auditLoggingDisabled?-1:109))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Ut,me,ot,et,$,Wl,jl,Yl,ie],encapsulation:2})}return r})();var va=He(Hn()),Kr=He(nt());var yN=["chartCanvasElements"],AN=()=>({"margin-bottom":"1rem"}),RN=()=>[10,25,50],wN=()=>({"min-width":"75rem"}),DN=(r,d)=>d.Id;function LN(r,d){r&1&&(e(0,` 8435 `),n(1,"span",17),e(2,"expand_more"),a(),e(3,` 8436 `))}function NN(r,d){r&1&&(e(0,` 8437 `),n(1,"tr"),e(2,` 8438 `),n(3,"th"),e(4,"User"),a(),e(5,` 8439 `),n(6,"th"),e(7,"User Group"),a(),e(8,` 8440 `),n(9,"th"),e(10,"Action"),a(),e(11,` 8441 `),n(12,"th"),e(13,"Action Type"),a(),e(14,` 8442 `),n(15,"th"),e(16,"Paid User Count"),a(),e(17,` 8443 `),n(18,"th"),e(19,"Updated By"),a(),e(20,` 8444 `),n(21,"th"),e(22,"Timestamp"),a(),e(23,` 8445 `),n(24,"th"),e(25,"Operation Id"),a(),e(26,` 8446 `),a(),e(27,` 8447 `))}function ON(r,d){if(r&1&&(e(0,` 8448 `),n(1,"tr"),e(2,` 8449 `),n(3,"td"),e(4),a(),e(5,` 8450 `),n(6,"td"),e(7),a(),e(8,` 8451 `),n(9,"td"),e(10),I(11,"translate"),a(),e(12,` 8452 `),n(13,"td"),e(14),I(15,"translate"),a(),e(16,` 8453 `),n(17,"td"),e(18),a(),e(19,` 8454 `),n(20,"td"),e(21),a(),e(22,` 8455 `),n(23,"td"),e(24),I(25,"dateFormat"),a(),e(26,` 8456 `),n(27,"td"),e(28),a(),e(29,` 8457 `),a(),e(30,` 8458 `)),r&2){let t=d.$implicit,o=m(2);l(4),v(t.UserId),l(3),v(t.TenantGroupId),l(3),v(y(11,8,"SUBSCRIPTION.PAID_USERS."+t.Action)),l(4),v(y(15,10,"SUBSCRIPTION.PAID_USERS."+t.ActionType)),l(4),v(t.UserCount),l(3),v(t.UpdatedByUserId),l(3),v(ma(25,12,t.TimestampUTC,"M/D/YYYY h:mm a",o.timezone())),l(4),v(t.OperationId)}}function FN(r,d){if(r&1){let t=b();e(0,` 8459 `),n(1,"div"),e(2,` 8460 `),n(3,"p-card",2),e(4,` 8461 `),n(5,"div",3),e(6,` 8462 `),n(7,"p-select",4),h("onChange",function(i){let s=E(t).$index,c=m();return S(c.viewChange(i,s))}),e(8,` 8463 `),_(9,LN,4,0,"ng-template",null,0,A),e(11,` 8464 `),a(),e(12,` 8465 `),a(),e(13,` 8466 `),n(14,"div",5),e(15,` 8467 `),R(16,"canvas",6,1),e(18,` 8468 `),a(),e(19,` 8469 `),n(20,"div",7),e(21,` 8470 `),n(22,"p-table",8),e(23,` 8471 `),_(24,NN,28,0,"ng-template",9),e(25,` 8472 `),_(26,ON,31,16,"ng-template",10),e(27,` 8473 `),a(),e(28,` 8474 `),a(),e(29,` 8475 `),n(30,"div",11),e(31,` 8476 `),n(32,"div",12),e(33,` 8477 `),n(34,"div"),e(35,"Assets"),a(),e(36,` 8478 `),n(37,"div"),e(38),a(),e(39,` 8479 `),a(),e(40,` 8480 `),n(41,"div",13),e(42,`
8481 `),n(43,"div"),e(44,"Service Areas"),a(),e(45,` 8482 `),n(46,"div"),e(47),a(),e(48,` 8483 `),a(),e(49,` 8484 `),n(50,"div",14),e(51,` 8485 `),n(52,"div"),e(53,"Work Order Statuses"),a(),e(54,` 8486 `),n(55,"div"),e(56),a(),e(57,` 8487 `),a(),e(58,` 8488 `),n(59,"div",15),e(60,` 8489 `),n(61,"div"),e(62,"Priorities"),a(),e(63,` 8490 `),n(64,"div"),e(65),a(),e(66,` 8491 `),a(),e(67,` 8492 `),n(68,"div",16),e(69,` 8493 `),n(70,"div"),e(71,"User Groups"),a(),e(72,` 8494 `),n(73,"div"),e(74),a(),e(75,` 8495 `),a(),e(76,` 8496 `),a(),e(77,` 8497 `),a(),e(78,` 8498 `),a(),e(79,` 8499`)}if(r&2){let t=d.$implicit,o=d.$index,i=m();l(3),Pt(ne(17,AN)),p("header",t.Name),l(4),p("autoDisplayFirst",!0)("options",i.viewOptions),l(9),p("id",o),l(6),p("value",i.tableUserStats()[o])("rowsPerPageOptions",ne(18,RN))("paginator",!0)("rows",10)("showCurrentPageReport",!0)("tableStyle",ne(19,wN)),l(16),v(i.tenantCounts()[o]?i.tenantCounts()[o].assets:"0"),l(9),v(i.tenantCounts()[o]?i.tenantCounts()[o].serviceAreas:"0"),l(9),v(i.tenantCounts()[o]?i.tenantCounts()[o].workOrderStatuses:"0"),l(9),v(i.tenantCounts()[o]?i.tenantCounts()[o].workOrderPriorities:"0"),l(9),v(i.tenantCounts()[o]?i.tenantCounts()[o].userGroups:"0")}}var Ql=(()=>{class r{chartElements;tenants=ee([]);parentSpinnerState=bn();userStats=Ye(()=>this.tenantData()?.userStats??[]);tenantCounts=Ye(()=>this.tenantData()?.tenantCounts??[]);timezone=Ye(()=>this.tenantData()?.appSettings?.Timezone??void 0);tableUserStats=Ye(()=>{let t=this.tenantData();return t?Kr.default.cloneDeep(t.userStats).map((o,i)=>(o.forEach(s=>{s.UserId=t.tenantUsers.find(c=>c.Id===s.UserId)?.FullName??s.UserId,s.UpdatedByUserId=t.tenantUsers.find(c=>c.Id===s.UpdatedByUserId)?.FullName??s.UpdatedByUserId,s.TenantGroupId=t.userGroups[i].find(c=>c.Id===s.TenantGroupId)?.Name}),o)):[]});viewOptions=[{label:"Last 30 Days",value:0},{label:"Last 24 Hours",value:1}];activeCharts=[];appSettingsService=te(dt);chartService=te(_l);tenantService=te($i);userService=te(ct);userGroupService=te(Tt);tenants$=or(this.tenants);tenantData=v0(this.tenants$.pipe(md(t=>t&&t.length>0),cs(()=>this.parentSpinnerState.set(!0)),Lo(t=>ue({appSettings:this.appSettingsService.getAppSettings().pipe(N()),userStats:ue(t.map(o=>this.userService.getPaidUserStats(o.Id))),tenantCounts:ue(t.map(o=>this.tenantService.getTenantCounts(o.Id))),tenantUsers:ue(t.map(o=>this.userService.getUsers(o.Id,!1))),userGroups:ue(t.map(o=>this.userGroupService.getUserGroups(o.Id,!1)))}).pipe(da(o=>({tenantList:t,numOfTenants:t.length,appSettings:o.appSettings,userStats:o.userStats,tenantCounts:o.tenantCounts,tenantUsers:Kr.default.flatten(o.tenantUsers),userGroups:o.userGroups})))),cs(()=>this.parentSpinnerState.set(!1))),{initialValue:void 0});constructor(){po.register(U0,k0,F0,P0,L0,N0,M0,O0),Bn(()=>{let t=this.tenantData();if(t&&t.userStats.length>0&&this.chartElements&&this.chartElements.length>0){let o=(0,va.default)(Vt.convertToAppTimezone(t.appSettings.Timezone??"",!0)),i=(0,va.default)(o).subtract(30,"d");
8499t.userStats.forEach((s,c)=>{let u=this.configureData(s.reverse(),[i,o],"d");this.addChart(c,u)})}})}configureData(t,o,i){let s=-1,c=t.filter((U,V)=>(U.TimestampUTC=Vt.convertToAppTimezone(this.timezone()??"",!0,U.TimestampUTC),(0,va.default)(U.TimestampUTC).isSameOrAfter(o[0])&&o[1].isSameOrAfter(U.TimestampUTC)?(s<0&&(s=V),!0):!1)),u=0;s>0?u=t.slice(0,s).map(V=>V.UserCount).filter(V=>V!==c[0].UserCount).pop()??0:s===-1&&(u=t.map(U=>U.UserCount).pop()??0);let x=Kr.default.groupBy(c,U=>i==="d"?(0,va.default)(U.TimestampUTC).format("M/D/YYYY"):(0,va.default)(U.TimestampUTC).startOf(i).format("M/D/YYYY h:mm a"));Object.keys(x).forEach(U=>{let V=x[U];V=Kr.default.sortBy(V,"TimestampUTC").reverse(),x[U]=[V[0]]});let C=[],O=o[0].clone();for(;O.add(1,i).diff(o[1])<=0;)i==="d"?C.push(O.format("M/D/YYYY")):C.push(O.clone().startOf(i).format("M/D/YYYY h:mm a"));let w=Object.keys(x).map(U=>C.indexOf(U)),F=[],L=Kr.default.flatten(Object.values(x)).map(U=>U.UserCount??0);for(let U=0;U<C.length;U++)w.includes(U)?F[U]=L.shift()??0:F[U]=F[F.length-1]??u;return{labels:C,data:F}}addChart(t,o){let s=this.chartElements.toArray()[t]?.nativeElement?.getContext("2d"),c={label:"Paid Users",data:o.data,backgroundColor:"#212121",borderColor:"#212121",borderWidth:1};if(s){let u=this.chartService.createLineChart(s,o.labels,[c],"",!0,!1);this.activeCharts[t]=u}}viewChange(t,o){let i=this.userStats()[o],s,c,u=(0,va.default)(Vt.convertToAppTimezone(this.timezone()??"",!0));switch(t.value){case 0:c=(0,va.default)(u).subtract(30,"d"),s=this.configureData(i,[c,u],"d"),this.activeCharts[o].destroy(),this.addChart(o,s);break;case 1:c=(0,va.default)(u).subtract(1,"d"),s=this.configureData(i,[c,u],"h"),this.activeCharts[o].destroy(),this.addChart(o,s);break;default:break}}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-tenant-analytics"]],viewQuery:function(o,i){if(o&1&&X(yN,5),o&2){let s;Y(s=Q())&&(i.chartElements=s)}},inputs:{tenants:[1,"tenants"],parentSpinnerState:[1,"parentSpinnerState"]},outputs:{parentSpinnerState:"parentSpinnerStateChange"},decls:2,vars:0,consts:[["dropdownicon",""],["chartCanvasElements",""],[3,"header"],[1,"dropdown-container"],["id","paid-user-view-dropdown",3,"onChange","autoDisplayFirst","options"],[1,"paid-user-chart"],["height","300px",3,"id"],[1,"paid-user-table"],["currentPageReportTemplate","Showing {first} to {last} of {totalRecords} entries",3,"value","rowsPerPageOptions","paginator","rows","showCurrentPageReport","tableStyle"],["pTemplate","header"],["pTemplate","body"],[1,"counts-container"],[1,"count","asset-count"],[1,"count","service-area-count"],[1,"count","status-count"],[1,"count","priorities-count"],[1,"count","user-group-count"],[1,"material-icons"]],template:function(o,i){o&1&&G(0,FN,80,20,null,null,DN),o&2&&k(i.tenants())},dependencies:[Zt,Mn,Ie,Pe,Oa,ea,it,ka,ht,Qt,ie],styles:[`qware-tenant-analytics .dropdown-container{padding:0 .75rem;margin-bottom:1rem}qware-tenant-analytics .paid-user-chart{padding:0 .75rem;margin-bottom:1rem}qware-tenant-analytics .paid-user-table{padding:0 1.5rem;margin-bottom:1rem}@media screen and (max-width: 960px){qware-tenant-analytics .paid-user-table p-table .p-datatable .p-datatable-table{table-layout:auto}qware-tenant-analytics .paid-user-table p-table .p-datatable .p-datatable-table .p-datatable-tbody>tr>td{border-width:1px}}qware-tenant-analytics .counts-container{display:flex;flex-wrap:wrap;padding:0 .75rem}qware-tenant-analytics .counts-container .count{height:175px;width:175px;border:1px solid var(--p-surface-400);border-radius:3px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;margin:.75rem;position:relative;color:var(--p-text-color)}qware-tenant-analytics .counts-container .count>div:first-child{padding:1rem;position:absolute;top:0;width:100%}qware-tenant-analytics .counts-container .count>div:nth-child(2){font-size:2rem} 8500`],encapsulation:2,changeDetection:0})}return r})();var UN=["dt"],PN=r=>({"disabled-row":r}),jm=(r,d)=>d.field;function GN(r,d){if(r&1){let t=b();e(0,` 8501 `),n(1,"div",10),e(2,` 8502 `),n(3,"p-button",11),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.showAnalytics=!i.showAnalytics)}),e(5,` 8503 `),a(),e(6,` 8504 `),a(),e(7,` 8505 `)}r&2&&(l(3),q("label",y(4,2,"SHARED.RETURN_TO_LIST")),p("raised",!0))}function kN(r,d){if(r&1&&(e(0,` 8506 `),n(1,"a",21),e(2,` 8507 `),n(3,"span",22),e(4),a(),e(5,` 8508 `),n(6,"span",23),e(7),a(),e(8,` 8509 `),a(),e(9,` 8510 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function VN(r,d){r&1&&(e(0,` 8511 `),n(1,"span",25),e(2,"SHARED.ACTIONS"),a(),e(3,` 8512 `),n(4,"i",16),e(5,"expand_more"),a(),e(6,` 8513 `))}function qN(r,d){if(r&1){let t=b();e(0,` 8514 `),n(1,"p-button",24),h("onClick",function(i){E(t),m();let s=Ee(6);return S(s.toggle(i))}),e(2,` 8515 `),_(3,VN,7,0,"ng-template",null,3,A),e(5,` 8516 `),a(),e(6,` 8517 `)}r&2&&(l(),p("raised",!0))}function BN(r,d){if(r&1&&(e(0,` 8518 `),n(1,"a",21),e(2,` 8519 `),n(3,"span",22),e(4),a(),e(5,` 8520 `),n(6,"span",23),e(7),a(),e(8,` 8521 `),a(),e(9,` 8522 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function HN(r,d){if(r&1){let t=b();e(0,` 8523 `),n(1,"div",10),e(2,` 8524 `),n(3,"div",12),e(4,` 8525 `),n(5,"p-menu",13,0),e(7,` 8526 `),_(8,kN,10,2,"ng-template",null,1,A),e(10,` 8527 `),a(),e(11,` 8528 `),_(12,qN,7,1),a(),e(13,` 8529 `),n(14,"div",14),e(15,` 8530 `),n(16,"p-iconfield",15),e(17,` 8531 `),n(18,"p-inputicon"),e(19,` 8532 `),n(20,"span",16),e(21,"search"),a(),e(22,` 8533 `),a(),e(23,` 8534 `),n(24,"input",17),I(25,"translate"),j("ngModelChange",function(i){E(t);let s=m();return W(s.generalFilter,i)||(s.generalFilter=i),S(i)}),h("keyup",function(){E(t);let i=m();return S(i.generalFilterOnChange())}),a(),e(26,` 8535 `),a(),e(27,` 8536 `),a(),e(28,` 8537 `),n(29,"div",18),e(30,` 8538 `),n(31,"p-menu",19,2),h("click",function(){E(t);let i=Ee(32);return S(i.hide())}),e(33,` 8539 `),_(34,BN,10,2,"ng-template",null,1,A),e(36,` 8540 `),a(),e(37,` 8541 `),n(38,"p-button",20),h("onClick",function(i){E(t);let s=Ee(32),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(39,` 8542 `),n(40,"i",16),e(41,"more_vert"),a(),e(42,` 8543 `),a(),e(43,` 8544 `),a(),e(44,` 8545 `),a(),e(45,` 8546 `)}if(r&2){let t=m();l(),ve("search-active",t.searchEnabled),l(4),p("model",t.actionItems)("popup",!0),l(7),f(t.actionItems&&t.actionItems.length>0?12:-1),l(12),q("placeholder",y(25,12,"SHARED.SEARCH")),H("ngModel",t.generalFilter),p("qwareFocus",t.generalFilter!==""),l(7),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function WN(r,d){if(r&1){let t=b();e(0,` 8547 `),n(1,"qware-tenant-analytics",26),j("parentSpinnerStateChange",function(i){E(t);let s=m();return W(s.displaySpinner,i)||(s.displaySpinner=i),S(i)}),a(),e(2,` 8548 `)}if(r&2){let t=m();l(),p("tenants",t.selectedTenants),H("parentSpinnerState",t.displaySpinner)}}function jN(r,d){if(r&1&&(e(0,` 8549 `),n(1,"th",33),e(2,` 8550 `),n(3,"span",34),e(4),a(),e(5,` 8551 `),a(),e(6,` 8552 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.field),l(3),v(t.header)}}function YN(r,d){if(r&1&&(e(0,` 8553 `),n(1,"tr"),e(2,` 8554 `),n(3,"th",31),e(4,` 8555 `),R(5,"p-tableHeaderCheckbox",32),e(6,` 8556 `),a(),e(7,` 8557 `),G(8,jN,7,2,null,null,jm),a(),e(10,` 8558 `)),r&2){let t=d.$implicit;m();let o=Ee(2);l(5),p("hidden",!o.value&&!o.filteredValue),l(3),k(t)}}function QN(r,d){r&1&&(e(0,` 8559 `),n(1,"span",40),e(2,"SHARED.DISABLED"),a(),e(3,` 8560 `))}function KN(r,d){if(r&1&&(e(0,` 8561 `),n(1,"span"),e(2,` 8562 `),n(3,"a",39),e(4),a(),e(5,` 8563 `),_(6,QN,4,0),a(),e(7,` 8564 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m(2);l(3),gt("routerLink","",i.tenantEditRoute,"/",o.Id,""),l(),v(o[t.field]),l(2),f(o.State==="DISABLED"?6:-1)}}function $N(r,d){if(r&1&&(e(0,` 8565 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 8566 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(y(3,1,"SUBSCRIPTION."+(o[t.field]==null?null:o[t.field].toString())))}}function zN(r,d){if(r&1&&(e(0,` 8567 `),n(1,"span"),e(2),a(),e(3,` 8568 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function XN(r,d){if(r&1&&(e(0,` 8569 `),n(1,"td"),e(2,` 8570 `),n(3,"span",37),e(4),a(),e(5,` 8571 `),n(6,"div",38),e(7,` 8572 `),n(8,"span"),e(9,` 8573 `),_(10,KN,8,5)(11,$N,5,3)(12,zN,4,1),e(13,` 8574 `),a(),e(14,` 8575 `),a(),e(15,` 8576 `),a(),e(16,` 8577 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:t==="SubLevel"?11:12)}}function ZN(r,d){if(r&1&&(e(0,` 8578 `),n(1,"tr",35),e(2,` 8579 `),n(3,"td"),e(4,` 8580 `),R(5,"p-tableCheckbox",36),e(6,` 8581 `),a(),e(7,` 8582 `),G(8,XN,17,2,null,null,jm),a(),e(10,` 8583 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(3,PN,t.State==="DISABLED"))("pSelectableRow",t),l(4),p("value",t),l(3),k(o)}}function JN(r,d){r&1&&(e(0,` 8584 `),n(1,"div",41),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 8585 `))}function eO(r,d){r&1&&(e(0,` 8586 `),n(1,"div",41),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 8587 `))}function tO(r,d){if(r&1&&(e(0,` 8588 `),n(1,"tr"),e(2,` 8589 `),n(3,"td"),e(4,` 8590 `),_(5,JN,4,0)(6,eO,4,0),a(),e(7,` 8591 `),a(),e(8,` 8592 `)),r&2){let t=d.$implicit,o=m(2);l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter?5:6)}}function iO(r,d){if(r&1){let t=b();e(0,` 8593 `),n(1,"p-table",27,4),j("selectionChange",function(i){E(t);let s=m();return W(s.selectedTenants,i)||(s.selectedTenants=i),S(i)}),h("onFilter",function(){E(t);let i=m();return S(i.detectFilter())}),e(3,` 8594 `),_(4,YN,11,1,"ng-template",28),e(5,` 8595 `),_(6,ZN,11,5,"ng-template",29),e(7,`
8596 `),_(8,tO,9,2,"ng-template",30),e(9,` 8597 `),a(),e(10,` 8598 `)}if(r&2){let t=m();l(),p("columns",t.tableColumns)("value",t.tenants),H("selection",t.selectedTenants),p("sortOrder",1)("paginator",!0)("pageLinks",3)("rows",15)("scrollable",!0)}}function nO(r,d){if(r&1&&(e(0,` 8599 `),n(1,"div",42),e(2,` 8600 `),n(3,"p-button",43),e(4,` 8601 `),n(5,"i",16),e(6,"add"),a(),e(7,` 8602 `),a(),e(8,` 8603 `),a(),e(9,` 8604 `)),r&2){let t=m();l(3),q("routerLink",t.tenantCreateRoute),p("raised",!0)}}var Ym=(()=>{class r{authService;tenantService;toastService;translate;dt;displaySpinner=D(!0);actionItems=[];generalFilter="";isActive=!1;moreItems=[];selectedTenants=[];searchEnabled=!1;searchResults=!1;showAnalytics=!1;tableColumns=[{field:"Name",header:"TENANT.NAME"},{field:"Key",header:"TENANT.KEY"},{field:"SubLevel",header:"TENANT.SUBSCRIPTION"}];tenants=[];tenantCreateRoute="../"+P.tenantCreate;tenantEditRoute="../"+P.tenant+"/"+P.edit;constructor(t,o,i,s){this.authService=t,this.tenantService=o,this.toastService=i,this.translate=s}ngOnInit(){ue([this.translate.get(["SHARED.ANALYTICS"]).pipe(N()),this.tenantService.getTenantsForUser(this.authService.currentUserId)]).subscribe(t=>{let o=t[0];this.tenants=t[1],this.actionItems=[{label:o["SHARED.ANALYTICS"],icon:"timeline",command:()=>this.showTenantAnalytics()}],this.moreItems=[{label:o["SHARED.ANALYTICS"],icon:"timeline",command:()=>this.showTenantAnalytics()}];let i=localStorage.getItem(Oe.TENANT_FILTER_STORAGE_KEY);i&&(this.generalFilter=i,this.generalFilterOnChange()),this.tenants&&this.tenants.length===0?this.searchResults=!1:this.detectFilter(),this.displaySpinner.set(!1)})}showTenantAnalytics(){!this.selectedTenants||this.selectedTenants.length===0?this.translate.get(["SHARED.ERROR_LABEL","TENANT.ERROR.SELECT_TENANTS_TO_VIEW_ANALYTICS"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["TENANT.ERROR.SELECT_TENANTS_TO_VIEW_ANALYTICS"],!0)}):this.showAnalytics=!0}generalFilterOnChange(){localStorage.setItem(Oe.TENANT_FILTER_STORAGE_KEY,this.generalFilter),this.generalFilter.length>0&&(this.searchEnabled=!0),this.dt?.filterGlobal(this.generalFilter,"contains")}detectFilter(){setTimeout(()=>{this.dt?.filteredValue?this.searchResults=!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0:this.searchResults=!0},0)}static \u0275fac=function(o){return new(o||r)(g(de),g($i),g(Se),g(le))};static \u0275cmp=B({type:r,selectors:[["qware-tenant-list"]],viewQuery:function(o,i){if(o&1&&X(UN,5),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},standalone:!1,decls:19,vars:4,consts:[["actionsMenu",""],["item",""],["moreMenu",""],["content",""],["dt",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.tenant.list.page-header","translate","",1,"page-header"],[1,"col-12","data-grid"],["id","qware.tenant.list.spinner",3,"displaySpinner"],[1,"actions","flex-inline","col-12"],["id","qware.tenant.list.return-to-list.button","severity","secondary",3,"onClick","label","raised"],[1,"action-button-container"],[3,"model","popup"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.tenant.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"more-container"],["id","qware.tenant.list.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.tenant.list.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[3,"parentSpinnerStateChange","tenants","parentSpinnerState"],["id","qware.tenant.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"selectionChange","onFilter","columns","value","selection","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[2,"width","40px"],[3,"hidden"],[3,"pSortableColumn"],["translate",""],[3,"ngClass","pSelectableRow"],[3,"value"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.tenants.list.table.tenant-name",3,"routerLink"],["translate","",1,"badge"],["translate","",1,"no-results"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button","id","qware.tenant.list.create-button",3,"raised","routerLink"]],template:function(o,i){o&1&&(n(0,"div",5),e(1,` 8605 `),n(2,"div",6),e(3,` 8606 `),n(4,"h3",7),e(5,` 8607 TENANT.MANAGEMENT 8608 `),a(),e(6,` 8609 `),a(),e(7,` 8610 8611 `),_(8,GN,8,4)(9,HN,46,14),n(10,"div",8),e(11,` 8612 `),n(12,"qware-spinner",9),e(13,` 8613 `),_(14,WN,3,2)(15,iO,11,8),a(),e(16,` 8614 `),a(),e(17,` 8615 `),_(18,nO,10,2),a()),o&2&&(l(8),f(i.showAnalytics?8:9),l(4),p("displaySpinner",i.displaySpinner()),l(2),f(i.showAnalytics?14:15),l(4),f(i.showAnalytics?-1:18))},dependencies:[Pe,oe,Qe,je,Ae,se,Le,pi,mi,ye,lt,me,kt,ot,et,ht,ji,Yi,ol,ll,Ql,$,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0!important}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{display:flex!important;position:relative!important;margin:0!important;width:100%}.actions[_ngcontent-%COMP%] .p-button-text[_ngcontent-%COMP%], .actions[_ngcontent-%COMP%] .p-button-text[_ngcontent-%COMP%]:enabled, .actions[_ngcontent-%COMP%] .p-button-text[_ngcontent-%COMP%]:hover{color:var(--p-text-color)}"]})}return r})();var To=He(nt());var hn=(()=>{class r{http;instanceDataService;get ROLE_API_URL(){return this.instanceDataService.ROLE_URL}constructor(t,o){this.http=t,this.instanceDataService=o}convertToTreeNode(t,o,i,s){let c=new yr,u=o.includes(t.Id??"");return c.data={id:t.Id,parentId:t.ModuleName,disabled:!1,deleted:!1,name:t.Name,selectable:s!==void 0?s:!0,showCustomBadge:!0,customBadgeText:i[u?0:1]},c}getRoles(){return this.http.get(this.ROLE_API_URL).pipe(Do())}static \u0275fac=function(o){return new(o||r)(Sr(fr),Sr(Zn))};static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();var Qm=He(nt());var kn=(()=>{class r{http;instanceDataService;get USER_GROUP_TEMPLATE_API_URL(){return this.instanceDataService.PRIVILEGE_TEMPLATE_GROUP_URL}constructor(t,o){this.http=t,this.instanceDataService=o}getUserGroupTemplates(t=!1){return this.http.get(this.USER_GROUP_TEMPLATE_API_URL).pipe(Do(),da(o=>o.filter(i=>t||!d0.includes(i.Name??"")).map(i=>(i.Roles=[],Qm.default.each(i.PrivilegeTemplateGroupRoles,s=>{i.Roles?.push(s.PrivilegeTemplateGroupRoleId)}),i.PrivilegeTemplateGroupRoles=void 0,i))))}static \u0275fac=function(o){return new(o||r)(Sr(fr),Sr(Zn))};static \u0275prov=Mi({token:r,factory:r.\u0275fac})}return r})();function rO(r,d){r&1&&(e(0,` 8616 `),n(1,"span",8),e(2,"expand_more"),a(),e(3,` 8617 `))}function oO(r,d){r&1&&(e(0,` 8618 `),n(1,"span",8),e(2,"search"),a(),e(3,` 8619 `))}
8619function lO(r,d){if(r&1){let t=b();e(0,` 8620 `),n(1,"div",5),e(2,` 8621 `),n(3,"p-floatlabel"),e(4,` 8622 `),n(5,"p-multiselect",6),h("ngModelChange",function(i){E(t);let s=m();return S(s.assetCategoriesOnChange(i))}),e(6,` 8623 `),_(7,rO,4,0,"ng-template",null,0,A),e(9,` 8624 `),_(10,oO,4,0,"ng-template",null,1,A),e(12,` 8625 `),a(),e(13,` 8626 `),n(14,"label",7),e(15),I(16,"translate"),a(),e(17,` 8627 `),a(),e(18,` 8628 `),a(),e(19,` 8629 `)}if(r&2){let t=m();l(5),p("options",t.assetCategoryOptions())("maxSelectedLabels",t.assetCategoryOptions().length+1)("fluid",!0),l(10),K(` 8630 `,y(16,4,"TENANTGROUP.ASSOCIATED_CATEGORIES.ASSET_CATEGORIES"),` 8631 `)}}function sO(r,d){r&1&&(e(0,` 8632 `),n(1,"span",8),e(2,"expand_more"),a(),e(3,` 8633 `))}function dO(r,d){r&1&&(e(0,` 8634 `),n(1,"span",8),e(2,"search"),a(),e(3,` 8635 `))}function pO(r,d){if(r&1){let t=b();e(0,` 8636 `),n(1,"div",5),e(2,` 8637 `),n(3,"p-floatlabel"),e(4,` 8638 `),n(5,"p-multiselect",9),h("ngModelChange",function(i){E(t);let s=m();return S(s.inventoryCategoriesOnChange(i))}),e(6,` 8639 `),_(7,sO,4,0,"ng-template",null,0,A),e(9,` 8640 `),_(10,dO,4,0,"ng-template",null,1,A),e(12,` 8641 `),a(),e(13,` 8642 `),n(14,"label",10),e(15),I(16,"translate"),a(),e(17,` 8643 `),a(),e(18,` 8644 `),a(),e(19,` 8645 `)}if(r&2){let t=m();l(5),p("options",t.inventoryCategoryOptions())("maxSelectedLabels",t.inventoryCategoryOptions().length+1)("fluid",!0),l(10),K(` 8646 `,y(16,4,"TENANTGROUP.ASSOCIATED_CATEGORIES.INVENTORY_CATEGORIES"),` 8647 `)}}var Kl=(()=>{class r{assetCategories=ee();form=ee.required();inventoryCategories=ee();selectAllAssetCategoriesByDefault=ee(!1);selectAllInventoryCategoriesByDefault=ee(!1);submitted=ee(!1);validationErrors=ee();_filteredAssetCategories=D(void 0);_filteredInventoryCategories=D(void 0);assetCategoryOptions=Ye(()=>this._filteredAssetCategories()??this.assetCategories());inventoryCategoryOptions=Ye(()=>this._filteredInventoryCategories()??this.inventoryCategories());constructor(){Bn(()=>{if(this.selectAllAssetCategoriesByDefault()){let t=[];this.assetCategories()?.filter(o=>o.Id).forEach(o=>{o.Id&&t.push(o.Id)}),this.form().get("AssetCategoryIds")?.setValue(t)}}),Bn(()=>{if(this.selectAllInventoryCategoriesByDefault()){let t=[];this.inventoryCategories()?.filter(o=>o.Id).forEach(o=>{o.Id&&t.push(o.Id)}),this.form().get("InventoryCategoryIds")?.setValue(t)}})}assetCategoriesOnChange(t){this._filteredAssetCategories.set(this.assetCategoryOptions()?.filter(o=>o.Id&&(o.State===M.ACTIVE||t?.includes(o.Id))))}inventoryCategoriesOnChange(t){this._filteredInventoryCategories.set(this.inventoryCategoryOptions()?.filter(o=>o.Id&&(o.State===M.ACTIVE||t?.includes(o.Id))))}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-associated-categories"]],inputs:{assetCategories:[1,"assetCategories"],form:[1,"form"],inventoryCategories:[1,"inventoryCategories"],selectAllAssetCategoriesByDefault:[1,"selectAllAssetCategoriesByDefault"],selectAllInventoryCategoriesByDefault:[1,"selectAllInventoryCategoriesByDefault"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:11,vars:3,consts:[["dropdownicon",""],["filtericon",""],[1,"user-group-associated-categories"],[1,"grid","flex-inline",3,"formGroup"],[1,"col-12"],[1,"medium-input"],["id","qware.usergroup.associated-categories.multiselect.asset-categories","formControlName","AssetCategoryIds","display","chip","optionLabel","Name","optionValue","Id","appendTo","body","variant","filled",3,"ngModelChange","options","maxSelectedLabels","fluid"],["id","qware.usergroup.associated-categories.label.asset-categories","for","qware.usergroup.associated-categories.multiselect.asset-categories"],[1,"material-icons"],["id","qware.usergroup.associated-categories.multiselect.inventory-categories","formControlName","InventoryCategoryIds","display","chip","optionLabel","Name","optionValue","Id","appendTo","body","variant","filled",3,"ngModelChange","options","maxSelectedLabels","fluid"],["id","qware.usergroup.associated-categories.label.inventory-categories","for","qware.usergroup.associated-categories.multiselect.inventory-categories"]],template:function(o,i){o&1&&(n(0,"div",2),e(1,` 8648 `),n(2,"div",3),e(3,`
8649 `),n(4,"div",4),e(5,` 8650 `),e(6,` 8651 `),_(7,lO,20,6)(8,pO,20,6),a(),e(9,` 8652 `),a(),e(10,` 8653`),a()),o&2&&(l(2),p("formGroup",i.form()),l(5),f(i.assetCategories()?7:-1),l(),f(i.inventoryCategories()?8:-1))},dependencies:[Ne,se,ge,Ni,Te,De,ie],encapsulation:2,changeDetection:0})}return r})();var $l=(()=>{class r{allStatusOptions=ee([]);allUserGroupOptions=ee([]);form=ee.required();static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-assigning-rules"]],inputs:{allStatusOptions:[1,"allStatusOptions"],allUserGroupOptions:[1,"allUserGroupOptions"],form:[1,"form"]},standalone:!1,decls:26,vars:9,consts:[[1,"grid","flex-inline",3,"formGroup"],[1,"col-12"],[1,"medium-input"],["formControlName","Statuses","labelId","qware.user-groups.assigning-rules.label.statuses","id","qware.user-groups.assigning-rules-e2e.statuses","label","TENANTGROUP.ASSIGNING_RULES.WORK_ORDER_STATUSES","elementId","qware.user-groups.assigning-rules.statuses",3,"tabindex","options"],["formControlName","AssignedToGroups","labelId","qware.user-groups.assigning-rules.label.user-groups","label","TENANTGROUP.ASSIGNING_RULES.USER_GROUPS","elementId","qware.user-groups.assigning-rules.user-groups","id","qware.user-groups.assigning-rules-e2e.user-groups",3,"tabindex","options","virtualScroll","virtualScrollItemSize"],[1,"medium-input","flex-inline","flex-space-between"],["translate",""],["id","qware.user-groups.assigning-rules-e2e.require-full-locations","name","RequireFullLocationsForWorkOrders","formControlName","RequireFullLocationsForWorkOrders",3,"tabindex","binary"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 8654 `),n(2,"div",1),e(3,` 8655 `),n(4,"div",2),e(5,` 8656 `),n(6,"qware-autocomplete",3),e(7,` 8657 `),a(),e(8,` 8658 `),a(),e(9,` 8659 `),n(10,"div",2),e(11,` 8660 `),n(12,"qware-autocomplete",4),e(13,` 8661 `),a(),e(14,` 8662 `),a(),e(15,` 8663 `),n(16,"div",5),e(17,` 8664 `),n(18,"label",6),e(19,"TENANTGROUP.ASSIGNING_RULES.REQUIRE_FULL_LOCATIONS_FOR_WORK_ORDERS"),a(),e(20,` 8665 `),n(21,"p-checkbox",7),e(22,` 8666 `),a(),e(23,` 8667 `),a(),e(24,` 8668 `),a(),e(25,` 8669`),a()),o&2&&(p("formGroup",i.form()),l(6),p("tabindex",4)("options",i.allStatusOptions()),l(6),p("tabindex",5)("options",i.allUserGroupOptions())("virtualScroll",!0)("virtualScrollItemSize",38),l(9),p("tabindex",6)("binary",!0))},dependencies:[yt,se,ge,wt,Te,De,$],encapsulation:2,changeDetection:0})}return r})();var zm=He(nt());function mO(r,d){if(r&1&&(e(0,` 8670 `),n(1,"small",17),e(2,` 8671 `),n(3,"div",6),e(4),a(),e(5,` 8672 `),a(),e(6,` 8673 `)),r&2){let t=d.$implicit;l(4),v(t)}}function cO(r,d){if(r&1&&(e(0,` 8674 `),G(1,mO,7,1,null,null,J)),r&2){let t,o=m(2);l(),k((t=o.validationErrors())==null?null:t.Name)}}function uO(r,d){r&1&&(e(0,` 8675 `),n(1,"span",18),e(2,"expand_more"),a(),e(3,` 8676 `))}function _O(r,d){if(r&1&&(e(0,` 8677 `),n(1,"small",17),e(2,` 8678 `),n(3,"div",6),e(4),a(),e(5,` 8679 `),a(),e(6,` 8680 `)),r&2){let t=d.$implicit;l(4),v(t)}}function EO(r,d){if(r&1&&(e(0,` 8681 `),G(1,_O,7,1,null,null,J)),r&2){let t,o=m(2);l(),k((t=o.validationErrors())==null?null:t.DefaultHomePage)}}function SO(r,d){if(r&1&&(e(0,` 8682 `),n(1,"small",17),e(2,` 8683 `),n(3,"div",6),e(4),a(),e(5,` 8684 `),a(),e(6,` 8685 `)),r&2){let t=d.$implicit;l(4),v(t)}}function xO(r,d){if(r&1&&(e(0,` 8686 `),G(1,SO,7,1,null,null,J)),r&2){let t,o=m(2);l(),k((t=o.validationErrors())==null?null:t.Description)}}function fO(r,d){if(r&1){let t=b();e(0,` 8687 `),n(1,"div",1),e(2,` 8688 `),n(3,"div",2),e(4,` 8689 `),n(5,"div",3),e(6,` 8690 `),n(7,"p-floatlabel"),e(8,` 8691 `),R(9,"input",4),e(10,` 8692 `),n(11,"label",5),e(12,` 8693 `),n(13,"span",6),e(14,"TENANTGROUP.GROUP_NAME"),a(),n(15,"span",7),e(16," *"),a(),e(17,` 8694 `),a(),e(18,` 8695 `),a(),e(19,` 8696 `),n(20,"small",8),e(21,` 8697 `),n(22,"div",9),e(23,` 8698 TENANTGROUP.ERROR.NAME_REQUIRED 8699 `),a(),e(24,` 8700 `),n(25,"div",10),e(26,` 8701 TENANTGROUP.ERROR.NAME_LENGTH 8702 `),a(),e(27,` 8703 `),a(),e(28,` 8704 `),_(29,cO,3,0),a(),e(30,` 8705 8706 `),n(31,"div",3),e(32,` 8707 `),n(33,"p-floatlabel"),e(34,`
8708 `),n(35,"p-select",11),e(36,` 8709 `),_(37,uO,4,0,"ng-template",null,0,A),e(39,` 8710 `),a(),e(40,` 8711 `),n(41,"label",12),e(42,` 8712 `),n(43,"span",6),e(44,"TENANTGROUP.DEFAULT_HOME_PAGE"),a(),e(45,` 8713 `),a(),e(46,` 8714 `),a(),e(47,` 8715 `),_(48,EO,3,0),a(),e(49,` 8716 `),a(),e(50,` 8717 8718 `),n(51,"div",13),e(52,` 8719 `),n(53,"div",3),e(54,` 8720 `),n(55,"p-floatlabel"),e(56,` 8721 `),n(57,"textarea",14),h("focus",function(){E(t);let i=m();return S(i.textareaFocus(!0))})("blur",function(){E(t);let i=m();return S(i.textareaFocus(!1))}),e(58," "),a(),e(59,` 8722 `),n(60,"label",15),e(61,` 8723 `),n(62,"span",6),e(63,"TENANTGROUP.DESCRIPTION"),a(),n(64,"span",7),e(65," *"),a(),e(66,` 8724 `),a(),e(67,` 8725 `),a(),e(68,` 8726 `),n(69,"small",8),e(70,` 8727 `),n(71,"div",16),e(72,` 8728 TENANTGROUP.ERROR.DESCRIPTION_REQUIRED 8729 `),a(),e(73,` 8730 `),n(74,"div",10),e(75,` 8731 TENANTGROUP.ERROR.DESCRIPTION_LENGTH 8732 `),a(),e(76,` 8733 `),a(),e(77,` 8734 `),_(78,xO,3,0),a(),e(79,` 8735 `),a(),e(80,` 8736 `),a(),e(81,` 8737`)}if(r&2){let t,o,i,s,c,u,x,C,O,w=m();l(),p("formGroup",w.form()),l(8),p("qwareFocus",w.autoFocus())("fluid",!0),l(11),p("hidden",((t=w.form())==null||t.controls==null||t.controls.Name==null?null:t.controls.Name.valid)||((t=w.form())==null||t.controls==null||t.controls.Name==null?null:t.controls.Name.pristine)&&!w.submitted),l(2),p("hidden",!(!((o=w.form())==null||o.controls==null||o.controls.Name==null||o.controls.Name.errors==null)&&o.controls.Name.errors.required)),l(3),p("hidden",!(!((i=w.form())==null||i.controls==null||i.controls.Name==null||i.controls.Name.errors==null)&&i.controls.Name.errors.maxlength)),l(4),f(w.validationErrors()&&((s=w.validationErrors())!=null&&s.Name)&&(!((s=w.form())==null||s.controls==null||s.controls.Name==null)&&s.controls.Name.untouched)?29:-1),l(6),p("tabindex",3)("autoDisplayFirst",!1)("options",w.defaultHomePageOptions)("fluid",!0),l(13),f(w.validationErrors()&&((c=w.validationErrors())!=null&&c.DefaultHomePage)&&(!((c=w.form())==null||c.controls==null||c.controls.DefaultHomePage==null)&&c.controls.DefaultHomePage.untouched)?48:-1),l(9),p("rows",1)("cols",30)("autoResize",!0)("fluid",!0),l(12),p("hidden",((u=w.form())==null||u.controls==null||u.controls.Description==null?null:u.controls.Description.valid)||((u=w.form())==null||u.controls==null||u.controls.Description==null?null:u.controls.Description.pristine)&&!w.submitted),l(2),p("hidden",!(!((x=w.form())==null||x.controls==null||x.controls.Description==null||x.controls.Description.errors==null)&&x.controls.Description.errors.required)),l(3),p("hidden",!(!((C=w.form())==null||C.controls==null||C.controls.Description==null||C.controls.Description.errors==null)&&C.controls.Description.errors.maxlength)),l(4),f(w.validationErrors()&&((O=w.validationErrors())!=null&&O.Description)&&(!((O=w.form())==null||O.controls==null||O.controls.Description==null)&&O.controls.Description.untouched)?78:-1)}}var zl=(()=>{class r{autoFocus=ee(!0);defaultHomePageOptions=[];form=ee();submitted=ee(!1);validationErrors=ee();textareaFocusChange=Dt();authService=te(de);translate=te(le);ngOnInit(){this.translate.get(["HOMEPAGE.ALL_MY_WORK_ORDERS","HOMEPAGE.ALL_OPEN_WORK_ORDERS","HOMEPAGE.CREATE_EVENT","HOMEPAGE.CREATE_WORK_ORDER","HOMEPAGE.DASHBOARD","HOMEPAGE.EVENT_LIST","HOMEPAGE.MY_OPEN_WORK_ORDERS","HOMEPAGE.OPEN_WORK_ORDERS_ASSIGNED_TO_ME","HOMEPAGE.WORK_ORDER_LIST"]).pipe(N()).subscribe(t=>{let o=[{label:t["HOMEPAGE.DASHBOARD"],value:Tr.dashboard+"/"+this.authService.tenant.Key},{label:t["HOMEPAGE.WORK_ORDER_LIST"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list},{label:t["HOMEPAGE.MY_OPEN_WORK_ORDERS"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.myWorkOrders},{label:t["HOMEPAGE.ALL_MY_WORK_ORDERS"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.allMyWorkOrders},{label:t["HOMEPAGE.OPEN_WORK_ORDERS_ASSIGNED_TO_ME"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.assignedToMe},{label:t["HOMEPAGE.ALL_OPEN_WORK_ORDERS"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.allOpenWorkOrders},{label:t["HOMEPAGE.CREATE_WORK_ORDER"],value:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.create}];this.authService.tenant.EventsModule&&(o.push({label:t["HOMEPAGE.CREATE_EVENT"],value:Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.create}),o.push({label:t["HOMEPAGE.EVENT_LIST"],value:Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.list})),this.defaultHomePageOptions=zm.default.sortBy(o,s=>(s.label??"").toLowerCase());let i=this.form();i&&i.get("DefaultHomePage")?.setValue(i.get("DefaultHomePage")?.value??"")})}textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-info"]],inputs:{autoFocus:[1,"autoFocus"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:1,vars:1,consts:[["dropdownicon",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.usergroup.group-information.input.group-name","tabindex","1","type","text","pInputText","","name","Group Name","formControlName","Name","variant","filled",3,"qwareFocus","fluid"],["id","qware.usergroup.group-information.label.group-name","for","qware.usergroup.group-information.input.group-name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.usergroup.group-information.error.name-req","translate","",3,"hidden"],["translate","",3,"hidden"],["id","qware.usergroup.group-information.input.home-page","formControlName","DefaultHomePage","variant","filled",3,"tabindex","autoDisplayFirst","options","fluid"],["id","qware.usergroup.group-information.label.home-page","for","qware.usergroup.group-information.input.home-page"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","2","id","qware.usergroup.group-information.textarea","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.usergroup.group-information.label.description","for","qware.usergroup.group-information.textarea"],["id","qware.usergroup.group-information.error.desc-req","translate","",3,"hidden"],[1,"validation-error"],[1,"material-icons"]],template:function(o,i){o&1&&_(0,fO,82,20),o&2&&f(i.form()?0:-1)},dependencies:[Ne,je,Ae,se,ge,ye,Te,De,it,ri,$],styles:[".text-box[_ngcontent-%COMP%]{min-height:93px!important}"],changeDetection:0})}return r})();var Xl=(()=>
8737{class r{disableSelectionOptions=ee(!1);form=ee.required();roleTreeNodes=ee([]);selectedTemplateOption=ee();submitted=ee(!1);userGroupTemplateOptions=ee([]);validationErrors=ee();selectedTemplateOptionChange=Dt();templateOptionChanged(t){t&&this.form().get("ParentId")?.setValue(t),this.selectedTemplateOptionChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-privileges"]],inputs:{disableSelectionOptions:[1,"disableSelectionOptions"],form:[1,"form"],roleTreeNodes:[1,"roleTreeNodes"],selectedTemplateOption:[1,"selectedTemplateOption"],submitted:[1,"submitted"],userGroupTemplateOptions:[1,"userGroupTemplateOptions"],validationErrors:[1,"validationErrors"]},outputs:{selectedTemplateOptionChange:"selectedTemplateOptionChange"},standalone:!1,decls:12,vars:11,consts:[[1,"grid","flex-inline",3,"formGroup"],[1,"col-12"],[1,"single-layer",2,"padding","1rem 1rem 1.5rem"],["formControlName","Roles","selectionType","hierarchy",3,"selectionOptionChange","primaryNodes","requiredMark","showSelectionOptions","selectionOptionsLabel","selectionOptions","disableSelectionOptions","selectedSelectionOption","sortSelectionOptions"]],template:function(o,i){o&1&&(n(0,"div",0),e(1,` 8738 `),n(2,"div",1),e(3,` 8739 `),n(4,"div",2),e(5,` 8740 `),n(6,"qware-hierarchy-picker",3),I(7,"translate"),h("selectionOptionChange",function(c){return i.templateOptionChanged(c)}),e(8,` 8741 `),a(),e(9,` 8742 `),a(),e(10,` 8743 `),a(),e(11,` 8744`),a()),o&2&&(p("formGroup",i.form()),l(6),q("selectionOptionsLabel",y(7,9,"TENANTGROUP.PRIVILEGE_TEMPLATE")),p("primaryNodes",i.roleTreeNodes())("requiredMark",!0)("showSelectionOptions",!0)("selectionOptions",i.userGroupTemplateOptions())("disableSelectionOptions",i.disableSelectionOptions())("selectedSelectionOption",i.selectedTemplateOption())("sortSelectionOptions",!1))},dependencies:[se,ge,Ri,Te,De,ie],encapsulation:2,changeDetection:0})}return r})();function hO(r,d){if(r&1){let t=b();e(0,` 8745 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8746 `),n(3,"span",17),e(4),a(),e(5,` 8747 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8748 `),a(),e(10,` 8749 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANTGROUP.GROUP_INFORMATION"))}}function CO(r,d){if(r&1){let t=b();e(0,` 8750 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8751 `),n(3,"span",17),e(4),a(),e(5,` 8752 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8753 `),a(),e(10,` 8754 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANTGROUP.PRIVILEGES"))}}function vO(r,d){if(r&1){let t=b();e(0,` 8755 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8756 `),n(3,"span",17),e(4),a(),e(5,` 8757 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8758 `),a(),e(10,` 8759 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANTGROUP.ASSIGNING_RULES.ASSIGNING_RULES"))}}function gO(r,d){if(r&1){let t=b();e(0,` 8760 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 8761 `),n(3,"span",17),e(4),a(),e(5,` 8762 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 8763 `),a(),e(10,` 8764 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"TENANTGROUP.ASSOCIATED_CATEGORIES.ASSOCIATED_CATEGORIES"))}}function TO(r,d){if(r&1){let t=b();e(0,` 8765 `),n(1,"div",3),e(2,` 8766 `),n(3,"h3",4),e(4,` 8767 TENANTGROUP.CREATE_USER_GROUP 8768 `),a(),e(5,` 8769 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 8770 `),n(8,"p-step-list"),e(9,` 8771 `),n(10,"p-step",6),e(11,` 8772 `),_(12,hO,11,4,"ng-template",null,0,A),e(14,` 8773 `),a(),e(15,` 8774 `),n(16,"p-step",6),e(17,` 8775 `),_(18,CO,11,4,"ng-template",null,0,A),e(20,` 8776 `),a(),e(21,` 8777 `),n(22,"p-step",6),e(23,` 8778 `),_(24,vO,11,4,"ng-template",null,0,A),e(26,` 8779 `),a(),e(27,` 8780 `),n(28,"p-step",6),e(29,` 8781 `),_(30,gO,11,4,"ng-template",null,0,A),e(32,` 8782 `),a(),e(33,` 8783 `),a(),e(34,` 8784 `),n(35,"p-step-panels"),e(36,` 8785 `),n(37,"p-card"),e(38,` 8786 `),n(39,"div",7),e(40,` 8787 `),n(41,"h4",8),e(42,`
8788 TENANTGROUP.GROUP_INFORMATION 8789 `),a(),e(43,` 8790 `),n(44,"qware-user-group-info",9),h("textareaFocusChange",function(i){E(t);let s=m();return S(s.updateTextAreaFocus(i))}),e(45,` 8791 `),a(),e(46,` 8792 `),a(),e(47,` 8793 `),n(48,"div",7),e(49,` 8794 `),n(50,"h4",8),e(51,` 8795 TENANTGROUP.PRIVILEGES 8796 `),a(),e(52,` 8797 `),n(53,"qware-user-group-privileges",10),j("selectedTemplateOptionChange",function(i){E(t);let s=m();return W(s.selectedTemplateOption,i)||(s.selectedTemplateOption=i),S(i)}),e(54,` 8798 `),a(),e(55,` 8799 `),a(),e(56,` 8800 `),n(57,"div",7),e(58,` 8801 `),n(59,"h4",8),e(60,` 8802 TENANTGROUP.ASSIGNING_RULES.ASSIGNING_RULES 8803 `),a(),e(61,` 8804 `),n(62,"qware-user-group-assigning-rules",11),e(63,` 8805 `),a(),e(64,` 8806 `),a(),e(65,` 8807 `),n(66,"div",7),e(67,` 8808 `),n(68,"h4",8),e(69,` 8809 TENANTGROUP.ASSOCIATED_CATEGORIES.ASSOCIATED_CATEGORIES 8810 `),a(),e(70,` 8811 `),n(71,"qware-user-group-associated-categories",12),e(72,` 8812 `),a(),e(73,` 8813 `),a(),e(74,` 8814 `),n(75,"div",13),e(76,` 8815 `),n(77,"p-button",14),I(78,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(79,` 8816 `),a(),e(80,` 8817 `),n(81,"p-button",15),I(82,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(83,` 8818 `),a(),e(84,` 8819 `),a(),e(85,` 8820 `),a(),e(86,` 8821 `),a(),e(87,` 8822 `),a(),e(88,` 8823 `),a(),e(89,` 8824 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1),l(6),ve("p-disabled",t.stepIndex<2),p("value",2),l(6),ve("p-disabled",t.stepIndex<3),p("value",3),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.GroupInformation)("submitted",t.submitted)("validationErrors",t.validationErrors),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.Privileges)("submitted",t.submitted)("validationErrors",t.validationErrors)("roleTreeNodes",t.roleTreeNodes)("userGroupTemplateOptions",t.userGroupTemplateOptions),H("selectedTemplateOption",t.selectedTemplateOption),l(4),p("hidden",t.stepIndex!==2),l(5),p("form",t.form.controls.AssigningRules)("allStatusOptions",t.allStatusOptions)("allUserGroupOptions",t.allUserGroupOptions),l(4),p("hidden",t.stepIndex!==3),l(5),p("form",t.form.controls.AssociatedCategories)("submitted",t.submitted)("validationErrors",t.validationErrors)("assetCategories",t.assetCategories)("inventoryCategories",t.inventoryCategories)("selectAllAssetCategoriesByDefault",!0)("selectAllInventoryCategoriesByDefault",!0),l(6),q("label",y(78,39,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(82,41,t.stepIndex===3?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.steps[t.stepIndex].control!=null&&t.steps[t.stepIndex].control.valid))}}var Jm=(()=>{class r{assetService;authService;fb;inventoryService;responseService;roleService;route;router;statusService;toastService;translate;userGroupService;userGroupTemplateService;allStatusOptions=[];allUserGroupOptions=[];assetCategories=[];displaySpinner=!0;form;hasEventsModule=!1;inventoryCategories=[];isLoaded=!1;roleTreeNodes=[];selectedTemplateOption;stepIndex=0;steps=[];submitted=!1;textareaFocused=!1;userGroupTemplateOptions=[];validationErrors;MODULES="MODULES.";ROLES="ROLES.";TEMPLATES="GROUP_TEMPLATES.";constructor(t,o,i,s,c,u,x,C,O,w,F,L,U){this.assetService=t,this.authService=o,this.fb=i,this.inventoryService=s,this.responseService=c,this.roleService=u,this.route=x,this.router=C,this.statusService=O,this.toastService=w,this.translate=F,this.userGroupService=L,this.userGroupTemplateService=U,this.hasEventsModule=this.authService.tenant.EventsModule}ngOnInit(){this.defineForm(),ue([this.userGroupService.getUserGroups(this.authService.tenant.Id),this.statusService.getStatuses(this.authService.tenant.Id),this.userGroupTemplateService.getUserGroupTemplates(this.hasEventsModule),this.roleService.getRoles(),this.assetService.getAssetCategories(!1,!1),this.inventoryService.getInventoryCategories(!1)]).subscribe(t=>{let o=t[0],i=t[1],s=t[2],c=t[3],u=t[4],x=t[5],C=s.find(L=>L.Name==="Requester"),O=c.filter(L=>C?.Roles?.includes(L.Id??"")).map(L=>L.Id??"");this.allUserGroupOptions=o.filter(L=>L.State===M.ACTIVE&&!ci.includes(L.Name??"")).map(L=>({label:L.Name,value:L.Id})),this.allStatusOptions=i.filter(L=>L.State===M.ACTIVE&&L.Type===Li.WORK_ORDERS).map(L=>({label:L.Name,value:L.Id})),this.assetCategories=To.default.orderBy(u.filter(L=>L.State===M.ACTIVE),L=>L.Name?.toLowerCase()),this.inventoryCategories=To.default.orderBy(x.filter(L=>L.State===M.ACTIVE),L=>L.Name?.toLowerCase()),this.roleTreeNodes=[],c=c.filter(L=>this.authService.userHasPrivilege(ae.IS_SUPER_USER)||L.Name!==ae.CAN_ACCESS_TENANT_MANAGEMENT&&L.Name!==ae.CAN_RESTORE_DELETED&&L.Name!==ae.CAN_VIEW_DELETED);let w=To.default.flatten(c.map(L=>[this.MODULES+L.ModuleName,this.ROLES+L.Name])),F=s.map(L=>this.TEMPLATES+L.Name);this.translate.get(To.default.concat(w,F,["SHARED.FREE","SHARED.PAID"])).pipe(N()).subscribe(L=>
8824{c.forEach(U=>{let V=!1;U.Name&&(V=this.authService.userHasPrivilege(U.Name)||this.authService.userHasPrivilege(ae.IS_SUPER_USER)),U.ModuleName=L[this.MODULES+U.ModuleName],U.Name=L[this.ROLES+U.Name];let z=this.roleTreeNodes.find(ce=>ce.data.name===U.ModuleName);z||(z=new yr,z.data={id:U.ModuleName,name:U.ModuleName,children:[],selectable:!0,invalid:!0},this.roleTreeNodes.push(z)),V||(z.data.selectable=!1),this.roleTreeNodes.push(this.roleService.convertToTreeNode(U,O,[L["SHARED.FREE"],L["SHARED.PAID"]],V))}),s=We.sortArrBasedOnAnotherArr(s,Ko,"Name"),this.userGroupTemplateOptions=s.filter(U=>U.Name&&U.Id).map(U=>({label:L[this.TEMPLATES+U.Name],value:U.Id,data:this.roleTreeNodes.filter(V=>U.Roles&&U.Roles.indexOf(V.data.id)>-1)})),this.steps=[{label:"TENANTGROUP.GROUP_INFORMATION",value:0,control:this.form.get("GroupInformation")},{label:"TENANTGROUP.PRIVILEGES",value:1,control:this.form.get("Privileges")},{label:"TENANTGROUP.ASSIGNING_RULES.ASSIGNING_RULES",value:2,control:this.form.get("AssigningRules")},{label:"TENANTGROUP.ASSOCIATED_CATEGORIES.ASSOCIATED_CATEGORIES",value:3,control:this.form.get("AssociatedCategories")}],this.isLoaded=!0,this.displaySpinner=!1})})}defineForm(){this.form=this.fb.group({GroupInformation:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),DefaultHomePage:this.fb.control(Tr.dashboard+"/"+this.authService.tenant.Key),Description:this.fb.control("",[T.required,T.maxLength(re)])}),Privileges:this.fb.group({ParentId:this.fb.control("",[T.required]),Roles:this.fb.control([])}),AssigningRules:this.fb.group({Statuses:this.fb.control([]),AssignedToGroups:this.fb.control([]),RequireFullLocationsForWorkOrders:this.fb.control(!1)}),AssociatedCategories:this.fb.group({AssetCategoryIds:this.fb.control([]),InventoryCategoryIds:this.fb.control([])})})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../../"+P.userList],t)}else this.stepIndex--}stepSubmit(t){this.steps[t].control?.valid&&(t<3?this.stepIndex++:this.submitForm(new lo().parseForm(this.form.value,this.form.get("Privileges.Roles")?.value??[],this.form.get("AssigningRules.Statuses")?.value??[],this.form.get("AssigningRules.AssignedToGroups")?.value??[],this.form.get("AssociatedCategories.AssetCategoryIds")?.value??[],this.form.get("AssociatedCategories.InventoryCategoryIds")?.value??[])))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,this.resetStatusesAndUserGroupValues(t),this.userGroupService.createUserGroup(t,this.authService.tenant.Id).pipe(we(o=>(t.Id=o,this.statusService.updateStatusGroups(t)))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.CREATE","../../"+P.userList,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(i=>i.control),this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}resetStatusesAndUserGroupValues(t){t.StatusIds=t.StatusIds?.map(o=>o.value),t.AssignedToGroups=t.AssignedToGroups?.map(o=>o.value)}updateTextAreaFocus(t){this.textareaFocused=t}static \u0275fac=function(o){return new(o||r)(g(Pa),g(de),g(be),g(Wi),g(Re),g(hn),g(he),g(Be),g(Oi),g(Se),g(le),g(Tt),g(kn))};static \u0275cmp=B({type:r,selectors:[["qware-user-group-create"]],standalone:!1,decls:7,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.usergroup.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.usergroup.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors"],[3,"selectedTemplateOptionChange","form","submitted","validationErrors","roleTreeNodes","userGroupTemplateOptions","selectedTemplateOption"],[3,"form","allStatusOptions","allUserGroupOptions"],[3,"form","submitted","validationErrors","assetCategories","inventoryCategories","selectAllAssetCategoriesByDefault","selectAllInventoryCategoriesByDefault"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.usergroup.group-information.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.usergroup.group-information.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("key
8824down.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(1,` 8825 `),n(2,"qware-spinner",2),e(3,` 8826 `),_(4,TO,90,43),a(),e(5,` 8827`),a(),e(6,` 8828`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,Kl,$l,zl,Xl,ie],encapsulation:2})}return r})();var cr=He(nt());var IO=["actionsMenu"],bO=["shades"],yO=["drawer"],AO=r=>({"lg:col-8":r}),RO=()=>["0"];function wO(r,d){if(r&1&&(e(0,` 8829 `),n(1,"a",29),e(2,` 8830 `),n(3,"span",30),e(4),a(),e(5,` 8831 `),n(6,"span",31),e(7),a(),e(8,` 8832 `),a(),e(9,` 8833 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function DO(r,d){r&1&&(e(0,` 8834 `),n(1,"span",33),e(2,"SHARED.ACTIONS"),a(),e(3,` 8835 `),n(4,"i",34),e(5,"expand_more"),a(),e(6,` 8836 `))}function LO(r,d){if(r&1){let t=b();e(0,` 8837 `),n(1,"p-button",32),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 8838 `),_(3,DO,7,0,"ng-template",null,4,A),e(5,` 8839 `),a(),e(6,` 8840 `)}r&2&&(l(),p("raised",!0))}function NO(r,d){if(r&1&&(e(0,` 8841 `),n(1,"a",29),e(2,` 8842 `),n(3,"span",30),e(4),a(),e(5,` 8843 `),n(6,"span",31),e(7),a(),e(8,` 8844 `),a(),e(9,` 8845 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function OO(r,d){if(r&1){let t=b();e(0,` 8846 `),n(1,"div",35),e(2,` 8847 `),n(3,"p-menu",36,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 8848 `),_(6,NO,10,2,"ng-template",null,1,A),e(8,` 8849 `),a(),e(9,` 8850 `),n(10,"p-button",37),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 8851 `),n(12,"i",34),e(13,"more_vert"),a(),e(14,` 8852 `),a(),e(15,` 8853 `),a(),e(16,` 8854 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function FO(r,d){r&1&&(e(0,` 8855 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 8856 `))}function MO(r,d){r&1&&(e(0,` 8857 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 8858 `))}function UO(r,d){if(r&1&&(e(0,` 8859 `),_(1,FO,4,0)(2,MO,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function PO(r,d){r&1&&(e(0,` 8860 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 8861 `))}function GO(r,d){r&1&&(e(0,` 8862 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 8863 `))}function kO(r,d){if(r&1&&(e(0,` 8864 `),_(1,PO,4,0)(2,GO,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function VO(r,d){r&1&&(e(0,` 8865 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 8866 `))}function qO(r,d){r&1&&(e(0,` 8867 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 8868 `))}function BO(r,d){if(r&1&&(e(0,` 8869 `),_(1,VO,4,0)(2,qO,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function HO(r,d){r&1&&(e(0,` 8870 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 8871 `))}function WO(r,d){r&1&&(e(0,` 8872 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 8873 `))}function jO(r,d){if(r&1&&(e(0,` 8874 `),_(1,HO,4,0)(2,WO,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function YO(r,d){if(r&1){let t=b();e(0,` 8875 `),n(1,"p-button",38),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 8876 `),a(),e(4,` 8877 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function QO(r,d){r&1&&(e(0,` 8878 `),n(1,"div",41),e(2,` 8879 `),n(3,"span",42),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 8880 `),a(),e(6,` 8881 `))}function KO(r,d){if(r&1){let t=b();e(0,` 8882 `),n(1,"qware-spinner",43),e(2,` 8883 `),n(3,"div",44),e(4,` 8884 `),n(5,"qware-entity-history",45),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 8885 `),a(),e(7,` 8886 `),a(),e(8,` 8887 `),a(),e(9,` 8888 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function $O(r,d){if(r&1){let t=b();e(0,` 8889 `),n(1,"div",39),e(2,` 8890 `),n(3,"p-drawer",40,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 8891 `),_(6,QO,7,0,"ng-template",null,7,A),e(8,` 8892 `),_(9,KO,10,7,"ng-template",null,4,A),e(11,` 8893 `),a(),e(12,` 8894 `),a(),e(13,` 8895 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var ec=(()=>{class r{assetService;authService;cacheService;cdr;confirmationService;fb;inventoryService;responseService;roleService;route;statusService;toastService;translate;userGroupService;userGroupTemplateService;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];allStatuses=[];allStatusOptions=[];allUserGroupOptions=[];allUserGroups=[];assetCategories=[];disableSelectionOptions=!1;displaySpinner=!0;form;hasEventsModule=!1;historyArrayProperties=["Roles","AssignedToGroups","StatusIds"];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;inventoryCategories=[];isActive=!1;locale;moreItems=[];roleTreeNodes=[];selectedTemplateOption;shadeFormGroups=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;statuses=[];submitted=!1;userEnabledSidebar=!1;userGroup;userGroups=[];userGroupTemplateOptions=[];validationErrors;auditLoggingDisabled=!0;userGroupLimit;isSuperUser=!1;userListRoute="../../../"+P.userList;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};defaultHomepages=[];MODULES="MODULES.";ROLES="ROLES.";TEMPLATES="GROUP_TEMPLATES.";roles=[];translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L,U,V,z){this.assetService=t,this.authService=o,this.cacheService=i,this.cdr=s,this.confirmationService=c,this.fb=u,this.inventoryService=x,this.responseService=C,this.roleService=O,this.route=w,this.statusService=F,this.toastService=L,this.translate=U,this.userGroupService=V,this.userGroupTemplateService=z,this.isSuperUser=this.authService.userHasPrivilege(ae.IS_SUPER_USER)}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser(),this.userGroupLimit=this.authService.qwareSubscription?.userGroupLimit,this.hasEventsModule=this.authService.tenant.EventsModule,this.configureRightDrawer(),this.createForm(),this.loadData()}
8895loadData(){let t=this.route.snapshot.params.id;this.historyIdMap=new Map,ue([this.translate.get(["SHARED.DISABLED","SHARED.DISABLE","SHARED.DELETED","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","AUDIT.USER_GROUP","HOMEPAGE.DASHBOARD","HOMEPAGE.WORK_ORDER_LIST","HOMEPAGE.MY_OPEN_WORK_ORDERS","HOMEPAGE.CREATE_EVENT","HOMEPAGE.OPEN_WORK_ORDERS_ASSIGNED_TO_ME","HOMEPAGE.ALL_OPEN_WORK_ORDERS","HOMEPAGE.CREATE_WORK_ORDER","HOMEPAGE.EVENT_LIST","SHARED.AUDIT_LOG"]).pipe(N()),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.statusService.getStatuses(this.authService.tenant.Id),this.userGroupService.getUserGroup(t),this.statusService.getStatusGroups(t),this.userGroupTemplateService.getUserGroupTemplates(this.hasEventsModule),this.roleService.getRoles(),this.assetService.getAssetCategories(!1,!1),this.inventoryService.getInventoryCategories(!1)]).subscribe({next:o=>{this.translations=o[0],this.allUserGroups=o[1],this.allStatuses=o[2].filter(L=>L.Type===Li.WORK_ORDERS),this.userGroup=o[3];let i=o[4],s=o[5];this.roles=o[6];let c=o[7],u=o[8];this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"alt_list",command:()=>this.toggleSidebar()}];let x=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableUserGroup()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableUserGroup()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteUserGroup()}];this.userGroup?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&x.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreUserGroup()}),this.actionItems=x.filter(L=>this.userGroup?.State===M.DISABLED?L.id!=="disable.action":this.userGroup?.State===M.DELETED?L.id!=="disable.action"&&L.id!=="enable.action"&&L.id!=="delete.action":L.id!=="enable.action"),this.userGroups=this.allUserGroups.filter(L=>L.State===M.ACTIVE&&!ci.includes(L.Name??"")),this.allUserGroupOptions=this.userGroups.map(L=>({label:L.Name,value:L.Id})),this.statuses=this.allStatuses.filter(L=>L.State===M.ACTIVE),this.allStatusOptions=this.statuses.map(L=>({label:L.Name,value:L.Id})),this.setSelectedStatuses(i),this.setSelectedAssignedToGroups(),this.setSelectedAssociatedCategories(c,u),this.setCurrentValuesForArrays();let C=s.find(L=>L.Name==="Requester"),O=this.roles.filter(L=>C?.Roles?.includes(L.Id??"")).map(L=>L.Id??""),w=cr.default.flatten(this.roles.map(L=>[this.MODULES+L.ModuleName,this.ROLES+L.Name])),F=s.map(L=>this.TEMPLATES+L.Name);this.roleTreeNodes=[],this.translate.get(cr.default.concat(w,F,["SHARED.FREE","SHARED.PAID"])).pipe(N()).subscribe(L=>{this.roles.forEach(U=>{let V=!1;U.Name&&(V=this.authService.userHasPrivilege(U.Name)||this.authService.userHasPrivilege(ae.IS_SUPER_USER)),U.ModuleName=L[this.MODULES+U.ModuleName],U.Name=L[this.ROLES+U.Name];let z=this.roleTreeNodes.find(ce=>ce.data.name===U.ModuleName);z||(z=new yr,z.data={id:U.ModuleName,name:U.ModuleName,children:[],selectable:!0,invalid:!0},this.roleTreeNodes.push(z)),V||(z.data.selectable=!1),this.roleTreeNodes.push(this.roleService.convertToTreeNode(U,O,[L["SHARED.FREE"],L["SHARED.PAID"]],V))})}),s=We.sortArrBasedOnAnotherArr(s,Ko,"Name"),this.userGroupTemplateOptions=s.filter(L=>L.Name&&L.Id).map(L=>({label:L.Name,value:L.Id,data:this.roleTreeNodes.filter(U=>L.Roles&&L.Roles.indexOf(U.data.id)>-1)})),this.cdr.detectChanges(),this.selectedTemplateOption=this.userGroup.ParentId,this.userGroup.StatusIds&&this.userGroup.StatusIds.forEach(L=>{if(!this.allStatusOptions.find(U=>U.value===L.value)){let U=this.allStatuses.find(V=>V.Id===L.value);if(U&&this.userGroup?.StatusIds){let V=U.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":U.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.userGroup.StatusIds.find(z=>z===L).label=U.Name+V}}}),this.userGroup.AssignedToGroups&&this.userGroup.AssignedToGroups.forEach(L=>{if(!this.allUserGroupOptions.find(U=>U.value===L.value)){let U=this.allUserGroups.find(V=>V.Id===L.value);if(U&&this.userGroup?.AssignedToGroups){let V=U.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":U.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.userGroup.AssignedToGroups.find(z=>z===L).label=U.Name+V}}}),this.defaultHomepages=[{Path:Tr.dashboard+"/"+this.authService.tenant.Key,Name:this.translations["HOMEPAGE.DASHBOARD"]},{Path:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list,Name:this.translations["HOMEPAGE.WORK_ORDER_LIST"]},{Path:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.myWorkOrders,Name:this.translations["HOMEPAGE.MY_OPEN_WORK_ORDERS"]},{Path:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.allOpenWorkOrders,Name:this.translations["HOMEPAGE.ALL_OPEN_WORK_ORDERS"]},{Path:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.list+"/"+At.assignedToMe,Name:this.translations["HOMEPAGE.OPEN_WORK_ORDERS_ASSIGNED_TO_ME"]},{Path:At.workOrder+"/"+this.authService.tenant.Key+"/"+At.create,Name:this.translations["HOMEPAGE.CREATE_WORK_ORDER"]}],this.authService.tenant.EventsModule&&(this.defaultHomepages.push({Path:Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.create,Name:this.translations["HOMEPAGE.CREATE_EVENT"]}),this.defaultHomepages.push({Path:Ti.event+"/"+this.authService.tenant.Key+"/"+Ti.list,Name:this.translations["HOMEPAGE.EVENT_LIST"]})),this.setHistoryParams(),this.form.patchValue(new lo().toForm(this.userGroup)),this.userGroup.State==="DELETED"&&this.form.disable(),this.displaySpinner=!1},error:o=>{this.responseService.onDataError(o,this.userListRoute,this.route)}})}setCurrentValuesForArrays(){this.userGroup&&(this.form.get("Privileges.Roles")?.setValue(this.userGroup.Roles?this.userGroup.Roles:[]),this.form.get("AssigningRules.AssignedToGroups")?.setValue(this.userGroup.AssignedToGroups?this.userGroup.AssignedToGroups:[]),this.form.get("AssigningRules.Statuses")?.setValue(this.userGroup.StatusIds??[]),this.form.get("AssociatedCategories.AssetCategoryIds")?.setValue(this.userGroup.AssetCategoryIds?this.userGroup.AssetCategoryIds:[]),this.form.get("AssociatedCategories.InventoryCategoryIds")?.setValue(this.userGroup.InventoryCategoryIds?this.userGroup.InventoryCategoryIds:[]))}setSelectedAssignedToGroups(){if(this.userGroup){let t=Array.apply([],this.userGroup.AssignedToGroups);this.userGroup.AssignedToGroups=[],this.userGroup.AssignedToGroups=this.allUserGroups.filter(o=>t.find(i=>o.Id===i)).map(o=>({label:o.Name,value:o.Id}))}}setSelectedStatuses(t){this.userGroup&&t.StatusIds&&(this.userGroup.StatusIds=[],this.userGroup.StatusIds=this.allStatuses.filter(o=>t.StatusIds?.find(i=>o.Id===i)).map(o=>({label:o.Name,value:o.Id})))}setSelectedAssociatedCategories(t,o){t.forEach(c=>{c.State===M.ACTIVE?this.assetCategories.push(c):c.State===M.DISABLED&&this.userGroup?.AssetCategoryIds?.includes(c.Id??"")?(c.Name=c.Name+" (Disabled)",this.assetCategories.push(c)):c.State===M.DELETED&&this.userGroup?.AssetCategoryIds?.includes(c.Id??"")&&(c.Name=c.Name+" (Deleted)",this.assetCategories.push(c))}),o.forEach(c=>{c.State===M.ACTIVE?this.inventoryCategories.push(c):c.State===M.DISABLED&&this.userGroup?.InventoryCategoryIds?.includes(c.Id??"")?(c.Name=c.Name+" (Disabled)",this.inventoryCategories.push(c)):c.State===M.DELETED&&this.userGroup?.InventoryCategoryIds?.includes(c.Id??"")&&(c.Name=c.Name+" (Deleted)",this.inventoryCategories.push(c))}),this.assetCategories=cr.default.orderBy(this.assetCategories,c=>c.Name?.toLowerCase()),this.inventoryCategories=cr.default.orderBy(this.inventoryCategories,c=>c.Name?.toLowerCase());let i=[];
8895this.assetCategories.forEach(c=>{this.userGroup?.AssetCategoryIds?.includes(c.Id??"")&&i.push(c.Id??"")});let s=[];this.inventoryCategories.forEach(c=>{this.userGroup?.InventoryCategoryIds?.includes(c.Id??"")&&s.push(c.Id??"")}),this.userGroup&&(this.userGroup.AssetCategoryIds=i,this.userGroup.InventoryCategoryIds=s)}createForm(){this.form=this.fb.group({GroupInformation:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),DefaultHomePage:this.fb.control(""),Description:this.fb.control("",[T.required,T.maxLength(re)])}),Privileges:this.fb.group({ParentId:this.fb.control(""),Roles:this.fb.control([])}),AssigningRules:this.fb.group({Statuses:this.fb.control([]),AssignedToGroups:this.fb.control([]),RequireFullLocationsForWorkOrders:this.fb.control(!1)}),AssociatedCategories:this.fb.group({AssetCategoryIds:this.fb.control([]),InventoryCategoryIds:this.fb.control([])})}),this.shadeFormGroups=[this.form.get("GroupInformation"),this.form.get("Privileges"),this.form.get("AssigningRules"),this.form.get("AssociatedCategories")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.USER_GROUP"]+' "'+this.userGroup?.Name+'"';let t=new Map;t.set("DefaultHomepage",[this.defaultHomepages,"Path","Name"]),t.set("Roles",[this.roles,"Id","Name"]),t.set("AssignedToGroups",[this.userGroups,"Id","Name"]),t.set("StatusIds",[this.statuses,"Id","Name"]),t.set("AssetCategoryIds",[this.assetCategories,"Id","Name"]),t.set("InventoryCategoryIds",[this.inventoryCategories,"Id","Name"]),this.historyIdMap=t;let o=new Map;o.set("Name","TENANTGROUP.GROUP_NAME"),o.set("Description","TENANTGROUP.DESCRIPTION"),o.set("ParentName","TENANTGROUP.PRIVILEGE_TEMPLATE"),o.set("DefaultHomepage","TENANTGROUP.DEFAULT_HOME_PAGE"),o.set("Roles","TENANTGROUP.PRIVILEGES"),o.set("StatusIds","TENANTGROUP.ASSIGNING_RULES.WORK_ORDER_STATUSES"),o.set("AssignedToGroups","TENANTGROUP.ASSIGNING_RULES.USER_GROUPS"),o.set("AssetCategories","TENANTGROUP.ASSOCIATED_CATEGORIES.ASSET_CATEGORIES"),o.set("InventoryCategories","TENANTGROUP.ASSOCIATED_CATEGORIES.INVENTORY_CATEGORIES"),this.historyNameMap=o}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new lo().parseForm(this.form.value,this.form.get("Privileges.Roles")?.value??[],this.form.get("AssigningRules.Statuses")?.value??[],this.form.get("AssigningRules.AssignedToGroups")?.value??[],this.form.get("AssociatedCategories.AssetCategoryIds")?.value??[],this.form.get("AssociatedCategories.InventoryCategoryIds")?.value??[]);this.resetStatusesAndUserGroupValues(t),t.Id=this.userGroup?.Id,t.State=this.userGroup?.State??M.ACTIVE,this.userGroupService.updateUserGroup(t).pipe(we(()=>this.statusService.updateStatusGroups(t))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.SAVE",this.userListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}resetStatusesAndUserGroupValues(t){t.StatusIds=t.StatusIds?.map(o=>o.value),t.AssignedToGroups=t.AssignedToGroups?.map(o=>o.value)}disableUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userGroupService.disableUserGroup(this.userGroup.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_TENANT_GROUPS),this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.DISABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userGroupService.enableUserGroup(this.userGroup.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_TENANT_GROUPS),this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.ENABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userGroupService.deleteUserGroup(this.userGroup.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_TENANT_GROUPS),this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.DELETE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreUserGroup(){this.actionsMenu.hide();let t=this.authService.tenant.UserGroupCount;t&&cr.default.isNumber(this.userGroupLimit)&&t>=this.userGroupLimit?this.translate.get(["SHARED.ERROR_LABEL","SUBSCRIPTION.ERROR.USER_GROUP_LIMIT_REACHED"],{limit:this.userGroupLimit}).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SUBSCRIPTION.ERROR.USER_GROUP_LIMIT_REACHED"])}):this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"restorePromptDialog",header:o["SHARED.RESTORE_HEADER"],message:o["SHARED.RESTORE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userGroupService.restoreUserGroup(this.userGroup.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_TENANT_GROUPS),this.displaySpinner=!1,this.responseService.onSuccess("TENANTGROUP.SUCCESS.RESTORE",this.userListRoute,this.route)},error:i=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=cr.default.clone(this.showSidebar)}static \u0275fac=function(o){return new(o||r)(g(Pa),g(de),g(ei),g(Mo),g(mt),g(be),g(Wi),g(Re),g(hn),g(he),g(Oi),g(Se),g(le),g(Tt),g(kn))};static \u0275cmp=B({type:r,selectors:[["qware-user-group-edit"]],viewQuery:function(o,i){if(o&1&&(X(IO,7),X(bO,7),X(yO,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:122,vars:52,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.user-groups.edit",1,"grid"],["id","qware.user-groups.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.user-groups.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.user-groups.edit.actions-menu",3,"model","popup"],["id","qware.user-groups.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.user-groups.edit.group-info-shade","value","0"],[1,"accordion-content-padding"],[3,"form","submitted","validationErrors","autoFocus"],["id","qware.user-groups.edit.privileges-shade","value","1"],[3,"selectedTemplateOptionChange","form","submitted","validationErrors","roleTreeNodes","disableSelectionOptions","userGroupTemplateOptions","selectedTemplateOption"],["id","qware.user-groups.edit.assigning-rules-sha
8895de","value","2"],[3,"form","allStatusOptions","allUserGroupOptions"],["id","qware.user-groups.edit.associated-categories-shade","value","3"],[3,"form","submitted","validationErrors","assetCategories","inventoryCategories"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.user-groups.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.user-groups.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],[3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.user-groups.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.user-group.edit.content-drawer-container",1,"content-right-drawer-container","col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.users.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.user-group.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","userGroup",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),e(1,` 8896 `),n(2,"div",9),e(3,` 8897 `),n(4,"div",10),e(5,` 8898 `),n(6,"h3",11),e(7,` 8899 TENANTGROUP.EDIT_USER_GROUP 8900 `),a(),e(8,` 8901 `),n(9,"div",12),e(10,` 8902 `),n(11,"p-menu",13,0),e(13,` 8903 `),_(14,wO,10,2,"ng-template",null,1,A),e(16,` 8904 `),a(),e(17,` 8905 `),_(18,LO,7,1),a(),e(19,` 8906 `),_(20,OO,17,4),a(),e(21,` 8907 `),n(22,"qware-spinner",14),e(23,` 8908 `),n(24,"p-card",15),e(25,` 8909 `),n(26,"qware-edit-lock",16),e(27,` 8910 `),n(28,"p-accordion",17,2),e(30,` 8911 `),n(31,"p-accordion-panel",18),e(32,` 8912 `),n(33,"p-accordion-header"),e(34),I(35,"translate"),_(36,UO,3,1,"ng-template",null,3,A),e(38,` 8913 `),a(),e(39,` 8914 `),n(40,"p-accordion-content"),e(41,` 8915 `),n(42,"div",19),e(43,` 8916 `),n(44,"qware-user-group-info",20),e(45,` 8917 `),a(),e(46,` 8918 `),a(),e(47,` 8919 `),a(),e(48,` 8920 `),a(),e(49,` 8921 `),n(50,"p-accordion-panel",21),e(51,` 8922 `),n(52,"p-accordion-header"),e(53),I(54,"translate"),_(55,kO,3,1,"ng-template",null,3,A),e(57,` 8923 `),a(),e(58,` 8924 `),n(59,"p-accordion-content"),e(60,` 8925 `),n(61,"div",19),e(62,` 8926 `),n(63,"qware-user-group-privileges",22),j("selectedTemplateOptionChange",function(u){return E(s),W(i.selectedTemplateOption,u)||(i.selectedTemplateOption=u),S(u)}),e(64,` 8927 `),a(),e(65,` 8928 `),a(),e(66,` 8929 `),a(),e(67,` 8930 `),a(),e(68,` 8931 `),n(69,"p-accordion-panel",23),e(70,` 8932 `),n(71,"p-accordion-header"),e(72),I(73,"translate"),_(74,BO,3,1,"ng-template",null,3,A),e(76,` 8933 `),a(),e(77,` 8934 `),n(78,"p-accordion-content"),e(79,` 8935 `),n(80,"div",19),e(81,` 8936 `),n(82,"qware-user-group-assigning-rules",24),e(83,` 8937 `),a(),e(84,` 8938 `),a(),e(85,` 8939 `),a(),e(86,` 8940 `),a(),e(87,` 8941 `),n(88,"p-accordion-panel",25),e(89,` 8942 `),n(90,"p-accordion-header"),e(91),I(92,"translate"),_(93,jO,3,1,"ng-template",null,3,A),e(95,` 8943 `),a(),e(96,` 8944 `),n(97,"p-accordion-content"),e(98,` 8945 `),n(99,"div",19),e(100,` 8946 `),n(101,"qware-user-group-associated-categories",26),e(102,` 8947 `),a(),e(103,` 8948 `),a(),e(104,` 8949 `),a(),e(105,` 8950 `),a(),e(106,` 8951 `),a(),e(107,` 8952 `),a(),e(108,` 8953 `),n(109,"div",27),e(110,` 8954 `),n(111,"p-button",28),I(112,"translate"),e(113,` 8955 `),a(),e(114,` 8956 `),_(115,YO,5,5),a(),e(116,` 8957 `),a(),e(117,` 8958 `),a(),e(118,` 8959 `),a(),e(119,` 8960 `),_(120,$O,14,6),a(),e(121,` 8961`)}o&2&&(l(2),p("ngClass",pe(49,AO,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.userGroup!==void 0&&i.userGroup.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(51,RO)),l(6),K(` 8962 `,y(35,39,"TENANTGROUP.GROUP_INFORMATION"),` 8963 `),l(10),p("form",i.form.controls.GroupInformation)("submitted",i.submitted)("validationErrors",i.validationErrors)("autoFocus",!1),l(9),K(` 8964 `,y(54,41,"TENANTGROUP.PRIVILEGES"),` 8965 `),l(10),p("form",i.form.controls.Privileges)("submitted",i.submitted)("validationErrors",i.validationErrors)("roleTreeNodes",i.roleTreeNodes)("disableSelectionOptions",i.disableSelectionOptions)("userGroupTemplateOptions",i.userGroupTemplateOptions),H("selectedTemplateOption",i.selectedTemplateOption),l(9),K(` 8966 `,y(73,43,"TENANTGROUP.ASSIGNING_RULES.ASSIGNING_RULES"),` 8967 `),l(10),p("form",i.form.controls.AssigningRules)("allStatusOptions",i.allStatusOptions)("allUserGroupOptions",i.allUserGroupOptions),l(9),K(` 8968 `,y(92,45,"TENANTGROUP.ASSOCIATED_CATEGORIES.ASSOCIATED_CATEGORIES"),` 8969 `),l(10),p("form",i.form.controls.AssociatedCategories)("submitted",i.submitted)("validationErrors",i.validationErrors)("assetCategories",i.assetCategories)("inventoryCategories",i.inventoryCategories),l(10),q("label",y(112,47,"SHARED.CANCEL")),p("routerLink",i.userListRoute)("text",!0),l(4),f((i.userGroup==null?null:i.userGroup.State)!=="DELETED"?115:-1),l(5),f(i.auditLoggingDisabled?-1:120))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,Kl,$l,zl,Xl,ie],encapsulation:2})}return r})();var Ja=He(nt());function zO(r,d){if(r&1&&(e(0,` 8970 `),n(1,"small",26),e(2,` 8971 `),n(3,"div",5),e(4),a(),e(5,` 8972 `),a(),e(6,` 8973 `)),r&2){let t=d.$implicit;l(4),v(t)}}function XO(r,d){if(r&1&&(e(0,` 8974 `),G(1,zO,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().FirstName)}}function ZO(r,d){if(r&1&&(e(0,` 8975 `),n(1,"small",26),e(2,` 8976 `),n(3,"div",5),e(4),a(),e(5,` 8977 `),a(),e(6,` 8978 `)),r&2){let t=d.$implicit;l(4),v(t)}}
8978function JO(r,d){if(r&1&&(e(0,` 8979 `),G(1,ZO,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().MiddleName)}}function e4(r,d){if(r&1&&(e(0,` 8980 `),n(1,"small",26),e(2,` 8981 `),n(3,"div",5),e(4),a(),e(5,` 8982 `),a(),e(6,` 8983 `)),r&2){let t=d.$implicit;l(4),v(t)}}function t4(r,d){if(r&1&&(e(0,` 8984 `),G(1,e4,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().LastName)}}function i4(r,d){if(r&1&&(e(0,` 8985 `),n(1,"small",26),e(2,` 8986 `),n(3,"div",5),e(4),a(),e(5,` 8987 `),a(),e(6,` 8988 `)),r&2){let t=d.$implicit;l(4),v(t)}}function n4(r,d){if(r&1&&(e(0,` 8989 `),G(1,i4,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Email)}}function a4(r,d){if(r&1&&(e(0,` 8990 `),n(1,"small",26),e(2,` 8991 `),n(3,"div",5),e(4),a(),e(5,` 8992 `),a(),e(6,` 8993 `)),r&2){let t=d.$implicit;l(4),v(t)}}function r4(r,d){if(r&1&&(e(0,` 8994 `),G(1,a4,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().PhoneNumber)}}function o4(r,d){if(r&1&&(e(0,` 8995 `),n(1,"small",26),e(2,` 8996 `),n(3,"div",5),e(4),a(),e(5,` 8997 `),a(),e(6,` 8998 `)),r&2){let t=d.$implicit;l(4),v(t)}}function l4(r,d){if(r&1&&(e(0,` 8999 `),G(1,o4,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Extension)}}var Zl=(()=>{class r{autoFocus=ee(!0);canEdit=ee();form=ee.required();submitted=ee(!1);validationErrors=ee();static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-contact-information"]],inputs:{autoFocus:[1,"autoFocus"],canEdit:[1,"canEdit"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:171,vars:37,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.user.contact-information.input.first-name","tabindex","1","type","text","pInputText","","name","firstName","formControlName","FirstName","variant","filled",3,"qwareFocus","fluid"],["id","qware.user.contact-information.label.first-name","for","qware.user.contact-information.input.first-name"],["translate",""],[1,"required-mark"],["id","qware.user.contact-information.error.first-name",1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.user.contact-information.input.middle-name","tabindex","2","type","text","pInputText","","name","middleName","formControlName","MiddleName","variant","filled",3,"fluid"],["id","qware.user.contact-information.label.middle-name","for","qware.user.contact-information.input.middle-name"],[1,"validation-error",3,"hidden"],["id","qware.user.contact-information.input.last-name","tabindex","3","type","text","pInputText","","name","lastName","formControlName","LastName","variant","filled",3,"fluid"],["id","qware.user.contact-information.label.last-name","for","qware.user.contact-information.input.last-name"],["id","qware.user.contact-information.error.last-name",1,"validation-error",3,"hidden"],["tabindex","4","id","qware.user.contact-information.input.email","type","text","pInputText","","name","email","formControlName","Email","variant","filled",3,"fluid"],["id","qware.user.contact-information.label.email","for","qware.user.contact-information.input.email"],["id","qware.user.contact-information.error.email.required","translate","",3,"hidden"],["id","qware.user.contact-information.error.email.length","translate","",3,"hidden"],["id","qware.user.contact-information.error.email.format","translate","",3,"hidden"],["inputId","qware.user.contact-information.input.phone","styleClass","full-width","mask","(999) 999-9999","name","phone","formControlName","PhoneNumber","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.user.contact-information.label.phone","for","qware.user.contact-information.input.phone"],["id","qware.user.contact-information.input.extension","tabindex","6","type","text","pInputText","","name","extension","formControlName","Extension","variant","filled",3,"fluid"],["id","qware.user.contact-information.label.extension","for","qware.user.contact-information.input.extension"],["id","qware.user.contact-information.error.extension",1,"validation-error",3,"hidden"],[1,"validation-error"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 9000 `),e(2,` 9001 `),n(3,"div",1),e(4,` 9002 `),n(5,"div",2),e(6,` 9003 `),n(7,"p-floatlabel"),e(8,` 9004 `),R(9,"input",3),e(10,` 9005 `),n(11,"label",4),e(12,` 9006 `),n(13,"span",5),e(14,"USER.FIRSTNAME"),a(),n(15,"span",6),e(16," *"),a(),e(17,` 9007 `),a(),e(18,` 9008 `),a(),e(19,` 9009 `),n(20,"small",7),e(21,` 9010 `),n(22,"div",8),e(23,` 9011 USER.ERROR.FIRSTNAME_REQUIRED 9012 `),a(),e(24,` 9013 `),n(25,"div",8),e(26,` 9014 USER.ERROR.FIRSTNAME_LENGTH 9015 `),a(),e(27,` 9016 `),a(),e(28,` 9017 `),_(29,XO,3,0),a(),e(30,` 9018 `),a(),e(31,` 9019 9020 `),n(32,"div",9),e(33,` 9021 `),n(34,"div",2),e(35,` 9022 `),n(36,"p-floatlabel"),e(37,` 9023 `),R(38,"input",10),e(39,` 9024 `),n(40,"label",11),e(41,` 9025 `),n(42,"span",5),e(43,"USER.MIDDLENAME"),a(),e(44,` 9026 `),a(),e(45,` 9027 `),a(),e(46,` 9028 `),n(47,"small",12),e(48,` 9029 `),n(49,"div",8),e(50,` 9030 USER.ERROR.MIDDLENAME_LENGTH 9031 `),a(),e(51,` 9032 `),a(),e(52,` 9033 `),_(53,JO,3,0),a(),e(54,` 9034 `),a(),e(55,` 9035 9036 `),e(56,` 9037 `),n(57,"div",1),e(58,` 9038 `),n(59,"div",2),e(60,` 9039 `),n(61,"p-floatlabel"),e(62,` 9040 `),R(63,"input",13),e(64,` 9041 `),n(65,"label",14),e(66,` 9042 `),n(67,"span",5),e(68,"USER.LASTNAME"),a(),n(69,"span",6),e(70," *"),a(),e(71,` 9043 `),a(),e(72,` 9044 `),a(),e(73,` 9045 `),n(74,"small",15),e(75,` 9046 `),n(76,"div",8),e(77,` 9047 USER.ERROR.LASTNAME_REQUIRED 9048 `),a(),e(78,` 9049 `),n(79,"div",8),e(80,` 9050 USER.ERROR.LASTNAME_LENGTH 9051 `),a(),e(81,` 9052 `),a(),e(82,` 9053 `),_(83,t4,3,0),a(),e(84,` 9054 `),a(),e(85,` 9055 9056 `),n(86,"div",9),e(87,` 9057 `),n(88,"div",2),e(89,` 9058 `),n(90,"p-floatlabel"),e(91,` 9059 `),R(92,"input",16),e(93,` 9060 `),n(94,"label",17),e(95,` 9061 `),n(96,"span",5),e(97,"USER.EMAIL"),a(),n(98,"span",6),e(99," *"),a(),e(100,` 9062 `),a(),e(101,` 9063 `),a(),e(102,` 9064 `),n(103,"small",12),e(104,` 9065 `),n(105,"div",18),e(106,` 9066 USER.ERROR.EMAIL_REQUIRED 9067 `),a(),e(107,` 9068 `),n(108,"div",19),e(109,` 9069 USER.ERROR.EMAIL_LENGTH 9070 `),a(),e(110,` 9071 `),n(111,"div",20),e(112,` 9072 USER.ERROR.EMAIL_FORMAT 9073 `),a(),e(113,` 9074 `),a(),e(114,` 9075 `),_(115,n4,3,0),a(),e(116,` 9076 `),a(),e(117,` 9077 9078 `),e(118,` 9079 `),n(119,"div",1),e(120,` 9080 `),n(121,"div",2),e(122,` 9081 `),n(123,"p-floatlabel"),e(124,` 9082 `),n(125,"p-inputmask",21),e(126,` 9083 `),a(),e(127,` 9084 `),n(128,"label",22),e(129,` 9085 `),n(130,"span",5),e(131,"USER.PHONE"),a(),e(132,` 9086 `),a(),e(133,` 9087 `),a(),e(134,` 9088 `),n(135,"small",12),e(136,` 9089 `),n(137,"div",8),e(138,` 9090 USER.ERROR.PHONENUMBER_NOTNUMBER 9091 `),a(),e(139,` 9092 `),n(140,"div",8),e(141,` 9093 USER.ERROR.PHONENUMBER_LENGTH 9094 `),a(),e(142,` 9095 `),a(),e(143,` 9096 `),_(144,r4,3,0),a(),e(145,` 9097 `),a(),e(146,` 9098 9099 `),n(147,"div",9),e(148,` 9100 `),n(149,"div",2),e(150,` 9101 `),n(151,"p-floatlabel"),e(152,` 9102 `),R(153,"input",23),e(154,` 9103 `),n(155,"label",24),e(156,` 9104 `),n(157,"span",5),e(158,"USER.EXTENSION"),a(),e(159,` 9105 `),a(),e(160,` 9106 `),a(),e(161,` 9107 `),n(162,"small",25),e(163,` 9108 `),n(164,"div",8),e(165,` 9109 USER.ERROR.EXTENSION_NOTNUMBER 9110 `),a(),e(166,` 9111 `),a(),e(167,` 9112 `),_(168,l4,3,0),a(),e(169,` 9113 `),a(),e(170,` 9114`),a()),o&2){let s,c,u,x,C,O,w,F,L,U,V;p("formGroup",i.form()),l(9),p("qwareFocus",i.autoFocus())("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.FirstName.valid||i.form().controls.FirstName.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.FirstName.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.FirstName.errors)!=null&&c.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().FirstName&&i.form().controls.FirstName.untouched?29:-1),l(9),p("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(9),p("hidden",i.form().controls.MiddleName.valid||i.form().controls.MiddleName.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.MiddleName.errors)!=null&&u.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().MiddleName&&i.form().controls.MiddleName.untouched?53:-1),l(10),p("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.LastName.valid||i.form().controls.LastName.pristine&&!i.submitted()),l(2),p("hidden",!((x=i.form().controls.LastName.errors)!=null&&x.required)),l(3),p("hidden",!((C=i.form().controls.LastName.errors)!=null&&C.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().LastName&&i.form().controls.LastName.untouched?83:-1),l(9),p("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.Email.valid||i.form().controls.Email.pristine&&!i.submitted()),l(2),p("hidden",!((O=i.form().controls.Email.errors)!=null&&O.required)),l(3),p("hidden",!((w=i.form().controls.Email.errors)!=null&&w.maxlength)),l(3),p("hidden",!((F=i.form().controls.Email.errors)!=null&&F.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().Email&&i.form().controls.Email.untouched?115:-1),l(10),p("tabindex","5")("unmask",!0)("autoClear",!1),l(10),p("hidden",i.form().controls.PhoneNumber.valid||i.form().controls.PhoneNumber.pristine&&!i.submitted()),l(2),p("hidden",!((L=i.form().controls.PhoneNumber.errors)!=null&&L.pattern)),l(3),p("hidden",!((U=i.form().controls.PhoneNumber.errors)!=null&&U.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().PhoneNumber&&i.form().controls.PhoneNumber.untouched?144:-1),l(9),p("fluid",!0),l(9),p("hidden",i.form().controls.Extension.valid||i.form().controls.Extension.pristine&&!i.submitted()),l(2),p("hidden",!((V=i.form().controls.Extension.errors)!=null&&V.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().Extension&&i.form().controls.Extension.untouched?168:-1)}},dependencies:[Ne,je,Ae,se,ge,Un,ye,Te,De,$],encapsulation:2,changeDetection:0})}return r})();function s4(r,d){r&1&&(e(0,` 9115 `),n(1,"span",24),e(2,"expand_less"),a(),e(3,` 9116 `))}function d4(r,d){r&1&&(e(0,` 9117 `),n(1,"span",24),e(2,"expand_more"),a(),e(3,` 9118 `))}function p4(r,d){r&1&&(e(0,` 9119 `),n(1,"span",24),e(2,"expand_less"),a(),e(3,` 9120 `))}function m4(r,d){r&1&&(e(0,` 9121 `),n(1,"span",24),e(2,"expand_more"),a(),e(3,` 9122 `))}var Jl=(()=>
9122{class r{allSupervisorOptions=ee([]);defaultSupervisor=ee();form=ee.required();submitted=ee(!1);validationErrors=ee();currencyType=D("USD");appSettingsService=te(dt);constructor(){this.appSettingsService.getAppSettings().pipe(N()).subscribe(t=>{this.currencyType.set(t.CurrencyType??"USD")})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-employment-information"]],inputs:{allSupervisorOptions:[1,"allSupervisorOptions"],defaultSupervisor:[1,"defaultSupervisor"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:153,vars:31,consts:[["incrementbuttonicon",""],["decrementbuttonicon",""],[1,"grid","zipper","flex-inline",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.user.employment-information.input.job-title","tabindex","7","type","text","pInputText","","name","jobTitle","formControlName","JobTitle","variant","filled",3,"qwareFocus","fluid"],["id","qware.user.employment-information.label.job-title","for","qware.user.employment-information.input.job-title"],["translate",""],["id","qware.user.employment-information.error.job-title",1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.user.employment-information.input.employee-number","tabindex","8","type","text","pInputText","","name","employeeNumber","formControlName","EmployeeNumber","variant","filled",3,"fluid"],["id","qware.user.employment-information.label.employee-number","for","qware.user.employment-information.input.employee-number"],["id","qware.user.employment-information.error.employee-number",1,"validation-error",3,"hidden"],["id","qware.user.employment-information.input.department","tabindex","9","type","text","pInputText","","name","department","formControlName","Department","variant","filled",3,"fluid"],["id","qware.user.employment-information.label.department","for","qware.user.employment-information.input.department"],["id","qware.user.employment-information.error.department",1,"validation-error",3,"hidden"],["label","USER.SUPERVISOR","formControlName","Supervisor","labelId","qware.user.employment-information.label.supervisor","id","qware.user.employment-information.dropdown-e2e.supervisor","elementId","qware.user.employment-information.dropdown.supervisor",3,"singleSelect","tabindex","options","defaultOption","virtualScroll","virtualScrollItemSize"],["inputId","qware.user.employment-information.input.hourly-rate","formControlName","HourlyRate","mode","currency","variant","filled",1,"is-filled",3,"tabindex","currency","showButtons","fluid"],["id","qware.user.employment-information.label.hourly-rate","for","qware.user.employment-information.input.hourly-rate"],[1,"required-mark"],[1,"validation-error",3,"hidden"],["inputId","qware.user.employment-information.input.overtime-rate","formControlName","OvertimeRate","mode","currency","variant","filled",1,"is-filled",3,"tabindex","currency","showButtons","fluid"],["id","qware.user.employment-information.label.overtime-rate","for","qware.user.employment-information.input.overtime-rate"],[1,"material-icons"]],template:function(o,i){if(o&1&&(n(0,"div",2),e(1,` 9123 `),e(2,` 9124 `),n(3,"div",3),e(4,` 9125 `),n(5,"div",4),e(6,` 9126 `),n(7,"p-floatlabel"),e(8,` 9127 `),R(9,"input",5),e(10,` 9128 `),n(11,"label",6),e(12,` 9129 `),n(13,"span",7),e(14," USER.JOB_TITLE"),a(),e(15,` 9130 `),a(),e(16,` 9131 `),a(),e(17,` 9132 `),n(18,"small",8),e(19,` 9133 `),n(20,"div",9),e(21,` 9134 USER.ERROR.JOB_TITLE_LENGTH 9135 `),a(),e(22,` 9136 `),a(),e(23,` 9137 `),a(),e(24,` 9138 `),a(),e(25,` 9139 9140 `),n(26,"div",10),e(27,` 9141 `),n(28,"div",4),e(29,` 9142 `),n(30,"p-floatlabel"),e(31,` 9143 `),R(32,"input",11),e(33,` 9144 `),n(34,"label",12),e(35,` 9145 `),n(36,"span",7),e(37,"USER.EMPLOYEE_NUMBER"),a(),e(38,` 9146 `),a(),e(39,` 9147 `),a(),e(40,` 9148 `),n(41,"small",13),e(42,` 9149 `),n(43,"div",9),e(44,` 9150 USER.ERROR.EMPLOYEE_NUMBER_LENGTH 9151 `),a(),e(45,` 9152 `),a(),e(46,` 9153 `),a(),e(47,` 9154 `),a(),e(48,` 9155 `),e(49,` 9156 `),n(50,"div",3),e(51,` 9157 `),n(52,"div",4),e(53,` 9158 `),n(54,"p-floatlabel"),e(55,` 9159 `),R(56,"input",14),e(57,` 9160 `),n(58,"label",15),e(59,` 9161 `),n(60,"span",7),e(61,"USER.DEPARTMENT"),a(),e(62,` 9162 `),a(),e(63,` 9163 `),a(),e(64,` 9164 `),n(65,"small",16),e(66,` 9165 `),n(67,"div",9),e(68,` 9166 USER.ERROR.DEPARTMENT_LENGTH 9167 `),a(),e(69,` 9168 `),a(),e(70,` 9169 `),a(),e(71,` 9170 `),a(),e(72,` 9171 9172 `),n(73,"div",10),e(74,` 9173 `),n(75,"div",4),e(76,` 9174 `),n(77,"qware-autocomplete",17),e(78,` 9175 `),a(),e(79,` 9176 `),a(),e(80,` 9177 `),a(),e(81,` 9178 `),e(82,` 9179 `),n(83,"div",3),e(84,` 9180 `),n(85,"div",4),e(86,` 9181 `),n(87,"p-floatlabel"),e(88,` 9182 `),n(89,"p-inputnumber",18),e(90,` 9183 `),_(91,s4,4,0,"ng-template",null,0,A),e(93,` 9184 `),_(94,d4,4,0,"ng-template",null,1,A),e(96,` 9185 `),a(),e(97,` 9186 `),n(98,"label",19),e(99,` 9187 `),n(100,"span",7),e(101,"USER.HOURLY_RATE"),a(),n(102,"span",20),e(103," *"),a(),e(104,` 9188 `),a(),e(105,` 9189 `),a(),e(106,` 9190 `),n(107,"small",21),e(108,` 9191 `),n(109,"div",9),e(110,` 9192 USER.ERROR.HOURLY_RATE_REQUIRED 9193 `),a(),e(111,` 9194 `),n(112,"div",9),e(113,` 9195 USER.ERROR.HOURLY_RATE_INVALID 9196 `),a(),e(114,` 9197 `),a(),e(115,` 9198 `),a(),e(116,` 9199 `),a(),e(117,` 9200 9201 `),n(118,"div",10),e(119,` 9202 `),n(120,"div",4),e(121,` 9203 `),n(122,"p-floatlabel"),e(123,` 9204 `),n(124,"p-inputnumber",22),e(125,` 9205 `),_(126,p4,4,0,"ng-template",null,0,A),e(128,` 9206 `),_(129,m4,4,0,"ng-template",null,1,A),e(131,` 9207 `),a(),e(132,` 9208 `),n(133,"label",23),e(134,` 9209 `),n(135,"span",7),e(136,"USER.OVERTIME_RATE"),a(),n(137,"span",20),e(138," *"),a(),e(139,` 9210 `),a(),e(140,` 9211 `),a(),e(141,` 9212 `),n(142,"small",21),e(143,` 9213 `),n(144,"div",9),e(145,` 9214 USER.ERROR.OVERTIME_RATE_REQUIRED 9215 `),a(),e(146,` 9216 `),n(147,"div",9),e(148,` 9217 USER.ERROR.OVERTIME_RATE_INVALID 9218 `),a(),e(149,` 9219 `),a(),e(150,` 9220 `),a(),e(151,` 9221 `),a(),e(152,` 9222`),a()),o&2){let s,c,u,x,C,O,w;p("formGroup",i.form()),l(9),p("qwareFocus",!0)("fluid",!0),l(9),p("hidden",i.form().controls.JobTitle.valid||i.form().controls.JobTitle.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.JobTitle.errors)!=null&&s.maxlength)),l(12),p("fluid",!0),l(9),p("hidden",i.form().controls.EmployeeNumber.valid||i.form().controls.EmployeeNumber.pristine&&!i.submitted()),l(2),p("hidden",!((c=i.form().controls.EmployeeNumber.errors)!=null&&c.maxlength)),l(13),p("fluid",!0),l(9),p("hidden",i.form().controls.Department.valid||i.form().controls.Department.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.Department.errors)!=null&&u.maxlength)),l(10),p("singleSelect",!0)("tabindex",10)("options",i.allSupervisorOptions())("defaultOption",i.defaultSupervisor)("virtualScroll",!0)("virtualScrollItemSize",38),l(12),p("tabindex",11)("currency",i.currencyType())("showButtons",!0)("fluid",!0),l(18),p("hidden",i.form().controls.HourlyRate.valid||i.form().controls.HourlyRate.pristine&&!i.submitted()),l(2),p("hidden",!((x=i.form().controls.HourlyRate.errors)!=null&&x.required)),l(3),p("hidden",!((C=i.form().controls.HourlyRate.errors)!=null&&C.pattern)),l(12),p("tabindex",12)("currency",i.currencyType())("showButtons",!0)("fluid",!0),l(18),p("hidden",i.form().controls.OvertimeRate.valid||i.form().controls.OvertimeRate.pristine&&!i.submitted()),l(2),p("hidden",!((O=i.form().controls.OvertimeRate.errors)!=null&&O.required)),l(3),p("hidden",!((w=i.form().controls.OvertimeRate.errors)!=null&&w.pattern))}},dependencies:[Ne,je,Ae,se,ge,bi,ye,wt,Te,De,$],encapsulation:2,changeDetection:0})}return r})();var Io=He(nt());var es=()=>({standalone:!0}),sa=()=>[],c4=r=>[r],u4=(r,d)=>d.controls.TenantId.value;function _4(r,d){r&1&&(e(0,` 9223 `),n(1,"span",12),e(2,"USER.NEW_PASSWORD"),a(),e(3,` 9224 `))}function E4(r,d){r&1&&(e(0,` 9225 `),n(1,"span",12),e(2,"USER.PASSWORD"),a(),e(3,` 9226 `))}function S4(r,d){r&1&&(e(0,` 9227 `),n(1,"i",33),e(2,"expand_less"),a(),e(3,` 9228 `))}function x4(r,d){r&1&&(e(0,` 9229 `),n(1,"i",33),e(2,"expand_more"),a(),e(3,` 9230 `))}function f4(r,d){if(r&1&&(e(0,` 9231 `),_(1,S4,4,0)(2,x4,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function h4(r,d){if(r&1&&(e(0,` 9232 `),n(1,"small",34),e(2,` 9233 `),n(3,"div",12),e(4),a(),e(5,` 9234 `),a(),e(6,` 9235 `)),r&2){let t=d.$implicit;l(4),v(t)}}function C4(r,d){if(r&1&&(e(0,` 9236 `),G(1,h4,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().TenantGroupId)}}
9236function v4(r,d){if(r&1&&(e(0,` 9237 `),n(1,"small",34),e(2,` 9238 `),n(3,"div",12),e(4),a(),e(5,` 9239 `),a(),e(6,` 9240 `)),r&2){let t=d.$implicit;l(4),v(t)}}function g4(r,d){if(r&1&&(e(0,` 9241 `),G(1,v4,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().ServiceAreaIds)}}function T4(r,d){if(r&1&&(e(0,` 9242 `),n(1,"small",34),e(2,` 9243 `),n(3,"div",12),e(4),a(),e(5,` 9244 `),a(),e(6,` 9245 `)),r&2){let t=d.$implicit;l(4),v(t)}}function I4(r,d){if(r&1&&(e(0,` 9246 `),G(1,T4,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors().LocationIds)}}function b4(r,d){r&1&&(e(0,` 9247 `),n(1,"span",33),e(2,"expand_more"),a(),e(3,` 9248 `))}function y4(r,d){if(r&1){let t=b();e(0,` 9249 `),n(1,"div",4),e(2,` 9250 `),n(3,"p-float-label"),e(4,` 9251 `),n(5,"p-select",35),h("onChange",function(i){let s;E(t);let c=m().$implicit,u=m();return S(u.updateCalendarViewFavSetting((s=i.value)!==null&&s!==void 0?s:void 0,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:""))}),e(6,` 9252 `),_(7,b4,4,0,"ng-template",36),e(8,` 9253 `),a(),e(9,` 9254 `),n(10,"label",37),e(11,` 9255 USER.FAVORITE_CALENDAR_VIEW 9256 `),a(),e(12,` 9257 `),a(),e(13,` 9258 `),a(),e(14,` 9259 `)}if(r&2){let t,o,i=m(),s=i.$implicit,c=i.$index,u=m();l(5),p("id","qware.user.security.input.favorite-calendar-view"+c.toString())("options",(t=u.calendarViewOptions().get((t=s.controls.TenantId.value)!==null&&t!==void 0?t:""))!==null&&t!==void 0?t:ne(8,sa))("ngModel",(o=u.userSettingsMap().get((o=s.controls.TenantId.value)!==null&&o!==void 0?o:""))==null?null:o.calendarViewFav)("showClear",!0)("ngModelOptions",ne(9,es))("fluid",!0),l(5),p("id","qware.user.security.label.favorite-calendar-view"+c.toString())("for","qware.user.security.input.favorite-calendar-view"+c.toString())}}function A4(r,d){if(r&1){let t=b();e(0,` 9260 `),n(1,"div",38),e(2,` 9261 `),n(3,"label",39),e(4,` 9262 USER.ENABLE_API_ACCESS 9263 `),a(),e(5,` 9264 `),n(6,"p-checkbox",40),h("onChange",function(i){let s;E(t);let c=m().$implicit,u=m();return S(u.updateApiAccessSetting(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:""))}),e(7,` 9265 `),a(),e(8,` 9266 `),a(),e(9,` 9267 `)}if(r&2){let t,o=m().$implicit,i=m();l(6),p("disabled",!i.canManageApiAccess())("tabindex",20)("ngModelOptions",ne(5,es))("binary",!0)("ngModel",(t=(t=i.userSettingsMap().get((t=o.controls.TenantId.value)!==null&&t!==void 0?t:""))==null?null:t.apiAccess)!==null&&t!==void 0?t:!1)}}function R4(r,d){if(r&1){let t=b();e(0,` 9268 `),n(1,"p-accordion-panel",18),e(2,` 9269 `),n(3,"p-accordion-header",19),h("click",function(){let i=E(t).$index,s=m();return S(s.loadTenantData(i))}),e(4),_(5,f4,3,1,"ng-template",null,0,A),e(7,` 9270 `),a(),e(8,` 9271 `),n(9,"p-accordion-content",20),e(10,` 9272 `),n(11,"div",21),e(12,` 9273 `),n(13,"qware-spinner",22),e(14,` 9274 `),n(15,"div",23),e(16,` 9275 `),n(17,"div",24),e(18,` 9276 `),n(19,"qware-autocomplete",25),h("selectChange",function(){let i,s=E(t).$implicit,c=m();return S(c.logChangeToTenantAssociations((i=s.controls.TenantId.value)!==null&&i!==void 0?i:""))}),e(20,` 9277 `),a(),e(21,` 9278 `),n(22,"small",7),e(23,` 9279 `),n(24,"div",8),e(25,` 9280 USER.ERROR.TENANTGROUP_REQUIRED 9281 `),a(),e(26,` 9282 `),a(),e(27,` 9283 `),_(28,C4,3,0),a(),e(29,` 9284 `),n(30,"div",24),e(31,` 9285 `),n(32,"qware-autocomplete",26),h("unselectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.clearSettings(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:""))})("selectChange",function(){let i,s=E(t).$implicit,c=m();return S(c.setFavServiceAreaOptions((i=s.controls.TenantId.value)!==null&&i!==void 0?i:""))}),e(33,` 9286 `),a(),e(34,` 9287 `),n(35,"small",7),e(36,` 9288 `),n(37,"div",27),e(38,` 9289 USER.ERROR.SERVICE_AREA_ASSOCIATIONS_REQUIRED 9290 `),a(),e(39,` 9291 `),a(),e(40,` 9292 `),_(41,g4,3,0),a(),e(42,` 9293 `),n(43,"div",4),e(44,` 9294 `),n(45,"qware-autocomplete",28),h("selectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.updateFavSetting(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:""))})("unselectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.updateFavSetting(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:""))}),e(46,` 9295 `),a(),e(47,` 9296 `),a(),e(48,` 9297 `),n(49,"div",29),e(50,` 9298 `),n(51,"qware-hierarchy-picker",30),I(52,"translate"),h("unselectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.clearSettings(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:"",!0))})("selectChange",function(){let i,s=E(t).$implicit,c=m();return S(c.setFavLocationOptions((i=s.controls.TenantId.value)!==null&&i!==void 0?i:""))}),e(53,` 9299 `),a(),e(54,` 9300 `),n(55,"small",7),e(56,` 9301 `),n(57,"div",31),e(58,` 9302 USER.ERROR.LOCATION_ASSOCIATIONS_REQUIRED 9303 `),a(),e(59,` 9304 `),a(),e(60,` 9305 `),_(61,I4,3,0),a(),e(62,` 9306 `),n(63,"div",4),e(64,` 9307 `),n(65,"qware-autocomplete",32),h("selectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.updateFavSetting(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:"",!0))})("unselectChange",function(i){let s,c=E(t).$implicit,u=m();return S(u.updateFavSetting(i,(s=c.controls.TenantId.value)!==null&&s!==void 0?s:"",!0))}),e(66,` 9308 `),a(),e(67,` 9309 `),a(),e(68,` 9310 `),_(69,y4,15,10)(70,A4,10,6),a(),e(71,` 9311 `),a(),e(72,` 9312 `),a(),e(73,` 9313 `),a(),e(74,` 9314 `),a(),e(75,` 9315 `)}if(r&2){let t,o,i,s,c,u,x,C,O,w,F,L,U,V=d.$implicit,z=d.$index,ce=m();l(),p("value",z),l(3),K(` 9316 `,(t=V.controls.TenantName.value)!==null&&t!==void 0?t:"",` 9317 `),l(9),p("isAbsolute",!0)("makeRelativeToBlockingComponent",!1)("displaySpinner",(o=ce.spinnerStates().get(z))!==null&&o!==void 0?o:!1),l(2),p("formGroupName",z),l(2),p("hidden",!ce.canEdit()),l(2),p("singleSelect",!0)("tabindex",16)("options",(i=ce.allUserGroupOptions().get((i=V.controls.TenantId.value)!==null&&i!==void 0?i:""))!==null&&i!==void 0?i:ne(52,sa))("isRequired",((s=ce.allUserGroupOptions().get((s=V.controls.TenantId.value)!==null&&s!==void 0?s:""))!==null&&s!==void 0?s:ne(53,sa)).length>0)("id","qware.user.security.dropdown-e2e.user-group"+z.toString())("elementId","qware.user.security.dropdown.user-group"+z.toString())("virtualScroll",!0)("virtualScrollItemSize",38),l(3),p("hidden",V.controls.TenantGroupId.valid||V.controls.TenantGroupId.pristine&&!ce.submitted),l(2),p("hidden",!(V.controls.TenantGroupId.errors!=null&&V.controls.TenantGroupId.errors.required)),l(4),f(ce.validationErrors()&&ce.validationErrors().TenantGroupId&&V.controls.TenantGroupId.untouched?28:-1),l(2),p("hidden",!ce.canEdit()),l(2),p("tabindex",17)("options",(c=ce.allServiceAreaOptions().get((c=V.controls.TenantId.value)!==null&&c!==void 0?c:""))!==null&&c!==void 0?c:ne(54,sa))("id","qware.user.security.dropdown-e2e.service-areas"+z.toString())("isRequired",!ce.isSuperUser()&&((u=ce.allServiceAreaOptions().get((u=V.controls.TenantId.value)!==null&&u!==void 0?u:""))!==null&&u!==void 0?u:ne(55,sa)).length>0)("elementId","qware.user.security.dropdown.service-areas"+z.toString()),l(3),p("hidden",V.controls.ServiceAreaIds.valid||V.controls.ServiceAreaIds.pristine&&!ce.submitted),l(2),p("hidden",!(V.controls.ServiceAreaIds.errors!=null&&V.controls.ServiceAreaIds.errors.required)),l(4),f(ce.validationErrors()&&ce.validationErrors().ServiceAreaIds&&V.controls.ServiceAreaIds.untouched?41:-1),l(4),p("tabindex",18)("options",(x=ce.serviceAreaFavOptions().get((x=V.controls.TenantId.value)!==null&&x!==void 0?x:""))!==null&&x!==void 0?x:ne(56,sa))("selectedOption",ce.userSettingsMap().get((C=V.controls.TenantId.value)!==null&&C!==void 0?C:"")?ce.userSettingsMap().get((C=V.controls.TenantId.value)!==null&&C!==void 0?C:"").serviceArea:void 0)("singleSelect",!0)("elementId","qware.user.security.input.favorite-service-area"+z.toString()),l(4),p("hidden",!ce.canEdit()),l(2),q("label",y(52,50,"USER.LOCATION_ASSOCIATIONS")),p("primaryNodes",(O=ce.locationTreeNodes().get((O=V.
9317controls.TenantId.value)!==null&&O!==void 0?O:""))!==null&&O!==void 0?O:ne(57,sa))("requiredMark",!ce.isSuperUser()&&((w=ce.locationTreeNodes().get((w=V.controls.TenantId.value)!==null&&w!==void 0?w:""))!==null&&w!==void 0?w:ne(58,sa)).length>0)("hideToolbar",!0),l(4),p("hidden",V.controls.LocationIds.valid||V.controls.LocationIds.pristine&&!ce.submitted),l(2),p("hidden",!(V.controls.LocationIds.errors!=null&&V.controls.LocationIds.errors.required)),l(4),f(ce.validationErrors()&&ce.validationErrors().LocationIds&&V.controls.LocationIds.untouched?61:-1),l(4),p("tabindex",19)("allLocations",ce.allLocations())("nodeIds",(F=ce.locationFavOptions().get((F=V.controls.TenantId.value)!==null&&F!==void 0?F:""))!==null&&F!==void 0?F:ne(59,sa))("selectedNodeIds",ce.userSettingsMap().get((L=V.controls.TenantId.value)!==null&&L!==void 0?L:"")?pe(60,c4,(L=ce.userSettingsMap().get((L=V.controls.TenantId.value)!==null&&L!==void 0?L:"").location)==null?null:L.value):ne(62,sa))("selectedOption",ce.userSettingsMap().get((U=V.controls.TenantId.value)!==null&&U!==void 0?U:"")?ce.userSettingsMap().get((U=V.controls.TenantId.value)!==null&&U!==void 0?U:"").location:void 0)("enablePicker",!0)("singleSelect",!0)("elementId","qware.user.security.input.favorite-location"+z.toString()),l(4),f(ce.hasEventsModule()||!ce.workOrderCalendarDisabled()?69:-1),l(),f(ce.apiDisabled()?-1:70)}}var ts=(()=>{class r{allLocations=ee([]);calendarViewOptions=ee(new Map);allServiceAreaOptions=bn(new Map);allUserGroupOptions=ee(new Map);canEdit=ee(void 0);form=ee.required();isSingleTenant=ee(!1);isUserEdit=ee(!1);locationTreeNodes=ee(new Map);submitted=ee(!1);userName=ee(void 0);validationErrors=ee(void 0);tenantAssociationClick=Dt();tenantAssociationAdded=Dt();formControls=D([]);locationFavOptions=D(new Map);selectedTenants=D([]);serviceAreaFavOptions=D(new Map);shadeIndex=D([]);spinnerStates=D(new Map);userSettingsMap=D(new Map);allTenantOptions=bn([]);tenantAssociationsThatChanged=bn(new Set);tenantId=Ye(()=>this.authService.tenant.Id);isAddingTenantAssociation=!1;loadedTenantIds=[];subscriptions=[];tenantOptionsObservable$=or(this.allTenantOptions);locationTreeNodesObservable$=or(this.locationTreeNodes);apiDisabled=D(!0);workOrderCalendarDisabled=D(!0);hasEventsModule=D(!1);canManageApiAccess=D(!1);isSuperUser=D(!1);authService=te(de);fb=te(be);constructor(){this.apiDisabled.set(!this.authService.qwareSubscription?.apiAccess),this.workOrderCalendarDisabled.set(!this.authService.qwareSubscription?.workOrderCalendar),this.hasEventsModule.set(this.authService.tenant.EventsModule),this.canManageApiAccess.set(this.authService.userHasPrivilege(ae.CAN_MANAGE_API_ACCESS)),this.isSuperUser.set(this.authService.userHasPrivilege(ae.IS_SUPER_USER))}ngOnInit(){this.subscriptions.push(this.form().valueChanges.subscribe(()=>{this.setSpinnerStates()})),this.subscriptions.push(this.tenantOptionsObservable$.subscribe(t=>{t&&t.length>0&&this.addExistingTenants()})),this.subscriptions.push(this.locationTreeNodesObservable$.subscribe(t=>{t&&t.size>
93170&&(this.selectedTenants().forEach(o=>{let i=t.get(o.value),s=this.loadedTenantIds.includes(o.value);i&&!s&&(this.setFavServiceAreaOptions(o.value,!1),this.setFavLocationOptions(o.value,!1),this.addExistingFavorites(o.value),this.loadedTenantIds.push(o.value))}),this.isAddingTenantAssociation&&(this.setSpinnerStates(),this.isAddingTenantAssociation=!1))}))}setSpinnerStates(t,o=!1){if(t===void 0)for(let i of this.spinnerStates().keys())this.spinnerStates.update(s=>s.set(i,o));else this.spinnerStates.update(i=>i.set(t,o))}ngOnDestroy(){this.subscriptions.forEach(t=>{t&&!t.closed&&t.unsubscribe()})}addExistingTenants(){this.selectedTenants.set(Io.default.sortBy(this.allTenantOptions(),t=>(t.label??"").toLowerCase()).filter(t=>this.form().controls.UserTenantAssociations.value.findIndex(o=>o.TenantId===t.value)>-1)),this.setFormRequirednessForLocsandSas(),this.formControls.set(this.form().controls.UserTenantAssociations.controls),this.formControls()&&this.formControls().length===1&&this.shadeIndex.set([0])}addExistingFavorites(t){let i=this.form().controls.UserSettings.value?.find(u=>u.TenantId===t),s=this.allLocations().find(u=>u.Id===i?.FavoriteLocationId),c=i?.FavoriteServiceAreaId?this.allServiceAreaOptions().get(t)?.find(u=>u.value===i.FavoriteServiceAreaId):void 0;this.userSettingsMap.update(u=>u.set(t,{location:s?{label:s.Name,value:s.Id}:void 0,serviceArea:c,apiAccess:i?.HasApiAccess??!1,calendarViewFav:i?.FavoriteCalendarViewName}))}addTenantFormGroup(t){return this.isSingleTenant()&&this.form().get("UserTenantAssociations").clear(),this.form().get("UserTenantAssociations").push(this.fb.group({TenantName:this.fb.control(t.label??""),TenantId:this.fb.control(t.value),TenantGroupId:this.fb.control(null,T.required),ServiceAreaIds:this.fb.control([],T.required),LocationIds:this.fb.control([],T.required)})),this.setFormRequirednessForLocsandSas(),this.formControls.set(this.form().controls.UserTenantAssociations.controls.sort((i,s)=>(i.value?.TenantName??"").localeCompare(s.value?.TenantName??""))),this.selectedTenants.update(i=>(i.push(t),Io.default.sortBy(i,s=>(s.label??"").toLowerCase()))),this.formControls().findIndex(i=>i.value?.TenantName===t.label)}tenantAdded(t){if(this.isSingleTenant()){let o=(this.form().get("UserTenantAssociations")?.value??[])[0];this.tenantRemoved({label:o.TenantName,value:o.TenantId})}t instanceof Event||t?.value&&(this.isAddingTenantAssociation=!0,this.shadeIndex.set([this.addTenantFormGroup(t)]),this.logChangeToTenantAssociations(t.value),this.loadedTenantIds.includes(t.value)||(this.setSpinnerStates(this.shadeIndex()[0],!0),this.tenantAssociationAdded.emit(t.value)),this.isDirty())}tenantRemoved(t){if(!(t instanceof Event)){let o=this.form(),i=o.get("UserTenantAssociations")?.value.findIndex(s=>s.TenantId===t.value);i!==void 0&&(o.get("UserTenantAssociations")?.removeAt(i),this.logChangeToTenantAssociations(t.value),this.isDirty()),i=this.allTenantOptions().findIndex(s=>s.value===t.value&&s.styleClass==="disabled"),i>-1&&this.allTenantOptions.update(s=>(s.splice(i,1),s)),this.removeSettings(t.value),this.shadeIndex.set([])}}setFavServiceAreaOptions(t,o=!0){let i=this.form().get("UserTenantAssociations");if(i&&i.value){let c=i.value.find(C=>C.TenantId===t)?.ServiceAreaIds??[],u=this.allServiceAreaOptions().get(t),x=Io.default.intersection(u,c);this.serviceAreaFavOptions.update(C=>C.set(t,x??[])),o&&this.logChangeToTenantAssociations(t)}}setFavLocationOptions(t,o=!0){let i=this.form().get("UserTenantAssociations");if(i&&i.value){let c=i.value.find(x=>x.TenantId===t)?.LocationIds??[];i.controls.find(x=>x.get("TenantId")?.value===t)?.get("LocationIds")?.setValue(c),this.locationFavOptions.update(x=>x.set(t,c)),o&&this.logChangeToTenantAssociations(t)}}updateFavSetting(t,o,i=!1){if(t){let s=this.form().get("UserSettings"),c=(s?.value??[]).find(u=>u.TenantId===o);if(c)i?c.FavoriteLocationId=t.data?.id:c.FavoriteServiceAreaId=t.value;else{let u=s?.value??[];u.push({UserId:void 0,TenantId:o,FavoriteLocationId:i?t.data?.id:void 0,FavoriteServiceAreaId:i?void 0:t.value,HasApiAccess:!1}),s?.setValue(u)}this.userSettingsMap.update(u=>u.set(o,u.get(o)??{})),i?this.userSettingsMap.update(u=>{let x=u.get(o)??{},C=t.data;return x.location=C?{label:C.name,value:C.id}:void 0,u.set(o,x),u}):this.userSettingsMap.update(u=>{let x=u.get(o)??{};return x.serviceArea=t||void 0,u.set(o,x),u}),this.logChangeToTenantAssociations(o),this.form().markAsDirty()}}updateApiAccessSetting(t,o){let i=this.form().get("UserSettings"),s=(i?.value??[]).find(c=>c.TenantId===o);if(s)s.HasApiAccess=t.checked;else{let c=i?.value??[];c.push({UserId:void 0,TenantId:o,FavoriteLocationId:void 0,FavoriteServiceAreaId:void 0,HasApiAccess:t.checked}),i?.setValue(c)}this.userSettingsMap.update(c=>{let u=c.get(o)??{};
9317return u.apiAccess=t.checked,c.set(o,u),c}),this.logChangeToTenantAssociations(o),this.form().markAsDirty()}updateCalendarViewFavSetting(t,o){let i=this.form().get("UserSettings"),s=(i?.value??[]).find(c=>c.TenantId===o);if(s)s.FavoriteCalendarViewName=t;else{let c=i?.value??[];c.push({UserId:void 0,TenantId:o,FavoriteLocationId:void 0,FavoriteServiceAreaId:void 0,FavoriteCalendarViewName:t,HasApiAccess:!1}),i?.setValue(c)}this.userSettingsMap.update(c=>{let u=c.get(o)??{};return u.calendarViewFav=t,c.set(o,u),c}),this.logChangeToTenantAssociations(o),this.form().markAsDirty()}clearSettings(t,o,i=!1){if(t&&!(t instanceof Event)){let c=(this.form().get("UserSettings")?.value??[]).find(x=>x.TenantId===o),u=i?!Io.default.includes(t.ids,c?.FavoriteLocationId):t.value===c?.FavoriteServiceAreaId;c&&u&&(i?(c.FavoriteLocationId=void 0,this.userSettingsMap.update(x=>{let C=x.get(o)??{};return C.location=void 0,x.set(o,C),x})):(c.FavoriteServiceAreaId=void 0,this.userSettingsMap.update(x=>{let C=x.get(o)??{};return C.serviceArea=void 0,x.set(o,C),x})))}this.setFavServiceAreaOptions(o),this.setFavLocationOptions(o)}removeSettings(t){if(t){let o=this.form().get("UserSettings"),i=(o?.value??[]).findIndex(s=>s.TenantId===t);o?.value&&i!==-1&&(o.value.splice(i,1),this.userSettingsMap.update(s=>(s.delete(t),s)))}}loadTenantData(t){if(t!==void 0){let o=this.selectedTenants()[t];o?.value&&!this.loadedTenantIds.includes(o.value)&&(this.setSpinnerStates(t,!0),this.tenantAssociationClick.emit(o.value))}}logChangeToTenantAssociations(t){this.tenantAssociationsThatChanged.update(o=>(o.add(t),o))}isDirty(){this.form().touched||this.form().markAsTouched(),this.form().dirty||this.form().markAsDirty()}setFormRequirednessForLocsandSas(){let t=this.form().controls.UserTenantAssociations.controls;this.isSuperUser()&&t.forEach(o=>{o.get("ServiceAreaIds")?.setValidators(null),o.get("LocationIds")?.setValidators(null)})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-security-access"]],inputs:{allLocations:[1,"allLocations"],calendarViewOptions:[1,"calendarViewOptions"],allServiceAreaOptions:[1,"allServiceAreaOptions"],allUserGroupOptions:[1,"allUserGroupOptions"],canEdit:[1,"canEdit"],form:[1,"form"],isSingleTenant:[1,"isSingleTenant"],isUserEdit:[1,"isUserEdit"],locationTreeNodes:[1,"locationTreeNodes"],submitted:[1,"submitted"],userName:[1,"userName"],validationErrors:[1,"validationErrors"],allTenantOptions:[1,"allTenantOptions"],tenantAssociationsThatChanged:[1,"tenantAssociationsThatChanged"]},outputs:{allServiceAreaOptions:"allServiceAreaOptionsChange",tenantAssociationClick:"tenantAssociationClick",tenantAssociationAdded:"tenantAssociationAdded",allTenantOptions:"allTenantOptionsChange",tenantAssociationsThatChanged:"tenantAssociationsThatChangedChange"},standalone:!1,decls:77,vars:27,consts:[["toggleicon",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],["hidden","","autocomplete","username","type","text","pInputText","",3,"ngModelChange","ngModel","ngModelOptions"],[1,"medium-input"],["id","qware.user.security.input.new-password","tabindex","13","type","password","name","newPassword","formControlName","NewPassword","autocomplete","new-password","variant","filled",1,"is-filled",3,"fluid"],["id","qware.user.security.label.new-password","for","qware.user.security.input.new-password"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.user.security.input.confirm-password","tabindex","14","type","password","name","ConfirmPassword","formControlName","ConfirmPassword","autocomplete","new-password","variant","filled",1,"is-filled",3,"fluid"],["id","qware.user.security.label.confirm-password","for","qware.user.security.input.confirm-password"],["translate",""],[1,"required-mark"],[1,"col-12"],["labelId","qware.user.security.label.tenants","elementId","qware.user.security.input.tenants",3,"unselectChange","selectChange","isStandalone","tabindex","options","isRequired","ngModel","ngModelOptions","label","singleSelect","disabled"],["formArrayName","UserTenantAssociations",1,"medium-input",3,"hidden"],[3,"value","multiple"],[2,"border-radius","0",3,"value"],[3,"click"],[2,"position","relative"],[1,"accordion-content-padding"],[3,"isAbsolute","makeRelativeToBlockingComponent","displaySpinner"],[3,"formGroupName"],[1,"medium-input",3,"hidden"],["formControlName","TenantGroupId","label","USER.USERGROUP","labelId","qware.user.security.label.user-group",3,"selectChange","singleSelect","tabindex","options","isRequired","id","elementId","virtualScroll","virtualScrollItemSize"],["formControlName","ServiceAreaIds","labelId","qware.user.security.label.service-areas","label","USER.SERVICE_AREA_ASSOCIATIONS",3,"unselectChange","selectChange","tabindex","options","i
9317d","isRequired","elementId"],["id","qware.user.security.service-areas-req","translate","",3,"hidden"],["labelId","qware.user.security.label.favorite-service-area","label","USER.FAVORITE_SERVICE_AREA",3,"selectChange","unselectChange","tabindex","options","selectedOption","singleSelect","elementId"],[2,"padding","0 1rem 1rem",3,"hidden"],["formControlName","LocationIds","selectionType","hierarchy",3,"unselectChange","selectChange","primaryNodes","requiredMark","hideToolbar","label"],["id","qware.user.security.locations-req","translate","",3,"hidden"],["label","USER.FAVORITE_LOCATION","labelId","qware.user.security.label.favorite-location",3,"selectChange","unselectChange","tabindex","allLocations","nodeIds","selectedNodeIds","selectedOption","enablePicker","singleSelect","elementId"],[1,"material-icons"],[1,"validation-error"],["variant","filled",3,"onChange","id","options","ngModel","showClear","ngModelOptions","fluid"],["pTemplate","dropdownicon"],["translate","",3,"id","for"],[1,"medium-input","flex","justify-content-between"],["id","qware.location-type.settings.checkbox.address.label","for","qware.location-type.settings.checkbox.address","translate",""],[3,"onChange","disabled","tabindex","ngModelOptions","binary","ngModel"]],template:function(o,i){if(o&1&&(n(0,"form",1),e(1,` 9318 `),n(2,"div",2),e(3,` 9319 `),e(4,` 9320 `),n(5,"input",3),j("ngModelChange",function(c){return W(i.userName,c)||(i.userName=c),c}),a(),e(6,` 9321 `),n(7,"div",4),e(8,` 9322 `),n(9,"p-floatlabel"),e(10,` 9323 `),n(11,"p-password",5),e(12,` 9324 `),a(),e(13,` 9325 `),n(14,"label",6),e(15,` 9326 `),_(16,_4,4,0)(17,E4,4,0),a(),e(18,` 9327 `),a(),e(19,` 9328 `),n(20,"small",7),e(21,` 9329 `),n(22,"div",8),e(23,` 9330 LOGIN.PASSWORD_MIN_LENGTH_VALIDATION 9331 `),a(),e(24,` 9332 `),n(25,"div",8),e(26,` 9333 LOGIN.PASSWORD_MAX_LENGTH_VALIDATION 9334 `),a(),e(27,` 9335 `),a(),e(28,` 9336 `),a(),e(29,` 9337 `),a(),e(30,` 9338 `),n(31,"div",9),e(32,` 9339 `),n(33,"div",4),e(34,` 9340 `),n(35,"p-floatlabel"),e(36,` 9341 `),n(37,"p-password",10),e(38,` 9342 `),a(),e(39,` 9343 `),n(40,"label",11),e(41,` 9344 `),n(42,"span",12),e(43,"USER.CONFIRM_PASSWORD"),a(),n(44,"span",13),e(45," *"),a(),e(46,` 9345 `),a(),e(47,` 9346 `),a(),e(48,` 9347 `),n(49,"small",7),e(50,` 9348 `),n(51,"div",8),e(52,` 9349 LOGIN.PASSWORD_CONFIRMATION_REQUIRED_VALIDATION 9350 `),a(),e(53,` 9351 `),n(54,"div",8),e(55,` 9352 LOGIN.PASSWORD_MATCH_VALIDATION 9353 `),a(),e(56,` 9354 `),a(),e(57,` 9355 `),a(),e(58,` 9356 `),a(),e(59,` 9357 `),n(60,"div",14),e(61,` 9358 `),n(62,"div",4),e(63,` 9359 `),n(64,"qware-autocomplete",15),h("unselectChange",function(c){return i.tenantRemoved(c)})("selectChange",function(c){return i.tenantAdded(c)}),e(65,` 9360 `),a(),e(66,` 9361 `),a(),e(67,` 9362 9363 `),n(68,"div",16),e(69,` 9364 `),n(70,"p-accordion",17),e(71,` 9365 `),G(72,R4,76,63,null,null,u4),a(),e(74,` 9366 `),a(),e(75,` 9367 `),a(),e(76,` 9368`),a()),o&2){let s,c,u,x;p("formGroup",i.form()),l(5),H("ngModel",i.userName),p("ngModelOptions",ne(25,es)),l(6),p("fluid",!0),l(5),f(i.isUserEdit()?16:17),l(4),p("hidden",i.form().controls.NewPassword.valid||i.form().controls.NewPassword.pristine&&!i.submitted),l(2),p("hidden",!((s=i.form().controls.NewPassword.errors)!=null&&s.minlength)),l(3),p("hidden",!((c=i.form().controls.NewPassword.errors)!=null&&c.maxlength)),l(12),p("fluid",!0),Ve("disabled",i.form().controls.NewPassword.value===""?!0:null),l(12),p("hidden",i.form().controls.ConfirmPassword.valid||i.form().controls.ConfirmPassword.pristine&&!i.submitted),l(2),p("hidden",!((u=i.form().controls.ConfirmPassword.errors)!=null&&u.required)),l(3),p("hidden",!((x=i.form().controls.ConfirmPassword.errors)!=null&&x.MatchPassword)),l(10),p("isStandalone",!0)("tabindex",15)("options",i.allTenantOptions())("isRequired",!0)("ngModel",i.isSingleTenant()?i.selectedTenants()[0]:i.selectedTenants())("ngModelOptions",ne(26,es))("label",i.isSingleTenant()?"USER.TENANT":"USER.TENANTS")("singleSelect",i.isSingleTenant())("disabled",!i.canEdit()),l(4),p("hidden",i.formControls().length===0),l(2),p("value",i.shadeIndex())("multiple",!0),l(2),k(i.formControls())}},dependencies:[Mt,Pe,Nt,Ot,Ft,yt,Ne,hr,Ae,se,ge,Le,Ri,ye,Ya,wt,me,Te,De,Md,Ud,it,$,ie],styles:[`qware-user-security-access .p-accordion .p-accordionpanel{border-left:1px solid var(--p-surface-400);border-right:1px solid var(--p-surface-400)}qware-user-security-access .p-accordion .p-accordionpanel:first-of-type{border-top:1px solid var(--p-surface-400)} 9369`],encapsulation:2,changeDetection:0})}return r})();function w4(r,d){if(r&1){let t=b();e(0,` 9370 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 9371 `),n(3,"span",18),e(4),a(),e(5,` 9372 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 9373 `),a(),e(10,` 9374 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"USER.CONTACT_INFORMATION"))}}function D4(r,d){if(r&1){let t=b();e(0,` 9375 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 9376 `),n(3,"span",18),e(4),a(),e(5,` 9377 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 9378 `),a(),e(10,` 9379 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"USER.EMPLOYMENT_INFORMATION"))}}function L4(r,d){if(r&1){let t=b();e(0,` 9380 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 9381 `),n(3,"span",18),e(4),a(),e(5,` 9382 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 9383 `),a(),e(10,` 9384 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"USER.SECURITY_AND_ACCESS"))}}function N4(r,d){if(r&1){let t=b();e(0,` 9385 `),n(1,"div",3),e(2,` 9386 `),n(3,"h3",4),e(4,` 9387 USER.CREATE_USER 9388 `),a(),e(5,` 9389 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();
9389return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 9390 `),n(8,"p-step-list"),e(9,` 9391 `),n(10,"p-step",6),e(11,` 9392 `),_(12,w4,11,4,"ng-template",null,0,A),e(14,` 9393 `),a(),e(15,` 9394 `),n(16,"p-step",6),e(17,` 9395 `),_(18,D4,11,4,"ng-template",null,0,A),e(20,` 9396 `),a(),e(21,` 9397 `),n(22,"p-step",6),e(23,` 9398 `),_(24,L4,11,4,"ng-template",null,0,A),e(26,` 9399 `),a(),e(27,` 9400 `),a(),e(28,` 9401 `),n(29,"p-step-panels"),e(30,` 9402 `),n(31,"p-card"),e(32,` 9403 `),n(33,"div",7),e(34,` 9404 `),n(35,"h4",8),e(36,` 9405 USER.CONTACT_INFORMATION 9406 `),a(),e(37,` 9407 `),n(38,"qware-user-contact-information",9),e(39,` 9408 `),a(),e(40,` 9409 `),a(),e(41,` 9410 `),n(42,"div",7),e(43,` 9411 `),n(44,"h4",10),e(45,` 9412 USER.EMPLOYMENT_INFORMATION 9413 `),a(),e(46,` 9414 `),n(47,"qware-user-employment-information",11),e(48,` 9415 `),a(),e(49,` 9416 `),a(),e(50,` 9417 `),n(51,"div",7),e(52,` 9418 `),n(53,"h4",12),e(54,` 9419 USER.SECURITY_AND_ACCESS 9420 `),a(),e(55,` 9421 `),n(56,"qware-user-security-access",13),e(57,` 9422 `),a(),e(58,` 9423 `),a(),e(59,` 9424 `),n(60,"div",14),e(61,` 9425 `),n(62,"p-button",15),I(63,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(64,` 9426 `),a(),e(65,` 9427 `),n(66,"p-button",16),I(67,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(68,` 9428 `),a(),e(69,` 9429 `),a(),e(70,` 9430 `),a(),e(71,` 9431 `),a(),e(72,` 9432 `),a(),e(73,` 9433 `),a(),e(74,` 9434 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1),l(6),ve("p-disabled",t.stepIndex<2),p("value",2),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.ContactInformation)("submitted",t.submitted)("validationErrors",t.validationErrors)("canEdit",!0),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.EmploymentInformation)("submitted",t.submitted)("validationErrors",t.validationErrors)("allSupervisorOptions",t.supervisorOptions)("defaultSupervisor",t.defaultSupervisor),l(4),p("hidden",t.stepIndex!==2),l(5),p("form",t.form.controls.SecurityAccess)("submitted",t.submitted)("allLocations",t.allLocations)("validationErrors",t.validationErrors)("allServiceAreaOptions",t.serviceAreaOptions)("canEdit",!0)("allUserGroupOptions",t.userGroupOptions)("locationTreeNodes",t.locationTreeNodes)("isSingleTenant",!0)("allTenantOptions",t.allTenantOptions),l(6),q("label",y(63,35,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(67,37,t.stepIndex===2?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.steps[t.stepIndex].control!=null&&t.steps[t.stepIndex].control.valid))}}var ac=(()=>{class r{authService;fb;locationService;locationTypeService;responseService;roleService;route;router;serviceAreaService;tenantService;toastService;translate;userGroupService;userGroupTemplateService;userService;allLocations=[];allTenantOptions=[];canEdit=!0;defaultSupervisor;displaySpinner=!0;exclusionRoleIds=[];form;isLoaded=!1;locationTreeNodes=new Map;freeRoleIds=[];serviceAreaOptions=new Map;stepIndex=0;steps=[];submitted=!1;supervisorOptions=[];userGroupOptions=new Map;validationErrors;translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L,U,V,z){this.authService=t,this.fb=o,this.locationService=i,this.locationTypeService=s,this.responseService=c,this.roleService=u,this.route=x,this.router=C,this.serviceAreaService=O,this.tenantService=w,this.toastService=F,this.translate=L,this.userGroupService=U,this.userGroupTemplateService=V,this.userService=z}ngOnInit(){this.createForm(),this.loadData()}loadData(){let t,o;ue([this.translate.get(["USER.NO_SUPERVISOR","SHARED.DISABLED","SHARED.DELETED","SHARED.FREE","SHARED.PAID","AUDIT.USER"]).pipe(N()),this.userService.getUsers(this.authService.tenant.Id),this.tenantService.getTenantsForUser(this.authService.currentUserId),this.userGroupTemplateService.getUserGroupTemplates(),this.roleService.getRoles()]).pipe(we(i=>{this.translations=i[0];let s=i[1],c=this.userService.removeSuperUsersIfNotSuperUser(s,this.authService.isSuperUser()),u=i[2],x=i[3],C=i[4],O=x.find(F=>F.Name==="Requester");this.freeRoleIds=O?.Roles??[],this.exclusionRoleIds=C.filter(F=>
9434F.Id&&F.Name==="IsQwareSuperUserGroup").map(F=>F.Id),this.defaultSupervisor={label:this.translations["USER.NO_SUPERVISOR"],value:void 0},this.form.get("EmploymentInformation.Supervisor")?.setValue(this.defaultSupervisor),this.supervisorOptions=[this.defaultSupervisor],this.supervisorOptions=this.supervisorOptions.concat(c.filter(F=>F.State===M.ACTIVE).map(F=>({label:F.fullNameWithEmail(),value:F.UserId})));let w=Ja.default.intersectionBy(u,[this.authService.tenant],"Id").filter(F=>F.State===M.ACTIVE);return w&&(o=w.map(F=>({label:F.Name,value:F.Id})),t=o.map(F=>F.value)),ue([this.userGroupService.getAllUserGroups(t),this.serviceAreaService.getAllServiceAreas(t),this.locationService.getAllLocations(t),this.locationTypeService.getAllLocationTypes(t)])})).subscribe(i=>{let s=Ja.default.flatten(i[0]),c=Ja.default.flatten(i[1]);this.allLocations=Ja.default.flatten(i[2]);let u=Ja.default.flatten(i[3]);t.forEach(x=>{this.userGroupOptions.set(x,s.filter(O=>O.TenantId===x&&O.State===M.ACTIVE&&!ci.includes(O.Name??"")).map(O=>{let w={label:O.Name,value:O.Id},F=this.freeRoleIds.length>0&&Ja.default.difference(O.Roles,this.freeRoleIds).length===0,L=Ja.default.intersection(O.Roles,this.exclusionRoleIds).length>0;return F?w.title=this.translations["SHARED.FREE"]:!F&&!L&&(w.title=this.translations["SHARED.PAID"]),w})),this.serviceAreaOptions.set(x,c.filter(O=>O.TenantId===x&&O.State===M.ACTIVE).map(O=>({label:O.Name,value:O.Id})));let C=this.allLocations.filter(O=>O.TenantId===x&&O.State===M.ACTIVE).map(O=>(O.LocationType=u.find(w=>w.Id===O.LocationTypeId),O.Icon=O.LocationType?.Icon,O.Parent=this.allLocations.find(w=>w.Id===O.ParentId),O));this.locationTreeNodes.set(x,C.map(O=>this.locationService.convertToTreeNode(O,new Set(C.filter(w=>w.Id).map(w=>w.Id)))))}),this.allTenantOptions=o,this.steps=[{label:"USER.CONTACT_INFORMATION",value:0,control:this.form.get("ContactInformation")},{label:"USER.EMPLOYMENT_INFORMATION",value:1,control:this.form.get("EmploymentInformation")},{label:"USER.SECURITY_AND_ACCESS",value:2,control:this.form.get("SecurityAccess")}],this.isLoaded=!0,this.displaySpinner=!1})}createForm(){this.form=this.fb.group({ContactInformation:this.fb.group({FirstName:this.fb.control("",[T.required,T.maxLength(re)]),LastName:this.fb.control("",[T.required,T.maxLength(re)]),MiddleName:this.fb.control("",T.maxLength(re)),Email:this.fb.control("",[T.required,T.maxLength(re),T.pattern(Ui)]),PhoneNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),Extension:this.fb.control("",T.pattern("^[0-9]*"))}),EmploymentInformation:this.fb.group({JobTitle:this.fb.control("",T.maxLength(re)),Department:this.fb.control("",T.maxLength(re)),HourlyRate:this.fb.control(0,T.required),EmployeeNumber:this.fb.control("",T.maxLength(re)),Supervisor:this.fb.control(null),OvertimeRate:this.fb.control(0,T.required)}),SecurityAccess:this.fb.group({NewPassword:this.fb.control("",[T.minLength(Nn),T.maxLength(On)]),ConfirmPassword:this.fb.control("",T.required),UserTenantAssociations:this.fb.array([this.fb.group({TenantName:this.fb.control(this.authService.tenant.Name),TenantId:this.fb.control(this.authService.tenant.Id),TenantGroupId:this.fb.control(null,T.required),ServiceAreaIds:this.fb.control([],T.required),LocationIds:this.fb.control([],T.required)})],T.required),UserSettings:this.fb.control([])})},{validators:[ia.matchPassword("NewPassword","ConfirmPassword","SecurityAccess")]})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../../"+P.userList],t)}else this.stepIndex--}stepSubmit(t){this.steps[t].control?.valid&&(t<2?this.stepIndex++:this.submitForm(new Ji().parseForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.UserTenantAssociations?.forEach(o=>{o.TenantGroupId=o.TenantGroupId.value,o.ServiceAreaIds=o.ServiceAreaIds.map(i=>i.value)}),this.userService.createUser(t,this.authService.tenant.Id).pipe(we(o=>{t.UserId=o;let i=[];return t.UserTenantAssociations&&t.UserTenantAssociations.length>0&&(t.UserTenantAssociations.forEach(s=>{s.UserId=o}),i.push(this.serviceAreaService.updateServiceAreaAssociations(t.UserTenantAssociations,Fa.CREATE))),t.UserSettings&&t.UserSettings.length>
94340&&(t.UserSettings.forEach(s=>{s.Audit=Fa.CREATE,s.UserId=t.UserId}),i.push(this.userService.updateUserSettings(t.UserSettings))),i.length===0?Fe({}):ue(i)}),we(()=>Er(this,null,function*(){t.UserTenantAssociations&&t.UserTenantAssociations.length>0&&this.updateLocationAssociations(t.UserTenantAssociations)}))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.CREATE","../../"+P.userList,this.route,{name:t.fullName(),email:t.Email})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(i=>i.control),this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}updateLocationAssociations(t){return Er(this,null,function*(){yield wo(this.locationService.updateLocationAssociations(t,Fa.CREATE)).catch(o=>{this.translate.get(["SHARED.ERROR_LABEL","USER.ERROR.ASSOCIATION_ERROR","USER.ERROR.ASSOCIATION_TIMEOUT"]).pipe(N()).subscribe(i=>{o.statusCode===0?this.toastService.error(i["SHARED.ERROR_LABEL"],i["USER.ERROR.ASSOCIATION_TIMEOUT"]):this.toastService.error(i["SHARED.ERROR_LABEL"],i["USER.ERROR.ASSOCIATION_ERROR"])})})})}static \u0275fac=function(o){return new(o||r)(g(de),g(be),g(zt),g(yi),g(Re),g(hn),g(he),g(Be),g(_i),g($i),g(Se),g(le),g(Tt),g(kn),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-create"]],standalone:!1,decls:6,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.user.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.user.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.user.create.contact.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","canEdit"],["id","qware.user.create.employment.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","allSupervisorOptions","defaultSupervisor"],["id","qware.user.create.security.label","translate","",1,"page-header"],[3,"form","submitted","allLocations","validationErrors","allServiceAreaOptions","canEdit","allUserGroupOptions","locationTreeNodes","isSingleTenant","allTenantOptions"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.user.create-user.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.user.create-user.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("keydown.enter",function(){return i.stepSubmit(i.stepIndex)}),e(1,` 9435 `),n(2,"qware-spinner",2),e(3,` 9436 `),_(4,N4,75,39),a(),e(5,` 9437`),a()),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,Zl,Jl,ts,ie],encapsulation:2})}return r})();var Tn=He(nt());var O4=r=>({userName:r});function F4(r,d){r&1&&(e(0,` 9438 `),n(1,"tr"),e(2,` 9439 `),n(3,"th",11),e(4,"EVENT.ASSIGNMENT"),a(),e(5,` 9440 `),n(6,"th",11),e(7,"EVENT.EDITOR"),a(),e(8,` 9441 `),n(9,"th",11),e(10,"EVENT.VOTER"),a(),e(11,` 9442 `),n(12,"th",11),e(13,"EVENT.NOTIFICATIONS"),a(),e(14,` 9443 `),a(),e(15,` 9444 `))}function M4(r,d){if(r&1&&(e(0,` 9445 `),n(1,"tr"),e(2,` 9446 `),n(3,"td"),e(4),a(),e(5,` 9447 `),n(6,"td"),e(7),a(),e(8,` 9448 `),n(9,"td"),e(10),a(),e(11,` 9449 `),n(12,"td"),e(13),a(),e(14,` 9450 `),a(),e(15,` 9451 `)),r&2){let t=d.$implicit;l(4),v(t.name),l(3),v(t.editor),l(3),v(t.voter),l(3),v(t.notifications)}}function U4(r,d){if(r&1&&(e(0,` 9452 `),n(1,"div",7),e(2,` 9453 `),n(3,"p-table",8),e(4,` 9454 `),_(5,F4,16,0,"ng-template",9),e(6,` 9455 `),_(7,M4,16,4,"ng-template",10),e(8,` 9456 `),a(),e(9,` 9457 `),a(),e(10,` 9458 `)),r&2){let t=m(2);l(3),p("value",t.eventPrivilegeData())("paginator",!0)("rows",t.isMobileSize()?5:10)}}function P4(r,d){if(r&1&&(e(0,` 9459 `),n(1,"div",6),e(2),I(3,"translate"),a(),e(4,` 9460 `),_(5,U4,11,3)),r&2){let t=m();l(2),K(` 9461 `,$e(3,2,"USER.EVENT_ASSIGNMENTS",pe(5,O4,t.userName())),` 9462 `),l(3),f(t.eventPrivilegeData()&&t.eventPrivilegeData().length>0?5:-1)}}function G4(r,d){if(r&1){let t=b();e(0,` 9463 `),n(1,"div",7),e(2,` 9464 `),n(3,"qware-autocomplete",12),h("selectChange",function(i){E(t);let s=m();return S(s.selectChanged(i))}),e(4,` 9465 `),a(),e(5,` 9466 `),a(),e(6,` 9467 `)}if(r&2){let t=m();l(3),p("options",t.allInternalUsersOptions())("singleSelect",!0)("virtualScroll",!0)("virtualScrollItemSize",38)}}var rc=(()=>{class r{onResize(){this.isMobileSize.set(window.innerWidth<=Je.lgbreak)}allInternalUsersOptions=D([]);displaySpinner=D(!0);eventPrivilegeData=D([]);isMobileSize=D(!1);selectedUserId=D(void 0);userName=D(void 0);authService=te(de);config=te(sl);eventService=te(oi);locationService=te(zt);ref=te(dl);translate=te(le);constructor(){this.allInternalUsersOptions.set(this.config.data.options),this.userName.set(this.config.data.userName);let t=this.config.data.eventAssignments,o=0,i=0,s=0;t.forEach(c=>{switch(c.AssignmentType){case rr.CALENDAR:o++;break;case rr.CATEGORY:i++;break;case rr.LOCATION:s++;break}}),ue([this.translate.get(["SHARED.YES","SHARED.NO","EVENT.CALENDAR","EVENT.CATEGORY","EVENT.LOCATION","EVENT.ASSIGNMENT"]).pipe(N()),o>0?this.eventService.getCalendars():Fe([]),i>0?this.eventService.getCategories():Fe([]),s>0?this.locationService.getLocations(this.authService.tenant.Id):Fe([])]).subscribe(c=>{let u=c[0],x=c[1],C=c[2],O=c[3],w=[];t.filter(L=>L.State===M.ACTIVE&&L.TenantId===this.authService.tenant.Id).forEac
9467h(L=>{switch(L.AssignmentType){case rr.CALENDAR:let U=x.find(ce=>ce.Id===L.EntityId);U&&U.Name&&w.push({name:U.Name+" ("+u["EVENT.CALENDAR"]+" "+u["EVENT.ASSIGNMENT"]+")",editor:u[L.IsEditor?"SHARED.YES":"SHARED.NO"],voter:u[L.IsVoter?"SHARED.YES":"SHARED.NO"],notifications:u[L.EmailNotifications?"SHARED.YES":"SHARED.NO"]});break;case rr.CATEGORY:let V=C.find(ce=>ce.Id===L.EntityId);V&&V.Name&&w.push({name:V.Name+" ("+u["EVENT.CATEGORY"]+" "+u["EVENT.ASSIGNMENT"]+")",editor:u[L.IsEditor?"SHARED.YES":"SHARED.NO"],voter:u[L.IsVoter?"SHARED.YES":"SHARED.NO"],notifications:u[L.EmailNotifications?"SHARED.YES":"SHARED.NO"]});break;case rr.LOCATION:let z=O.find(ce=>ce.Id===L.EntityId);if(z){let ce=this.locationService.getLocationName(z,O);ce&&w.push({name:ce+" ("+u["EVENT.LOCATION"]+" "+u["EVENT.ASSIGNMENT"]+")",editor:u[L.IsEditor?"SHARED.YES":"SHARED.NO"],voter:u[L.IsVoter?"SHARED.YES":"SHARED.NO"],notifications:u[L.EmailNotifications?"SHARED.YES":"SHARED.NO"]})}break}}),w.length>0&&this.eventPrivilegeData.set(w.sort((L,U)=>L.name.toLowerCase()<U.name.toLowerCase()?-1:1)),this.displaySpinner.set(!1)})}transfer(){this.ref&&this.ref.close(this.selectedUserId())}cancel(){this.ref&&this.ref.close()}selectChanged(t){this.selectedUserId?.set(t?.value)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-transfer-event-approvals-popup"]],hostBindings:function(o,i){o&1&&h("resize",function(){return i.onResize()},!1,vt)},standalone:!1,decls:23,vars:15,consts:[["id","qware.user.edit.transfer-event-approvals-popup.spinner",3,"displaySpinner"],[1,"grid","popup-container"],["id","qware.user.edit.transfer-event-approvals-popup.instructions",1,"col-12","instructions"],[1,"align-right","flex-inline","p-dialog-footer",2,"width","100%"],["id","qware.user.edit.transfer-event-approvals-popup.button.cancel","severity","secondary",3,"onClick","label","text"],["id","qware.user.edit.transfer-event-approvals-popup.button.transfer",3,"onClick","label","text","disabled"],["id","qware.user.edit.transfer-event-approvals-popup.user-message",1,"col-12"],[1,"col-12"],["tableStyleClass","p-datatable-sm","id","qware.user.edit.transfer-event-approvals-popup.assignment-table",3,"value","paginator","rows"],["pTemplate","header"],["pTemplate","body"],["translate",""],["label","SHARED.USER","labelId","qware.user.edit.transfer-event-approvals-popup.label.dropdown","elementId","qware.user.edit.transfer-event-approvals-popup.dropdown","appendTo","body","id","qware.user.edit.transfer-event-approvals-popup.dropdown-e2e",3,"selectChange","options","singleSelect","virtualScroll","virtualScrollItemSize"]],template:function(o,i){o&1&&(n(0,"qware-spinner",0),e(1,` 9468 `),n(2,"div",1),e(3,` 9469 `),_(4,P4,6,7),n(5,"div",2),e(6),I(7,"translate"),a(),e(8,` 9470 `),_(9,G4,7,4),a(),e(10,` 9471 `),n(11,"div",3),e(12,` 9472 `),n(13,"p-button",4),I(14,"translate"),h("onClick",function(){return i.cancel()}),e(15,` 9473 `),a(),e(16,` 9474 `),n(17,"p-button",5),I(18,"translate"),h("onClick",function(){return i.transfer()}),e(19,` 9475 `),a(),e(20,` 9476 `),a(),e(21,` 9477`),a(),e(22,` 9478`)),o&2&&(p("displaySpinner",i.displaySpinner()),l(4),f(i.userName()?4:-1),l(2),K(` 9479 `,y(7,9,"EVENT.TRANSFER_EVENT_APPROVALS_MESSAGE"),` 9480 `),l(3),f(i.allInternalUsersOptions()&&i.allInternalUsersOptions().length>0?9:-1),l(4),q("label",y(14,11,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(18,13,"SHARED.TRANSFER")),p("text",!0)("disabled",!i.selectedUserId()))},dependencies:[Pe,oe,wt,me,ht,$,ie],styles:[".popup-container[_ngcontent-%COMP%]{padding:.5rem 1rem 1rem}.popup-container[_ngcontent-%COMP%] .assignment-container[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:500}.popup-container[_ngcontent-%COMP%] .instructions[_ngcontent-%COMP%]{margin-bottom:.5rem}"],changeDetection:0})}return r})();var k4=()=>[oe,_n,se,Le,gi,Ya,$],V4=(r,d)=>d.Id;function q4(r,d){if(r&1&&(e(0,` 9481 `),n(1,"p"),e(2),a(),e(3,` 9482 `)),r&2){let t=m(2).$implicit;l(2),v(t.FilterString)}}function B4(r,d){r&1&&(e(0,` 9483 `),n(1,"p",13),e(2,"SHARED.NONE"),a(),e(3,` 9484 `))}function H4(r,d){r&1&&(e(0,` 9485 `),n(1,"span",16),e(2,` 9486 `),n(3,"i",10),e(4,"visibility_off"),a(),e(5,` 9487 `),a(),e(6,` 9488 `))}function W4(r,d){r&1&&(e(0,` 9489 `),n(1,"span",16),e(2,` 9490 `),n(3,"i",10),e(4,"visibility"),a(),e(5,` 9491 `),a(),e(6,` 9492 `))}function j4(r,d){r&1&&(e(0,` 9493 `),n(1,"i",10),e(2,"check"),a(),e(3,` 9494 `))}function Y4(r,d){r&1&&(e(0,` 9495 `),n(1,"div",17),e(2,` 9496 `),n(3,"p-message",18),e(4,` 9497 `),_(5,j4,4,0,"ng-template",null,2,A),e(7,` 9498 `),n(8,"span",13),e(9,"SHARED.COPIED_TO_CLIPBOARD"),a(),e(10,` 9499 `),a(),e(11,` 9500 `),a(),e(12,` 9501 `))}function Q4(r,d){if(r&1){let t=b();e(0,` 9502 `),n(1,"div",5),e(2,` 9503 `),n(3,"div",6),e(4,` 9504 `),n(5,"h5",7),e(6),a(),e(7,` 9505 `),n(8,"div",8),e(9,` 9506 `),n(10,"p-button",9),h("click",function(){let i;E(t);let s=m().$implicit,c=m();return S(c.showCopySuccessMessage((i=s.Id)!==null&&i!==void 0?i:""))}),e(11,` 9507 `),n(12,"i",10),e(13,"content_copy"),a(),e(14,` 9508 `),a(),e(15,` 9509 `),n(16,"p-button",11),h("onClick",function(){E(t);let i=m().$implicit,s=m();return S(s.deleteSubscription(i))}),e(17,` 9510 `),n(18,"i",10),e(19,"delete"),a(),e(20,` 9511 `),a(),e(21,` 9512 `),a(),e(22,` 9513 `),a(),e(23,` 9514 9515 `),n(24,"div",12),e(25,` 9516 `),n(26,"p",13),e(27,"SHARED.FILTERS"),a(),e(28,` 9517 `),_(29,q4,4,1)(30,B4,4,0),a(),e(31,` 9518 9519 `),n(32,"div",14),e(33,` 9520 `),n(34,"p-password",15),e(35,` 9521 `),_(36,H4,7,0,"ng-template",null,0,A),e(38,` 9522 `),_(39,W4,7,0,"ng-template",null,1,A),e(41,` 9523 `),a(),e(42,` 9524 `),a(),e(43,` 9525 9526 `),_(44,Y4,13,0),a(),e(45,` 9527 `)}if(r&2){let t,o=m().$implicit,i=m();l(6),v(o.CalendarName),l(4),p("text",!0)("rounded",!0)("qwareCopyToClipboard",o.Url),l(6),p("text",!0)("rounded",!0),l(13),f(o.FilterString&&o.FilterString.length>0?29:30),l(5),xd("inputId","qware.calendar-feeds.input.url-",o.Id,""),p("ngModel",o.Url)("disabled",!0)("feedback",!1)("toggleMask",!0)("fluid",!0),l(10),f(i.showCopyMessage().get((t=o.Id)!==null&&t!==void 0?t:"")?44:-1)}}function K4(r,d){r&1&&R(0,"p-skeleton",19)}function $4(r,d){r&1&&(e(0,` 9528 `),_(1,Q4,46,15)(2,K4,1,0),Oo(3,1,k4,null,2),Fo(0,-1))}var oc=(()=>{class r{subscriptions=ee.required();subscriptionDeleted=Dt();showCopyMessage=D(new Map);copyMessageTimeouts=new Map;authService=te(de);confirmationService=te(mt);eventService=te(oi);toastService=te(Se);translate=te(le);
9528ngOnDestroy(){this.copyMessageTimeouts.forEach(t=>clearTimeout(t)),this.copyMessageTimeouts.clear()}showCopySuccessMessage(t){let o=this.copyMessageTimeouts.get(t);o&&clearTimeout(o);let i=new Map(this.showCopyMessage());i.set(t,!0),this.showCopyMessage.set(i);let s=setTimeout(()=>{let c=new Map(this.showCopyMessage());c.set(t,!1),this.showCopyMessage.set(c),this.copyMessageTimeouts.delete(t)},2e3);this.copyMessageTimeouts.set(t,s)}deleteSubscription(t){this.translate.get(["SHARED.DELETE_HEADER","USER.DELETE_SUBSCRIPTION_MESSAGE","SHARED.DELETE","SHARED.CANCEL"],{calendarName:t.CalendarName}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"deletePromptDialog",header:o["SHARED.DELETE_HEADER"],message:o["USER.DELETE_SUBSCRIPTION_MESSAGE"],acceptLabel:o["SHARED.DELETE"],rejectLabel:o["SHARED.CANCEL"],accept:()=>{this.performDelete(t)}})})}performDelete(t){t.Id&&this.eventService.deleteCalendarSubscription(t.Id,this.authService.tenant.Id).pipe(N()).subscribe({next:o=>{o===!0&&(this.translate.get(["SHARED.SUCCESS","USER.SUCCESS.DELETE_SUBSCRIPTION"]).pipe(N()).subscribe(i=>{this.toastService.success(i["SHARED.SUCCESS"],i["USER.SUCCESS.DELETE_SUBSCRIPTION"])}),this.subscriptionDeleted.emit(t.Id))},error:()=>{this.translate.get(["SHARED.ERROR_LABEL","USER.ERROR.DELETE_SUBSCRIPTION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["USER.ERROR.DELETE_SUBSCRIPTION"])})}})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-calendar-feeds"]],inputs:{subscriptions:[1,"subscriptions"]},outputs:{subscriptionDeleted:"subscriptionDeleted"},standalone:!1,decls:7,vars:0,consts:[["hideicon",""],["showicon",""],["icon",""],[1,"col-12"],[1,"subscriptions-container"],[1,"subscription-item"],[1,"subscription-header"],[1,"subscription-name"],[1,"subscription-actions"],["severity","secondary","styleClass","icon-only-button",3,"click","text","rounded","qwareCopyToClipboard"],[1,"material-icons"],["severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded"],[1,"filters"],["translate",""],[1,"subscription-url"],["variant","filled","styleClass","calendar-subscription-password",3,"ngModel","disabled","feedback","toggleMask","fluid","inputId"],[1,"p-iconwrapper","p-password-toggle-mask-icon","p-password-mask-icon"],[1,"copy-success-message"],["severity","success"],["height","4rem"]],template:function(o,i){o&1&&(n(0,"div",3),e(1,` 9529 `),n(2,"div",4),e(3,` 9530 `),G(4,$4,5,0,null,null,V4),a(),e(6,` 9531`),a()),o&2&&(l(4),k(i.subscriptions()))},dependencies:[Fr],styles:[".subscriptions-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;margin:1rem 1rem 1.5rem}.subscription-item[_ngcontent-%COMP%]{border:1px solid var(--p-surface-400);border-radius:4px;padding:1rem;background:var(--p-surface-0)}.subscription-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:flex-start}.subscription-name[_ngcontent-%COMP%]{margin:0;font-weight:700;color:var(--p-text-color)}.subscription-actions[_ngcontent-%COMP%]{display:flex;gap:.25rem}.filters[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]:first-of-type{font-weight:500}.filters[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]:last-of-type{font-size:var(--p-font-size-body3)}.subscription-url[_ngcontent-%COMP%]{margin-top:.5rem}.subscription-url[_ngcontent-%COMP%] .material-icons[_ngcontent-%COMP%]{cursor:pointer}.subscription-url[_ngcontent-%COMP%] .calendar-subscription-password input{font-family:monospace;font-size:var(--p-font-size-body3)}.copy-success-message[_ngcontent-%COMP%]{margin-top:.5rem;transition:opacity .3s ease-in-out}.no-subscriptions[_ngcontent-%COMP%]{text-align:center;padding:2rem;color:var(--p-text-muted-color)} .calendar-subscription-password input:disabled{opacity:1!important}"],changeDetection:0})}return r})();var X4=["actionsMenu"],Z4=["shades"],J4=["drawer"],e5=r=>({"lg:col-8":r}),t5=()=>["0"];function i5(r,d){r&1&&(e(0,` 9532 `),n(1,"h3",31),e(2,` 9533 USER.MY_ACCOUNT 9534 `),a(),e(3,` 9535 `))}function n5(r,d){r&1&&(e(0,` 9536 `),n(1,"h3",31),e(2,` 9537 USER.EDIT_USER 9538 `),a(),e(3,` 9539 `))}function a5(r,d){if(r&1&&(e(0,` 9540 `),n(1,"span",34),e(2),a(),e(3,` 9541 `)),r&2){let t=m().$implicit;l(2),v(t.icon)}}function r5(r,d){if(r&1&&(e(0,` 9542 `),R(1,"img",35),e(2,` 9543 `)),r&2){let t=m().$implicit;l(),Bt(t.iconClass),p("src",t.icon,jt)}}function o5(r,d){if(r&1&&(e(0,` 9544 `),n(1,"a",32),e(2,` 9545 `),_(3,a5,4,1)(4,r5,3,3),n(5,"span",33),e(6),a(),e(7,` 9546 `),a(),e(8,` 9547 `)),r&2){let t=d.$implicit;l(3),f(t.icon&&!t.iconClass?3:-1),l(),f(t.icon&&t.iconClass==="menu-svg"?4:-1),l(2),v(t.label)}}function l5(r,d){r&1&&(e(0,` 9548 `),n(1,"span",37),e(2,"SHARED.ACTIONS"),a(),e(3,` 9549 `),n(4,"i",38),e(5,"expand_more"),a(),e(6,` 9550 `))}function s5(r,d){if(r&1){let t=b();e(0,` 9551 `),n(1,"p-button",36),h("onClick",function(i){E(t),m();let s=Ee(11);return S(s.toggle(i))}),e(2,` 9552 `),_(3,l5,7,0,"ng-template",null,4,A),e(5,` 9553 `),a(),e(6,` 9554 `)}r&2&&(l(),p("raised",!0))}function d5(r,d){if(r&1&&(e(0,` 9555 `),n(1,"a",32),e(2,` 9556 `),n(3,"span",34),e(4),a(),e(5,` 9557 `),n(6,"span",33),e(7),a(),e(8,` 9558 `),a(),e(9,` 9559 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function p5(r,d){if(r&1){let t=b();e(0,` 9560 `),n(1,"div",39),e(2,` 9561 `),n(3,"p-menu",40,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 9562 `),_(6,d5,10,2,"ng-template",null,1,A),e(8,` 9563 `),a(),e(9,` 9564 `),n(10,"p-button",41),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 9565 `),n(12,"i",38),e(13,"more_vert"),a(),e(14,` 9566 `),a(),e(15,` 9567 `),a(),e(16,` 9568 `)}if(r&2){let t=m();l(3),p("model",t.moreItems())("popup",!0),l(7),p("rounded",!0)("text",!0)}}function m5(r,d){r&1&&(e(0,` 9569 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 9570 `))}function c5(r,d){r&1&&(e(0,` 9571 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 9572 `))}function u5(r,d){if(r&1&&(e(0,` 9573 `),_(1,m5,4,0)(2,c5,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function _5(r,d){r&1&&(e(0,` 9574 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 9575 `))}function E5(r,d){r&1&&(e(0,` 9576 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 9577 `))}function S5(r,d){if(r&1&&(e(0,` 9578 `),_(1,_5,4,0)(2,E5,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function x5(r,d){r&1&&(e(0,` 9579 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 9580 `))}function f5(r,d){r&1&&(e(0,` 9581 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 9582 `))}function h5(r,d){if(r&1&&(e(0,` 9583 `),_(1,x5,4,0)(2,f5,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function C5(r,d){r&1&&(e(0,` 9584 `),n(1,"i",38),e(2,"expand_less"),a(),e(3,` 9585 `))}function v5(r,d){r&1&&(e(0,` 9586 `),n(1,"i",38),e(2,"expand_more"),a(),e(3,` 9587 `))}function g5(r,d){if(r&1&&(e(0,` 9588 `),_(1,C5,4,0)(2,v5,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function T5(r,d){if(r&1){let t=b();e(0,` 9589 `),n(1,"p-accordion-panel",42),e(2,` 9590 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,g5,3,1,"ng-template",null,3,A),e(8,` 9591 `),a(),e(9,` 9592 `),n(10,"p-accordion-content"),e(11,` 9593 `),n(12,"div",23),e(13,` 9594 `),n(14,"qware-calendar-feeds",43),h("subscriptionDeleted",function(i){E(t);let s=m();return S(s.onSubscriptionDeleted(i))}),e(15,` 9595 `),a(),e(16,` 9596 `),a(),e(17,` 9597 `),a(),e(18,` 9598 `),a(),e(19,` 9599 `)}if(r&2){let t=m();l(4),K(` 9600 `,y(5,2,"USER.CALENDAR_SUBSCRIPTIONS"),` 9601 `),l(10),p("subscriptions",t.calendarSubscriptions())}}function I5(r,d){if(r&1){let t=b();e(0,` 9602 `),n(1,"p-button",44),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 9603 `),a(),e(4,` 9604 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function b5(r,d){r&1&&(e(0,` 9605 `),n(1,"div",47),e(2,` 9606 `),n(3,"span",48),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 9607 `),a(),e(6,` 9608 `))}function y5(r,d){if(r&1){let t=b();e(0,` 9609 `),n(1,"qware-spinner",49),e(2,` 9610 `),n(3,"div",50),e(4,` 9611 `),n(5,"qware-entity-history",51),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 9612 `),a(),e(7,` 9613 `),a(),e(8,` 9614 `),a(),e(9,` 9615 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText())("nameMap",t.historyNameMap())("idMaps",t.historyIdMap())("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner),p("blacklistProperties",t.historyBlacklist())}}function A5(r,d){if(r&1){let t=b();e(0,` 9616 `),n(1,"div",45),e(2,` 9617 `),n(3,"p-drawer",46,6),h("visibleChange",function(i){E(t);let s=m();return S(s.showSidebar.set(i))})("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar.set(!1))}),e(5,` 9618 `),_(6,b5,7,0,"ng-template",null,7,A),e(8,` 9619 `),_(9,y5,10,8,"ng-template",null,4,A),e(11,` 9620 `),a(),e(12,` 9621 `),a(),e(13,` 9622 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar()),l(2),p("visible",t.showSidebar())("modal",t.showMask())("transitionOptions",t.sidebarOptions())("closeOnEscape",!1)}}var td=(()=>{class r{actionsMenu;shades;drawer;actionItems=D([]);allLocations=D([]);allTenantOptions=D([]);calendarSubscriptions=D([]);calendarViewOptions=D(new Map);defaultSupervisor=D(void 0);displayDrawerSpinner=D(!1);displaySpinner=D(!0);historyBlacklist=D(el.USER_EDIT);historyCreatedText=D(void 0);historyIdMap=D(new Map);historyNameMap=D(new Map);isLoggedUser=D(!1);locationTreeNodes=D(new Map);moreItems=D([]);securityHeader=D("");serviceAreaOptions=D(new Map);showMask=D(!1);showSidebar=D(!1);sidebarOptions=D(qe.REMOVE_ANIMATION);submitted=D(!1);supervisorOptions=D([]);tenantAssociationsThatChanged=D(new Set);user=D(void 0);userEnabledSidebar=D(!1);userFirstLetter=D("");userGroupOptions=D(new Map);validationErrors=D(void 0);showCalendarSubscriptions=Ye(()=>{let t=this.hasEventsModule(),o=this.calendarSubscriptions(),i=this.isLoggedUser(),s=this.isSuperUser();return t&&o.length>0&&(i||s)});form;historyArrayProperties=["LocationIds","ServiceAreaIds"];isActive=!1;allLocationTypes=[];allRoles=[];allServiceAreas=[];allUserGroups=[];allUsers=[];isAccountUrl=!1;isMobileSize=!1;isUserGroupDisabled=!1;shadeFormGroups=[];translations={};userEventAssignments=[];userLocations=[];userServiceAreas=[];auditLoggingDisabled=D(!0);hasEventsModule=D(!1);canEdit=D(void 0);isSuperUser=D(!1);cancelRoute="../../../"+P.userList;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};authService=te(de);cacheService=te(ei);confirmationService=te(mt);dialogService=te(Va);eventService=te(oi);fb=te(be);locationService=te(zt);locationTypeService=te(yi);loginService=te(El);responseService=te(Re);roleService=te(hn);route=te(he);router=te(Be);serviceAreaService=te(_i);tenantService=te($i);toastService=te(Se);translate=te(le);userGroupService=te(Tt);userService=te(ct);constructor(){this.isLoggedUser.set(this.authService.currentUserId===this.route.
9622snapshot.params.id);let t=this.authService.userHasPrivilege(ae.IS_SUPER_USER);this.isSuperUser.set(t),this.canEdit.set(this.authService.userHasPrivilege(ae.CAN_ACCESS_USER_MANAGEMENT)||t),this.auditLoggingDisabled.set(!this.authService.qwareSubscription?.auditLogging&&!t),this.hasEventsModule.set(this.authService.tenant.EventsModule)}configureRightDrawer(){this.isMobileSize=window.innerWidth<=Je.lgbreak;let t=window.innerWidth>=Je.lgbreak;this.showSidebar.set(t||this.userEnabledSidebar()),this.showMask.set(window.innerWidth<Je.lgbreak),this.showMask()&&this.showSidebar()?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions.set(this.showSidebar()?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION)}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){let t=this.route.snapshot.params.id;this.isAccountUrl=this.route.snapshot.url[this.route.snapshot.url.length-1]?.path==="account";let o=this.hasEventsModule(),i=this.isLoggedUser(),s;ue([this.translate.get(["AUDIT.USER","EVENT.TRANSFER_APPROVALS","EVENT.TRANSFER_EVENT_APPROVALS_HEADER","EVENT.TRANSFER_EVENT_APPROVALS_MESSAGE","SHARED.AUDIT_LOG","SHARED.DELETE","SHARED.DELETED","SHARED.DISABLE","SHARED.DISABLED","SHARED.ENABLE","SHARED.RESTORE","USER.ERROR.NO_TENANT","USER.ERROR.NO_TENANT_DESCRIPTION","USER.NO_SUPERVISOR","USER.PASSWORD_AND_FAVORITES","USER.SECURITY_AND_ACCESS","CALENDAR.ALL_WORK_ORDERS","CALENDAR.CORRECTIVE_WORK_ORDERS","CALENDAR.SCHEDULED_WORK_ORDERS","CALENDAR.EVENT_WORK_ORDERS","CALENDAR.ALL_EVENTS","CALENDAR.EVENTS_WITH_CONFLICTS","CALENDAR.BLOCKING_EVENTS","CALENDAR.MY_EVENTS"]).pipe(N()),this.userService.getUsers(this.authService.tenant.Id),this.userService.getUser(t,this.authService.tenant.Id),this.userService.getUserSettings(t),this.tenantService.getTenants().pipe(N()),this.tenantService.getTenantsForUser(this.authService.currentUserId),this.serviceAreaService.getAllUserServiceAreas(t),this.locationService.getAllUserLocations(t),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.roleService.getRoles(),this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.locationService.getLocations(this.authService.tenant.Id),this.locationTypeService.getLocationTypes(this.authService.tenant.Id),o?this.eventService.getAssignmentsByUserId(t):Fe([]),o&&i?this.eventService.getCalendarSubscriptions(this.authService.tenant.Id,t):Fe([])]).subscribe(c=>{this.translations=c[0],this.allUsers=c[1],this.user.set(c[2]);let u=c[3],x=c[4],C=c[5];this.userServiceAreas=c[6],this.userLocations=c[7],this.allUserGroups=c[8],this.allRoles=c[9],this.allServiceAreas=c[10],this.allLocations.set(c[11]),this.allLocationTypes=c[12],this.userEventAssignments=c[13];let O=c[14],w=this.user(),F=this.canEdit();if(Array.isArray(O)){let Z=O.sort((fe,Me)=>(fe.CalendarName?.toLowerCase()??"").localeCompare(Me.CalendarName?.toLowerCase()??""));this.calendarSubscriptions.set(Z)}w&&(w.UserSettings=u),this.securityHeader.set(this.translations[F?"USER.SECURITY_AND_ACCESS":"USER.PASSWORD_AND_FAVORITES"]),this.moreItems.set([{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}]);let L=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableUser()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableUser()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteUser()}];this.userEventAssignments&&this.userEventAssignments.length>0&&this.userEventAssignments.filter(fe=>fe.State===M.ACTIVE&&fe.TenantId===this.authService.tenant.Id).length>0&&L.push({id:"transfer.action",label:this.translations["EVENT.TRANSFER_APPROVALS"],icon:"../../../assets/icons/actions/transfer-privileges.svg",iconClass:"menu-svg",command:()=>this.transferEventApprovals()});let U=w?.AllTenantGroups?.find(Z=>Z.TenantId===this.authService.tenant.Id)?.State;w?.State===M.DELETED&&U===M.ACTIVE&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&L.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreUser()}),this.actionItems.set(L.filter(Z=>{if(w?.State)switch(w.State){case M.DELETED:return U===M.ACTIVE?Z.id==="restore.action":!1;case M.DISABLED:return U===M.ACTIVE?Z.id!=="disable.action":Z.id==="delete.action";default:return Z.id!=="enable.action"}else return!1}));let V=this.isSuperUser(),z={label:this.translations["USER.NO_SUPERVISOR"],value:void 0};if(this.defaultSupervisor.set(z),this.supervisorOptions.set([z]),this.supervisorOptions.update(Z=>Z.concat(this.userService.removeSuperUsersIfNotSuperUser(this.allUsers,V).filter(fe=>fe.State===M.ACTIVE).map(fe=>({label:fe.fullNameWithEmail(),value:fe.UserId})))),this.userFirstLetter.set(w&&w?.FirstName?w.FirstName[0].toUpperCase():""),s=Tn.default.sortBy((V?x:C).map(Z=>{let fe=Z.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":"";return{label:Z.Name+fe,value:Z.Id,styleClass:Z.State!==M.ACTIVE?"disabled":""}}),Z=>(Z.label??"").toLowerCase()),this.setTenantOptions(s.map(Z=>Z.value)),!this.supervisorOptions().find(Z=>Z.value===w?.Supervisor)&&w?.SupervisorUser){let Z=w.SupervisorUser,fe=Z.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":Z.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.supervisorOptions.update(Me=>[...Me,{label:Z.fullNameWithEmail()+fe,value:Z.Id,styleClass:"disabled-ddl-item"}])}if(w){w.UserTenantAssociations=[],w.AllTenantGroups?.forEach(Me=>{let ke=new ys;ke.TenantId=Me.TenantId;let Xt=s.find(on=>on.value===ke.TenantId);ke.TenantName=Xt?Xt.label:"",ke.TenantGroupId=Me.Id;let hi=this.userLocations.find(on=>on.TenantId===ke.TenantId);ke.LocationIds=hi?hi.LocationIds:[];let Gi=this.userServiceAreas.find(on=>on.TenantId===ke.TenantId);ke.ServiceAreaIds=Gi?Gi.ServiceAreaIds:[],w.UserTenantAssociations?.push(ke)}),w.UserTenantAssociations=Tn.default.sortBy(w.UserTenantAssociations,Me=>(Me.TenantName??"").toLowerCase());let Z=!1;this.form.patchValue(new Ji().toForm(w));let fe=this.form.get("ContactInformation.PhoneNumber");if(fe&&fe.value&&fe.value.length>0&&We.addPrimeNgFilledClass("qware.user.contact-information.input.phone"),w.UserTenantAssociations?.forEach(Me=>{if(Me.TenantId){let ke=this.userGroupOptions().get(Me.TenantId);if(ke){let Xt=this.serviceAreaOptions().get(Me.TenantId);if(ke&&Xt){let hi=Me.TenantId===this.authService.tenant.Id,Gi=this.fb.group({TenantName:this.fb.control(Me.TenantName??""),TenantId:this.fb.control(Me.TenantId),TenantGroupId:this.fb.control(ke.find(on=>on.value===Me.TenantGroupId)),ServiceAreaIds:this.fb.control(Xt.filter(on=>Me.ServiceAreaIds.indexOf(on.value)>-1)),LocationIds:this.fb.control(Me.LocationIds)});hi&&(Gi.get("TenantGroupId")?.setValidators(T.required),Gi.get("ServiceAreaIds")?.setValidators(T.required),Gi.get("LocationIds")?.setValidators(T.required)),this.form.controls.SecurityAccess.controls.UserTenantAssociations.push(Gi)}}else Z=!0}}),Z){this.toastService.error(this.translations["USER.ERROR.NO_TENANT"],this.translations["USER.ERROR.NO_TENANT_DESCRIPTION"]);let Me={relativeTo:this.route};this.router.navigate([this.cancelRoute],Me)}}this.calendarViewOptions.update(Z=>new Map([...Z,[this.authService.tenant.Id,this.computeCalendarViewOptions(this.authService.tenant.Id)]])
9622),this.allTenantOptions.set(s),this.setHistoryParams();let ce=this.supervisorOptions().find(Z=>Z.value===w?.Supervisor);this.form.get("EmploymentInformation.Supervisor")?.setValue(ce??this.defaultSupervisor()??null),this.form.markAsPristine(),this.form.markAsUntouched(),w&&w?.State==="DELETED"&&this.form.disable(),this.user.set(w),this.displaySpinner.set(!1)})}setTenantOptions(t,o=!1){let i=this.user(),s=this.allLocations();t.forEach(c=>{let u=this.allUserGroups.filter(L=>L.TenantId===c&&L.State===M.ACTIVE&&!ci.includes(L.Name??"")).map(L=>({label:L.Name,value:L.Id}));i?.AllTenantGroups?.filter(L=>L.TenantId===c).map(L=>L.Id).forEach(L=>{if(!u.find(U=>U.value===L)){this.isUserGroupDisabled=c===this.authService.tenant.Id;let U=this.allUserGroups.find(V=>V.Id===L);if(U){let V=U.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":U.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";u.push({label:U.Name+V,value:U.Id,styleClass:"disabled-ddl-item"})}}}),this.userGroupOptions.update(L=>new Map([...L,[c,u]])),this.serviceAreaOptions.update(L=>L.set(c,this.allServiceAreas.filter(U=>U.TenantId===c&&U.State===M.ACTIVE).map(U=>({label:U.Name,value:U.Id})))),this.userServiceAreas.filter(L=>L.TenantId===c).map(L=>L.ServiceAreaIds).forEach(L=>{L.forEach(U=>{let V=this.serviceAreaOptions().get(c);if(V&&!V.find(z=>z.value===U)){let z=this.allServiceAreas.find(ce=>ce.Id===U);if(z){let ce=z.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":z.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";V.push({label:z.Name+ce,value:z.Id})}}})});let x=s.filter(L=>L.TenantId===c&&L.State===M.ACTIVE).map(L=>(L.LocationType=this.allLocationTypes.find(U=>U.Id===L.LocationTypeId),L.LocationType&&(L.Icon=L.LocationType.Icon),L.Parent=s.find(U=>U.Id===L.ParentId),L)),C=Tn.default.filter(this.userLocations,{TenantId:c});Tn.default.uniq(Tn.default.map(C,"LocationIds")).forEach(L=>{L.forEach(U=>{if(!x.find(V=>V.Id===U)){let V=s.find(z=>z.Id===U);for(;V;)x.findIndex(z=>z.Id===U)===-1&&x.push(V),V=V.Parent}})});let w=Tn.default.uniqBy(x,"Id"),F=o?[]:void 0;w&&w.length>0&&(F=w.map(L=>this.locationService.convertToTreeNode(L,new Set(w.filter(U=>U.Id).map(U=>U.Id)),void 0,void 0,!1))),this.locationTreeNodes.update(L=>new Map([...L,[c,F]]))})}computeCalendarViewOptions(t){let o=this.user();if(o?.Type===Rt.INTERNAL){let s=o?.AllTenantGroups?.find(ce=>ce.TenantId===t)?.Id;if(!s)return[];let c=this.allUserGroups.find(ce=>ce.Id===s),u=new Set(c?.Roles),x=ce=>u.has(this.allRoles.find(Z=>Z.Name?.includes(ce))?.Id??""),C=x(ae.CAN_VIEW_WORK_ORDER_LIST),O=x(ae.CAN_SCHEDULE_WORK_ORDERS),w=x(ae.CAN_VIEW_EVENT_LIST),F=x(ae.CAN_VIEW_ALL_EVENTS),L=t===this.authService.tenant.Id,U=L?this.authService.tenant.EventsModule??!1:!0,V=L?this.authService.qwareSubscription?.workOrderCalendar??!1:C,z=[];return C&&V&&(z.push({label:this.translations["CALENDAR.ALL_WORK_ORDERS"],value:"ALLWORKORDERS"}),U&&w&&O&&z.push({label:this.translations["CALENDAR.CORRECTIVE_WORK_ORDERS"],value:"CORRECTIVE"}),O&&z.push({label:this.translations["CALENDAR.SCHEDULED_WORK_ORDERS"],value:"SCHEDULED"}),U&&w&&z.push({label:this.translations["CALENDAR.EVENT_WORK_ORDERS"],value:"EVENT"})),F&&z.push({label:this.translations["CALENDAR.ALL_EVENTS"],value:"ALLEVENTS"}),U&&z.push({label:this.translations["CALENDAR.MY_EVENTS"],value:"MYEVENTS"}),F&&z.push({label:this.translations["CALENDAR.EVENTS_WITH_CONFLICTS"],value:"CONFLICTINGEVENTS"},{label:this.translations["CALENDAR.BLOCKING_EVENTS"],value:"BLOCKINGEVENTS"}),z}return[]}loadTenantAssociationForm(t){ue([this.userGroupService.getAllUserGroups([t]),this.serviceAreaService.getAllServiceAreas([t]),this.locationService.getAllLocations([t]),this.locationTypeService.getAllLocationTypes([t])]).subscribe(o=>{let i=o[0],s=o[1],c=o[2],u=o[3];this.allUserGroups=Tn.default.concat(this.allUserGroups,i[0]),this.allServiceAreas=Tn.default.concat(this.allServiceAreas,s[0]),this.allLocations.set(Tn.default.concat(this.allLocations(),c[0])),this.allLocationTypes=Tn.default.concat(this.allLocationTypes,u[0]),this.setTenantOptions([t],!0),this.calendarViewOptions.update(x=>new Map([...x,[t,this.computeCalendarViewOptions(t)]])),this.user()?.UserTenantAssociations?.forEach(x=>
9622{if(x.TenantId===t){let C=this.userGroupOptions().get(x.TenantId),O=this.serviceAreaOptions().get(x.TenantId);if(C&&O){let F=this.form.get("SecurityAccess.UserTenantAssociations").controls.find(L=>L.get("TenantId")?.value===t);if(!F?.dirty&&(F?.patchValue({TenantName:x.TenantName??"",TenantId:x.TenantId,TenantGroupId:C.find(L=>L.value===x.TenantGroupId),ServiceAreaIds:O.filter(L=>x.ServiceAreaIds.indexOf(L.value)>-1),LocationIds:x.LocationIds}),!this.isSuperUser())){let L=F?.get("TenantGroupId"),U=F?.get("ServiceAreaIds"),V=F?.get("LocationIds");L?.setValidators(T.required),U?.setValidators(T.required),V?.setValidators(T.required),L?.updateValueAndValidity(),U?.updateValueAndValidity(),V?.updateValueAndValidity()}}}})})}createForm(){this.form=this.fb.group({ContactInformation:this.fb.group({FirstName:this.fb.control("",[T.required,T.maxLength(re)]),LastName:this.fb.control("",[T.required,T.maxLength(re)]),MiddleName:this.fb.control("",T.maxLength(re)),Email:this.fb.control("",[T.required,T.maxLength(re),T.pattern(Ui)]),PhoneNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),Extension:this.fb.control("",T.pattern("^[0-9]*"))}),EmploymentInformation:this.fb.group({JobTitle:this.fb.control("",T.maxLength(re)),Department:this.fb.control("",T.maxLength(re)),HourlyRate:this.fb.control(0,T.required),EmployeeNumber:this.fb.control("",T.maxLength(re)),Supervisor:this.fb.control(null),OvertimeRate:this.fb.control(0,T.required)}),SecurityAccess:this.fb.group({NewPassword:this.fb.control("",[T.minLength(Nn),T.maxLength(On)]),ConfirmPassword:this.fb.control("",T.required),UserTenantAssociations:this.fb.array([],T.required),UserSettings:this.fb.control([])})},{validators:[ia.matchPassword("NewPassword","ConfirmPassword","SecurityAccess")]}),this.shadeFormGroups=[this.form.get("ContactInformation"),this.form.get("EmploymentInformation"),this.form.get("SecurityAccess")]}setHistoryParams(){let t=this.allLocations();this.historyCreatedText.set(this.translations["AUDIT.USER"]+' "'+this.user()?.fullName()+'"');let o=new Map;o.set("Supervisor",[this.allUsers,"UserId",s=>s.fullNameWithEmail()]),o.set("ServiceAreaIds",[this.allServiceAreas,"Id",s=>s.Name]),o.set("FavoriteServiceAreaId",[this.allServiceAreas,"Id",s=>s.Name]),o.set("TenantGroupId",[this.allUserGroups,"Id",s=>s.Name]),o.set("LocationIds",[t,"Id",s=>s.Name]),o.set("FavoriteLocationId",[t,"Id",s=>s.Name]),this.historyIdMap.set(o);let i=new Map;i.set("FirstName","USER.FIRSTNAME"),i.set("MiddleName","USER.MIDDLENAME"),i.set("LastName","USER.LASTNAME"),i.set("JobTitle","USER.JOB_TITLE"),i.set("EmployeeNumber","USER.EMPLOYEE_NUMBER"),i.set("Department","USER.DEPARTMENT"),i.set("HourlyRate","USER.HOURLY_RATE"),i.set("OvertimeRate","USER.OVERTIME_RATE"),i.set("Extension","USER.EXTENSION"),i.set("Email","USER.EMAIL"),i.set("PhoneNumber","USER.PHONE"),i.set("Supervisor","USER.SUPERVISOR"),i.set("ServiceAreaIds","USER.SERVICE_AREAS"),i.set("FavoriteServiceAreaId","USER.FAVORITE_SERVICE_AREA"),i.set("TenantGroupId","USER.USERGROUP"),i.set("LocationIds","USER.LOCATION_ASSOCIATIONS"),i.set("FavoriteLocationId","USER.FAVORITE_LOCATION"),i.set("FavoriteCalendarViewName","USER.FAVORITE_CALENDAR_VIEW"),i.set("HasApiAccess","USER.HAS_API_ACCESS"),this.historyNameMap.set(i)}isDirty(){return this.form.dirty&&!this.submitted()}save(){if(!this.submitted())if(this.form.valid){this.submitted.set(!0),this.displaySpinner.set(!0);let t=new Ji().parseForm(this.form.value),o=this.user();t.Id=o?.Id,t.UserId=o?.Id,t.State=o?.State??M.ACTIVE;let i=[],s=[];this.tenantAssociationsThatChanged().forEach(c=>{let u=t.UserTenantAssociations?.find(C=>C.TenantId===c),x=t.UserSettings?.find(C=>C.TenantId===c);if(u)u.TenantGroupId&&(u.TenantGroupId=u.TenantGroupId.value),u.ServiceAreaIds=(u.ServiceAreaIds??[]).map(C=>C.value),t.Id&&(u.UserId=t.Id),i.push(Tn.default.cloneDeep(u)),x&&s.push(x);else{let C=new ys;C.TenantId=c,t.Id&&(C.UserId=t.Id),i.push(C),x&&(x.FavoriteLocationId=void 0,x.FavoriteServiceAreaId=void 0,x.HasApiAccess=!1,s.push(x))}}),t.UserTenantAssociations?.forEach(c=>{c.LocationIds=[],c.ServiceAreaIds=[],c.TenantGroupId&&c.TenantGroupId.value&&(c.TenantGroupId=c.TenantGroupId.value)}),this.userService.editUser(t,this.authService.tenant.Id).pipe(we(()=>{let c=[];return i&&i.length>0&&c.push(this.serviceAreaService.updateServiceAreaAssociations(i)),s&&s.length>0&&(s.forEach(u=>{u.Audit=Fa.UPDATE,u.UserId=t.UserId}),c.push(this.userService.updateUserSettings(s))),t.Password&&t.Id!==void 0&&c.push(this.authService.resetPassword(t.Id,t.Password,void 0,!0)),c.length===0?Fe({}):ue(c)}),we(()=>Er(this,null,function*(){i&&i.length>0&&this.updateLocationAssociations(i)})),we(()=>t.Id?this.userService.getUser(t.Id,this.authService.tenant.Id):Fe({}))).subscribe({next:c=>{t.Id===this.authService.currentUserId&&(this.authService.currentUser=c,Tn.default.isEqual(t.UserTenantAssociations,o?.UserTenantAssociations)||this.tenantService.refreshTenantList(
9622)),this.isLoggedUser()&&this.isAccountUrl?(this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.SAVE"),this.loginService.handleRedirect()):(this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.SAVE",this.cancelRoute,this.route))},error:c=>{this.submitted.set(!1),this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(c,this.form,this.shades,this.shadeFormGroups))}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}updateLocationAssociations(t){return Er(this,null,function*(){yield wo(this.locationService.updateLocationAssociations(t)).catch(o=>{this.translate.get(["SHARED.ERROR_LABEL","USER.ERROR.ASSOCIATION_ERROR","USER.ERROR.ASSOCIATION_TIMEOUT"]).pipe(N()).subscribe(i=>{o.statusCode===0?this.toastService.error(i["SHARED.ERROR_LABEL"],i["USER.ERROR.ASSOCIATION_TIMEOUT"]):this.toastService.error(i["SHARED.ERROR_LABEL"],i["USER.ERROR.ASSOCIATION_ERROR"])})})})}disableUser(){let t=this.user();this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:t?.fullName()}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"disablePromptDialog",header:o["SHARED.DISABLE_HEADER"],message:o["SHARED.DISABLE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.userService.disableUser(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.DISABLE",this.cancelRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}enableUser(){let t=this.user();this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE","SHARED.ERROR_LABEL","USER.ERROR.TENANTGROUP_DISABLED"],{entity:t?.fullName()}).pipe(N()).subscribe(o=>{this.isUserGroupDisabled?this.toastService.error(o["SHARED.ERROR_LABEL"],o["USER.ERROR.TENANTGROUP_DISABLED"]):this.confirmationService.confirm({key:"enablePromptDialog",header:o["SHARED.ENABLE_HEADER"],message:o["SHARED.ENABLE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.userService.enableUser(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.ENABLE",this.cancelRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}deleteUser(){let t=this.user();this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:t?.fullName()}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"deletePromptDialog",header:o["SHARED.DELETE_HEADER"],message:o["SHARED.DELETE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.userService.deleteUser(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.DELETE",this.cancelRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}restoreUser(){let t=this.user();this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:t?.fullName()}).pipe(N()).subscribe(o=>{this.confirmationService.confirm({key:"restorePromptDialog",header:o["SHARED.RESTORE_HEADER"],message:o["SHARED.RESTORE_MESSAGE"],accept:()=>{t?.Id&&(this.displaySpinner.set(!0),this.submitted.set(!0),this.userService.restoreUser(t.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner.set(!1),this.responseService.onSuccess("USER.SUCCESS.RESTORE",this.cancelRoute,this.route)},error:i=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(i))}}))}})})}transferEventApprovals(){let t=this.user();this.actionsMenu.hide();let o=this.allUsers.filter(i=>i.State===M.ACTIVE&&i.Id!==t?.Id).map(i=>({label:i.fullNameWithEmail(),value:i.Id}));this.dialogService.open(rc,{closable:!0,data:{eventAssignments:this.userEventAssignments,options:o,userName:t?.FullName},dismissableMask:!0,header:this.translations["EVENT.TRANSFER_EVENT_APPROVALS_HEADER"],modal:!0,width:this.isMobileSize?"95%":"50%"}).onClose.pipe(N()).subscribe(i=>{if(i){this.displaySpinner.set(!0);let s=o.find(c=>c.value===i)?.label;
9622this.eventService.transferApprovalPrivileges(this.route.snapshot.params.id,i).subscribe({next:()=>{this.displaySpinner.set(!1),this.responseService.onSuccess("EVENT.SUCCESS.APPROVALS_TRANSFERRED",this.cancelRoute,this.route,{name:s})},error:c=>{this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(c))}})}})}toggleSidebar(){this.showSidebar.update(t=>!t),this.userEnabledSidebar.set(this.showSidebar())}onSubscriptionDeleted(t){let o=this.calendarSubscriptions().filter(i=>i.Id!==t);this.calendarSubscriptions.set(o)}redirect(){if(this.isLoggedUser()&&this.isAccountUrl)this.loginService.handleRedirect();else{let t={relativeTo:this.route};this.router.navigate([this.cancelRoute],t)}}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-edit"]],viewQuery:function(o,i){if(o&1&&(X(X4,7),X(Z4,7),X(J4,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:121,vars:56,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.users.edit",1,"grid"],["id","qware.users.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],[1,"top-indent-large","actions-container"],["id","qware.users.edit.actions-menu",3,"model","popup"],["id","qware.user.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing","isAbsolute"],[1,"flex-inline","accordian-header"],[1,"flex-column","name-icon"],[1,"name-icon-letter"],[1,"flex-column","user-info"],[1,"sub-text"],[3,"multiple","value"],["id","qware.users.edit.contact-information-shade","value","0"],[1,"accordion-content-padding"],[3,"form","submitted","validationErrors","autoFocus","canEdit"],["id","qware.users.edit.employment-information-shade","value","1",3,"hidden"],[3,"form","submitted","validationErrors","allSupervisorOptions","defaultSupervisor"],["id","qware.users.edit.security-access-shade","value","2"],[3,"tenantAssociationClick","tenantAssociationAdded","tenantAssociationsThatChangedChange","form","submitted","userName","validationErrors","allServiceAreaOptions","allLocations","allTenantOptions","allUserGroupOptions","isUserEdit","locationTreeNodes","canEdit","calendarViewOptions","tenantAssociationsThatChanged"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.users.edit.button.cancel",3,"onClick","text","label"],["id","qware.users.edit.page-header","translate","",1,"page-header"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-label"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-icon",3,"src"],["id","qware.users.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],[3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.users.edit.calendar-feeds-shade","value","3"],[3,"subscriptionDeleted","subscriptions"],["tabindex","999","type","button","id","qware.users.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.user.edit.content-drawer-container",1,"content-right-drawer-container","col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.users.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.user.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","user",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","arrayProperties","parentSpinnerState","blacklistProperties"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),e(1,` 9623 `),n(2,"div",9),e(3,` 9624 `),n(4,"div",10),e(5,` 9625 `),_(6,i5,4,0)(7,n5,4,0),n(8,"div",11),e(9,` 9626 `),n(10,"p-menu",12,0),e(12,` 9627 `),_(13,o5,9,3,"ng-template",null,1,A),e(15,` 9628 `),a(),e(16,` 9629 `),_(17,s5,7,1),a(),e(18,` 9630 `),_(19,p5,17,4),a(),e(20,` 9631 `),n(21,"qware-spinner",13),e(22,` 9632 `),n(23,"p-card",14),e(24,` 9633 `),n(25,"qware-edit-lock",15),e(26,` 9634 `),n(27,"div",16),e(28,` 9635 `),e(29,` 9636 `),n(30,"div",17),e(31,` 9637 `),n(32,"div",18),e(33),a(),e(34,` 9638 `),a(),e(35,` 9639 `),n(36,"div",19),e(37,` 9640 `),n(38,"h4"),e(39),a(),e(40,` 9641 `),n(41,"div",20),e(42),a(),e(43,` 9642 `),a(),e(44,` 9643 `),a(),e(45,` 9644 `),n(46,"p-accordion",21,2),e(48,` 9645 `),n(49,"p-accordion-panel",22),e(50,` 9646 `),n(51,"p-accordion-header"),e(52),I(53,"translate"),_(54,u5,3,1,"ng-template",null,3,A),e(56,` 9647 `),a(),e(57,` 9648 `),n(58,"p-accordion-content"),e(59,` 9649 `),n(60,"div",23),e(61,` 9650 `),n(62,"qware-user-contact-information",24),e(63,` 9651 `),a(),e(64,` 9652 `),a(),e(65,` 9653 `),a(),e(66,` 9654 `),a(),e(67,` 9655 `),n(68,"p-accordion-panel",25),e(69,` 9656 `),n(70,"p-accordion-header"),e(71),I(72,"translate"),_(73,S5,3,1,"ng-template",null,3,A),e(75,` 9657 `),a(),e(76,` 9658 `),n(77,"p-accordion-content"),e(78,` 9659 `),n(79,"div",23),e(80,` 9660 `),n(81,"qware-user-employment-information",26),e(82,` 9661 `),a(),e(83,` 9662 `),a(),e(84,` 9663 `),a(),e(85,` 9664 `),a(),e(86,` 9665 `),n(87,"p-accordion-panel",27),e(88,` 9666 `),n(89,"p-accordion-header"),e(90),_(91,h5,3,1,"ng-template",null,3,A),e(93,` 9667 `),a(),e(94,` 9668 `),n(95,"p-accordion-content"),e(96,` 9669 `),n(97,"div",23),e(98,` 9670 `),n(99,"qware-user-security-access",28),h("tenantAssociationClick",function(u){return E(s),S(i.loadTenantAssociationForm(u))})("tenantAssociationAdded",function(u){return E(s),S(i.loadTenantAssociationForm(u))}),j("tenantAssociationsThatChangedChange",function(u){return E(s),W(i.tenantAssociationsThatChanged,u)||(i.tenantAssociationsThatChanged=u),S(u)}),e(100,` 9671 `),a(),e(101,` 9672 `),a(),e(102,` 9673 `),a(),e(103,` 9674 `),a(),e(104,` 9675 `),_(105,T5,20,4),a(),e(106,` 9676 `),a(),e(107,` 9677 `),n(108,"div",29),e(109,` 9678 `),n(110,"p-button",30),I(111,"translate"),h("onClick",function(){return E(s),S(i.redirect())}),e(112,` 9679 `),a(),e(113,` 9680 `),_(114,I5,5,5),a(),e(115,` 9681 `),a(),e(116,` 9682 `),a(),e(117,` 9683 `),a(),e(118,` 9684 `),_(119,A5,14,6),a(),e(120,` 9685`)}if(o&2){let s,c,u,x,C;l(2),p("ngClass",pe(53,e5,!i.auditLoggingDisabled())),l(4),f(i.isLoggedUser()?6:7),l(4),p("model",i.actionItems())("popup",!0),l(7),f(i.actionItems()&&i.actionItems().length>0?17:-1),l(2),f(i.auditLoggingDisabled()?-1:19),l(2),p("displaySpinner",i.displaySpinner()),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.user()!==void 0&&((s=i.user())==null?null:s.State)==="DELETED")("isAbsolute",!0),l(8),v(i.userFirstLetter()),l(6),v((c=i.user())==null?null:c.fullName()),l(3),v((u=i.user())==null?null:u.JobTitle),l(4),p("multiple",!0)("value",ne(55,t5)),l(6),K(` 9686 `,y(53,47,"USER.CONTACT_INFORMATION"),` 9687 `),l(10),p("form",i.form.controls.ContactInformation)("submitted",i.submitted())("validationErrors",i.validationErrors())("autoFocus",!1)("canEdit",i.canEdit()),l(6),p("hidden",!i.canEdit()),l(3),K(` 9688 `,y(72,49,"USER.EMPLOYMENT_INFORMATION"),` 9689 `),l(10),p("form",i.form.controls.EmploymentInformation)("submitted",i.submitted())("validationErrors",i.validationErrors())("allSupervisorOptions",i.supervisorOptions())("defaultSupervisor",i.defaultSupervisor()),l(9),K(` 9690 `,i.securityHeader(),` 9691 `),l(9),p("form",i.form.controls.SecurityAccess)("submitted",i.submitted())("userName",(x=i.user())==null?null:x.UserName)("validationErrors",i.validationErrors())("allServiceAreaOptions",i.serviceAreaOptions())("allLocations",i.allLocations())("allTenantOptions",i.allTenantOptions())("allUserGroupOptions",i.userGroupOptions())("isUserEdit",!0)("locationTreeNodes",i.locationTreeNodes())("canEdit",i.canEdit())("c
9691alendarViewOptions",i.calendarViewOptions()),H("tenantAssociationsThatChanged",i.tenantAssociationsThatChanged),l(6),f(i.showCalendarSubscriptions()?105:-1),l(5),q("label",y(111,51,"SHARED.CANCEL")),p("text",!0),l(4),f(((C=i.user())==null?null:C.State)!=="DELETED"?114:-1),l(5),f(i.auditLoggingDisabled()?-1:119)}},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,$,oc,Zl,Jl,ts,ie],encapsulation:2,changeDetection:0})}return r})();var ur=He(nt());var R5=["actionsMenu"],w5=["picker"],D5=r=>({"margin-right":r}),L5=()=>({standalone:!0}),N5=()=>({raised:!0});function O5(r,d){if(r&1){let t=b();e(0,` 9692 `),n(1,"div",23),e(2,` 9693 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 9694 `),n(7,"p-toggleswitch",24),j("ngModelChange",function(i){E(t);let s=m();return W(s.showDeleted,i)||(s.showDeleted=i),S(i)}),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())}),e(8,` 9695 `),a(),e(9,` 9696 `),a(),e(10,` 9697 `)}if(r&2){let t=m();l(4),v(y(5,3,"SHARED.SHOW_DELETED_FILTER")),l(3),H("ngModel",t.showDeleted),p("ngModelOptions",ne(5,L5))}}function F5(r,d){if(r&1){let t=b();e(0,` 9698 `),n(1,"p-button",26),I(2,"translate"),h("onClick",function(){E(t),m(2);let i=Ee(67);return S(i.expandAllNodes())}),e(3,` 9699 `),a(),e(4,` 9700 `)}if(r&2){let t=m(2);l(),q("label",y(2,3,"SHARED.EXPAND_ALL")),p("disabled",!t.userTreeNodes||t.userTreeNodes.length===0)("raised",!0)}}function M5(r,d){if(r&1){let t=b();e(0,` 9701 `),n(1,"p-button",27),I(2,"translate"),h("onClick",function(){E(t),m(2);let i=Ee(67);return S(i.collapseAllNodes())}),e(3,` 9702 `),a(),e(4,` 9703 `)}if(r&2){let t=m(2);l(),q("label",y(2,3,"SHARED.COLLAPSE_ALL")),p("disabled",!t.userTreeNodes||t.userTreeNodes.length===0)("raised",!0)}}function U5(r,d){if(r&1&&(e(0,` 9704 `),n(1,"div",25),e(2,` 9705 `),_(3,F5,5,5)(4,M5,5,5),a(),e(5,` 9706 `)),r&2){let t=m();l(3),f(t.allExpanded?4:3)}}function P5(r,d){r&1&&(e(0,` 9707 `),n(1,"span",11),e(2,"expand_more"),a(),e(3,` 9708 `))}function G5(r,d){if(r&1&&(e(0,` 9709 `),n(1,"a",28),e(2,` 9710 `),n(3,"span",29),e(4),a(),e(5,` 9711 `),n(6,"span",30),e(7),a(),e(8,` 9712 `),a(),e(9,` 9713 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function k5(r,d){r&1&&(e(0,` 9714 `),n(1,"i",11),e(2,"add"),a(),e(3,` 9715 `))}function V5(r,d){if(r&1&&(e(0,` 9716 `),n(1,"i",11),e(2),a(),e(3,` 9717 `)),r&2){let t=m().$implicit;l(2),v(t.icon)}}function q5(r,d){if(r&1&&(e(0,` 9718 `),R(1,"img",36),e(2,` 9719 `)),r&2){let t=m().$implicit;l(),p("src",t.svg,jt)}}function B5(r,d){if(r&1&&(e(0,` 9720 `),n(1,"div",33),e(2,` 9721 `),R(3,"p-badge",34),e(4,` 9722 `),n(5,"p-button",35),e(6,` 9723 `),_(7,V5,4,1)(8,q5,3,1),a(),e(9,` 9724 `),a(),e(10,` 9725 `)),r&2){let t=d.$implicit;l(3),p("value",t.label),l(2),q("routerLink",t.routerLink),p("text",!0)("rounded",!0)("raised",!0),l(2),f(t.icon?7:-1),l(),f(t.svg?8:-1)}}function H5(r,d){if(r&1&&(e(0,` 9726 `),n(1,"div",31),e(2,` 9727 `),n(3,"p-speeddial",32),e(4,` 9728 `),_(5,k5,4,0,"ng-template",null,5,A),e(7,` 9729 `),_(8,B5,11,7,"ng-template",null,2,A),e(10,` 9730 `),a(),e(11,` 9731 `),a(),e(12,` 9732 `)),r&2){let t=m(2);l(3),p("model",t.addMenuItems)("buttonProps",ne(3,N5))("mask",!0)}}function W5(r,d){if(r&1&&(e(0,` 9733 `),n(1,"div",31),e(2,` 9734 `),n(3,"p-button",37),e(4,` 9735 `),n(5,"i",11),e(6,"add"),a(),e(7,` 9736 `),a(),e(8,` 9737 `),a(),e(9,` 9738 `)),r&2){let t=m(2);l(3),q("routerLink",t.addMenuItems[0].routerLink),p("raised",!0)}}function j5(r,d){if(r&1&&(e(0,` 9739 `),_(1,H5,13,4)(2,W5,10,2)),r&2){let t=m();l(),f(t.addMenuItems.length>1?1:t.addMenuItems.length===1?2:-1)}}var lc=(()=>{class r{appSettingsService;authService;externalGroupService;roleService;route;translate;userGroupService;userGroupTemplateService;userService;actionsMenu;picker;displaySpinner=D(!0);addMenuItems=[];allExpanded=!1;allExternalGroups=[];allExternalUserGroupTreeNodes=[];allExternalUsers=[];allExternalUserTreeNodes=[];allUsers=[];externalGroupFilterFields=[];externalGroupTableColumns=[];externalUserFilterFields=[];externalUserTableColumns=[];generalFilter="";isActive=!1;isInternalUser=!1;listViewOptions=[];moreItems=[];searchEnabled=!1;searchResults=!1;secondaryNodes=[];selectedColumns=[];selectedViewOption="AllInternalUsers";showDeleted=!1;tableColumns=[];tableFiltered=!1;timezone;translations={};userSettings;tableRows=[];userTreeNodes=[];userGroupLimit;hasEventModule=!1;storageKey=Oe.USER_FILTER_STORAGE_KEY;listViewStorageKey=Oe.USER_LIST_VIEW_STORAGE_KEY;canAccessIntUserGroups=!1;canAccessIntUsers=!1;canAccessExtUserGroups=!1;canAccessExtUsers=!1;canViewDeleted=!1;userCreateRoute="../"+P.user+"/"+P.create;userEditRoute="../"+P.user+"/"+P.edit;userExternalCreateRoute="../"+P.userExternal+"/"+P.create;userExternalEditRoute="../"+P.userExternal+"/"+P.edit;userGroupCreateRoute="../"+P.userGroup+"/"+P.create;userGroupEditRoute="../"+P.userGroup+"/"+P.edit;userGroupExternalCreateRoute="../"+P.userGroupExternal+"/"+P.create;userGroupExternalEditRoute="../"+P.userGroupExternal+"/"+P.edit;userUploadRoute="../"+P.user+"/"+P.uploadUsers;
9739constructor(t,o,i,s,c,u,x,C,O){this.appSettingsService=t,this.authService=o,this.externalGroupService=i,this.roleService=s,this.route=c,this.translate=u,this.userGroupService=x,this.userGroupTemplateService=C,this.userService=O,this.userGroupLimit=this.authService.qwareSubscription?.userGroupLimit,this.hasEventModule=this.authService.tenant.EventsModule,this.canAccessIntUserGroups=this.authService.userHasPrivilege(ae.CAN_ACCESS_USER_GROUP_MANAGEMENT),this.canAccessIntUsers=this.authService.userHasPrivilege(ae.CAN_ACCESS_USER_MANAGEMENT),this.canAccessExtUserGroups=this.authService.userHasPrivilege(ae.CAN_ACCESS_EXT_USER_GROUP_MANAGEMENT),this.canAccessExtUsers=this.authService.userHasPrivilege(ae.CAN_ACCESS_EXT_USER_MANAGEMENT),this.canViewDeleted=this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED),this.isInternalUser=this.authService.currentUserType===Rt.INTERNAL}ngOnInit(){this.generalFilter=localStorage.getItem(this.storageKey)??"";let t="AllInternalUsers";!this.canAccessIntUsers&&!this.canAccessIntUserGroups&&this.canAccessExtUsers||!this.isInternalUser?t="AllExternalUsers":!this.canAccessIntUsers&&!this.canAccessIntUserGroups&&this.canAccessExtUserGroups&&(t="AllExternalGroups");let o=localStorage.getItem(this.listViewStorageKey);this.selectedViewOption=o??t;let i=JSON.parse(this.route.snapshot.queryParams.useCache??"true"),s=[this.translate.get(["USER.IMPORT_INT_USERS","USER.CREATE_INT_USER","USER.CREATE_EXT_USER","TENANTGROUP.CREATE_INT_USER_GROUP","EXTERNALGROUP.CREATE_EXT_USER_GROUP","USER.LIST_VIEW.ALL_INTERNAL_USERS","USER.LIST_VIEW.ALL_EXTERNAL_USERS","USER.LIST_VIEW.EXT_USERS_PENDING_APPROVAL","EXTERNALGROUP.LIST_VIEW.ALL_EXTERNAL_GROUPS","USER.CREATE_USER","EXTERNALGROUP.LIST_VIEW.EXT_GROUPS_PENDING_APPROVAL","USER.NAME","USER.EMAIL","USER.PHONE","USER.ASSIGNED_GROUPS","EXTERNALGROUP.GROUP_NAME","EXTERNALGROUP.ADDRESS","EXTERNALGROUP.PHONE","EXTERNALGROUP.CERTIFICATE_EXP","USER.L
9739IST_VIEW.ALL_USERS","USER.LIST_VIEW.ALL_GROUPS","TENANTGROUP.CREATE_USER_GROUP","USER.LIST_VIEW.GROUPS_PENDING_APPROVAL","USER.LIST_VIEW.USERS_PENDING_APPROVAL","USER.LIST_VIEW.EXT_GROUPS_PENDING_APPROVAL","EXTERNALGROUP.REQUEST_NEW_GROUP","USER.CREATE_USER","USER.IMPORT_USERS","TENANTGROUP.CREATE_USER_GROUP","EXTERNALGROUP.LIST_VIEW.ALL_GROUPS","EXTERNALGROUP.LIST_VIEW.GROUPS_PENDING_APPROVAL","SHARED.SEARCH","SHARED.FREE","SHARED.PAID"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N())];s=ur.default.concat(s,[this.isInternalUser?this.userGroupTemplateService.getUserGroupTemplates():Fe([]),this.isInternalUser?this.roleService.getRoles():Fe([]),this.isInternalUser?this.userGroupService.getUserGroups(this.authService.tenant.Id):Fe([]),this.isInternalUser?this.userGroupService.getUserGroupUsers(this.authService.tenant.Id):Fe([]),this.canAccessExtUserGroups?this.externalGroupService.getAllExternalUserGroups(this.authService.tenant.Id,i):Fe([]),this.canAccessExtUsers?this.userService.getExternalUsers(this.authService.tenant.Id,i):Fe([])]),ue(s).subscribe(c=>{this.translations=c[0],this.timezone=c[1].Timezone;
9739let u=c[2],x=c[3],C=c[4],O=c[5];if(this.allExternalGroups=c[6],this.allExternalUsers=c[7],this.moreItems=[{label:this.translations["SHARED.SEARCH"],icon:"search",command:()=>this.enableSearch()}],this.isInternalUser){this.allUsers=O.filter(V=>V.Type!==Rt.EXTERNAL);let L=u.find(V=>V.Name==="Requester")?.Roles??[],U=x.filter(V=>V.Id&&V.Name==="IsQwareSuperUserGroup").map(V=>V.Id);this.userTreeNodes=ur.default.concat(C.map(V=>this.userGroupService.convertToTreeNode(V,!0,!0,this.canAccessIntUserGroups?this.userGroupEditRoute:void 0,!0,L,U,[this.translations["SHARED.FREE"],this.translations["SHARED.PAID"]])),this.allUsers.map(V=>this.userService.convertToTreeNode(V,this.authService.currentUser,!0,this.canAccessIntUsers?[this.userEditRoute]:void 0,!0)))}let w=[];if(this.canAccessExtUserGroups&&(!this.isInternalUser&&this.authService.currentUser?.UserExternalGroupAssociations&&this.authService.currentUser.UserExternalGroupAssociations.forEach(F=>{F.TenantGroupId&&F.Manager&&w.push(F.TenantGroupId)}),this.externalGroupTableColumns=[{field:"name",header:this.translations["EXTERNALGROUP.GROUP_NAME"]},{field:"phoneNumber",header:this.translations["EXTERNALGROUP.PHONE"]},{field:"address",header:this.translations["EXTERNALGROUP.ADDRESS"]},{field:"certificateExpirationUTC",header:this.translations["EXTERNALGROUP.CERTIFICATE_EXP"],format:"ll"}],this.externalGroupFilterFields=this.externalGroupTableColumns.map(F=>F.field??""),this.allExternalGroups=ur.default.sortBy(this.allExternalGroups.filter(F=>F.Id&&(this.isInternalUser||w.includes(F.Id))),F=>F.Name),this.allExternalUserGroupTreeNodes=this.allExternalGroups.map(F=>this.externalGroupService.convertToTreeNode(F,this.timezone??"",!0,!0,this.userGroupExternalEditRoute,this.externalGroupFilterFields))),this.canAccessExtUsers){let F=[];this.isInternalUser||this.allExternalUsers.forEach(L=>{L.UserExternalGroupAssociations&&L.UserExternalGroupAssociations.forEach(U=>{L.Id&&U.TenantGroupId&&w.includes(U.TenantGroupId)&&F.push(L.Id)})}),this.externalUserTableColumns=[{field:"name",header:this.translations["USER.NAME"]},{field:"email",header:this.translations["USER.EMAIL"]},{field:"phoneNumber",header:this.translations["USER.PHONE"]},{field:"externalTenantGroups",header:this.translations["USER.ASSIGNED_GROUPS"],pSortableColumnDisabled:!0}],this.externalUserFilterFields=this.externalUserTableColumns.map(L=>L.field??""),this.allExternalUsers=ur.default.sortBy(this.allExternalUsers.filter(L=>L.Id&&(this.isInternalUser||F.includes(L.Id))),L=>L.LastName),this.allExternalUserTreeNodes=this.allExternalUsers.map(L=>this.userService.convertToTreeNode(L,this.authService.currentUser,!0,[this.userExternalEditRoute,this.userGroupExternalEditRoute],!0,this.externalUserFilterFields))}this.setAddMenuItems(),this.setListViewOptions(),this.setListView(this.selectedViewOption),this.isInternalUser||this.displaySpinner.set(!1)})}listViewOnChange(t){t&&t.value&&(this.generalFilter="",this.generalFilterOnChange(),this.setListView(t.value))}enableSearch(){this.searchEnabled=!this.searchEnabled,this.searchEnabled===!1&&(this.generalFilter="",this.generalFilterOnChange())}setListView(t){switch(t){case"AllInternalUsers":localStorage.setItem(this.listViewStorageKey,"AllInternalUsers");break;case"AllExternalUsers":this.secondaryNodes=this.allExternalUserTreeNodes.filter(o=>o.data.state&&o.data.state!==M.DELETED||this.showDeleted),this.selectedColumns=Array.apply([],this.externalUserTableColumns),localStorage.setItem(this.listViewStorageKey,"AllExternalUsers");break;case"ExternalUsersPendingApproval":this.secondaryNodes=this.allExternalUserTreeNodes.filter(o=>o.data.showCustomBadge&&(o.data.state&&o.data.state!==M.DELETED||this.showDeleted)),this.selectedColumns=Array.apply([],this.externalUserTableColumns),localStorage.setItem(this.listViewStorageKey,"ExternalUsersPendingApproval");break;case"AllExternalGroups":this.secondaryNodes=this.allExternalUserGroupTreeNodes.filter(o=>o.data.state&&o.data.state!==M.DELETED||this.showDeleted),this.selectedColumns=Array.apply([],this.externalGroupTableColumns),localStorage.setItem(this.listViewStorageKey,"AllExternalGroups");break;case"ExternalGroupsPendingApproval":this.secondaryNodes=this.allExternalUserGroupTreeNodes.filter(o=>o.data.showCustomBadge&&(o.data.state&&o.data.state!==M.DELETED||this.showDeleted)),this.selectedColumns=Array.apply([],this.externalGroupTableColumns),localStorage.setItem(this.listViewStorageKey,"ExternalGroupsPendingApproval");break}}generalFilterOnChange(){this.generalFilter.length>0&&(this.searchEnabled=!0),localStorage.setItem(this.storageKey,this.generalFilter)}toggleShowDeleted(){this.setListView(this.selectedViewOption)}changeExpandedButton(t){this.allExpanded=t}setAddMenuItems(){let t=[];this.hasEventModule&&(this.canAccessExtUserGroups&&t.push({id:"createExtUserGroup",label:this.translations[this.isInternalUser?"EXTERNALGROUP.CREATE_EXT_USER_GROUP":"EXTERNALGROUP.REQUEST_NEW_GROUP"],icon:"group_add",routerLink:this.userGroupExternalCreateRoute}
9739),this.canAccessExtUsers&&t.push({id:"createExtUser",label:this.translations[this.isInternalUser?"USER.CREATE_EXT_USER":"USER.CREATE_USER"],icon:"person_add",routerLink:this.userExternalCreateRoute})),this.userGroupLimit!==0&&this.canAccessIntUserGroups&&t.push({id:"createIntUserGroup",label:this.translations[this.hasEventModule&&this.canAccessExtUserGroups?"TENANTGROUP.CREATE_INT_USER_GROUP":"TENANTGROUP.CREATE_USER_GROUP"],icon:"group",routerLink:this.userGroupCreateRoute}),this.canAccessIntUsers&&t.push({id:"createIntUser",label:this.translations[this.hasEventModule&&this.canAccessExtUsers?"USER.CREATE_INT_USER":"USER.CREATE_USER"],icon:"person",routerLink:this.userCreateRoute}),this.authService.userHasPrivilege(ae.IS_SUPER_USER)&&t.push({id:"uploadUsers",label:this.translations["USER.IMPORT_INT_USERS"],icon:"file_upload",routerLink:this.userUploadRoute}),this.addMenuItems=t}setListViewOptions(){let t=[];(this.canAccessIntUsers||this.canAccessIntUserGroups)&&t.push({label:this.translations[this.hasEventModule?"USER.LIST_VIEW.ALL_INTERNAL_USERS":"USER.LIST_VIEW.ALL_USERS"],value:"AllInternalUsers"}),this.canAccessExtUsers&&this.hasEventModule&&(t=ur.default.concat(t,[{label:this.translations[this.isInternalUser?"USER.LIST_VIEW.ALL_EXTERNAL_USERS":"USER.LIST_VIEW.ALL_USERS"],value:"AllExternalUsers"},{label:this.translations[this.isInternalUser?"USER.LIST_VIEW.EXT_USERS_PENDING_APPROVAL":"USER.LIST_VIEW.USERS_PENDING_APPROVAL"],value:"ExternalUsersPendingApproval"}])),this.canAccessExtUserGroups&&this.hasEventModule&&(t=ur.default.concat(t,[{label:this.translations[this.isInternalUser?"EXTERNALGROUP.LIST_VIEW.ALL_EXTERNAL_GROUPS":"EXTERNALGROUP.LIST_VIEW.ALL_GROUPS"],value:"AllExternalGroups"},{label:this.translations[this.isInternalUser?"EXTERNALGROUP.LIST_VIEW.EXT_GROUPS_PENDING_APPROVAL":"EXTERNALGROUP.LIST_VIEW.GROUPS_PENDING_APPROVAL"],value:"ExternalGroupsPendingApproval"}])),this.listViewOptions=t}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(un),g(hn),g(he),g(le),g(Tt),g(kn),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-list"]],viewQuery:function(o,i){if(o&1&&(X(R5,7),X(w5,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.picker=s.first)}},standalone:!1,decls:74,vars:32,consts:[["dropdownicon",""],["moreMenu",""],["item",""],["spinner",""],["picker",""],["icon",""],[1,"align-items-center","flex-inline","col-12"],["id","qware.users.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search",3,"ngStyle"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.user.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"flex-inline","list-view-control-container",3,"hidden"],[1,"list-view-label"],["translate",""],["id","qware.user.list.list-view-ddl",1,"list-view-dropdown",3,"ngModelChange","onChange","options","ngModel"],[1,"more-container"],["id","qware.user.list.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"col-12","single-layer",2,"padding-top","0"],["id","qware.user.list.spinner",3,"displaySpinner"],["selectionType","multiple",3,"parentSpinnerStateChange","expandedChange","primaryNodes","showIncludeSecondarySwitch","searchFilterStorageKey","removeDeleted","removeDisabled","showCheckboxes","parentSpinnerState","searchFilter","secondaryTableColumns","secondaryNodes","selectButtonValue"],[1,"show-deleted-switch"],["id","qware.users.list.show-deleted-switch",3,"ngModelChange","onChange","ngModel","ngModelOptions"],[1,"expand-all"],["id","qware.hierarchy-picker.expand-all.button","severity","secondary",3,"onClick","disabled","label","raised"],["id","qware.hierarchy-picker.collapse-all.button","severity","secondary",3,"onClick","disabled","label","raised"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],[1,"bottom-right-button"],["direction","up","buttonClassName","fab-button","id","qware.component.multiaction-fab",3,"model","buttonProps","mask"],[1,"create-navigation"],[1,"raised",3,"value"],["type","button","severity","secondary","styleClass","icon-only-button p-s
9739peeddial-action",3,"text","rounded","raised","routerLink"],[3,"src"],["severity","primary","styleClass","fab-button",3,"raised","routerLink"]],template:function(o,i){if(o&1){let s=b();n(0,"div"),e(1,` 9740 `),n(2,"div",6),e(3,` 9741 `),n(4,"h3",7),e(5,` 9742 USER.MANAGEMENT 9743 `),a(),e(6,` 9744 `),_(7,O5,11,6),a(),e(8,` 9745 `),n(9,"div",8),e(10,` 9746 `),e(11,` 9747 `),_(12,U5,6,1),n(13,"div",9),e(14,` 9748 `),n(15,"p-iconfield",10),e(16,` 9749 `),n(17,"p-inputicon"),e(18,` 9750 `),n(19,"span",11),e(20,"search"),a(),e(21,` 9751 `),a(),e(22,` 9752 `),n(23,"input",12),I(24,"translate"),j("ngModelChange",function(u){return E(s),W(i.generalFilter,u)||(i.generalFilter=u),S(u)}),h("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(25,` 9753 `),a(),e(26,` 9754 `),a(),e(27,` 9755 `),e(28,` 9756 `),n(29,"div",13),e(30,` 9757 `),n(31,"div",14),e(32,` 9758 `),n(33,"span",15),e(34,"SHARED.LIST_VIEW"),a(),e(35,` 9759 `),a(),e(36,` 9760 `),n(37,"p-select",16),j("ngModelChange",function(u){return E(s),W(i.selectedViewOption,u)||(i.selectedViewOption=u),S(u)}),h("onChange",function(u){return E(s),S(i.listViewOnChange(u))}),e(38,` 9761 `),_(39,P5,4,0,"ng-template",null,0,A),e(41,` 9762 `),a(),e(42,` 9763 `),a(),e(43,` 9764 `),n(44,"div",17),e(45,` 9765 `),n(46,"p-menu",18,1),h("click",function(){E(s);let u=Ee(47);return S(u.hide())}),e(48,` 9766 `),_(49,G5,10,2,"ng-template",null,2,A),e(51,` 9767 `),a(),e(52,` 9768 `),n(53,"p-button",19),h("onClick",function(u){return E(s),Ee(47).toggle(u),S(i.isActive=!i.isActive)}),e(54,` 9769 `),n(55,"i",11),e(56,"more_vert"),a(),e(57,` 9770 `),a(),e(58,` 9771 `),a(),e(59,` 9772 `),a(),e(60,` 9773 `),n(61,"div",20),e(62,` 9774 `),n(63,"qware-spinner",21,3),e(65,` 9775 `),n(66,"qware-hierarchy-picker",22,4),j("parentSpinnerStateChange",function(u){return E(s),W(i.displaySpinner,u)||(i.displaySpinner=u),S(u)}),h("expandedChange",function(u){return E(s),S(i.changeExpandedButton(u))}),e(68,` 9776 `),a(),e(69,` 9777 `),a(),e(70,` 9778 `),a(),e(71,` 9779 `),_(72,j5,3,1),a(),e(73,` 9780`)}o&2&&(l(7),f(i.canViewDeleted?7:-1),l(2),ve("search-active",i.searchEnabled),l(3),f(i.isInternalUser&&i.selectedViewOption==="AllInternalUsers"?12:-1),l(),p("ngStyle",pe(30,D5,i.isInternalUser&&!i.canAccessExtUsers&&!i.canAccessExtUserGroups?"0":"0.5rem")),l(10),q("placeholder",y(24,28,"SHARED.SEARCH")),H("ngModel",i.generalFilter),p("qwareFocus",i.generalFilter!==""),l(6),p("hidden",i.isInternalUser&&!i.canAccessExtUsers&&!i.canAccessExtUserGroups),l(8),p("options",i.listViewOptions),H("ngModel",i.selectedViewOption),l(9),p("model",i.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0),l(10),p("displaySpinner",i.displaySpinner()),l(3),p("primaryNodes",i.userTreeNodes)("showIncludeSecondarySwitch",!1)("searchFilterStorageKey",i.storageKey)("removeDeleted",!i.showDeleted)("removeDisabled",!1)("showCheckboxes",!1),H("parentSpinnerState",i.displaySpinner),p("searchFilter",i.generalFilter)("secondaryTableColumns",i.selectedColumns)("secondaryNodes",i.secondaryNodes)("selectButtonValue",i.isInternalUser&&i.selectedViewOption==="AllInternalUsers"?0:1),l(6),f(i.addMenuItems?72:-1))},dependencies:[Da,oe,$n,je,Ae,se,Le,Ri,pi,mi,ye,lt,me,ot,it,qa,et,Ai,$,ie],encapsulation:2})}return r})();var sc=He(Hn()),xt=He(nt());var Y5=["upload"],Q5=()=>({raised:!0}),dc=()=>[],K5=r=>({fullName:r}),$5=r=>({userNames:r}),z5=(r,d)=>({value:r,isAre:d}),id=r=>({value:r}),X5=(r,d)=>({colName:r,value:d}),Z5=r=>({colName:r}),J5=(r,d,t)=>({colName:r,max:d,value:t}),e6=(r,d,t)=>({colName:r,min:d,value:t}),t6=(r,d,t)=>({colName:r,equal:d,value:t}),i6=(r,d,t,o)=>({colName:r,min:d,max:t,value:o}),pc=(r,d)=>d.field;function n6(r,d){r&1&&(e(0,` 9781 `),n(1,"span",14),e(2,"add"),a(),e(3,` 9782 `))}function a6(r,d){if(r&1){let t=b();e(0,` 9783 `),n(1,"div",15),e(2,` 9784 `),n(3,"p-button",16),I(4,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(5,` 9785 `),a(),e(6,` 9786 `),a(),e(7,` 9787 `)}if(r&2){let t=m();l(3),q("label",y(4,3,"SHARED.SAVE_RECORDS")),p("raised",!0)("disabled",t.duplicateRows&&t.duplicateRows.length>0||t.rowsWithInvalidData&&t.rowsWithInvalidData.length>0||t.colsWithInvalidHeaders&&t.colsWithInvalidHeaders.length>0)}}function r6(r,d){if(r&1&&(e(0,` 9788 `),n(1,"div",17),e(2,` 9789 `),n(3,"span",13),e(4,"UPLOAD.VALIDATION.ROWS_NOT_UNIQUE"),a(),n(5,"span",18),e(6),I(7,"json"),a(),e(8,` 9790 `),a(),e(9,` 9791 `)),r&2){let t=m();l(6),K(" ",y(7,1,t.duplicateRows),"")}}function o6(r,d){if(r&1&&(e(0,` 9792 `),n(1,"div",17),e(2,` 9793 `),n(3,"span",13),e(4,"UPLOAD.VALIDATION.ROWS_INVALID_DATA"),a(),n(5,"span",19),e(6),I(7,"json"),a(),e(8,` 9794 `),a(),e(9,` 9795 `)),r&2){let t=m();l(6),K(" ",y(7,1,t.rowsWithInvalidData),"")}}function l6(r,d){if(r&1&&(e(0,` 9796 `),n(1,"th"),e(2,` 9797 `),n(3,"div"),e(4),a(),e(5,` 9798 `),a(),e(6,` 9799 `)),r&2){let t=d.$implicit;l(4),v(t.field)}}function s6(r,d){if(r&1&&(e(0,` 9800 `),n(1,"tr"),e(2,` 9801 `),R(3,"th",23),e(4,` 9802 `),n(5,"th"),e(6,"Row Number"),a(),e(7,` 9803 `),G(8,l6,7,1,null,null,pc),a(),e(10,` 9804 `)),r&2){let t=d.$implicit;l(8),k(t)}}function d6(r,d){if(r&1){let t=b();e(0,` 9805 `),n(1,"input",29),h("blur",function(){E(t);let i=m(2).$implicit,s=m(),c=s.$implicit,u=s.rowIndex,x=m(2);return S(x.validityCheck(c,u,i))})("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),a(),e(2,` 9806 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("fluid",!0)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?o[t.field].value[0]:o[t.field])}}function p6(r,d){r&1&&(e(0,` 9807 `),n(1,"span",25),e(2,"expand_less"),a(),e(3,` 9808 `))}function m6(r,d){r&1&&(e(0,` 9809 `),n(1,"span",25),e(2,"expand_more"),a(),e(3,` 9810 `))}function c6(r,d){if(r&1){let t=b();e(0,` 9811 `),n(1,"p-inputnumber",30),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9812 `),_(3,p6,4,0,"ng-template",null,3,A),e(5,` 9813 `),_(6,m6,4,0,"ng-template",null,4,A),e(8,` 9814 `),a(),e(9,` 9815 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("minFractionDigits",0)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?void 0:o[t.field])("step",0)("useGrouping",!1)("fluid",!0)}}function u6(r,d){r&1&&(e(0,` 9816 `),n(1,"span",25),e(2,"expand_less"),a(),e(3,` 9817 `))}function _6(r,d){r&1&&(e(0,` 9818 `),n(1,"span",25),e(2,"expand_more"),a(),e(3,` 9819 `))}function E6(r,d){if(r&1){let t=b();e(0,` 9820 `),n(1,"p-inputnumber",31),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9821 `),_(3,u6,4,0,"ng-template",null,3,A),e(5,` 9822 `),_(6,_6,4,0,"ng-template",null,4,A),e(8,` 9823 `),a(),e(9,` 9824 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit,i=m(2);l(),p("minFractionDigits",2)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?void 0:o[t.field])("currency",i.currencyType)("step",0)("useGrouping",!0)("fluid",!0)}}function S6(r,d){if(r&1){let t=b();e(0,` 9825 `),n(1,"p-inputmask",32),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9826 `),a(),e(3,` 9827 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("unmask",!0)("autoClear",!1)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?void 0:o[t.field])}}function x6(r,d){if(r&1){let t=b();e(0,` 9828 `),n(1,"qware-autocomplete",33),h("selectChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9829 `),a(),e(3,` 9830 `)}if(r&2){let t=m(3).$implicit,o=m(),i=o.$implicit,s=o.rowIndex;l(),p("id",t.field+(s+1))("options",t.options)("singleSelect",!0)("material",!1)("selectedOption",!(i[t.field]==null||i[t.field].label==null)&&i[t.field].label.includes("FIELD_ERROR")?void 0:i[t.field])("forceSelection",!0)}}function f6(r,d){if(r&1){let t=b();e(0,` 9831 `),n(1,"qware-autocomplete",34),h("selectChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9832 `),a(),e(3,` 9833 `)}if(r&2){let t,o=m(3).$implicit,i=m(),s=i.$implicit,c=i.rowIndex,u=m(2);l(),p("id",o.field+(c+1))("singleSelect",!0)("options",(t=u.favOptionsMap.get(c.toString()+"LocationAssociations"))!==null&&t!==void 0?t:ne(8,dc))("material",!1)("selectedOption",!(s[o.field]==null||s[o.field].label==null)&&s[o.field].label.includes("FIELD_ERROR")?void 0:s[o.field])("forceSelection",!0)("virtualScroll",!0)("virtualScrollItemSize",38)}}function h6(r,d){if(r&1){let t=b();e(0,` 9834 `),n(1,"qware-autocomplete",35),h("selectChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9835 `),a(),e(3,` 9836 `)}if(r&2){let t,o=m(3).$implicit,i=m(),s=i.$implicit,c=i.rowIndex,u=m(2);l(),p("id",o.field+(c+1))("singleSelect",!0)("options",(t=u.favOptionsMap.get(c.toString()+"ServiceAreaAssociations"))!==null&&t!==void 0?t:ne(6,dc))("material",!1)("selectedOption",!(s[o.field]==null||s[o.field].label==null)&&s[o.field].label.includes("FIELD_ERROR")?void 0:s[o.field])("forceSelection",!0)}}function C6(r,d){if(r&1&&(e(0,` 9837 `),_(1,x6,4,6)(2,f6,4,9)(3,h6,4,7)),r&2){let t=m(2).$implicit;
9837l(),f(t.field.includes("Favorite")?t.field==="FavoriteLocation"?2:t.field==="FavoriteServiceArea"?3:-1:1)}}function v6(r,d){if(r&1){let t=b();e(0,` 9838 `),n(1,"qware-autocomplete",36),h("unselectChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.unsetItem(u,x,s,i))})("selectChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2,` 9839 `),a(),e(3,` 9840 `)}if(r&2){let t=m(3).$implicit,o=m(),i=o.$implicit,s=o.rowIndex,c=m(2);l(),p("id",t.field+(s+1))("enablePicker",!0)("nodeIds",c.allLocationIds)("material",!1)("forceSelection",!1)("allLocations",c.allLocations)("selectedOption",!(i[t.field]==null||i[t.field].label==null)&&i[t.field].label.includes("FIELD_ERROR")?void 0:i[t.field])("filterByUserAccess",!1)}}function g6(r,d){r&1&&(e(0,` 9841 `),n(1,"span",25),e(2,"expand_more"),a(),e(3,` 9842 `))}function T6(r,d){r&1&&(e(0,` 9843 `),n(1,"span",25),e(2,"search"),a(),e(3,` 9844 `))}function I6(r,d){if(r&1){let t=b();e(0,` 9845 `),n(1,"p-multiselect",37),h("ngModelChange",function(i){E(t);let s=m(3).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))})("onBlur",function(){E(t);let i=m(3).$implicit,s=m(),c=s.$implicit,u=s.rowIndex,x=m(2);return S(x.validityCheck(c,u,i))})("onFocus",function(){E(t);let i=m(3).$implicit,s=m(),c=s.$implicit,u=s.rowIndex,x=m(2);return S(x.setItem(c,u,i,!(c[i.field]==null||c[i.field].label==null)&&c[i.field].label.includes("FIELD_ERROR")?void 0:c[i.field]))}),e(2,` 9846 `),_(3,g6,4,0,"ng-template",null,5,A),e(5,` 9847 `),_(6,T6,4,0,"ng-template",null,6,A),e(8,` 9848 `),a(),e(9,` 9849 `)}if(r&2){let t=m(3).$implicit,o=m(),i=o.$implicit,s=o.rowIndex;l(),p("id",t.field+(s+1))("options",t.options)("fluid",!0)("ngModel",!(i[t.field]==null||i[t.field].label==null)&&i[t.field].label.includes("FIELD_ERROR")?void 0:i[t.field])("resetFilterOnHide",!0)("maxSelectedLabels",t.options.length+1)}}function b6(r,d){if(r&1&&(e(0,` 9850 `),_(1,v6,4,8)(2,I6,10,6)),r&2){let t=m(2).$implicit;l(),f(t.field==="LocationAssociations"?1:-1),l(),f(t.field==="ServiceAreaAssociations"?2:-1)}}function y6(r,d){if(r&1){let t=b();e(0,` 9851 `),n(1,"textarea",38),h("ngModelChange",function(i){E(t);let s=m(2).$implicit,c=m(),u=c.$implicit,x=c.rowIndex,C=m(2);return S(C.setItem(u,x,s,i))}),e(2," "),a(),e(3,` 9852 `)}if(r&2){let t=m(2).$implicit,o=m().$implicit;l(),p("rows",3)("cols",30)("autoResize",!0)("ngModel",!(o[t.field]==null||o[t.field].label==null)&&o[t.field].label.includes("FIELD_ERROR")?o[t.field].value[0]:o[t.field])("fluid",!0)}}function A6(r,d){if(r&1&&(e(0,` 9853 `),_(1,d6,3,2)(2,c6,10,5)(3,E6,10,6)(4,S6,4,3)(5,C6,4,1)(6,b6,3,2)(7,y6,4,5),e(8,` 9854 `)),r&2){let t,o=m().$implicit;l(),f((t=o.valType)==="input"?1:t==="number"?2:t==="currency"?3:t==="phone"?4:t==="single-select"?5:t==="multi-select"?6:t==="multiline"?7:-1)}}function R6(r,d){if(r&1&&(e(0,` 9855 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9856 `)),r&2){let t=m(4).$implicit,o=m().$implicit;l(2),K(` 9857 `,$e(3,1,"UPLOAD.ERROR.MULTIPLE_USERS",pe(4,K5,o[t.field]==null?null:o[t.field].duplicates)),` 9858 `)}}function w6(r,d){if(r&1&&(e(0,` 9859 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9860 `)),r&2){let t=m(4).$implicit,o=m().$implicit;l(2),K(` 9861 `,$e(3,1,"UPLOAD.ERROR.DUPLICATE_USER",pe(4,$5,o[t.field]==null?null:o[t.field].duplicates)),` 9862 `)}}function D6(r,d){if(r&1&&(e(0,` 9863 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9864 `)),r&2){let t=m(4).$implicit,o=m().$implicit;l(2),K(` 9865 `,$e(3,1,"UPLOAD.ERROR.DUPLICATE_VALUE",Kn(4,z5,o[t.field]==null?null:o[t.field].duplicates,(o[t.field]==null||o[t.field].duplicates==null?null:o[t.field].duplicates.length)>1?"are":"is")),` 9866 `)}}function L6(r,d){if(r&1&&(e(0,` 9867 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9868 `)),r&2){let t=m();l(2),K(` 9869 `,$e(3,1,"UPLOAD.ERROR.INVALID_REFERENCE_VALUE",pe(4,id,t)),` 9870 `)}}function N6(r,d){if(r&1&&(e(0,` 9871 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9872 `)),r&2){let t=m();l(2),K(` 9873 `,$e(3,1,"UPLOAD.ERROR.INVALID_EMAIL_FORMAT",pe(4,id,t)),` 9874 `)}}function O6(r,d){if(r&1&&(e(0,` 9875 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9876 `)),r&2){let t=m();l(2),K(` 9877 `,$e(3,1,"UPLOAD.ERROR.INVALID_VALUE",pe(4,id,t)),` 9878 `)}}function F6(r,d){if(r&1&&(e(0,` 9879 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9880 `)),r&2){let t=m(2),o=m(3).$implicit;l(2),K(` 9881 `,$e(3,1,"UPLOAD.ERROR.MISSING_VALUE_WITH_VALUE",Kn(4,X5,o.field,t)),` 9882 `)}}function M6(r,d){if(r&1&&(e(0,` 9883 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9884 `)),r&2){let t=m(5).$implicit;l(2),K(` 9885 `,$e(3,1,"UPLOAD.ERROR.MISSING_VALUE",pe(4,Z5,t.field)),` 9886 `)}}function U6(r,d){if(r&1&&(e(0,` 9887 `),n(1,"span"),e(2,` 9888 `),e(3,`
9889 `),_(4,F6,5,7)(5,M6,5,6),a(),e(6,` 9890 `)),r&2){let t=m(4).$implicit,o=m().$implicit;l(4),f(o[t.field]!=null&&o[t.field].value[0]?4:-1),l(),f(o[t.field]!=null&&o[t.field].value[0]?-1:5)}}function P6(r,d){if(r&1&&(e(0,` 9891 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9892 `)),r&2){let t=m(),o=m(3).$implicit;l(2),K(` 9893 `,$e(3,1,"UPLOAD.ERROR.INVALID_LENGTH_MAX",er(4,J5,o.field,o.max,t)),` 9894 `)}}function G6(r,d){if(r&1&&(e(0,` 9895 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9896 `)),r&2){let t=m(),o=m(3).$implicit;l(2),K(` 9897 `,$e(3,1,"UPLOAD.ERROR.INVALID_LENGTH_MIN",er(4,e6,o.field,o.min,t)),` 9898 `)}}function k6(r,d){if(r&1&&(e(0,` 9899 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9900 `)),r&2){let t=m(),o=m(3).$implicit;l(2),K(` 9901 `,$e(3,1,"UPLOAD.ERROR.INVALID_LENGTH_EQUAL",er(4,t6,o.field,o.equal,t)),` 9902 `)}}function V6(r,d){if(r&1&&(e(0,` 9903 `),n(1,"span"),e(2),I(3,"translate"),a(),e(4,` 9904 `)),r&2){let t=m(),o=m(3).$implicit;l(2),K(` 9905 `,$e(3,1,"UPLOAD.ERROR.INVALID_LENGTH_BETWEEN",hd(4,i6,o.field,o.min,o.max,t)),` 9906 `)}}function q6(r,d){if(r&1&&(e(0,` 9907 `),n(1,"p"),e(2,` 9908 `),e(3,` 9909 `),_(4,R6,5,6)(5,w6,5,6)(6,D6,5,7)(7,L6,5,6)(8,N6,5,6)(9,O6,5,6)(10,U6,7,2)(11,P6,5,8)(12,G6,5,8)(13,k6,5,8)(14,V6,5,9),a(),e(15,` 9910 `)),r&2){let t=m(3).$implicit,o=m().$implicit,i=m(2);l(4),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.MULTIPLE_USERS?4:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.DUPLICATE_USERS?5:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.DUPLICATE_VALUES?6:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_REFERENCE_VALUE?7:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_EMAIL_FORMAT?8:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_VALUE?9:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.VALUE_REQUIRED?10:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_LENGTH_MAX?11:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_LENGTH_MIN?12:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_LENGTH_EQUAL?13:-1),l(),f(o[t.field]&&o[t.field].label==="FIELD_ERROR_"+i.uploadErrorEnum.INVALID_LENGTH_BETWEEN?14:-1)}}function B6(r,d){if(r&1&&(e(0,` 9911 `),n(1,"div",39),e(2,` 9912 `),_(3,q6,16,11),a(),e(4,` 9913 `)),r&2){let t,o=m(2).$implicit,i=m().$implicit;l(3),f((t=i[o.field].value)?3:-1,t)}}function H6(r,d){if(r&1&&(e(0,` 9914 `),n(1,"span"),e(2),a(),e(3,` 9915 `)),r&2){let t=m().$implicit;l(2),v(t)}}function W6(r,d){if(r&1&&(e(0,` 9916 `),n(1,"span"),e(2),n(3,"span"),e(4,","),a()(),R(5,"br"),e(6,` 9917 `)),r&2){let t=m().$implicit;l(2),v(t)}}function j6(r,d){if(r&1&&(e(0,` 9918 `),_(1,H6,4,1)(2,W6,7,1)),r&2){let t=d.$index,o=d.$count;l(),f(t===o-1?1:2)}}function Y6(r,d){if(r&1&&(e(0,` 9919 `),n(1,"span"),e(2,` 9920 `),G(3,j6,3,1,null,null,Zi),a(),e(5,` 9921 `)),r&2){let t=m(3).$implicit,o=m().rowIndex,i=m(2);l(3),k(i.labelMap.get(o+t.field))}}function Q6(r,d){if(r&1&&(e(0,` 9922 `),n(1,"span"),e(2,` 9923 `),e(3),a(),e(4,` 9924 `)),r&2){let t,o=m(3).$implicit,i=m().rowIndex,s=m(2);l(3),K(` 9925 `,(t=s.labelMap.get(i+o.field))==null?null:t.valueOf(),` 9926 `)}}function K6(r,d){if(r&1&&(e(0,` 9927 `),n(1,"div"),e(2,` 9928 `),n(3,"div",40),e(4,` 9929 `),_(5,Y6,6,0)(6,Q6,5,1),a(),e(7,` 9930 `),a(),e(8,` 9931 `)),r&2){let t=m(2).$implicit,o=m().rowIndex,i=m(2);l(5),f(t.valType==="multi-select"&&i.labelMap.get(o+t.field)?5:t.valType!=="multi-select"&&i.labelMap.get(o+t.field)?6:-1)}}function $6(r,d){if(r&1&&(e(0,` 9932 `),_(1,B6,5,1)(2,K6,9,1)),r&2){let t=m().$implicit,o=m().$implicit;l(),f(o[t.field]&&o[t.field].label&&o[t.field].label.includes("FIELD_ERROR")?1:-1),l(),f(((o[t.field]==null?null:o[t.field].label)||"").includes("FIELD_ERROR")?-1:2)}}function z6(r,d){r&1&&(e(0,` 9933 `),n(1,"td",26),e(2,` 9934 `),n(3,"p-cellEditor"),e(4,` 9935 `),_(5,A6,9,1,"ng-template",27),e(6,` 9936 `),_(7,$6,3,2,"ng-template",28),e(8,` 9937 `),a(),e(9,` 9938 `),a(),e(10,` 9939 `))}function X6(r,d){if(r&1){let t=b();e(0,` 9940 `),n(1,"tr"),e(2,` 9941 `),n(3,"td"),e(4,` 9942 `),n(5,"p-button",24),h("onClick",function(){let i=E(t).rowIndex,s=m(2);return S(s.removeUser(i))}),e(6,` 9943 `),n(7,"i",25),e(8,"close"),a(),e(9,` 9944 `),a(),e(10,` 9945 `),a(),e(11,` 9946 `),n(12,"td"),e(13),a(),e(14,` 9947 `),G(15,z6,11,0,null,null,pc),a(),e(17,` 9948 `)}if(r&2){let t=d.columns,o=d.rowIndex;l(5),p("rounded",!0)("text",!0),l(8),v(o+2),l(2),k(t)}}function Z6(r,d){if(r&1&&(e(0,` 9949 `),n(1,"p-table",20,2),e(3,` 9950 `),_(4,s6,11,0,"ng-template",21),e(5,` 9951 `),_(6,X6,18,3,"ng-template",22),e(7,` 9952 `),a(),e(8,` 9953 `)),r&2){let t=m();l(),p("value",t.uploadedItems)("columns",t.tableColumns)("paginator",!0)("pageLinks",10)("rows",20)}}var mc=(()=>
9953{class r{appSettingsService;authService;cp;locationService;pp;roleService;serviceAreaService;toastService;translate;userGroupService;userGroupTemplateService;userService;upload;allLocationIds=[];allLocations=[];colsWithInvalidHeaders=[];currencyType="USD";displaySpinner=!0;duplicateRows=[];favOptionsMap=new Map;labelMap=new Map;locationOptions=[];rowsWithInvalidData=[];serviceAreaOptions=[];tableColumns=[];uploadedItems=[];uploadErrorEnum=St;dupeCheckingFields=["FirstName","MiddleName","LastName","Email","UserGroup","PhoneNumber","Extension","JobTitle","EmployeeNumber","Department","Supervisor","HourlyRate","OvertimeRate","Password","LocationAssociations","ServiceAreaAssociations","FavoriteLocation","FavoriteServiceArea"];timezone;translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.appSettingsService=t,this.authService=o,this.cp=i,this.locationService=s,this.pp=c,this.roleService=u,this.serviceAreaService=x,this.toastService=C,this.translate=O,this.userGroupService=w,this.userGroupTemplateService=F,this.userService=L}ngOnInit(){ue([this.translate.get(["UPLOAD.USER_UPLOAD_TEMPLATE","UPLOAD.USER_TEMPLATE_INSTRUCTIONS","UPLOAD.USER_TEMPLATE_EXAMPLES","UPLOAD.ERROR.USER_UPLOAD_ERROR","SHARED.ERROR_LABEL","UPLOAD.SUCCESSFUL.USER_UPLOAD_SUCCESSFUL","SHARED.SUCCESS","SHARED.FREE","SHARED.PAID"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N()),this.userService.getUsers(this.authService.tenant.Id),this.userGroupService.getUserGroups(this.authService.tenant.Id),this.locationService.getLocations(this.authService.tenant.Id),this.serviceAreaService.getServiceAreas(this.authService.tenant.Id),this.userGroupTemplateService.getUserGroupTemplates(),this.roleService.getRoles()]).subscribe(t=>{this.translations=t[0];let o=t[1],i=t[2],s=t[3];this.allLocations=t[4];let c=t[5],u=t[6],x=t[7],O=u.find(U=>U.Name==="Requester")?.Roles??[],w=x.filter(U=>U.Id&&U.Name==="IsQwareSuperUserGroup").map(U=>U.Id);this.timezone=o.Timezone??"",this.currencyType=o.CurrencyType??"USD";let F=xt.default.sortBy(i.filter(U=>U.State===M.ACTIVE).map(U=>({label:U.fullNameWithEmail(),value:U.Id})),U=>(U.label??"").toLowerCase()),L=xt.default.sortBy(s.filter(U=>U.State===M.ACTIVE).map(U=>{let V={label:U.Name,value:U.Id},z=O.length>0&&xt.default.difference(U.Roles,O).length===0,ce=xt.default.intersection(U.Roles,w).length>0;return z?V.title=this.translations["SHARED.FREE"]:!z&&!ce&&(V.title=this.translations["SHARED.PAID"]),V}),U=>(U.label??"").toLowerCase());this.allLocations.forEach(U=>{let V=this.allLocations.find(z=>z.Id===U.ParentId);for(U.LocationHierarchy=U.Name;V!==void 0;)U.LocationHierarchy+=" // "+V.Name,V=this.allLocations.find(z=>z.Id===V?.ParentId)}),this.locationOptions=xt.default.sortBy(this.allLocations.filter(U=>U.State===M.ACTIVE).map(U=>(this.allLocationIds.push(U.Id),{label:U.LocationHierarchy,value:U.Id})),U=>(U.label??"").toLowerCase()),this.serviceAreaOptions=xt.default.sortBy(c.filter(U=>U.State===M.ACTIVE).map(U=>({label:U.Name,value:U.Id})),U=>(U.label??"").toLowerCase()),this.tableColumns=[{field:"FirstName",header:"USER.FIRSTNAME",valType:"input",required:!0,max:re},{field:"MiddleName",header:"USER.MIDDLENAME",valType:"input",max:re},{field:"LastName",header:"USER.LASTNAME",valType:"input",required:!0,max:re},{field:"Email",header:"USER.EMAIL",valType:"input",required:!0,max:re},{field:"UserGroup",header:"USER.USERGROUP",valType:"single-select",options:L,required:!0},{field:"PhoneNumber",header:"USER.PHONE",valType:"phone",equal:10},{field:"Extension",header:"USER.EXTENSION",valType:"number"},{field:"JobTitle",header:"USER.JOB_TITLE",valType:"input",max:re},{field:"EmployeeNumber",header:"USER.EMPLOYEE_NUMBER",valType:"input",max:re},{field:"Department",header:"USER.DEPARTMENT",valType:"input",max:re},{field:"Supervisor",header:"USER.SUPERVISOR",valType:"single-select",options:F},{field:"HourlyRate",header:"USER.HOURLY_RATE",valType:"currency",required:!0},{field:"OvertimeRate",header:"USER.OVERTIME_RATE",valType:"currency",required:!0},{field:"Password",header:"USER.PASSWORD",valType:"input",required:!0,min:Nn,max:On},{field:"LocationAssociations",header:"USER.LOCATION_ASSOCIATIONS",valType:"multi-select",pickerEnabled:!0,options:this.locationOptions},{field:"ServiceAreaAssociations",header:"USER.SERVICE_AREA_ASSOCIATIONS",valType:"multi-select",options:this.serviceAreaOptions},{field:"FavoriteLocation",header:"USER.FAVORITE_LOCATION",valType:"single-select"},{field:"FavoriteServiceArea",header:"USER.FAVORITE_SERVICE_AREA",valType:"single-select"}],this.displaySpinner=!1})}onUpload(t){this.displaySpinner=!0,this.favOptionsMap.clear(),this.labelMap.clear();let o=new FileReader;o.readAsText(t.files[0]),o.onload=i=>{let s=i.target.result.split(/\r\n|\n/),c=[],u=this.readLine(s[0]);this.rowsWithInvalidData=[],this.duplicateRows=[];let x=[],C=0;
9953s.forEach((O,w)=>{if(w>0&&O!==""){O=O.replace("'","!*!*!").replace('""',"@&@&@");let F=this.readLine(O),L=new Ji,U=!1,V=!1;if(F){this.favOptionsMap.set((w-1).toString()+"LocationOptions",this.locationOptions),this.favOptionsMap.set((w-1).toString()+"ServiceAreaOptions",this.serviceAreaOptions);for(let z in F)F.hasOwnProperty(z)&&(F[z]=F[z].replace("!*!*!","'").replace("@&@&@",'""'));u?.forEach((z,ce)=>{let Z=[],fe;U=U||F[ce]!==null&&F[ce]!==void 0;let Me=this.tableColumns.find(Xt=>Xt.field?.toLowerCase()===z.toLowerCase()),ke=F[ce]??"";if(Me)if(L[z])this.colsWithInvalidHeaders.push(z);else{if(Me.valType==="single-select"||Me.valType==="multi-select"){let hi=ke.split(",").filter(xi=>xi!=="");Z=xt.default.concat(Z,We.getDuplicatesFromArray(hi)),Z.length>0&&(fe=St.DUPLICATE_VALUES);let Gi=[],on=[],Ro=[];if(Me.field==="Supervisor")hi.forEach(xi=>{let Ue=(Me?.options).filter(Wt=>Wt.label?.toLowerCase().includes(xi.toLowerCase()));Gi=xt.default.concat(Gi,Ue),Ue.length>1&&(fe||(fe=St.MULTIPLE_USERS),Ro.push(xi))});else{let xi=Me.options;if(Me.field?.includes("Favorite")){let Ue=this.favOptionsMap.get((w-1).toString()+Me.field);xi=xt.default.cloneDeep(Ue)}Gi=xi?.filter(Ue=>hi.map(Wt=>Wt.toLowerCase()).includes(Ue.label?.toLowerCase()??"")),(!Gi||Gi.length===0)&&(on=xi?.filter(Ue=>hi.map(Wt=>Wt.toLowerCase()).includes(Ue.value?.toLowerCase()??"")))}let In=xt.default.sortBy(xt.default.concat(Gi??[],on??[]),xi=>xi.label?.toLowerCase());if(In.length>0&&In.length>=hi.length||Z&&Z.length>0)if(fe)V=!0,L[z]={label:"FIELD_ERROR_"+fe,value:[ke],duplicates:fe!==St.MULTIPLE_USERS?Z:Ro};else if(In.length>0){if(Me.field==="LocationAssociations"){let xi=In.map(Wt=>this.allLocations.find(ps=>ps.Id===Wt.value)).filter(Wt=>Wt!==void 0),Ue=[];xi.forEach(Wt=>{Ue=xt.default.uniq(xt.default.concat(Ue,this.locationService.getChildLocationIdsForParent(Wt,this.allLocations,!0)))}),In=xt.default.sortBy(Ue.map(Wt=>this.locationOptions.find(ps=>ps.value===Wt)).filter(Wt=>Wt!==void 0),Wt=>Wt.label?.toLowerCase()),L[z]=In}else L[z]=Me.valType==="single-select"?In[0]:In.map(xi=>xi.value);Me.field==="LocationAssociations"?this.favOptionsMap.set((w-1).toString()+"FavoriteLocation",In):Me.field==="ServiceAreaAssociations"&&this.favOptionsMap.set((w-1).toString()+"FavoriteServiceArea",In)}else L[z]=Me.valType==="single-select"?null:[];else hi.length>0&&hi[0]&&(V=!0,L[z]={label:"FIELD_ERROR_"+St.INVALID_REFERENCE_VALUE,value:[ke]}),Me.required&&(V=!0,L[z]={label:"FIELD_ERROR_"+St.VALUE_REQUIRED,value:[ke]})}else{switch(z){case"FirstName":case"LastName":ke?Me.max&&ke.length>Me.max?fe=St.INVALID_LENGTH:L[z]=ke:fe=St.VALUE_REQUIRED;break;case"Email":ke?Me.max&&ke.length>Me.max?fe=St.INVALID_LENGTH:Ui.test(ke)?L[z]=ke:fe=St.INVALID_EMAIL_FORMAT:fe=St.VALUE_REQUIRED;break;case"PhoneNumber":!Number(ke)&&ke!==""?fe=St.INVALID_VALUE:ke&&Me.equal&&ke.length!==Me.equal?fe=St.INVALID_LENGTH_EQUAL:L[z]=ke;break;case"MiddleName":case"JobTitle":case"Department":case"EmployeeNumber":ke&&Me.max&&ke.length>Me.max?fe=St.INVALID_LENGTH_MAX:L[z]=ke;break;case"HourlyRate":case"OvertimeRate":ke?isNaN(Number(ke))?fe=St.INVALID_VALUE:L[z]=Number.parseFloat(ke):fe=St.VALUE_REQUIRED;break;case"Password":ke?Me.min&&ke.length<Me.min||Me.max&&ke.length>Me.max?fe=St.INVALID_LENGTH_BETWEEN:L[z]=ke:fe=St.VALUE_REQUIRED;break;default:L[z]=ke}fe&&(V=!0,L[z]={label:"FIELD_ERROR_"+fe,value:[ke]})}let Xt=this.getLabel(Me,xt.default.clone(L[z]),w-1);this.labelMap.set((w-1).toString()+Me.field,Xt)}else x=xt.default.uniq(xt.default.concat(x,[z]))})}else C++;U&&(c.push(L),V&&this.rowsWithInvalidData.push(w+1-C))}}),x.length>0&&this.translate.get(["SHARED.ERROR_LABEL","UPLOAD.ERROR.INVALID_COLUMN"],{colNames:x.join(", ")}).pipe(N()).subscribe(O=>{this.toastService.error(O["SHARED.ERROR_LABEL"],O["UPLOAD.ERROR.INVALID_COLUMN"])}),C>0&&this.translate.get(["SHARED.ERROR_LABEL","UPLOAD.ERROR.PARSE_ERROR"]).pipe(N()).subscribe(O=>{this.toastService.error(O["SHARED.ERROR_LABEL"],O["UPLOAD.ERROR.PARSE_ERROR"])}),this.uploadedItems=xt.default.concat([],c),this.duplicateCheck(),this.upload.clear(),this.displaySpinner=!1},o.onerror=()=>{console.log("Error occured while reading the file")}}duplicateCheck(){let t=[],o=this.uploadedItems.map(i=>{let s=xt.default.pick(i,this.dupeCheckingFields);
9953return xt.default.keys(s).forEach(c=>{let u=s[c];s[c]=u?.label?.includes("FIELD_ERROR")?u.value[0]:u}),s});o.forEach(i=>{let s=o.reduce((c,u,x)=>(xt.default.isEqual(i,u)&&!xt.default.flatten(t).includes(x+2)&&(c[0]=xt.default.concat(c[0]??[],x+2)),c),[]);s[0]&&s[0].length>1&&t.push(s[0])}),this.duplicateRows=t.map(i=>"("+i.join(", ")+")")}validityCheck(t,o,i){let s=!1;Object.values(t).filter(C=>C&&C.label&&C.label?.includes("FIELD_ERROR")).length>0&&(s=!0);let u=t[i.field];u=xt.default.clone(u&&u.value?u.value[0]:u),i.max&&!i.min&&u&&u.length>i.max&&(s=!0,t[i.field]={label:"FIELD_ERROR_"+St.INVALID_LENGTH_MAX,value:[u]}),i.min&&!i.max&&u&&u.length<i.min&&(s=!0,t[i.field]={label:"FIELD_ERROR_"+St.INVALID_LENGTH_MIN,value:[u]}),i.max&&i.min&&u&&(u.length>i.max||u.length<i.min)&&(s=!0,t[i.field]={label:"FIELD_ERROR_"+St.INVALID_LENGTH_BETWEEN,value:[u]}),i.field==="Email"&&u&&!Ui.test(u)&&(s=!0,t[i.field]={label:"FIELD_ERROR_"+St.INVALID_EMAIL_FORMAT,value:[u]}),this.tableColumns.filter(C=>C.required).map(C=>C.field).forEach(C=>{u=t[C],u=xt.default.clone(u&&u.value?u.value[0]:u),(u==null||u==="")&&(s=!0,t[C]={label:"FIELD_ERROR_"+St.VALUE_REQUIRED,value:[void 0]})}),s&&!this.rowsWithInvalidData.includes(o+2)&&this.rowsWithInvalidData.push(o+2),!s&&o!==void 0&&(this.rowsWithInvalidData=this.rowsWithInvalidData.filter(C=>C!==o+2)),this.rowsWithInvalidData=xt.default.sortBy(this.rowsWithInvalidData,C=>C),this.dupeCheckingFields.includes(i.field)&&this.duplicateCheck()}
9953getLabel(t,o,i){if(o?.label?.includes("FIELD_ERROR"))return[""];switch(t.valType){case"single-select":case"multi-select":let s=[],c=(t.options??this.favOptionsMap.get((i??"").toString()+t.field)??[]).filter(u=>u!==void 0);return c&&o&&(t.pickerEnabled?s=o.map(u=>c.find(x=>xt.default.isEqual(u,x))).filter(u=>u!==void 0):s=(t.valType==="single-select"&&o?[o?.value]:o).map(u=>c.find(x=>x.value===(u?.value??u))).filter(u=>u!==void 0)),s.map(u=>u.label);case"number":return[o!=null?o.toString():""];case"currency":return[o!=null?this.cp.transform(o,this.currencyType,"symbol","1.2-2"):""];case"phone":return[o!=null?this.pp.transform(o):""];default:return[o?.toString()??""]}}setItem(t,o,i,s){let c=s??void 0;i.field==="LocationAssociations"?(c=xt.default.sortBy((c??[]).map(x=>this.locationOptions.find(C=>C.value===x.data.id)).filter(x=>x!==void 0),x=>x?.label?.toLowerCase()),t.FavoriteLocation&&(c.find(C=>xt.default.isEqual(C,t.FavoriteLocation))||(t.FavoriteLocation=void 0,this.labelMap.set(o.toString()+"FavoriteLocation",[""]))),this.favOptionsMap.set(o.toString()+"FavoriteLocation",c.length>0?c:this.locationOptions),t[i.field]=c):i.field==="ServiceAreaAssociations"?(c=xt.default.sortBy((c??[]).map(x=>this.serviceAreaOptions.find(C=>C.value===x)).filter(x=>x!==void 0),x=>x?.label?.toLowerCase()),t.FavoriteServiceArea&&(c.find(C=>xt.default.isEqual(C,t.FavoriteServiceArea))||(t.FavoriteServiceArea=void 0,this.labelMap.set(o.toString()+"FavoriteServiceArea",[""]))),this.favOptionsMap.set(o.toString()+"FavoriteServiceArea",c.length>0?c:this.serviceAreaOptions),t[i.field]=s):t[i.field]=c;let u=this.getLabel(i,xt.default.clone(c),o);this.labelMap.set(o.toString()+i.field,u),this.validityCheck(t,o,i)}unsetItem(t,o,i,s){let c=xt.default.cloneDeep(t);xt.default.remove(c[i.field],u=>xt.default.isEqual(u,s)),this.setItem(t,o,i,c[i.field].map(u=>u.value))}removeUser(t){this.uploadedItems.splice(t,1),this.uploadedItems=xt.default.cloneDeep(this.uploadedItems),this.rowsWithInvalidData.includes(t+2)&&xt.default.remove(this.rowsWithInvalidData,o=>o===t+2),this.rowsWithInvalidData=this.rowsWithInvalidData.map(o=>o>t+2?o-1:o),this.duplicateCheck()}downloadExcelFile(){let t=[];t[0]=[Object({v:this.translations["UPLOAD.USER_TEMPLATE_INSTRUCTIONS"]})],t[1]=this.tableColumns.map(x=>x.field),t[2]=this.translations["UPLOAD.USER_TEMPLATE_EXAMPLES"];let o=t[1].map((x,C)=>{let O=x.length,w=t[2][C]?t[2][C].length:0;return w>O?w:O}),i=Ba.aoa_to_sheet(t);i["!margins"]={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer
9953:.3},i["!rows"]=t.map(()=>Object({hpx:20})),i["!cols"]=o.map(x=>Object({wpx:x*6>90?x*6<300?x*6:300:90}));let s=Ba.book_new();Ba.book_append_sheet(s,i);let c=We.formatDate(sc.default.tz("UTC"),this.timezone??""),u=this.translations["UPLOAD.USER_UPLOAD_TEMPLATE"];ml(s,u+" "+c+".xlsx")}save(){this.displaySpinner=!0;let t=xt.default.cloneDeep(this.uploadedItems).map(o=>(o.State=M.ACTIVE,o.TenantGroupId=o.UserGroup?.value,o.Supervisor=o.Supervisor?.value,o.LocationAssociations=o.LocationAssociations?.map(i=>i.value)??[],o.FavoriteLocation=o.FavoriteLocation?.value,o.FavoriteServiceArea=o.FavoriteServiceArea?.value,o.TenantId=this.authService.tenant.Id,o));this.userService.uploadUserCsv(t).subscribe({next:()=>{this.toastService.success(this.translations["SHARED.SUCCESS"],this.translations["UPLOAD.SUCCESSFUL.USER_UPLOAD_SUCCESSFUL"],0,!0),this.displaySpinner=!1},error:o=>{this.toastService.error(this.translations["SHARED.ERROR_LABEL"],this.translations["UPLOAD.ERROR.USER_UPLOAD_ERROR"]),console.log(o),this.displaySpinner=!1}})}readLine(t){let o=We.parseCsvLine(t);return o&&(o=o.map(i=>i.trim())),o}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(Ra),g(zt),g(jo),g(hn),g(_i),g(Se),g(le),g(Tt),g(kn),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-upload"]],viewQuery:function(o,i){if(o&1&&X(Y5,7),o&2){let s;Y(s=Q())&&(i.upload=s.first)}},standalone:!1,decls:35,vars:16,consts:[["upload",""],["chooseicon",""],["dt",""],["incrementbuttonicon",""],["decrementbuttonicon",""],["dropdownicon",""],["filtericon",""],["id","qware.user.upload.spinner",3,"displaySpinner"],[1,"toolbar"],[1,"flex-inline"],["id","upload-button","mode","basic","name","userUpload","accept",".csv",1,"file-uploader",3,"uploadHandler","auto","customUpload","chooseLabel","chooseButtonProps"],["id","template-button",3,"onClick","label","raised"],[1,"upload-info"],["translate",""],[1,"material-icons",2,"padding","0.25rem 0"],[2,"margin-left","auto"],["id","save-button",3,"onClick","label","raised","disabled"],[1,"upload-feedback"],["id","dupe-row-errors"],["id","data-errors"],["id","upload-table","responsiveLayout","scroll",3,"value","columns","paginator","pageLinks","rows"],["pTemplate","header"],["pTemplate","body"],[2,"width","58px"],["type","button","styleClass","icon-only-button",3,"onClick","rounded","text"],[1,"material-icons"],["pEditableColumn","",2,"max-width","100%"],["pTemplate","input"],["pTemplate","output"],["pInputText","","type","text",3,"blur","ngModelChange","fluid","ngModel"],["mode","decimal",3,"ngModelChange","minFractionDigits","ngModel","step","useGrouping","fluid"],["mode","currency",3,"ngModelChange","minFractionDigits","ngModel","currency","step","useGrouping","fluid"],["mask","(999) 999-9999","styleClass","full-width",3,"ngModelChange","unmask","autoClear","ngModel"],["appendTo","body",3,"selectChange","id","options","singleSelect","material","selectedOption","forceSelection"],["appendTo","body",3,"selectChange","id","singleSelect","options","material","selectedOption","forceSelection","virtualScroll","virtualScrollItemSize"],["appendTo","body",3,"selectChange","id","singleSelect","options","material","selectedOption","forceSelection"],["appendTo","body","hierarchySelectionType","hierarchy",3,"unselectChange","selectChange","id","enablePicker","nodeIds","material","forceSelection","allLocations","selectedOption","filterByUserAccess"],["appendTo","body","display","chip",3,"ngModelChange","onBlur","onFocus","id","options","fluid","ngModel","resetFilterOnHide","maxSelectedLabels"],["pTextarea","",3,"ngModelChange","rows","cols","autoResize","ngModel","fluid"],[1,"field-error"],["qwareTruncate",""]],template:function(o,i){if(o&1){let s=b();n(0,"qware-spinner",7),e(1,` 9954 `),n(2,"div",8),e(3,` 9955 `),n(4,"div",9),e(5,` 9956 `),n(6,"p-fileupload",10,0),I(8,"translate"),h("uploadHandler",function(u){return E(s),S(i.onUpload(u))}),e(9,` 9957 `),_(10,n6,4,0,"ng-template",null,1,A),e(12,` 9958 `),a(),e(13,` 9959 `),n(14,"p-button",11),I(15,"translate"),h("onClick",function(){return E(s),S(i.downloadExcelFile())}),e(16,` 9960 `),a(),e(17,` 9961 `),_(18,a6,8,5),a(),e(19,` 9962 `),n(20,"div",12),e(21,` 9963 `),n(22,"span",13),e(23,"SHARED.NOTE"),a(),n(24,"span"),e(25,": "),a(),n(26,"span",13),e(27,"UPLOAD.USER_UPLOAD_INFO"),a(),e(28,` 9964 `),a(),e(29,` 9965 `),_(30,r6,10,3)(31,o6,10,3),a(),e(32,` 9966 `),_(33,Z6,9,5),a(),e(34,` 9967`)}o&2&&(p("displaySpinner",i.displaySpinner),l(6),q("chooseLabel",y(8,11,"USER.UPLOAD_USERS")),p("auto",!0)("customUpload",!0)("chooseButtonProps",ne(15,Q5)),l(8),q("label",y(15,13,"UPLOAD.DOWNLOAD_TEMPLATE")),p("raised",!0),l(4),f(i.uploadedItems&&i.uploadedItems.length>0?18:-1),l(12),f(i.duplicateRows&&i.duplicateRows.length>0?30:-1),l(),f(i.rowsWithInvalidData&&i.rowsWithInvalidData.length>0?31:-1),l(2),f(i.uploadedItems&&i.uploadedItems.length>0?33:-1))}
9967,dependencies:[Pe,oe,gr,Ae,se,Le,Un,bi,ye,Ni,wt,me,kt,ht,Nr,Or,ri,$,Go,ie],styles:[`qware-user-upload .toolbar{margin-bottom:.5rem}@media screen and (max-width: 992px){qware-user-upload .toolbar{padding:0 1rem}}qware-user-upload .toolbar .file-uploader{margin:0 .5rem .5rem 0}qware-user-upload .toolbar .upload-info{background-color:var(--p-surface-400);padding:.5rem;margin:.5rem 0;border-radius:3px}qware-user-upload .toolbar .upload-info span:not(:last-of-type){font-weight:700;text-transform:uppercase}qware-user-upload .toolbar .upload-feedback{margin:.5rem 0}qware-user-upload .field-error{background:tomato;font-weight:700;border-radius:4px;padding:.25rem;white-space:normal;cursor:pointer}qware-user-upload .wide-fields{max-width:300px}qware-user-upload .p-inputtext{min-width:160px} 9968`],encapsulation:2})}return r})();var J6=["attachments"];function eF(r,d){if(r&1&&(e(0,` 9969 `),n(1,"small",5),e(2,` 9970 `),n(3,"div",6),e(4),a(),e(5,` 9971 `),a(),e(6,` 9972 `)),r&2){let t=d.$implicit;l(4),v(t)}}function tF(r,d){if(r&1&&(e(0,` 9973 `),G(1,eF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Attachments)}}var is=(()=>{class r{attachments;disableAllControls=ee(!1);docs=ee([]);form=ee.required();submitted=ee(!1);validationErrors=ee();docsChanged=Dt();setDocs(t){t instanceof Event||this.docsChanged.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-vendor-attachments"]],viewQuery:function(o,i){if(o&1&&X(J6,7),o&2){let s;Y(s=Q())&&(i.attachments=s.first)}},inputs:{disableAllControls:[1,"disableAllControls"],docs:[1,"docs"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{docsChanged:"docsChanged"},standalone:!1,decls:13,vars:4,consts:[["attachments",""],[1,"grid"],[1,"col-12"],[1,"relative",2,"padding","0.75rem 1rem 1.5rem"],[3,"docsChanged","form","docs","disableAllControls"],[1,"validation-error"],["translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 9974 `),n(2,"div",2),e(3,` 9975 `),n(4,"div",3),e(5,` 9976 `),n(6,"qware-attachments",4,0),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(8,` 9977 `),a(),e(9,` 9978 `),_(10,tF,3,0),a(),e(11,` 9979 `),a(),e(12,` 9980`),a()}o&2&&(l(6),p("form",i.form())("docs",i.docs())("disableAllControls",i.disableAllControls()),l(4),f(i.validationErrors()&&i.validationErrors().Attachments&&i.form().controls.Documents.untouched?10:-1))},dependencies:[ta,$],encapsulation:2,changeDetection:0})}return r})();function iF(r,d){if(r&1&&(e(0,` 9981 `),n(1,"small",42),e(2,` 9982 `),n(3,"div",5),e(4),a(),e(5,` 9983 `),a(),e(6,` 9984 `)),r&2){let t=d.$implicit;l(4),v(t)}}function nF(r,d){if(r&1&&(e(0,` 9985 `),G(1,iF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Name)}}function aF(r,d){if(r&1&&(e(0,` 9986 `),n(1,"small",42),e(2,` 9987 `),n(3,"div",5),e(4),a(),e(5,` 9988 `),a(),e(6,` 9989 `)),r&2){let t=d.$implicit;l(4),v(t)}}function rF(r,d){if(r&1&&(e(0,` 9990 `),G(1,aF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Website)}}function oF(r,d){if(r&1&&(e(0,` 9991 `),n(1,"small",42),e(2,` 9992 `),n(3,"div",5),e(4),a(),e(5,` 9993 `),a(),e(6,` 9994 `)),r&2){let t=d.$implicit;l(4),v(t)}}function lF(r,d){if(r&1&&(e(0,` 9995 `),G(1,oF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Description)}}function sF(r,d){if(r&1&&(e(0,` 9996 `),n(1,"small",42),e(2,` 9997 `),n(3,"div",5),e(4),a(),e(5,` 9998 `),a(),e(6,` 9999 `)),r&2){let t=d.$implicit;l(4),v(t)}}function dF(r,d){if(r&1&&(e(0,` 10000 `),G(1,sF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Address)}}function pF(r,d){if(r&1&&(e(0,` 10001 `),n(1,"small",42),e(2,` 10002 `),n(3,"div",5),e(4),a(),e(5,` 10003 `),a(),e(6,` 10004 `)),r&2){let t=d.$implicit;l(4),v(t)}}function mF(r,d){if(r&1&&(e(0,` 10005 `),G(1,pF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().City)}}function cF(r,d){if(r&1&&(e(0,` 10006 `),n(1,"small",42),e(2,` 10007 `),n(3,"div",5),e(4),a(),e(5,` 10008 `),a(),e(6,` 10009 `)),r&2){let t=d.$implicit;l(4),v(t)}}function uF(r,d){if(r&1&&(e(0,` 10010 `),G(1,cF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().LocationState)}}function _F(r,d){if(r&1&&(e(0,` 10011 `),n(1,"small",42),e(2,` 10012 `),n(3,"div",5),e(4),a(),e(5,` 10013 `),a(),e(6,` 10014 `)),r&2){let t=d.$implicit;l(4),v(t)}}function EF(r,d){if(r&1&&(e(0,` 10015 `),G(1,_F,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().ZipCode)}}function SF(r,d){if(r&1&&(e(0,` 10016 `),n(1,"small",42),e(2,` 10017 `),n(3,"div",5),e(4),a(),e(5,` 10018 `),a(),e(6,` 10019 `)),r&2){let t=d.$implicit;l(4),v(t)}}function xF(r,d){if(r&1&&(e(0,` 10020 `),G(1,SF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().FaxNumber)}}function fF(r,d){if(r&1&&(e(0,` 10021 `),n(1,"small",42),e(2,` 10022 `),n(3,"div",5),e(4),a(),e(5,` 10023 `),a(),e(6,` 10024 `)),r&2){let t=d.$implicit;l(4),v(t)}}function hF(r,d){if(r&1&&(e(0,` 10025 `),G(1,fF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().ContactName)}}function CF(r,d){if(r&1&&(e(0,` 10026 `),n(1,"small",42),e(2,` 10027 `),n(3,"div",5),e(4),a(),e(5,` 10028 `),a(),e(6,` 10029 `)),r&2){let t=d.$implicit;l(4),v(t)}}function vF(r,d){if(r&1&&(e(0,` 10030 `),G(1,CF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Email)}}function gF(r,d){if(r&1&&(e(0,` 10031 `),n(1,"small",42),e(2,` 10032 `),n(3,"div",5),e(4),a(),e(5,` 10033 `),a(),e(6,` 10034 `)),r&2){let t=d.$implicit;l(4),v(t)}}function TF(r,d){if(r&1&&(e(0,` 10035 `),G(1,gF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().PhoneNumber)}}function IF(r,d){if(r&1&&(e(0,` 10036 `),n(1,"small",42),e(2,` 10037 `),n(3,"div",5),e(4),a(),e(5,` 10038 `),a(),e(6,` 10039 `)),r&2){let t=d.$implicit;l(4),v(t)}}function bF(r,d){if(r&1&&(e(0,` 10040 `),G(1,IF,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().CellNumber)}}var ns=(()=>{class r{autoFocus=ee(!0);form=ee.required();submitted=ee(!1);validationErrors=ee();textareaFocusChange=Dt();textareaFocus(t){this.textareaFocusChange.emit(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-vendor-details"]],inputs:{autoFocus:[1,"autoFocus"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:294,vars:66,consts:[[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.vendor.details.input.name","tabindex","1","type","text","pInputText","","name","Name","formControlName","Name","variant","filled",3,"qwareFocus","fluid"],["id","qware.vendor.details.label.name","for","qware.vendor.details.input.name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["id","qware.vendor.details.error.
10040name-req","translate","",3,"hidden"],["id","qware.vendor.details.error.name-length","translate","",3,"hidden"],["id","qware.vendor.details.input.website","tabindex","2","type","text","pInputText","","name","Website","formControlName","Website","variant","filled",3,"fluid"],["id","qware.vendor.details.label.website","for","qware.vendor.details.input.website"],["translate","",3,"hidden"],["id","qware.vendor.details.error.website-length","translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["tabindex","3","id","qware.vendor.details.textarea.description","pTextarea","","formControlName","Description","variant","filled",1,"text-box",3,"focus","blur","rows","cols","autoResize","fluid"],["id","qware.vendor.details.label.description","for","qware.vendor.details.textarea.description"],["id","qware.vendor.details.input.address","tabindex","4","ype","text","pInputText","","name","Address","formControlName","Address","variant","filled",3,"fluid"],["id","qware.vendor.details.label.address","for","qware.vendor.details.input.address"],["id","qware.vendor.details.error.address-length","translate","",3,"hidden"],["id","qware.vendor.details.input.city","tabindex","5","type","text","pInputText","","name","City","formControlName","City","variant","filled",3,"fluid"],["id","qware.vendor.details.label.city","for","qware.vendor.details.input.city"],["id","qware.vendor.details.error.city-length","translate","",3,"hidden"],["id","qware.vendor.details.input.state","tabindex","6","type","text","pInputText","","name","LocationState","formControlName","LocationState","variant","filled",3,"fluid"],["id","qware.vendor.details.label.state","for","qware.vendor.details.input.state"],["id","qware.vendor.details.error.state-length","translate","",3,"hidden"],["id","qware.vendor.details.input.zip","tabindex","7","type","text","pInputText","","name","ZipCode","formControlName","ZipCode","variant","filled",3,"fluid"],["id","qware.vendor.details.label.zip","for","qware.vendor.details.input.zip"],["inputId","qware.vendor.details.input.fax","mask","(999) 999-9999","name","fax","formControlName","FaxNumber","styleClass","full-width","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.vendor.details.label.fax","for","qware.vendor.details.input.fax"],["id","qware.vendor.details.input.contactName","tabindex","9","type","text","pInputText","","name","ContactName","formControlName","ContactName","variant","filled",3,"fluid"],["id","qware.vendor.details.label.contactName","for","qware.vendor.details.input.contactName"],["id","qware.vendor.details.error.contactName-length","translate","",3,"hidden"],["id","qware.vendor.details.input.email","tabindex","10","type","text","pInputText","","name","Email","formControlName","Email","variant","filled",3,"fluid"],["id","qware.vendor.details.label.email","for","qware.vendor.details.input.email"],["id","qware.vendor.details.error.email-length","translate","",3,"hidden"],["id","qware.vendor.details.error.email.format","translate","",3,"hidden"],["inputId","qware.vendor.details.input.phone","styleClass","full-width","mask","(999) 999-9999","name","phone","formControlName","PhoneNumber","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.vendor.details.label.phone","for","qware.vendor.details.input.phone"],[1,"p-field","medium-input"],["inputId","qware.vendor.details.input.cell","styleClass","full-width","mask","(999) 999-9999","name","cell","formControlName","CellNumber","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.vendor.details.label.cell","for","qware.vendor.details.input.cell"],[1,"validation-error"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 10041 `),e(2,` 10042 `),n(3,"div",1),e(4,` 10043 `),n(5,"div",2),e(6,` 10044 `),n(7,"p-floatlabel"),e(8,` 10045 `),R(9,"input",3),e(10,` 10046 `),n(11,"label",4),e(12,` 10047 `),n(13,"span",5),e(14,"VENDOR.NAME"),a(),n(15,"span",6),e(16," *"),a(),e(17,` 10048 `),a(),e(18,` 10049 `),a(),e(19,` 10050 `),n(20,"small",7),e(21,` 10051 `),n(22,"div",8),e(23,` 10052 VENDOR.ERROR.NAME_REQUIRED 10053 `),a(),e(24,` 10054 `),n(25,"div",9),e(26,` 10055 VENDOR.ERROR.NAME_LENGTH 10056 `),a(),e(27,` 10057 `),a(),e(28,` 10058 `),_(29,nF,3,0),a(),e(30,` 10059 `),n(31,"div",2),e(32,` 10060 `),n(33,"p-floatlabel"),e(34,`
10061 `),R(35,"input",10),e(36,` 10062 `),n(37,"label",11),e(38,` 10063 `),n(39,"span",5),e(40,"VENDOR.WEBSITE"),a(),e(41,` 10064 `),a(),e(42,` 10065 `),a(),e(43,` 10066 `),n(44,"small",7),e(45,` 10067 `),n(46,"div",12),e(47,` 10068 VENDOR.ERROR.WEBSITE_FORMAT 10069 `),a(),e(48,` 10070 `),n(49,"div",13),e(50,` 10071 VENDOR.ERROR.WEBSITE_LENGTH 10072 `),a(),e(51,` 10073 `),a(),e(52,` 10074 `),_(53,rF,3,0),a(),e(54,` 10075 `),a(),e(55,` 10076 `),n(56,"div",14),e(57,` 10077 `),n(58,"div",2),e(59,` 10078 `),n(60,"p-floatlabel"),e(61,` 10079 `),n(62,"textarea",15),h("focus",function(){return i.textareaFocus(!0)})("blur",function(){return i.textareaFocus(!1)}),e(63," "),a(),e(64,` 10080 `),n(65,"label",16),e(66,` 10081 `),n(67,"span",5),e(68,"VENDOR.DESCRIPTION"),a(),e(69,` 10082 `),a(),e(70,` 10083 `),a(),e(71,` 10084 `),n(72,"small",7),e(73,` 10085 `),n(74,"div",12),e(75,` 10086 VENDOR.ERROR.DESCRIPTION_LENGTH 10087 `),a(),e(76,` 10088 `),a(),e(77,` 10089 `),_(78,lF,3,0),a(),e(79,` 10090 `),a(),e(80,` 10091 `),e(81,` 10092 `),n(82,"div",1),e(83,` 10093 `),n(84,"div",2),e(85,` 10094 `),n(86,"p-floatlabel"),e(87,` 10095 `),R(88,"input",17),e(89,` 10096 `),n(90,"label",18),e(91,` 10097 `),n(92,"span",5),e(93,"VENDOR.ADDRESS"),a(),e(94,` 10098 `),a(),e(95,` 10099 `),a(),e(96,` 10100 `),n(97,"small",7),e(98,` 10101 `),n(99,"div",19),e(100,` 10102 VENDOR.ERROR.ADDRESS_LENGTH 10103 `),a(),e(101,` 10104 `),a(),e(102,` 10105 `),_(103,dF,3,0),a(),e(104,` 10106 `),n(105,"div",2),e(106,` 10107 `),n(107,"p-floatlabel"),e(108,` 10108 `),R(109,"input",20),e(110,` 10109 `),n(111,"label",21),e(112,` 10110 `),n(113,"span",5),e(114,"VENDOR.CITY"),a(),e(115,` 10111 `),a(),e(116,` 10112 `),a(),e(117,` 10113 `),n(118,"small",7),e(119,` 10114 `),n(120,"div",22),e(121,` 10115 VENDOR.ERROR.CITY_LENGTH 10116 `),a(),e(122,` 10117 `),a(),e(123,` 10118 `),_(124,mF,3,0),a(),e(125,` 10119 `),n(126,"div",2),e(127,` 10120 `),n(128,"p-floatlabel"),e(129,` 10121 `),R(130,"input",23),e(131,` 10122 `),n(132,"label",24),e(133,` 10123 `),n(134,"span",5),e(135,"VENDOR.LOCATIONSTATE"),a(),e(136,` 10124 `),a(),e(137,` 10125 `),a(),e(138,` 10126 `),n(139,"small",7),e(140,` 10127 `),n(141,"div",25),e(142,` 10128 VENDOR.ERROR.LOCATIONSTATE_LENGTH 10129 `),a(),e(143,` 10130 `),a(),e(144,` 10131 `),_(145,uF,3,0),a(),e(146,` 10132 `),n(147,"div",2),e(148,` 10133 `),n(149,"p-floatlabel"),e(150,` 10134 `),R(151,"input",26),e(152,` 10135 `),n(153,"label",27),e(154,` 10136 `),n(155,"span",5),e(156,"VENDOR.ZIP"),a(),e(157,` 10137 `),a(),e(158,` 10138 `),a(),e(159,` 10139 `),n(160,"small",7),e(161,` 10140 `),n(162,"div",12),e(163,` 10141 VENDOR.ERROR.ZIPCODE_NOTNUMBER 10142 `),a(),e(164,` 10143 `),n(165,"div",12),e(166,` 10144 VENDOR.ERROR.ZIPCODE_LENGTH 10145 `),a(),e(167,` 10146 `),a(),e(168,` 10147 `),_(169,EF,3,0),a(),e(170,` 10148 `),n(171,"div",2),e(172,` 10149 `),n(173,"p-floatlabel"),e(174,` 10150 `),n(175,"p-inputmask",28),e(176,` 10151 `),a(),e(177,` 10152 `),n(178,"label",29),e(179,` 10153 `),n(180,"span",5),e(181,"VENDOR.FAX"),a(),e(182,` 10154 `),a(),e(183,` 10155 `),a(),e(184,` 10156 `),n(185,"small",7),e(186,` 10157 `),n(187,"div",12),e(188,` 10158 VENDOR.ERROR.FAXNUMBER_NOTNUMBER 10159 `),a(),e(189,` 10160 `),n(190,"div",12),e(191,` 10161 VENDOR.ERROR.FAXNUMBER_LENGTH 10162 `),a(),e(192,` 10163 `),a(),e(193,` 10164 `),_(194,xF,3,0),a(),e(195,` 10165 `),a(),e(196,` 10166 `),n(197,"div",14),e(198,` 10167 `),n(199,"div",2),e(200,` 10168 `),n(201,"p-floatlabel"),e(202,` 10169 `),R(203,"input",30),e(204,` 10170 `),n(205,"label",31),e(206,` 10171 `),n(207,"span",5),e(208,"VENDOR.CONTACT_NAME"),a(),e(209,` 10172 `),a(),e(210,` 10173 `),a(),e(211,` 10174 `),n(212,"small",7),e(213,` 10175 `),n(214,"div",32),e(215,` 10176 VENDOR.ERROR.CONTACTNAME_LENGTH 10177 `),a(),e(216,` 10178 `),a(),e(217,` 10179 `),_(218,hF,3,0),a(),e(219,` 10180 `),n(220,"div",2),e(221,` 10181 `),n(222,"p-floatlabel"),e(223,` 10182 `),R(224,"input",33),e(225,` 10183 `),n(226,"label",34),e(227,` 10184 `),n(228,"span",5),e(229,"VENDOR.EMAIL"),a(),e(230,` 10185 `),a(),e(231,` 10186 `),a(),e(232,` 10187 `),n(233,"small",7),e(234,` 10188 `),n(235,"div",35),e(236,` 10189 VENDOR.ERROR.EMAIL_LENGTH 10190 `),a(),e(237,` 10191 `),n(238,"div",36),e(239,` 10192 VENDOR.ERROR.EMAIL_FORMAT 10193 `),a(),e(240,` 10194 `),a(),e(241,` 10195 `),_(242,vF,3,0),a(),e(243,` 10196 `),n(244,"div",2),e(245,` 10197 `),n(246,"p-floatlabel"),e(247,` 10198 `),R(248,"p-inputmask",37),e(249,` 10199 `),n(250,"label",38),e(251,` 10200 `),n(252,"span",5),e(253,"VENDOR.PHONE"),a(),e(254,` 10201 `),a(),e(255,` 10202 `),a(),e(256,` 10203 `),n(257,"small",7),e(258,` 10204 `),n(259,"div",12),e(260,` 10205 VENDOR.ERROR.PHONENUMBER_NOTNUMBER 10206 `),a(),e(261,` 10207 `),n(262,"div",12),e(263,` 10208 VENDOR.ERROR.PHONENUMBER_LENGTH 10209 `),a(),e(264,` 10210 `),a(),e(265,` 10211 `),_(266,TF,3,0),a(),e(267,` 10212 `),n(268,"div",39),e(269,` 10213 `),n(270,"p-floatlabel"),e(271,` 10214 `),n(272,"p-inputmask",40),e(273,` 10215 `),a(),e(274,` 10216 `),n(275,"label",41),e(276,` 10217 `),n(277,"span",5),e(278,"VENDOR.CELL"),a(),e(279,` 10218 `),a(),e(280,` 10219 `),a(),e(281,` 10220 `),n(282,"small",7),e(283,` 10221 `),n(284,"div",12),e(285,` 10222 VENDOR.ERROR.CELLNUMBER_NOTNUMBER 10223 `),a(),e(286,` 10224 `),n(287,"div",12),e(288,` 10225 VENDOR.ERROR.CELLNUMBER_LENGTH 10226 `),a(),e(289,`
10227 `),a(),e(290,` 10228 `),_(291,bF,3,0),a(),e(292,` 10229 `),a(),e(293,` 10230 `),a()),o&2){let s,c,u,x,C,O,w,F,L,U,V,z,ce,Z,fe,Me,ke,Xt,hi;p("formGroup",i.form()),l(9),p("qwareFocus",i.autoFocus())("fluid",!0),l(11),p("hidden",i.form().controls.Name.valid||i.form().controls.Name.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.Name.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.Name.errors)!=null&&c.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Name&&i.form().controls.Name.untouched?29:-1),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.Website.valid||i.form().controls.Website.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.Website.errors)!=null&&u.pattern)),l(3),p("hidden",!((x=i.form().controls.Website.errors)!=null&&x.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Website&&i.form().controls.Website.untouched?53:-1),l(9),p("rows",3)("cols",30)("autoResize",!0)("fluid",!0),l(10),p("hidden",i.form().controls.Description.valid||i.form().controls.Description.pristine&&!i.submitted()),l(2),p("hidden",!((C=i.form().controls.Description.errors)!=null&&C.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Description&&i.form().controls.Description.untouched?78:-1),l(10),p("fluid",!0),l(9),p("hidden",i.form().controls.Address.valid||i.form().controls.Address.pristine&&!i.submitted()),l(2),p("hidden",!((O=i.form().controls.Address.errors)!=null&&O.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Address&&i.form().controls.Address.untouched?103:-1),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.City.valid||i.form().controls.City.pristine&&!i.submitted()),l(2),p("hidden",!((w=i.form().controls.City.errors)!=null&&w.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().City&&i.form().controls.City.untouched?124:-1),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.LocationState.valid||i.form().controls.LocationState.pristine&&!i.submitted()),l(2),p("hidden",!((F=i.form().controls.LocationState.errors)!=null&&F.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().LocationState&&i.form().controls.LocationState.untouched?145:-1),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.ZipCode.valid||i.form().controls.ZipCode.pristine&&!i.submitted()),l(2),p("hidden",!((L=i.form().controls.ZipCode.errors)!=null&&L.pattern)),l(3),p("hidden",!((U=i.form().controls.ZipCode.errors)!=null&&U.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().ZipCode&&i.form().controls.ZipCode.untouched?169:-1),l(6),p("tabindex","8")("unmask",!0)("autoClear",!1),l(10),p("hidden",i.form().controls.FaxNumber.valid||i.form().controls.FaxNumber.pristine&&!i.submitted()),l(2),p("hidden",!((V=i.form().controls.FaxNumber.errors)!=null&&V.pattern)),l(3),p("hidden",!((z=i.form().controls.FaxNumber.errors)!=null&&z.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().FaxNumber&&i.form().controls.FaxNumber.untouched?194:-1),l(9),p("fluid",!0),l(9),p("hidden",i.form().controls.ContactName.valid||i.form().controls.ContactName.pristine&&!i.submitted()),l(2),p("hidden",!((ce=i.form().controls.ContactName.errors)!=null&&ce.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().ContactName&&i.form().controls.ContactName.untouched?218:-1),l(6),p("fluid",!0),l(9),p("hidden",i.form().controls.Email.valid||i.form().controls.Email.pristine&&!i.submitted()),l(2),p("hidden",!((Z=i.form().controls.Email.errors)!=null&&Z.maxlength)),l(3),p("hidden",!((fe=i.form().controls.Email.errors)!=null&&fe.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().Email&&i.form().controls.Email.untouched?242:-1),l(6),p("tabindex","11")("unmask",!0)("autoClear",!1),l(9),p("hidden",i.form().controls.PhoneNumber.valid||i.form().controls.PhoneNumber.pristine&&!i.submitted()),l(2),p("hidden",!((Me=i.form().controls.PhoneNumber.errors)!=null&&Me.pattern)),l(3),p("hidden",!((ke=i.form().controls.PhoneNumber.errors)!=null&&ke.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().PhoneNumber&&i.form().controls.PhoneNumber.untouched?266:-1),l(6),p("tabindex","12")("unmask",!0)("autoClear",!1),l(10),p("hidden",i.form().controls.CellNumber.valid||i.form().controls.CellNumber.pristine&&!i.submitted()),l(2),p("hidden",!((Xt=i.form().controls.CellNumber.errors)!=null&&Xt.pattern)),l(3),p("hidden",!((hi=i.form().controls.CellNumber.errors)!=null&&hi.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().CellNumber&&i.form().controls.CellNumber.untouched?291:-1)}},dependencies:[Ne,je,Ae,se,ge,Un,ye,Te,De,ri,$],styles:[".text-box[_ngcontent-%COMP%]{min-height:93px}"],changeDetection:0})}return r})();var yF=["attachments"];function AF(r,d){if(r&1){let t=b();e(0,` 10231 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 10232 `),n(3,"span",17),e(4),a(),e(5,` 10233 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 10234 `),a(),e(10,` 10235 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"VENDOR.DETAILS"))}}function RF(r,d){if(r&1){let t=b();e(0,` 10236 `),n(1,"button",16),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 10237 `),n(3,"span",17),e(4),a(),e(5,` 10238 `),n(6,"span",18),e(7),I(8,"translate"),a(),e(9,` 10239 `),a(),e(10,` 10240 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"VENDOR.ATTACHMENTS"))}}var _c=(()=>{class r{attachments;displaySpinner=D(!1);docs=D([]);stepIndex=D(0);submitted=D(!1);textareaFocused=D(!1);validationErrors=D(void 0);form;stepFormGroups=[];attachmentService=te(ui);authService=te(de);fb=te(be);responseService=te(Re);route=te(he);router=te(Be);toastService=te(Se);translate=te(le);vendorService=te(Lr);constructor(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Address:this.fb.control("",[T.maxLength(re)]),Description:this.fb.control("",T.maxLength(ft)),City:this.fb.control("",[T.maxLength(re)]),ContactName:this.fb.control("",[T.maxLength(re)]),LocationState:this.fb.control("",[T.maxLength(re)]),Email:this.fb.control("",[T.maxLength(re),T.pattern(Ui)]),ZipCode:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(5)]),PhoneNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),FaxNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),CellNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),Website:this.fb.control("",[T.pattern("^[^ ][^ ]*[.][^ ][^ ]*$"),T.maxLength(re)])}),Attachments:this.fb.group({Documents:this.fb.control([])})}),this.stepFormGroups=[this.form.get("Details"),this.form.get("Attachments")]}isDirty(){return this.form.dirty&&!this.submitted()}stepBack(){let t=this.stepIndex();if(t!==void 0)if(t===0){let o={relativeTo:this.route};this.router.navigate(["../"+P.list],o)}else this.stepIndex.set(t-1)}stepSubmit(t){let o=this.stepIndex();o!==void 0&&this.stepFormGroups[o].valid&&(t<1?this.stepIndex.set(o+1):this.submitForm(new so().parseForm(this.form.value)))}submitForm(t){if(!this.form.valid){this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])});return}this.submitted()||(this.submitted.set(!0),this.displaySpinner.set(!0),this.attachmentService.upload().pipe(N(),we(o=>o===void 0?wi(()=>new Error("Upload error.")):this.vendorService.handleAttachmentUpload(o,t,this.docs(),this.attachments.attachments)),we(()=>this.vendorService.createVendor(t,this.authService.tenant.Id))).subscribe({next:()=>{this.displaySpinner.set(!1),this.responseService.onSuccess("VENDOR.SUCCESS.CREATE","../"+P.list,this.route,{name:t.Name})},error:o=>{this.submitted.set(!1),this.displaySpinner.set(!1),this.validationErrors.set(this.responseService.onError(o,this.form)),this.stepIndex.set(We.getValidationErrorIndex(this.stepFormGroups,this.validationErrors()))}}),this.fileUpload())}fileUpload(){this.attachments&&this.attachments.attachments&&this.attachments.attachments.fileup.files.length>0?this.attachments.attachments.fileup.uploader():this.attachmentService.clearObservable()}updateTextAreaFocus(t){this.textareaFocused.set(t)}setDocs(t){t instanceof Event||this.docs.set(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-vendor-create"]],viewQuery:function(o,i){if(o&1&&X(yF,5),o&2){let s;Y(s=Q())&&(i.attachments=s.first)}},standalone:!1,decls:66,vars:24,consts:[["content",""],["attachments",""],[1,"col-12",3,"keydown.enter"],["id","qware.vendr.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.vendor.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.vendor.create.contact.details","translate","",1,"page-header"],[3,"textareaFocusChange","form","submitted","validationErrors"],["translate","","id","qware.vendor.create.attachments.label",1,"page-header"],[3,"docsCh
10240anged","form","submitted","validationErrors","docs"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.vendor.create-vendor.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.vendor.create-vendor.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){if(o&1){let s=b();n(0,"div",2),h("keydown.enter",function(){return E(s),S(i.textareaFocused()?void 0:i.stepSubmit(i.stepIndex()))}),e(1,` 10241 `),n(2,"qware-spinner",3),e(3,` 10242 `),n(4,"div",4),e(5,` 10243 `),n(6,"h3",5),e(7,` 10244 VENDOR.CREATE 10245 `),a(),e(8,` 10246 `),n(9,"p-stepper",6),h("valueChange",function(u){return E(s),S(i.stepIndex.set(u))}),e(10,` 10247 `),n(11,"p-step-list"),e(12,` 10248 `),n(13,"p-step",7),e(14,` 10249 `),_(15,AF,11,4,"ng-template",null,0,A),e(17,` 10250 `),a(),e(18,` 10251 `),n(19,"p-step",7),e(20,` 10252 `),_(21,RF,11,4,"ng-template",null,0,A),e(23,` 10253 `),a(),e(24,` 10254 `),a(),e(25,` 10255 `),n(26,"p-step-panels"),e(27,` 10256 `),n(28,"p-card"),e(29,` 10257 `),n(30,"div",8),e(31,` 10258 `),n(32,"h4",9),e(33,` 10259 VENDOR.DETAILS 10260 `),a(),e(34,` 10261 `),n(35,"qware-vendor-details",10),h("textareaFocusChange",function(u){return E(s),S(i.updateTextAreaFocus(u))}),e(36,` 10262 `),a(),e(37,` 10263 `),a(),e(38,` 10264 `),n(39,"div",8),e(40,` 10265 `),n(41,"h4",11),e(42,` 10266 VENDOR.ATTACHMENTS 10267 `),a(),e(43,` 10268 `),n(44,"qware-vendor-attachments",12,1),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(46,` 10269 `),a(),e(47,` 10270 `),a(),e(48,` 10271 `),n(49,"div",13),e(50,` 10272 `),n(51,"p-button",14),I(52,"translate"),h("onClick",function(){return E(s),S(i.stepBack())}),e(53,` 10273 `),a(),e(54,` 10274 `),n(55,"p-button",15),I(56,"translate"),h("onClick",function(){return E(s),S(i.stepSubmit(i.stepIndex()))})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(57,` 10275 `),a(),e(58,` 10276 `),a(),e(59,` 10277 `),a(),e(60,` 10278 `),a(),e(61,` 10279 `),a(),e(62,` 10280 `),a(),e(63,` 10281 `),a(),e(64,` 10282`),a(),e(65,` 10283`)}if(o&2){let s;l(2),p("displaySpinner",i.displaySpinner()),l(7),p("value",i.stepIndex()),l(4),p("value",0),l(6),ve("p-disabled",i.stepIndex()===0),p("value",1),l(11),p("hidden",i.stepIndex()!==0),l(5),p("form",i.form.controls.Details)("submitted",i.submitted())("validationErrors",i.validationErrors()),l(4),p("hidden",i.stepIndex()!==1),l(5),p("form",i.form.controls.Attachments)("submitted",i.submitted())("validationErrors",i.validationErrors())("docs",i.docs()),l(7),q("label",y(52,20,i.stepIndex()===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(56,22,i.stepIndex()===1?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",i.stepIndex()!==void 0&&!((s=i.stepFormGroups[i.stepIndex()])!=null&&s.val
10283id))}},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,is,ns,ie],encapsulation:2,changeDetection:0})}return r})();var as=He(nt());var wF=["actionsMenu"],DF=["attachments"],LF=["drawer"],NF=["shades"],OF=r=>({"lg:col-8":r}),FF=()=>["0"];function MF(r,d){if(r&1&&(e(0,` 10284 `),n(1,"a",27),e(2,` 10285 `),n(3,"span",28),e(4),a(),e(5,` 10286 `),n(6,"span",29),e(7),a(),e(8,` 10287 `),a(),e(9,` 10288 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function UF(r,d){r&1&&(e(0,` 10289 `),n(1,"span",31),e(2,"SHARED.ACTIONS"),a(),e(3,` 10290 `),n(4,"i",32),e(5,"expand_more"),a(),e(6,` 10291 `))}function PF(r,d){if(r&1){let t=b();e(0,` 10292 `),n(1,"p-button",30),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 10293 `),_(3,UF,7,0,"ng-template",null,5,A),e(5,` 10294 `),a(),e(6,` 10295 `)}r&2&&(l(),p("raised",!0))}function GF(r,d){if(r&1&&(e(0,` 10296 `),n(1,"a",27),e(2,` 10297 `),n(3,"span",28),e(4),a(),e(5,` 10298 `),n(6,"span",29),e(7),a(),e(8,` 10299 `),a(),e(9,` 10300 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function kF(r,d){if(r&1){let t=b();e(0,` 10301 `),n(1,"div",33),e(2,` 10302 `),n(3,"p-menu",34,6),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 10303 `),_(6,GF,10,2,"ng-template",null,1,A),e(8,` 10304 `),a(),e(9,` 10305 `),n(10,"p-button",35),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 10306 `),n(12,"i",32),e(13,"more_vert"),a(),e(14,` 10307 `),a(),e(15,` 10308 `),a(),e(16,` 10309 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function VF(r,d){r&1&&(e(0,` 10310 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 10311 `))}function qF(r,d){r&1&&(e(0,` 10312 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 10313 `))}function BF(r,d){if(r&1&&(e(0,` 10314 `),_(1,VF,4,0)(2,qF,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function HF(r,d){r&1&&(e(0,` 10315 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 10316 `))}function WF(r,d){r&1&&(e(0,` 10317 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 10318 `))}function jF(r,d){if(r&1&&(e(0,` 10319 `),_(1,HF,4,0)(2,WF,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function YF(r,d){if(r&1){let t=b();e(0,` 10320 `),n(1,"p-button",36),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 10321 `),a(),e(4,` 10322 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function QF(r,d){r&1&&(e(0,` 10323 `),n(1,"div",39),e(2,` 10324 `),n(3,"span",40),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 10325 `),a(),e(6,` 10326 `))}function KF(r,d){if(r&1){let t=b();e(0,` 10327 `),n(1,"qware-spinner",41),e(2,` 10328 `),n(3,"div",42),e(4,` 10329 `),n(5,"qware-entity-history",43),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 10330 `),a(),e(7,` 10331 `),a(),e(8,` 10332 `),a(),e(9,` 10333 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function $F(r,d){if(r&1){let t=b();e(0,` 10334 `),n(1,"div",37),e(2,` 10335 `),n(3,"p-drawer",38,7),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 10336 `),_(6,QF,7,0,"ng-template",null,8,A),e(8,` 10337 `),_(9,KF,10,7,"ng-template",null,5,A),e(11,` 10338 `),a(),e(12,` 10339 `),a(),e(13,` 10340 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var Ec=(()=>{class r{attachmentService;authService;confirmationService;fb;responseService;route;toastService;translate;vendorService;actionsMenu;attachments;drawer;shades;displayDrawerSpinner=D(!1);actionItems=[];displaySpinner=!0;docs=[];form;historyArrayProperties=[];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;moreItems=[];showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;userEnabledSidebar=!1;validationErrors;vendor;auditLoggingDisabled=!0;vendorListRoute="../../"+P.list;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};shadeFormGroups=[];translations={};constructor(t,o,i,s,c,u,x,C,O){this.attachmentService=t,this.authService=o,this.confirmationService=i,this.fb=s,this.responseService=c,this.route=u,this.toastService=x,this.translate=C,this.vendorService=O,this.auditLoggingDisabled=!this.authService.qwareSubscription?.auditLogging&&!this.authService.isSuperUser()}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){ue([this.translate.get(["SHARED.DISABLED","SHARED.DELETED","SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","AUDIT.VENDOR"]).pipe(N()),this.vendorService.getVendor(this.route.
10340snapshot.params.id,this.authService.tenant.Id)]).subscribe({next:t=>{this.translations=t[0],this.vendor=t[1],this.docs=this.vendor.Documents?as.default.sortBy(as.default.cloneDeep(this.vendor.Documents),u=>(u.Name??"").toLowerCase()):[],this.form.patchValue(new so().toForm(this.vendor)),this.form.markAsPristine(),this.form.markAsUntouched();let o=this.form.get("Details.PhoneNumber");o&&o.value&&o.value.length>0&&We.addPrimeNgFilledClass("qware.vendor.details.input.phone");let i=this.form.get("Details.FaxNumber");i&&i.value&&i.value.length>0&&We.addPrimeNgFilledClass("qware.vendor.details.input.fax");let s=this.form.get("Details.CellNumber");s&&s.value&&s.value.length>0&&We.addPrimeNgFilledClass("qware.vendor.details.input.cell"),this.vendor.State==="DELETED"&&this.form.disable(),this.setHistoryParams(),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}];let c=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableVendor()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableVendor()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteVendor()}];this.vendor?.State===M.DELETED&&this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)&&c.push({id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreVendor()}),this.actionItems=c.filter(u=>this.vendor?.State===M.DISABLED?u.id!=="disable.action":this.vendor?.State===M.DELETED?u.id!=="disable.action"&&u.id!=="enable.action"&&u.id!=="delete.action":u.id!=="enable.action"),this.displaySpinner=!1},error:t=>{this.responseService.onDataError(t,this.vendorListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),Address:this.fb.control("",[T.maxLength(re)]),Description:this.fb.control("",T.maxLength(ft)),City:this.fb.control("",[T.maxLength(re)]),ContactName:this.fb.control("",[T.maxLength(re)]),LocationState:this.fb.control("",[T.maxLength(re)]),Email:this.fb.control("",[T.maxLength(re),T.pattern(Ui)]),ZipCode:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(5)]),PhoneNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),FaxNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),CellNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),Website:this.fb.control("",[T.pattern("^[^ ][^ ]*[.][^ ][^ ]*$"),T.maxLength(re)])}),Attachments:this.fb.group({Documents:this.fb.control([])})}),this.shadeFormGroups=[this.form.get("Details"),this.form.get("Attachments")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.VENDOR"]+' "'+this.vendor?.Name+'"',this.historyIdMap=new Map;let t=new Map;t.set("Address","VENDOR.ADDRESS"),t.set("Attachments","VENDOR.ATTACHMENTS"),t.set("Cell","VENDOR.CELL"),t.set("City","VENDOR.CITY"),t.set("ContactName","VENDOR.CONTACT_NAME"),t.set("Create","VENDOR.CREATE"),t.set("Description","VENDOR.DESCRIPTION"),t.set("Email","VENDOR.EMAIL"),t.set("Fax","VENDOR.FAX"),t.set("List","VENDOR.LIST"),t.set("Name","VENDOR.NAME"),t.set("Phone","VENDOR.PHONE"),t.set("LocationState","VENDOR.LOCATIONSTATE"),t.set("Website","VENDOR.WEBSITE"),t.set("Zip","VENDOR.ZIP"),this.historyNameMap=t}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new so().parseForm(this.form.value);t.Id=this.vendor?.Id,t.TenantId=this.authService.tenant.Id,t.State=this.vendor?.State??M.ACTIVE,this.attachmentService.upload().pipe(N(),we(o=>o?this.vendorService.handleAttachmentUpload(o,t,this.docs,this.attachments.attachments):wi(()=>new Error("Upload error."))),we(()=>this.vendorService.updateVendor(t))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("VENDOR.SUCCESS.SAVE",this.vendorListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}}),this.fileUpload()}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}fileUpload(){this.attachments.attachments&&this.attachments.attachments.fileup.files.length>0?this.attachments.attachments.fileup.uploader():this.attachmentService.clearObservable()}disableVendor(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.vendor?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.vendor?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.vendor.State=M.DISABLED,this.vendorService.updateVendor(this.vendor).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("VENDOR.SUCCESS.DISABLE",this.vendorListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableVendor(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.vendor?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.vendor?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.vendor.State=M.ACTIVE,this.vendorService.updateVendor(this.vendor).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("VENDOR.SUCCESS.ENABLE",this.vendorListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteVendor(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.vendor?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.vendor?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.vendor.State=M.DELETED,this.vendorService.updateVendor(this.vendor).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("VENDOR.SUCCESS.DELETE",this.vendorListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreVendor(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.vendor?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.vendor?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.vendor.State=M.ACTIVE,this.vendorService.updateVendor(this.vendor).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("VENDOR.SUCCESS.RESTORE",this.vendorListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=as.default.clone(this.showSidebar)}setDocs(t){t instanceof Event||(this.docs=t)}static \u0275fac=function(o){return new(o||r)(g(ui),g(de),g(mt),g(be),g(Re),g(he),g(Se),g(le),g(Lr))};static \u0275cmp=B({type:r,selectors:[["qware-vendor-edit"]],viewQuery:function(o,i){if(o&1&&(X(wF,7),X(DF,7),X(LF,7),X(NF,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.attachments=s.first),Y(s=Q())&&(i.drawer=s.first),Y(s=Q())&&(i.shades=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:88,vars:36,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["attachments",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.vendor.edit",1,"grid"],["id","qware.vendor.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.vendor.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.vendor.edit.edit.actions-menu",3,"model","popup"],["id","qware.vendor.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.vendor.edit.details-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[3,"form","submitted","validationErrors","autoFocus"],["id","qware.vendor.edit.attachments-shade","value","1"],[3,"docsCh
10340anged","form","submitted","validationErrors","docs","disableAllControls"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.vendor.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.vendor.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],["id","qware.vendor.edit.more-menu",3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","999","type","button","id","qware.vendor.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.vendor.edit.content-drawer-container",1,"content-right-drawer-container","col-12","lg:col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.vendor.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.vendor.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","vendor",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",9),e(1,` 10341 `),n(2,"div",10),e(3,` 10342 `),n(4,"div",11),e(5,` 10343 `),n(6,"h3",12),e(7,` 10344 VENDOR.EDIT_VENDOR 10345 `),a(),e(8,` 10346 `),n(9,"div",13),e(10,` 10347 `),n(11,"p-menu",14,0),e(13,` 10348 `),_(14,MF,10,2,"ng-template",null,1,A),e(16,` 10349 `),a(),e(17,` 10350 `),_(18,PF,7,1),a(),e(19,` 10351 `),_(20,kF,17,4),a(),e(21,` 10352 `),n(22,"qware-spinner",15),e(23,` 10353 `),n(24,"p-card",16),e(25,` 10354 `),n(26,"qware-edit-lock",17),e(27,` 10355 `),n(28,"p-accordion",18,2),e(30,` 10356 `),n(31,"p-accordion-panel",19),e(32,` 10357 `),n(33,"p-accordion-header"),e(34),I(35,"translate"),_(36,BF,3,1,"ng-template",null,3,A),e(38,` 10358 `),a(),e(39,` 10359 `),n(40,"p-accordion-content"),e(41,` 10360 `),n(42,"div",20),e(43,` 10361 `),n(44,"div",21),e(45,` 10362 `),n(46,"qware-vendor-details",22),e(47,` 10363 `),a(),e(48,` 10364 `),a(),e(49,` 10365 `),a(),e(50,` 10366 `),a(),e(51,` 10367 `),a(),e(52,` 10368 `),n(53,"p-accordion-panel",23),e(54,` 10369 `),n(55,"p-accordion-header"),e(56),I(57,"translate"),_(58,jF,3,1,"ng-template",null,3,A),e(60,` 10370 `),a(),e(61,` 10371 `),n(62,"p-accordion-content"),e(63,` 10372 `),n(64,"div",20),e(65,` 10373 `),n(66,"qware-vendor-attachments",24,4),h("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(68,` 10374 `),a(),e(69,` 10375 `),a(),e(70,` 10376 `),a(),e(71,` 10377 `),a(),e(72,` 10378 `),a(),e(73,` 10379 `),a(),e(74,` 10380 `),n(75,"div",25),e(76,` 10381 `),n(77,"p-button",26),I(78,"translate"),e(79,` 10382 `),a(),e(80,` 10383 `),_(81,YF,5,5),a(),e(82,` 10384 `),a(),e(83,` 10385 `),a(),e(84,` 10386 `),a(),e(85,` 10387 `),_(86,$F,14,6),a(),e(87,` 10388`)}o&2&&(l(2),p("ngClass",pe(33,OF,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f(i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.vendor!==void 0&&i.vendor.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(35,FF)),l(6),K(` 10389 `,y(35,27,"VENDOR.DETAILS"),` 10390 `),l(12),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("autoFocus",!1),l(10),K(` 10391 `,y(57,29,"VENDOR.ATTACHMENTS"),` 10392 `),l(10),p("form",i.form.controls.Attachments)("submitted",i.submitted)("validationErrors",i.validationErrors)("docs",i.docs)("disableAllControls",(i.vendor==null?null:i.vendor.State)==="DELETED"),l(11),q("label",y(78,31,"SHARED.CANCEL")),p("routerLink",i.vendorListRoute)("text",!0),l(4),f((i.vendor==null?null:i.vendor.State)!=="DELETED"?81:-1),l(5),f(i.auditLoggingDisabled?-1:86))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,et,$,is,ns,ie],encapsulation:2})}return r})();var zF=["dt"],XF=r=>({"disabled-row":r}),Sc=(r,d)=>d.field;function ZF(r,d){if(r&1){let t=b();e(0,` 10393 `),n(1,"div",17),e(2,` 10394 `),n(3,"span"),e(4),I(5,"translate"),a(),e(6,` 10395 `),n(7,"p-toggleswitch",18),h("onChange",function(){E(t);let i=m();return S(i.toggleShowDeleted())})("ngModelChange",function(i){E(t);let s=m();return S(s.showDeleted.set(i))}),a(),e(8,` 10396 `),a(),e(9,` 10397 `)}if(r&2){let t=m();l(4),v(y(5,2,"SHARED.SHOW_DELETED_FILTER")),l(3),p("ngModel",t.showDeleted())}}function JF(r,d){if(r&1&&(e(0,` 10398 `),R(1,"p-sortIcon",21),e(2,` 10399 `)),r&2){let t=m().$implicit;l(),p("field",t.field)}}function eM(r,d){if(r&1&&(e(0,` 10400 `),n(1,"th",19),e(2,` 10401 `),n(3,"span",20),e(4),a(),e(5,` 10402 `),_(6,JF,3,1),a(),e(7,` 10403 `)),r&2){let t=d.$implicit;l(),p("pSortableColumn",t.field),l(3),v(t.header),l(2),f(t.pSortableColumnDisabled?-1:6)}}function tM(r,d){if(r&1&&(e(0,` 10404 `),n(1,"tr"),e(2,` 10405 `),G(3,eM,8,3,null,null,Sc),a(),e(5,` 10406 `)),r&2){let t=d.$implicit;l(3),k(t)}}function iM(r,d){r&1&&(e(0,` 10407 `),n(1,"span",26),e(2,"SHARED.DISABLED"),a(),e(3,` 10408 `))}function nM(r,d){r&1&&(e(0,` 10409 `),n(1,"span",26),e(2,"SHARED.DELETED"),a(),e(3,` 10410 `))}function aM(r,d){if(r&1&&(e(0,` 10411 `),n(1,"span"),e(2,` 10412 `),n(3,"a",25),e(4),a(),e(5,` 10413 `),_(6,iM,4,0)(7,nM,4,0),a(),e(8,` 10414 `)),r&2){let t=m().$implicit,o=m().$implicit,i=m();l(3),gt("routerLink","",i.vendorEditRoute,"/",o.Id,""),l(),v(o[t.field]),l(2),f(o.State==="DISABLED"?6:-1),l(),f(o.State==="DELETED"?7:-1)}}function rM(r,d){if(r&1&&(e(0,` 10415 `),n(1,"a",27),I(2,"linkFormat"),e(3),a(),e(4,` 10416 `)),r&2){let t=m().$implicit,o=m().$implicit;l(),p("href",y(2,2,o[t.field]),jt),l(2),v(o[t.field])}}function oM(r,d){if(r&1&&(e(0,` 10417 `),n(1,"a",28),e(2),a(),e(3,` 10418 `)),r&2){let t=m().$implicit,o=m().$implicit;l(),p("href","mailto:"+o[t.field],jt),l(),v(o[t.field])}}function lM(r,d){if(r&1&&(e(0,` 10419 `),n(1,"span"),e(2),a(),e(3,` 10420 `)),r&2){let t=m().$implicit,o=m().$implicit;l(2),v(o[t.field])}}function sM(r,d){if(r&1&&(e(0,` 10421 `),n(1,"td"),e(2,` 10422 `),n(3,"span",23),e(4),a(),e(5,` 10423 `),n(6,"div",24),e(7,` 10424 `),n(8,"span"),e(9,` 10425 `),_(10,aM,9,6)(11,rM,5,4)(12,oM,4,2)(13,lM,4,1),e(14,` 10426 `),a(),e(15,` 10427 `),a(),e(16,` 10428 `),a(),e(17,` 10429 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(6),f((t=o.field)==="Name"?10:t==="Website"?11:t==="Email"?12:13)}}function dM(r,d){if(r&1&&(e(0,` 10430 `),n(1,"tr",22),e(2,` 10431 `),G(3,sM,18,2,null,null,Sc),a(),e(5,` 10432 `)),r&2){let t=d.$implicit,o=d.columns;l(),p("ngClass",pe(2,XF,t.State==="DISABLED"||t.State==="DELETED"))("pSelectableRow",t),l(2),k(o)}}function pM(r,d){r&1&&(e(0,` 10433 `),n(1,"div",29),e(2,"SHARED.NO_SEARCH_RESULTS_FOUND"),a(),e(3,` 10434 `))}function mM(r,d){r&1&&(e(0,` 10435 `),n(1,"div",29),e(2,"SHARED.RECORDS_NOT_FOUND"),a(),e(3,` 10436 `))}function cM(r,d){if(r&1&&(e(0,` 10437 `),n(1,"tr"),e(2,` 10438 `),n(3,"td"),e(4,` 10439 `),_(5,pM,4,0)(6,mM,4,0),a(),e(7,` 10440 `),a(),e(8,` 10441 `)),r&2){let t=d.$implicit,o=m();l(3),Ve("colspan",t.length+1),l(2),f(o.generalFilter()?5:6)}}var xc=(()=>{class r{dt;displayedEntities=D([]);displaySpinner=D(!0);generalFilter=D("");isActive=D(!1);searchEnabled=D(!1);searchResults=D(!1);selectedEntities=D([]);showDeleted=D(!1);tableColumns=[{field:"Name",header:"VENDOR.NAME"},{field:"Description",header:"VENDOR.DESCRIPTION"},{field:"Website",header:"VENDOR.WEBSITE"},{field:"Email",header:"VENDOR.EMAIL"}];allEntities=[];filterStorageKey=Oe.VENDOR_FILTER_STORAGE_KEY;canViewDeleted=D(!1);vendorCreateRoute="../../"+P.vendor+"/"+P.create;vendorEditRoute="../../"+P.vendor+"/"+P.edit;authService=te(de);vendorService=te(Lr);constructor(){this.canViewDeleted.set(this.authService.userHasPrivilege(ae.CAN_VIEW_DELETED)),this.vendorService.getVendors(this.authService.tenant.Id).subscribe(t=>{let o=t;this.allEntities=o,this.displayedEntities.set(this.filterEntities());let i=localStorage.getItem(this.filterStorageKey);i&&(this.generalFilter.set(i),this.generalFilterOnChange()),this.displayedEntities().length===0?this.searchResults.set(!1):this.detectFilter(),this.displaySpinner.set(!1)})}generalFilterOnChange(){localStorage.setItem(this.filterStorageKey,this.generalFilter()),this.generalFilter().length>0&&this.searchEnabled.set(!0),this.dt.filterGlobal(this.generalFilter(),"contains")}detectFilter(){setTimeout(()=>{this.dt.filteredValue?this.searchResults.set(!this.dt.filteredValue&&this.dt.value.length>0||this.dt.filteredValue&&this.dt.filteredValue.length>0):this.searchResults.set(!0)},0)}filterEntities(t){if(!t){if(!this.allEntities||!this.allEntities.length)return[];t=this.allEntities}return t.filter(o=>o.State!==M.DELETED||this.showDeleted())}toggleShowDeleted(){this.displayedEntities.set(this.filterEntities())}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-vendor-list"]],viewQuery:function(o,i){if(o&1&&X(zF,7),o&2){let s;Y(s=Q())&&(i.dt=s.first)}},standalone:!1,decls:52,vars:19,consts:[["dt",""],[1,"grid"],[1,"align-items-center","flex-inline","col-12"],["id","qware.vendor.list.page-header","translate","",1,"page-header"],[1,"actions","flex-inline","col-12"],[1,"search"],["iconPosition","left"],[1,"material-icons"],["type","text","pInputText","","size","30","id","qware.vendor.list.search","variant","outlined",1,"search-input",3,"ngModelChange","keyup","placeholder","ngModel","qwareFocus"],[1,"col-12","data-grid"],["id","qware.vendor.list.spinner",3,"displaySpinner"],["id","qware.vendor.list.table","sortField","Name","dataKey","Id","responsiveLayout","stack",3,"selectionChange","onFilter","columns","value","selection","sortOrder","paginator","pageLinks","rows","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"bottom-right-button"],["severity","primary","styleClass","fab-button",3,"raised","routerLink"],[1,"show-deleted-switch"],["id","qware.vendor-list.show-deleted-switch",3,"onChange","ngModelChange","ngModel"],[3,"pSortableColumn"],["translate",""],[3,"field"],[3,"ngClass","pSelectableRow"],["translate","",1,"p-datatable-column-title"],["qwareTruncate",""],["id","qware.vendor.list.table.vendor-name",3,"routerLink"],["translate","",1,"badge"],["target","_blank",3,"href"],[3,"href"],["translate","",1,"no-results"]],template:function(o,i){if(o&1){let s=b();n(0,"div",1),e(1,` 10442 `),n(2,"div",2),e(3,` 10443 `),n(4,"h3",3),e(5,` 10444 VENDOR.LIST 10445 `),a(),e(6,` 10446 `),_(7,ZF,10,4),a(),e(8,` 10447 `),n(9,"div",4),e(10,` 10448 `),n(11,"div",5),e(12,` 10449 `),n(13,"p-iconfield",6),e(14,` 10450 `),n(15,"p-inputicon"),e(16,` 10451 `),n(17,"span",7),e(18,"search"),a(),e(19,` 10452 `),a(),e(20,` 10453 `),n(21,"input",8),I(22,"translate"),h("ngModelChange",function(u){return E(s),S(i.generalFilter.set(u))})("keyup",function(){return E(s),S(i.generalFilterOnChange())}),a(),e(23,` 10454 `),a(),e(24,` 10455 `),a(),e(25,` 10456 `),a(),e(26,` 10457 `),n(27,"div",9),e(28,` 10458 `),n(29,"qware-spinner",10),e(30,` 10459 `),n(31,"p-table",11,0),h("selectionChange",function(u){return E(s),S(i.selectedEntities.set(u))})("onFilter",function(){return E(s),S(i.detectFilter())}),e(33,` 10460 `),_(34,tM,6,0,"ng-template",12),e(35,` 10461 `),_(36,dM,6,4,"ng-template",13),e(37,` 10462 `),_(38,cM,9,2,"ng-template",14),e(39,` 10463 `),a(),e(40,` 10464 `),a(),e(41,` 10465 `),a(),e(42,` 10466 `),n(43,"div",15),e(44,` 10467 `),n(45,"p-button",16),e(46,` 10468 `),n(47,"i",7),e(48,"add"),a(),e(49,` 10469 `),a(),e(50,` 10470 `),a(),e(51,` 10471`),a()}o&2&&(l(7),f(i.canViewDeleted()?7:-1),l(2),ve("search-active",i.searchEnabled()),l(12),q("placeholder",y(22,17,"SHARED.SEARCH")),p("ngModel",i.generalFilter())("qwareFocus",i.generalFilter()!==""),l(8),p("displaySpinner",i.displaySpinner()),l(2),p("columns",i.tableColumns)("value",i.displayedEntities())("selection",i.selectedEntities())("sortOrder",1)("paginator",!0)("pageLinks",5)("rows",10)("scrollable",!0),l(14),q("routerLink",i.vendorCreateRoute),p("raised",!0))},dependencies:[Pe,oe,Qe,je,Ae,se,Le,pi,mi,ye,me,kt,et,ht,ji,Yi,cn,Ai,$,t0,ie],styles:[".actions[_ngcontent-%COMP%]{margin-bottom:0!important}.actions[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{display:flex!important;position:relative!important;margin:0!important;width:100%}"],changeDetection:0})}return r})();var fc=He(Hn()),Pi=He(nt());var uM=["bodyDropdown"],_M=["defaultPickerView"],EM=["priorityInput"],SM=["shades"],xM=["subjectDropdown"],fM=()=>["0"],nd=r=>({value:r}),rs=()=>({standalone:!0}),hM=r=>({opacity:r,display:"inline-flex"}),CM=(r,d)=>d.Name;function vM(r,d){r&1&&(e(0,` 10472 `),n(1,"i",68),e(2,"expand_less"),a(),e(3,` 10473 `))}function gM(r,d){r&1&&(e(0,` 10474 `),n(1,"i",68),e(2,"expand_more"),a(),e(3,` 10475 `))}function TM(r,d){if(r&1&&(e(0,` 10476 `),_(1,vM,4,0)(2,gM,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function IM(r,d){if(r&1){let t=b();e(0,` 10477 `),n(1,"div",23),e(2,` 10478 `),n(3,"label",24),e(4,"APP_SETTINGS.WORK_ORDER.ENABLE_GUEST_WORK_REQUEST_FORM"),a(),e(5,` 10479 `),n(6,"p-checkbox",69),h("onChange",function(){E(t);let i=m();return S(i.guestFormOptionChanged())}),e(7,` 10480 `),a(),e(8,` 10481 `),a(),e(9,` 10482 `)}r&2&&(l(6),p("qwareFocus",!0)("tabindex",1)("binary",!0))}function bM(r,d){if(r&1&&(e(0,` 10483 `),n(1,"small",70),e(2,` 10484 `),n(3,"div",24),e(4),a(),e(5,` 10485 `),a(),e(6,` 10486 `)),r&2){let t=d.$implicit;l(4),v(t)}}function yM(r,d){if(r&1&&(e(0,` 10487 `),G(1,bM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.WorkOrderGuestForm)}}function AM(r,d){if(r&1&&(e(0,` 10488 `),n(1,"small",70),e(2,` 10489 `),n(3,"div",24),e(4),a(),e(5,` 10490 `),a(),e(6,` 10491 `)),r&2){let t=d.$implicit;l(4),v(t)}}function RM(r,d){if(r&1&&(e(0,` 10492 `),G(1,AM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Priority)}}function wM(r,d){if(r&1&&(e(0,` 10493 `),n(1,"small",70),e(2,` 10494 `),n(3,"div",24),e(4),a(),e(5,` 10495 `),a(),e(6,` 10496 `)),r&2){let t=d.$implicit;l(4),v(t)}}function DM(r,d){if(r&1&&(e(0,` 10497 `),G(1,wM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.DueDate)}}function LM(r,d){if(r&1&&(e(0,` 10498 `),n(1,"small",70),e(2,` 10499 `),n(3,"div",24),e(4),a(),e(5,` 10500 `),a(),e(6,` 10501 `)),r&2){let t=d.$implicit;l(4),v(t)}}function NM(r,d){if(r&1&&(e(0,` 10502 `),G(1,LM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.HideCommentFromRequester)}}function OM(r,d){if(r&1&&(e(0,` 10503 `),n(1,"small",70),e(2,` 10504 `),n(3,"div",24),e(4),a(),e(5,` 10505 `),a(),e(6,` 10506 `)),r&2){let t=d.$implicit;l(4),v(t)}}function FM(r,d){if(r&1&&(e(0,` 10507 `),G(1,OM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.EmailAssignee)}}function MM(r,d){r&1&&(e(0,` 10508
10508 `),n(1,"span",33),e(2," *"),a(),e(3,` 10509 `))}function UM(r,d){r&1&&(e(0,` 10510 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10511 `))}function PM(r,d){r&1&&(e(0,` 10512 `),n(1,"span",68),e(2,"search"),a(),e(3,` 10513 `))}function GM(r,d){if(r&1){let t=b();e(0,` 10514 `),n(1,"span",75),e(2,` 10515 `),n(3,"p-select",76,8),I(5,"translate"),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m(2);return S(i.selectChanged("subject"))}),e(6,` 10516 `),_(7,UM,4,0,"ng-template",31),e(8,` 10517 `),_(9,PM,4,0,"ng-template",77),e(10,` 10518 `),a(),e(11,` 10519 `),a(),e(12,` 10520 `)}if(r&2){let t=m(2);l(3),q("placeholder",y(5,6,"MERGE_FIELDS.SELECT")),p("options",t.workOrderSubjectFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(8,rs))("fluid",!0)("filter",!0)}}function kM(r,d){if(r&1&&(e(0,` 10521 `),n(1,"small",70),e(2,` 10522 `),n(3,"div",24),e(4),a(),e(5,` 10523 `),a(),e(6,` 10524 `)),r&2){let t=d.$implicit;l(4),v(t)}}function VM(r,d){if(r&1&&(e(0,` 10525 `),G(1,kM,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Subject)}}function qM(r,d){if(r&1){let t=b();e(0,` 10526 `),n(1,"div",29),e(2,` 10527 `),n(3,"label",71),e(4,` 10528 `),n(5,"span",24),e(6,"APP_SETTINGS.WORK_ORDER.SUBJECT"),a(),e(7,` 10529 `),_(8,MM,4,0),a(),e(9,` 10530 `),n(10,"p-editor",72,7),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(12,` 10531 `),_(13,GM,13,9,"ng-template",null,3,A),e(15,` 10532 `),a(),e(16,` 10533 `),n(17,"small",36),e(18,` 10534 `),n(19,"div",73),e(20,` 10535 APP_SETTINGS.WORK_ORDER.ERROR.SUBJECT_LENGTH 10536 `),a(),e(21,` 10537 `),n(22,"div",74),e(23,` 10538 APP_SETTINGS.WORK_ORDER.ERROR.SUBJECT_REQUIRED 10539 `),a(),e(24,` 10540 `),a(),e(25,` 10541 `),_(26,VM,3,0),a(),e(27,` 10542 `)}if(r&2){let t=m();l(8),f(t.emailRequired?8:-1),l(9),p("hidden",t.form.controls.Subject.valid||t.form.controls.Subject.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Subject.errors!=null&&t.form.controls.Subject.errors.maxlength))("translateParams",pe(6,nd,t.form.controls.Subject.value)),l(3),p("hidden",!(t.form.controls.Subject.errors!=null&&t.form.controls.Subject.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.Subject&&t.form.controls.Subject.untouched?26:-1)}}function BM(r,d){r&1&&(e(0,` 10543 `),n(1,"span",33),e(2," *"),a(),e(3,` 10544 `))}function HM(r,d){r&1&&(e(0,` 10545 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10546 `))}function WM(r,d){r&1&&(e(0,` 10547 `),n(1,"span",68),e(2,"search"),a(),e(3,` 10548 `))}function jM(r,d){if(r&1){let t=b();e(0,` 10549 `),n(1,"span",82),e(2,` 10550 `),e(3,` 10551 `),R(4,"select",83),e(5,` 10552 `),R(6,"select",84),e(7,` 10553 `),a(),e(8,` 10554 `),n(9,"span",82),e(10,` 10555 `),e(11,` 10556 `),R(12,"button",85),e(13,` 10557 `),R(14,"button",86),e(15,` 10558 `),R(16,"button",87),e(17,` 10559 `),a(),e(18,` 10560 `),n(19,"span",82),e(20,` 10561 `),e(21,` 10562 `),R(22,"button",88),e(23,` 10563 `),R(24,"button",89),e(25,` 10564 `),R(26,"button",90),e(27,` 10565 `),R(28,"button",91),e(29,` 10566 `),a(),e(30,` 10567 `),n(31,"span",82),e(32,` 10568 `),e(33,` 10569 `),R(34,"button",92),e(35,` 10570 `),a(),e(36,` 10571 `),e(37,` 10572 `),n(38,"span",82),e(39,` 10573 `),R(40,"button",93),e(41,` 10574 `),a(),e(42,` 10575 `),n(43,"span",75),e(44,` 10576 `),n(45,"p-select",94,10),I(47,"translate"),j("ngModelChange",function(i){E(t);let s=m(2);return W(s.selectedMergeField,i)||(s.selectedMergeField=i),S(i)}),h("onChange",function(){E(t);let i=m(2);return S(i.selectChanged("body"))}),e(48,` 10577 `),_(49,HM,4,0,"ng-template",31),e(50,` 10578 `),_(51,WM,4,0,"ng-template",77),e(52,` 10579 `),a(),e(53,` 10580 `),a(),e(54,` 10581 `)}if(r&2){let t=m(2);l(45),q("placeholder",y(47,6,"MERGE_FIELDS.SELECT")),p("options",t.workOrderBodyFields),H("ngModel",t.selectedMergeField),p("ngModelOptions",ne(8,rs))("fluid",!0)("filter",!0)}}function YM(r,d){if(r&1&&(e(0,` 10582 `),n(1,"small",70),e(2,` 10583 `),n(3,"div",24),e(4),a(),e(5,` 10584 `),a(),e(6,` 10585 `)),r&2){let t=d.$implicit;l(4),v(t)}}function QM(r,d){if(r&1&&(e(0,` 10586 `),G(1,YM,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.Body)}}function KM(r,d){if(r&1){let t=b();e(0,` 10587 `),n(1,"div",29),e(2,` 10588 `),n(3,"label",78),e(4,` 10589 `),n(5,"span",24),e(6,"APP_SETTINGS.WORK_ORDER.BODY"),a(),e(7,` 10590 `),_(8,BM,4,0),a(),e(9,` 10591 `),n(10,"p-editor",79,9),h("onTextChange",function(){E(t);let i=m();return S(i.textareaFocused=!0)}),e(12,` 10592 `),_(13,jM,55,9,"ng-template",null,3,A),e(15,` 10593 `),a(),e(16,` 10594 `),n(17,"small",36),e(18,` 10595 `),n(19,"div",80),e(20,` 10596 APP_SETTINGS.WORK_ORDER.ERROR.BODY_LENGTH 10597 `),a(),e(21,` 10598 `),n(22,"div",81),e(23,` 10599 APP_SETTINGS.WORK_ORDER.ERROR.BODY_REQUIRED 10600 `),a(),e(24,` 10601 `),a(),e(25,` 10602 `),_(26,QM,3,0),a(),e(27,` 10603 `)}if(r&2){let t=m();l(8),f(t.emailRequired?8:-1),l(9),p("hidden",t.form.controls.Body.valid||t.form.controls.Body.pristine&&!t.submitted),l(2),p("hidden",!(t.form.controls.Body.errors!=null&&t.form.controls.Body.errors.maxlength))("translateParams",pe(6,nd,t.form.controls.Body.value)),l(3),p("hidden",!(t.form.controls.Body.errors!=null&&t.form.controls.Body.errors.required)),l(4),f(t.validationErrors&&t.validationErrors.Body&&t.form.controls.Body.untouched?26:-1)}}function $M(r,d){r&1&&(e(0,` 10604 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10605 `))}function zM(r,d){if(r&1&&(e(0,` 10606 `),n(1,"small",70),e(2,` 10607 `),n(3,"div",24),e(4),a(),e(5,` 10608 `),a(),e(6,` 10609 `)),r&2){let t=d.$implicit;l(4),v(t)}}function XM(r,d){if(r&1&&(e(0,` 10610 `),G(1,zM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.DefaultPicker)}}function ZM(r,d){r&1&&(e(0,` 10611 `),n(1,"span",82),e(2,` 10612 `),e(3,`
10613 `),n(4,"select",95),e(5,` 10614 `),R(6,"option",96),e(7,` 10615 `),e(8,` 10616 `),R(9,"option",97),e(10,` 10617 `),R(11,"option",98),e(12,` 10618 `),R(13,"option",99),e(14,` 10619 `),a(),e(15,` 10620 `),a(),e(16,` 10621 `),n(17,"span",82),e(18,` 10622 `),e(19,` 10623 `),R(20,"select",83),e(21,` 10624 `),R(22,"select",84),e(23,` 10625 `),a(),e(24,` 10626 `),n(25,"span",82),e(26,` 10627 `),e(27,` 10628 `),R(28,"button",85),e(29,` 10629 `),R(30,"button",86),e(31,` 10630 `),R(32,"button",87),e(33,` 10631 `),R(34,"button",100),e(35,` 10632 `),R(36,"button",101),e(37,` 10633 `),a(),e(38,` 10634 `),n(39,"span",82),e(40,` 10635 `),e(41,` 10636 `),R(42,"button",88),e(43,` 10637 `),R(44,"button",89),e(45,` 10638 `),R(46,"button",90),e(47,` 10639 `),R(48,"button",91),e(49,` 10640 `),a(),e(50,` 10641 `),n(51,"span",82),e(52,` 10642 `),e(53,` 10643 `),R(54,"button",92),e(55,` 10644 `),a(),e(56,` 10645 `),e(57,` 10646 `),n(58,"span",82),e(59,` 10647 `),R(60,"button",93),e(61,` 10648 `),a(),e(62,` 10649 `))}function JM(r,d){if(r&1&&(e(0,` 10650 `),n(1,"small",70),e(2,` 10651 `),n(3,"div",24),e(4),a(),e(5,` 10652 `),a(),e(6,` 10653 `)),r&2){let t=d.$implicit;l(4),v(t)}}function eU(r,d){if(r&1&&(e(0,` 10654 `),G(1,JM,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.AlertMessage)}}function tU(r,d){r&1&&(e(0,` 10655 `),n(1,"i",68),e(2,"expand_less"),a(),e(3,` 10656 `))}function iU(r,d){r&1&&(e(0,` 10657 `),n(1,"i",68),e(2,"expand_more"),a(),e(3,` 10658 `))}function nU(r,d){if(r&1&&(e(0,` 10659 `),_(1,tU,4,0)(2,iU,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function aU(r,d){r&1&&(e(0,` 10660 `),n(1,"i",68),e(2,"check"),a(),e(3,` 10661 `))}function rU(r,d){if(r&1&&(e(0,` 10662 `),n(1,"small",70),e(2,` 10663 `),n(3,"div",24),e(4),a(),e(5,` 10664 `),a(),e(6,` 10665 `)),r&2){let t=d.$implicit;l(4),v(t)}}function oU(r,d){if(r&1&&(e(0,` 10666 `),G(1,rU,7,1,null,null,J)),r&2){let t=m(2);l(),k(t.validationErrors.WorkOrderGuestUserId)}}function lU(r,d){if(r&1){let t=b();e(0,` 10667 `),n(1,"p-accordion-panel",102),e(2,` 10668 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,nU,3,1,"ng-template",null,1,A),e(8,` 10669 `),a(),e(9,` 10670 `),n(10,"p-accordion-content"),e(11,` 10671 `),n(12,"div",20),e(13,` 10672 `),n(14,"div",21),e(15,` 10673 `),n(16,"div",22),e(17,` 10674 `),n(18,"div",103),e(19,` 10675 `),n(20,"p",24),e(21,"APP_SETTINGS.WORK_ORDER.GUEST_FORM_NOTE"),a(),e(22,` 10676 `),n(23,"a",104),e(24),a(),e(25,` 10677 `),n(26,"a",105),h("click",function(){E(t);let i=m();return S(i.showMessage())}),e(27,` 10678 `),n(28,"i",68),e(29,"content_copy"),a(),e(30,` 10679 `),a(),e(31,` 10680 `),n(32,"p-message",106),e(33,` 10681 `),_(34,aU,4,0,"ng-template",null,11,A),e(36,` 10682 `),n(37,"span"),e(38),a(),e(39,` 10683 `),a(),e(40,` 10684 `),a(),e(41,` 10685 `),a(),e(42,` 10686 `),n(43,"div",22),e(44,` 10687 `),n(45,"div",29),e(46,` 10688 `),n(47,"qware-autocomplete",107),e(48,` 10689 `),a(),e(49,` 10690 `),n(50,"small",24),e(51,"APP_SETTINGS.WORK_ORDER.GUEST_USER_NOTE"),a(),e(52,` 10691 `),n(53,"small",36),e(54,` 10692 `),n(55,"div",108),e(56,` 10693 APP_SETTINGS.WORK_ORDER.ERROR.GUEST_USER_REQUIRED 10694 `),a(),e(57,` 10695 `),a(),e(58,` 10696 `),_(59,oU,3,0),a(),e(60,` 10697 `),a(),e(61,` 10698 `),a(),e(62,` 10699 `),a(),e(63,` 10700 `),a(),e(64,` 10701 `),a(),e(65,` 10702 `)}if(r&2){let t,o=m();l(),p("hidden",!o.form.controls.WorkOrderGuestForm.value),l(3),K(` 10703 `,y(5,16,"APP_SETTINGS.WORK_ORDER.GUEST_FORM"),` 10704 `),l(19),p("routerLink",o.guestFormRoute),l(),v(o.guestFormLink),l(2),p("qwareCopyToClipboard",o.guestFormLink),l(6),p("ngStyle",pe(18,hM,o.showCopyLinkMessage?1:0)),l(6),v(o.linkCopiedText),l(9),p("tabindex",9)("options",o.allUserItems)("singleSelect",!0)("isRequired",(t=o.form.controls.WorkOrderGuestForm.value)!==null&&t!==void 0?t:!1)("virtualScroll",!0)("virtualScrollItemSize",38),l(6),p("hidden",o.form.controls.WorkOrderGuestUserId.valid||o.form.controls.WorkOrderGuestUserId.pristine&&!o.submitted),l(2),p("hidden",!(o.form.controls.WorkOrderGuestUserId.errors!=null&&o.form.controls.WorkOrderGuestUserId.errors.required)),l(4),f(o.validationErrors&&o.validationErrors.WorkOrderGuestUserId&&o.form.controls.WorkOrderGuestUserId.untouched?59:-1)}}function sU(r,d){r&1&&(e(0,` 10705 `),n(1,"i",68),e(2,"expand_less"),a(),e(3,` 10706 `))}function dU(r,d){r&1&&(e(0,` 10707 `),n(1,"i",68),e(2,"expand_more"),a(),e(3,` 10708 `))}function pU(r,d){if(r&1&&(e(0,` 10709 `),_(1,sU,4,0)(2,dU,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function mU(r,d){if(r&1){let t=b();e(0,` 10710 `),n(1,"p-floatlabel"),e(2,` 10711 `),n(3,"input",116),h("change",function(){E(t);let i=m(2);return S(i.markFormDirty())})("ngModelChange",function(i){E(t);let s=m().$implicit,c=m();return S(c.setPriorityOption(s,i))}),a(),e(4,` 10712 `),n(5,"label",117),e(6,` 10713 APP_SETTINGS.WORK_ORDER.PRIORITY_NAME 10714 `),a(),e(7,` 10715 `),a(),e(8,` 10716 `)}if(r&2){let t=m().$implicit;l(3),p("qwareFocus",!0)("fluid",!0)("ngModel",t.Name)("ngModelOptions",ne(4,rs))}}function cU(r,d){if(r&1&&(e(0,` 10717 `),n(1,"span"),e(2),a(),e(3,` 10718 `)),r&2){let t=m().$implicit;l(2),v(t.Name)}}function uU(r,d){if(r&1){let t=b();e(0,` 10719 `),n(1,"p-button",115),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.editPriorityOption(i))}),e(2,` 10720 `),n(3,"i",68),e(4,"close"),a(),e(5,` 10721 `),a(),e(6,` 10722 `)}r&2&&(l(),p("text",!0)("rounded",!0))}function _U(r,d){if(r&1){let t=b();e(0,` 10723 `),n(1,"p-button",115),h("onClick",function(){E(t);let i=m().$index,s=m();return S(s.editPriorityOption(i))}),e(2,` 10724 `),n(3,"i",68),e(4,"edit"),a(),e(5,` 10725 `),a(),e(6,` 10726 `)}r&2&&(l(),p("text",!0)("rounded",!0))}function EU(r,d){if(r&1){let t=b();e(0,` 10727 `),n(1,"div"),e(2,` 10728 `),n(3,"div",109),e(4,` 10729 `),n(5,"div",110),e(6,` 10730 `),n(7,"i",111),e(8,"drag_handle"),a(),e(9,` 10731 `),a(),e(10,` 10732 `),n(11,"div",112),e(12,` 10733 `),n(13,"div",113),e(14,` 10734 `),_(15,mU,9,5)(16,cU,4,1),a(),e(17,` 10735 `),n(18,"div",114),e(19,` 10736 `),n(20,"p-button",115),h("onClick",function(){let i=E(t).$implicit,s=m();return S(s.deletePriorityOption(i.Name))}),e(21,` 10737 `),n(22,"i",68),e(23,"delete"),a(),e(24,` 10738 `),a(),e(25,` 10739 `),_(26,uU,7,2)(27,_U,7,2),a(),e(28,` 10740 `),a(),e(29,` 10741 `),a(),e(30,` 10742 `),a(),e(31,` 10743 `)}if(r&2){let t=d.$index,o=m();l(15),f(o.isEditing==="isEditing"+t?15:16),l(5),p("text",!0)("rounded",!0),l(6),f(o.isEditing==="isEditing"+t?26:27)}}function SU(r,d){if(r&1&&(e(0,` 10744 `),n(1,"small",70),e(2,` 10745 `),n(3,"div",24),e(4),a(),e(5,` 10746 `),a(),e(6,` 10747 `)),r&2){let t=d.$implicit;l(4),v(t)}}function xU(r,d){if(r&1&&(e(0,` 10748 `),G(1,SU,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.PriorityOptions)}}function fU(r,d){r&1&&(e(0,` 10749 `),n(1,"i",68),e(2,"expand_less"),a(),e(3,` 10750 `))}function hU(r,d){r&1&&(e(0,` 10751 `),n(1,"i",68),e(2,"expand_more"),a(),e(3,` 10752 `))}function CU(r,d){if(r&1&&(e(0,` 10753 `),_(1,fU,4,0)(2,hU,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function vU(r,d){r&1&&(e(0,` 10754 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10755 `))}function gU(r,d){r&1&&(e(0,` 10756 `),n(1,"span",68),e(2,"search"),a(),e(3,` 10757 `))}function TU(r,d){if(r&1&&(e(0,` 10758 `),n(1,"small",70),e(2,` 10759 `),n(3,"div",24),e(4),a(),e(5,` 10760 `),a(),e(6,` 10761 `)),r&2){let t=d.$implicit;l(4),v(t)}}function IU(r,d){if(r&1&&(e(0,` 10762 `),G(1,TU,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.NewStatus)}}function bU(r,d){r&1&&(e(0,` 10763 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10764 `))}function yU(r,d){r&1&&(e(0,` 10765 `),n(1,"span",68),e(2,"search"),a(),e(3,` 10766 `))}function AU(r,d){if(r&1&&(e(0,` 10767 `),n(1,"small",70),e(2,` 10768 `),n(3,"div",24),e(4),a(),e(5,` 10769 `),a(),e(6,` 10770 `)),r&2){let t=d.$implicit;l(4),v(t)}}function RU(r,d){if(r&1&&(e(0,` 10771 `),G(1,AU,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.OnHoldStatuses)}}function wU(r,d){r&1&&(e(0,` 10772 `),n(1,"span",68),e(2,"expand_more"),a(),e(3,` 10773 `))}function DU(r,d){r&1&&(e(0,` 10774 `),n(1,"span",68),e(2,"search"),a(),e(3,` 10775 `))}function LU(r,d){if(r&1&&(e(0,` 10776 `),n(1,"small",70),e(2,` 10777 `),n(3,"div",24),e(4),a(),e(5,` 10778 `),a(),e(6,` 10779 `)),r&2){let t=d.$implicit;l(4),v(t)}}function NU(r,d){if(r&1&&(e(0,` 10780 `),G(1,LU,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.ClosedStatuses)}}var hc=(()=>
10780{class r{appSettingsService;authService;customFieldService;dragulaService;fb;responseService;route;router;statusService;toastService;translate;userGroupService;bodyDropdown;defaultPickerView;priorityInput;shades;subjectDropdown;editors;activeStatuses=[];allStatuses=[];allStatusItems=[];allUserGroups=[];allUserItems=[];allUsers=[];allUserStatusItems=[];appSettings;availableClosedItems=[];availableNewItems=[];availableOnHoldItems=[];defaultPickerViewOptions=[];displaySpinner=!0;dragulaGroupName="PRIORITYOPTIONS";emailRequired=!1;form;guestFormLink;isEditing;linkCopiedText="Link Copied to Clipboard";priorityName;priorityOptions=[];selectedMergeField;shadeFormGroups=[{controls:{WorkOrderGuestForm:"",Priority:"",DueDate:"",EmailAssignee:"",HideCommentFromRequester:"",Subject:"",Body:"",DefaultPicker:"",AlertMessage:""}},{controls:{WorkOrderGuestUserId:""}},{controls:{PriorityOptions:""}},{controls:{NewStatus:"",OnHoldStatuses:"",ClosedStatuses:""}}];showCopyLinkMessage=!1;sortAscIcon="../../../../../assets/icons/actions/sort_asc.svg";sortDescIcon="../../../../../assets/icons/actions/sort_desc.svg";sortOrder;submitted=!1;textareaFocused=!1;validationErrors;workOrderBodyFields=[];workOrderSubjectFields=[];dragulaSubs=new Vi;translations={};customFieldsDisabled=!0;guestWorkRequestsDisabled=!0;workOrderPrioritiesLimit;guestFormRoute="";accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px"}}};constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.appSettingsService=t,this.authService=o,this.customFieldService=i,this.dragulaService=s,this.fb=c,this.responseService=u,this.route=x,this.router=C,this.statusService=O,this.toastService=w,this.translate=F,this.userGroupService=L,this.guestFormRoute="/"+At.workOrder+"/"+this.authService.tenant.Key+"/"+At.createGuest,this.dragulaService.find(this.dragulaGroupName)||(this.dragulaService.createGroup(this.dragulaGroupName,{moves:(U,V,z)=>z?z.className==="drag-handle":!1}),this.dragulaSubs.add(s.drop(this.dragulaGroupName).subscribe(()=>{this.isEditing=void 0,this.sortOrder="custom",this.sortAndSetPriorityOptions()})))}ngOnDestroy(){this.dragulaService.destroy(this.dragulaGroupName),this.dragulaSubs.unsubscribe()}ngOnInit(){this.customFieldsDisabled=(this.authService.qwareSubscription?.customFieldsPerLayoutLimit??0)===0,this.guestWorkRequestsDisabled=!this.authService.qwareSubscription?.guestWorkRequests,this.workOrderPrioritiesLimit=this.authService.qwareSubscription?.workOrderPrioritiesLimit,this.form=this.fb.group({WorkOrderGuestForm:this.fb.control(!1),Priority:this.fb.control(!1),DueDate:this.fb.control(!1),HideCommentFromRequester:this.fb.control(!1),EmailAssignee:this.fb.control(!1),Subject:this.fb.control("",[T.required,T.maxLength(fi)]),Body:this.fb.control("",[T.required,T.maxLength(Kt)]),DefaultPicker:this.fb.control(null,T.required),AlertMessage:this.fb.control("",T.maxLength(Kt)),WorkOrderCreateTimeLocal:this.fb.control(new Date(0)),WorkOrderGuestUserId:this.fb.control(null),PriorityOptions:this.fb.control(null),NewStatus:this.fb.control(null,T.required),OnHoldStatuses:this.fb.control(null,T.required),ClosedStatuses:this.fb.control(null,T.required)}),ue([this.translate.get(["MERGE_FIELDS.SELECT","MERGE_FIELDS.WO_NUMBER","MERGE_FIELDS.DESCRIPTION","MERGE_FIELDS.LOCATIONS","MERGE_FIELDS.WO_TYPE","MERGE_FIELDS.SERVICE_AREA","MERGE_FIELDS.STATUS","MERGE_FIELDS.COMPLETED_DATE","MERGE_FIELDS.ASSETS","MERGE_FIELDS.CREATION_DATE","MERGE_FIELDS.CREATED_BY","MERGE_FIELDS.ASSIGNED_TO","MERGE_FIELDS.MOD_DATE","MERGE_FIELDS.PRIORITY","MERGE_FIELDS.MOD_BY","MERGE_FIELDS.LINK_TO_WO","MERGE_FIELDS.COMMENTS","SHARED.DISABLED","SHARED.DELETED","MERGE_FIELDS.DUE_DATE","SHARED.LOCATION_VIEW","SHARED.ASSET_VIEW","WORK_ORDER.HIGH","WORK_ORDER.MEDIUM","WORK_ORDER.LOW","SHARED.LINK_COPIED","MERGE_FIELDS.GUEST_EMAIL","MERGE_FIELDS.GUEST_NAME","MERGE_FIELDS.GUEST_PHONE","MERGE_FIELDS.REQUESTER"]).pipe(N()),this.statusService.getStatuses(this.authService.tenant.Id),this.userGroupService.getUserGroupUsers(this.authService.tenant.Id),this.appSettingsService.getAppSettingsForEdit(),this.customFieldsDisabled?Fe([]):this.customFieldService.getCustomFieldLayouts(this.authService.tenant.Id)]).subscribe(t=>{this.translations=t[0],this.allStatuses=t[1].filter(w=>
10780w.Type===Li.WORK_ORDERS),this.allUsers=t[2],this.appSettings=t[3];let o=t[4];this.defaultPickerViewOptions=[{label:this.translations["SHARED.LOCATION_VIEW"],value:bs.LOCATION},{label:this.translations["SHARED.ASSET_VIEW"],value:bs.ASSETS}];let i=[{label:this.translations["MERGE_FIELDS.ASSIGNED_TO"],value:"[ASSIGNED_TO]"},{label:this.translations["MERGE_FIELDS.COMPLETED_DATE"],value:"[COMPLETED_DATE]"},{label:this.translations["MERGE_FIELDS.CREATED_BY"],value:"[CREATED_BY]"},{label:this.translations["MERGE_FIELDS.CREATION_DATE"],value:"[CREATION_DATE]"}];this.appSettings.DueDate&&i.push({label:this.translations["MERGE_FIELDS.DUE_DATE"],value:"[DUE_DATE]"}),this.appSettings.WorkOrderGuestForm&&(i.push({label:this.translations["MERGE_FIELDS.GUEST_EMAIL"],value:"[GUEST_EMAIL]"}),i.push({label:this.translations["MERGE_FIELDS.GUEST_NAME"],value:"[GUEST_NAME]"}),i.push({label:this.translations["MERGE_FIELDS.GUEST_PHONE"],value:"[GUEST_PHONE_NUMBER]"})),i.push({label:this.translations["MERGE_FIELDS.MOD_BY"],value:"[MODIFIED_BY]"}),i.push({label:this.translations["MERGE_FIELDS.MOD_DATE"],value:"[MODIFICATION_DATE]"}),this.appSettings.Priority&&i.push({label:this.translations["MERGE_FIELDS.PRIORITY"],value:"[PRIORITY]"}),i.push({label:this.translations["MERGE_FIELDS.REQUESTER"],value:"[REQUESTER]"}),i.push({label:this.translations["MERGE_FIELDS.SERVICE_AREA"],value:"[SERVICE_AREA]"}),i.push({label:this.translations["MERGE_FIELDS.STATUS"],value:"[STATUS]"}),i.push({label:this.translations["MERGE_FIELDS.WO_NUMBER"],value:"[WORK_ORDER_NUMBER]"}),i.push({label:this.translations["MERGE_FIELDS.WO_TYPE"],value:"[WORK_ORDER_TYPE]"});let s=Pi.default.concat(i,[{label:this.translations["MERGE_FIELDS.ASSETS"],value:"[ASSETS]"},{label:this.translations["MERGE_FIELDS.COMMENTS"],value:"[COMMENTS]"},{label:this.translations["MERGE_FIELDS.DESCRIPTION"],value:"[DESCRIPTION]"},{label:this.translations["MERGE_FIELDS.LINK_TO_WO"],value:"[WORK_ORDER_LINK]"},{label:this.translations["MERGE_FIELDS.LOCATIONS"],value:"[LOCATIONS]"}]);s=Pi.default.sortBy(s,w=>(w.label??"").toLowerCase());let c=Pi.default.sortBy(Pi.default.uniqBy(Pi.default.flatten(o.filter(w=>w.Type==="WORKORDERS").map(w=>(w.Fields??[]).filter(F=>F.State===M.ACTIVE))),"ParentId"),w=>(w.Name??"").toLowerCase()).map(w=>({label:w.Name,value:this.customFieldService.formatMergeField(w.Name??"")}));this.workOrderSubjectFields=i,this.workOrderBodyFields=Pi.default.concat(s,c),this.setGuestFormOptionsOnModel(),this.guestFormLink=location.protocol+"//"+location.host+"/#"+this.guestFormRoute,this.linkCopiedText=this.translations["SHARED.LINK_COPIED"],this.appSettings?.PriorityOptions||(this.appSettings.PriorityOptions='[{ "Name": "'+this.translations["WORK_ORDER.HIGH"]+'", "SortOrder": 0 },{ "Name": "'+this.translations["WORK_ORDER.MEDIUM"]+'", "SortOrder": 1 },{ "Name": "'+this.translations["WORK_ORDER.LOW"]+'", "SortOrder": 2 }]');let u=JSON.parse(this.appSettings.PriorityOptions);this.priorityOptions=Pi.default.sortBy(u,w=>w.SortOrder??(w.Name??"").toLowerCase()),this.activeStatuses=Pi.default.sortBy(this.allStatuses.filter(w=>w.State===M.ACTIVE),w=>(w.Name??"").toLowerCase()),this.loadStatuses(this.activeStatuses);let x=this.appSettings.WorkOrderCreateTimeLocal||"0001-01-01T06:00:00Z",C=Pi.default.replace(x.toString(),"0001-01-01T",""),O=(0,fc.default)(C,"HH:mm:ss");this.appSettings.WorkOrderCreateTimeLocal=O.toDate(),this.appSettings.NewStatus=void 0,this.appSettings.OnHoldStatuses=[],this.appSettings.ClosedStatuses=[],this.allStatuses.forEach(w=>{if(!this.allStatusItems.find(F=>F.value===w.Id)){let F=this.allStatuses.find(L=>L.Id===w.Id);if(F&&this.appSettings){let L=F.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":F.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";w.Category===vn.NEW?this.appSettings.NewStatus={label:F.Name+L,value:F.Id}:w.Category===vn.ON_HOLD?this.appSettings.OnHoldStatuses.push({label:F.Name+L,value:F.Id}):w.Category===vn.CLOSED&&this.appSettings.ClosedStatuses.push({label:F.Name+L,value:F.Id})}}}
10780),this.setStatusesOnModel(),this.form.patchValue(this.appSettings),this.updateAvailableStatuses(),this.emailOptionChanged(),this.form.markAsPristine(),this.form.markAsUntouched(),this.displaySpinner=!1})}ngAfterViewInit(){this.editors.forEach((t,o)=>{if(t.quill){t.quill?.options.container.firstChild.addEventListener("blur",()=>{this.textareaFocused=!1});let i=o<2?o+4:o+5;t.quill.options.container.firstChild.tabindex=i}})}markFormDirty(){this.form.markAsDirty(),this.form.markAsTouched()}selectChanged(t){if(this.selectedMergeField){let o=t==="subject"?this.editors.toArray()[0].quill:this.editors.toArray()[1].quill,i=0,s=o.history.quill.selection.savedRange;s&&(s.length===0?i=s.index:(i=s.index,o.deleteText(s.index,s.length))),o.insertText(i,this.selectedMergeField,"user"),o.setSelection(o.getText(0).length),o.focus(),this.bodyDropdown.updateModel(void 0),this.subjectDropdown.updateModel(void 0)}}emailOptionChanged(){let t=this.form.get("EmailAssignee")?.value;this.updateFormControls("emailOption",t),this.emailRequired=t}guestFormOptionChanged(){this.updateFormControls("guestForm",this.form.get("WorkOrderGuestForm")?.value)}updateFormControls(t,o){if(t==="emailOption"&&(o?(this.form.get("Subject")?.setValidators([T.required,T.maxLength(fi)]),this.form.get("Body")?.setValidators([T.required,T.maxLength(Kt)])):(this.form.get("Subject")?.setValidators(T.maxLength(fi)),this.form.get("Body")?.setValidators(T.maxLength(Kt))),this.form.get("Subject")?.updateValueAndValidity(),this.form.get("Body")?.updateValueAndValidity()),t==="guestForm"){if(o)this.form.get("WorkOrderGuestUserId")?.setValidators([T.required]);else{let i=this.form.get("WorkOrderGuestUserId");i?.clearValidators(),i?.reset()}this.form.get("WorkOrderGuestUserId")?.updateValueAndValidity()}this.form.updateValueAndValidity()}addPriorityOption(){this.sortOrder="custom",this.priorityName=Pi.default.trim(this.priorityName),this.priorityName&&(this.priorityOptions&&Pi.default.isNumber(this.workOrderPrioritiesLimit)&&this.priorityOptions.length>=this.workOrderPrioritiesLimit?this.translate.get(["SHARED.ERROR_LABEL","SUBSCRIPTION.ERROR.PRIORITIES_LIMIT_REACHED"],{limit:this.workOrderPrioritiesLimit}).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SUBSCRIPTION.ERROR.PRIORITIES_LIMIT_REACHED"])}):Pi.default.some(this.priorityOptions,t=>Pi.default.trim(Pi.default.toLower(t.Name))===Pi.default.toLower(this.priorityName))?this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"]).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.DUPLICATE_OPTION"])}):this.priorityName.length>255?this.translate.get(["SHARED.ERROR_LABEL","CUSTOM_FIELD.ERROR.MAX_LENGTH"],{field:this.translations["APP_SETTINGS.WORK_ORDER.PRIORITY_NAME"]}).pipe(N()).subscribe(t=>{this.toastService.warnTimeout(t["SHARED.ERROR_LABEL"],t["CUSTOM_FIELD.ERROR.MAX_LENGTH"])}):(this.priorityOptions.unshift({Name:this.priorityName,SortOrder:0}),this.sortAndSetPriorityOptions(),this.priorityInput.nativeElement.focus()))}editPriorityOption(t){this.isEditing&&this.isEditing!=="isEditing"+t?this.isEditing="isEditing"+t:this.isEditing=this.isEditing?void 0:"isEditing"+t}sortPriorityOptionsAlpha(){this.isEditing||(this.sortOrder==="desc"?(this.sortOrder="asc",this.priorityOptions=this.priorityOptions.sort((t,o)=>t.Name.localeCompare(o.Name))):(this.sortOrder="desc",this.priorityOptions=this.priorityOptions.sort((t,o)=>t.Name.localeCompare(o.Name)).reverse()),this.sortAndSetPriorityOptions())}deletePriorityOption(t){this.sortOrder="custom",this.priorityOptions=this.priorityOptions.filter(o=>o.Name!==t),this.sortAndSetPriorityOptions()}setPriorityOption(t,o){t.Name=o,this.sortAndSetPriorityOptions()}sortAndSetPriorityOptions(){this.priorityOptions.forEach((t,o)=>t.SortOrder=o),this.form.get("PriorityOptions")?.setValue(this.priorityOptions.length>0?JSON.stringify(this.priorityOptions):null),this.markFormDirty()}loadStatuses(t){this.allStatusItems=t.map(o=>({label:o.Name,value:o.Id}))}setStatusesOnModel(){this.appSettings&&this.activeStatuses.forEac
10780h(t=>{let o=this.allStatusItems.find(i=>i.value===t.Id);o&&this.appSettings&&(t.Category===vn.NEW?this.appSettings.NewStatus=o:t.Category===vn.ON_HOLD?this.appSettings.OnHoldStatuses.push(o):t.Category===vn.CLOSED&&this.appSettings.ClosedStatuses.push(o))})}isDirty(){return this.form.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Ln;this.appSettings&&(t=new Ln().parseWorkOrderForm(this.form.value,this.appSettings)),this.appSettingsService.updateAppSettings(t).pipe(we(()=>(this.allStatuses.forEach(o=>{o.TenantId=this.authService.tenant.Id,t.NewStatus?.value===o.Id?o.Category=vn.NEW:t.OnHoldStatuses.findIndex(i=>i.value===o.Id)>-1?o.Category=vn.ON_HOLD:t.ClosedStatuses.findIndex(i=>i.value===o.Id)>-1?o.Category=vn.CLOSED:o.Category=vn.IN_PROGRESS}),this.statusService.updateStatuses(this.allStatuses)))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("APP_SETTINGS.WORK_ORDER.SUCCESS.SAVE","../",this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}updateAvailableStatuses(t,o){let i=this.form.get("NewStatus")?.value,s=this.form.get("OnHoldStatuses")?.value,c=this.form.get("ClosedStatuses")?.value;(!o||o!=="new")&&(this.availableNewItems=this.allStatusItems.filter(u=>!s?.find(x=>u.value===x.value)&&!c?.find(x=>u.value===x.value))),(!o||o!=="closed")&&(this.availableClosedItems=this.allStatusItems.filter(u=>i?.value!==u.value&&!s?.find(x=>u.value===x.value))),(!o||o!=="hold")&&(this.availableOnHoldItems=this.allStatusItems.filter(u=>i?.value!==u.value&&!c?.find(x=>u.value===x.value)))}setGuestFormOptionsOnModel(){this.setGuestUserSelectItems(),this.appSettings&&this.appSettings.WorkOrderGuestUserId&&(this.appSettings.WorkOrderGuestUserId=this.allUserItems.find(t=>t.value===this.appSettings?.WorkOrderGuestUserId))}setGuestUserSelectItems(){let t=Pi.default.sortBy(this.allUsers.filter(o=>o.State===M.ACTIVE),o=>(o.fullNameWithEmail()??"").toLowerCase());this.allUserItems=t.map(o=>({label:o.fullNameWithEmail(),value:o.Id}))}showMessage(){this.showCopyLinkMessage=!0,setTimeout(()=>{this.showCopyLinkMessage=!1},2e3)}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g($t),g(Dn),g(be),g(Re),g(he),g(Be),g(Oi),g(Se),g(le),g(Tt))};static \u0275cmp=B({type:r,selectors:[["qware-work-order-settings"]],viewQuery:function(o,i){if(o&1&&(X(uM,5),X(_M,5),X(EM,5),X(SM,7),X(xM,5),X(Jt,5)),o&2){let s;Y(s=Q())&&(i.bodyDropdown=s.first),Y(s=Q())&&(i.defaultPickerView=s.first),Y(s=Q())&&(i.priorityInput=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.subjectDropdown=s.first),Y(s=Q())&&(i.editors=s)}},standalone:!1,decls:353,vars:104,consts:[["shades",""],["toggleicon",""],["alertMessageEditor",""],["header",""],["priorityInput",""],["dropdownicon",""],["filtericon",""],["subjectEditor",""],["subjectDropdown",""],["bodyEditor",""],["bodyDropdown",""],["icon",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.work-order.page-header",1,"page-header"],[3,"dt"],["id","qware.app-settings.work-order.spinner",3,"displaySpinner"],[3,"formGroup"],[3,"multiple","dt","value"],["id","qware.app-settings.work-order.general-shade","value","0"],[1,"accordion-content-padding"],[1,"display-in-grid"],[1,"col-12"],[1,"medium-input","flex-inline","flex-space-between"],["translate",""],["id","qware.app-settings.work-order.checkbox.includePriority","name","Priority","formControlName","Priority",3,"tabindex","binary"],["id","qware.app-settings.work-order.checkbox.includeDueDate","name","DueDate","formControlName","DueDate",3,"tabindex","binary"],["id","qware.app-settings.work-order.checkbox.hideCommentFromRequester","name","HideCommentFromRequester","formControlName","HideCommentFromRequester",3,"tabindex","binary"],["id","qware.app-settings.work-order.checkbox.emailAssignee","name","EmailAssignee","formControlName","EmailAssignee",3,"onChange","tabindex","binary"],[1,"medium-input"],["id","qware.app-settings.work-order.dropdown.defaultPicker","formControlName","DefaultPicker","variant","filled",3,"tabindex","autoDisplayFirst","options","fluid"],["pTemplate","dropdownicon"],["id","qware.app_settings.general.label.defaultPicker","for","qware.app-settings.work-order.dropdown.defaultPicker"],[1,"required-mark"],["id","qware.app-settings.work-order.label.alertMessage",1,"standalone-label"],["id","qware.app-settings.work-order.alertMessage.editor","formControlName","AlertMessage",3,"onTextChange"],[1,"validation-error",3,"hidden"],["id","qware.app-settings.work-order.error.alertMessage-length","translate","",3,"hidden","translateParams"],["formControlName","WorkOrderCreateTimeLocal","hourFormat","12","variant","filled",1,"is-filled",3,"tabindex","timeOnly","showTime","fluid"],["id","qware.app-settings.work-order.priority-shade","value","2",3,"hidden"],[1,"grid","flex-inline","priority-container"],[1,"col-12","lg:col-6","md:col-6","first-column"],["tabindex","10","type","text","pInputText","","name","Priority Name","variant","filled","id","qware.app-settings.work-order.input.priority-name",3,"ngModelChange","keydown.enter","ngModel","ngModelOptions","fluid"],["id","qware.app-settings.work-order.label.priority-name","for","qware.app-settings.work-order.input.priority-name"],[1,"col-12","lg:col-6","md:col-6","second-column","flex-inline","align-items-bottom"],[1,"medium-input","flex-inline","flex-space-between",2,"width","100%"],[1,"add-button"],["tabindex","11","i
10780d","qware.app-settings.work-order.button.add","type","button",3,"onClick","disabled","raised","label"],[1,"sort-button"],["tabindex","-1","type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","text","rounded","raised","hidden"],[3,"src"],["id","qware.app-settings.work-order.priorities",1,"priority-options"],["id","qware.app-settings.work-order.label.priority-list",1,"standalone-label"],["translate","",3,"hidden"],["dragula","PRIORITYOPTIONS",3,"dragulaModelChange","hidden","dragulaModel"],["id","qware.app-settings.work-order.statuses-shade","value","3"],["formControlName","NewStatus","filterBy","label","inputId","qware.app-settings.work-order.new-status","optionLabel","label","id","qware.app-settings.work-order.new-status-e2e","variant","filled",3,"onChange","tabindex","options","filter","resetFilterOnHide","fluid"],["id","qware.app-settings.work-order.label.new-status","for","qware.app-settings.work-order.new-status"],["id","qware.app-settings.work-order.error.new-status-req","translate","",3,"hidden"],["formControlName","OnHoldStatuses","display","chip","optionLabel","label","inputId","qware.app-settings.work-order.on-hold","variant","filled",3,"ngModelChange","tabindex","options","maxSelectedLabels","id","resetFilterOnHide","fluid"],["id","qware.app-settings.work-order.label.on-hold","for","qware.app-settings.work-order.on-hold"],["id","qware.app-settings.work-order.error.on-hold-status-req","translate","",3,"hidden"],["formControlName","ClosedStatuses","display","chip","optionLabel","label","inputId","qware.app-settings.work-order.closed","variant","filled",3,"ngModelChange","tabindex","options","maxSelectedLabels","id","fluid","resetFilterOnHide"],["id","qware.app-settings.work-order.label.closed","for","qware.app-settings.work-order.closed"],["
10780id","qware.app-settings.work-order.error.completed-status-req","translate","",3,"hidden"],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.work-order.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.work-order.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"material-icons"],["id","qware.app-settings.work-order.checkbox.enableGuestForm","name","WorkOrderGuestForm","formControlName","WorkOrderGuestForm",3,"onChange","qwareFocus","tabindex","binary"],[1,"validation-error"],["id","qware.app-settings.work-order.label.subject",1,"standalone-label"],["id","qware.app-settings.work-order.subject.editor","formControlName","Subject",3,"onTextChange"],["id","qware.app-settings.work-order.error.subject-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.work-order.error.subject-req","translate","",3,"hidden"],[1,"ql-formats","merge-field"],["id","qware.app-settings.work-order.dropdown.subject.fields",3,"ngModelChange","onChange","options","placeholder","ngModel","ngModelOptions","fluid","filter"],["pTemplate","filtericon"],["id","qware.status.label.body",1,"standalone-label"],["id","qware.app-settings.work-order.body.editor","formControlName","Body",3,"onTextChange"],["id","qware.app-settings.work-order.error.body-length","translate","",3,"hidden","translateParams"],["id","qware.app-settings.work-order.error.body-req","translate","",3,"hidden"],[1,"ql-formats"],[1,"ql-color"],[1,"ql-background"],[1,"ql-bold"],[1,"ql-italic"],[1,"ql-underline"],["value","ordered",1,"ql-list"],["value","bullet",1,"ql-list"],["value","+1",1,"ql-indent"],["value","-1",1,"ql-indent"],[1,"ql-link"],[1,"ql-clean"],["id","qware.app-settings.work-order.dropdown.body.fields",3,"ngModelChange","onChange","options","placeholder","ngModel","ngModelOptions","fluid","filter"],[1,"ql-size"],["value","small"],["selected",""],["value","large"],["value","huge"],["value","sub",1,"ql-script"],["value","super",1,"ql-script"],["id","qware.app-settings.work-order.guest-form-shade","value","1",3,"hidden"],[1,"medium-input",2,"margin-bottom","0"],[3,"routerLink"],[3,"click","qwareCopyToClipboard"],["severity","success",3,"ngStyle"],["formControlName","WorkOrderGuestUserId","labelId","qware.app-settings.work-order.label.guest-user","label","APP_SETTINGS.WORK_ORDER.GUEST_USER","elementId","qware.app-settings.work-order.guest-user","id","qware.app-settings.work-order.guest-user-e2e",3,"tabindex","options","singleSelect","isRequired","virtualScroll","virtualScrollItemSize"],["id","qware.app-settings.work-order.error.guest-user-req","translate","",3,"hidden"],[1,"priority-option"],[1,"drag-handle"],["tabindex","-1",1,"material-icons"],[1,"flex-inline","align-items-center"],[1,"priority-fields"],[1,"delete-button","flex-inline","align-right"],["type","button","severity","secondary","styleClass","icon-only-button","tabindex","-1",3,"onClick","text","rounded"],["type","text","pInputText","","id","qware.app-settings.work-order.input.priority-name","variant","filled",3,"change","ngModelChange","qwareFocus","fluid","ngModel","ngModelOptions"],["for","qware.app-settings.work-order.input.priority-name","translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"div",12),h("keydown.enter",function(){return E(s),S(i.textareaFocused?void 0:i.save())}),e(1,` 10781 `),n(2,"div",13),e(3,` 10782 `),n(4,"h3",14),e(5,` 10783 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.WORK_ORDER.WORK_ORDER 10784 `),a(),e(9,` 10785 `),n(10,"p-card",15),e(11,` 10786 `),n(12,"qware-spinner",16),e(13,` 10787 `),n(14,"div",17),e(15,` 10788 `),n(16,"p-accordion",18,0),e(18,` 10789 `),n(19,"p-accordion-panel",19),e(20,` 10790 `),n(21,"p-accordion-header"),e(22),I(23,"translate"),_(24,TM,3,1,"ng-template",null,1,A),e(26,` 10791 `),a(),e(27,` 10792 `),n(28,"p-accordion-content"),e(29,` 10793 `),n(30,"div",20),e(31,` 10794 `),n(32,"div",21),e(33,` 10795 `),n(34,"div",22),e(35,` 10796 `),_(36,IM,10,3)(37,yM,3,0),n(38,"div",23),e(39,` 10797 `),n(40,"label",24),e(41,"APP_SETTINGS.WORK_ORDER.INCLUDE_PRIORITY"),a(),e(42,` 10798 `),n(43,"p-checkbox",25),e(44,` 10799 `),a(),e(45,` 10800 `),a(),e(46,` 10801 `),_(47,RM,3,0),n(48,"div",23),e(49,` 10802 `),n(50,"label",24),e(51,"APP_SETTINGS.WORK_ORDER.INCLUDE_DUE_DATE"),a(),e(52,` 10803 `),n(53,"p-checkbox",26),e(54,` 10804 `),a(),e(55,` 10805 `),a(),e(56,` 10806 `),_(57,DM,3,0),n(58,"div",23),e(59,` 10807 `),n(60,"label",24),e(61,"APP_SETTINGS.WORK_ORDER.HIDE_COMMENTS_FROM_REQUESTER"),a(),e(62,` 10808 `),n(63,"p-checkbox",27),e(64,` 10809 `),a(),e(65,` 10810 `),a(),e(66,` 10811 `),_(67,NM,3,0),n(68,"div",23),e(69,` 10812 `),n(70,"label",24),e(71,"APP_SETTINGS.WORK_ORDER.EMAIL_ASSIGNEES"),a(),e(72,` 10813 `),n(73,"p-checkbox",28),h("onChange",function(){return E(s),S(i.emailOptionChanged())}),e(74,` 10814 `),a(),e(75,` 10815 `),a(),e(76,` 10816 `),_(77,FM,3,0)(78,qM,28,8)(79,KM,28,8),n(80,"div",29),e(81,` 10817 `),n(82,"p-floatlabel"),e(83,` 10818 `),n(84,"p-select",30),e(85,` 10819 `),_(86,$M,4,0,"ng-template",31),e(87,` 10820 `),a(),e(88,` 10821 `),n(89,"label",32),e(90,` 10822 `),n(91,"span",24),e(92,"APP_SETTINGS.WORK_ORDER.DEFAULT_LOCATION_ASSET_VIEW"),a(),e(93,` 10823 `),n(94,"span",33),e(95," *"),a(),e(96,` 10824 `),a(),e(97,` 10825 `),a(),e(98,` 10826 `),_(99,XM,3,0),a(),e(100,` 10827 10828 `),n(101,"div",29),e(102,` 10829 `),n(103,"label",34),e(104,` 10830 `),n(105,"span",24),e(106,"APP_SETTINGS.WORK_ORDER.ALERT_MESSAGE"),a(),e(107,` 10831 `),a(),e(108,` 10832 `),n(109,"p-editor",35,2),h("onTextChange",function(){return E(s),S(i.textareaFocused=!0)}),e(111,` 10833 `),_(112,ZM,63,0,"ng-template",null,3,A),e(114,` 10834 `),a(),e(115,` 10835 `),n(116,"small",36),e(117,` 10836 `),n(118,"div",37),e(119,` 10837 APP_SETTINGS.WORK_ORDER.ERROR.ALERT_MESSAGE_LENGTH 10838 `),a(),e(120,` 10839 `),a(),e(121,` 10840 `),_(122,eU,3,0),a(),e(123,` 10841 `),n(124,"div",29),e(125,` 10842 `),n(126,"p-floatlabel"),e(127,` 10843 `),n(128,"p-datepicker",38),e(129,` 10844 `),a(),e(130,` 10845 `),n(131,"label",24),e(132,"APP_SETTINGS.WORK_ORDER.CREATE_LOCAL_TIME"),a(),e(133,` 10846 `),a(),e(134,` 10847 `),a(),e(135,` 10848 `),a(),e(136,` 10849 `),a(),e(137,` 10850 `),a(),e(138,` 10851 `),a(),e(139,` 10852 `),a(),e(140,` 10853 `),_(141,lU,66,20),n(142,"p-accordion-panel",39),e(143,` 10854 `),n(144,"p-accordion-header"),e(145),I(146,"translate"),_(147,pU,3,1,"ng-template",null,1,A),e(149,` 10855 `),a(),e(150,` 10856 `),n(151,"p-accordion-content"),e(152,` 10857 `),n(153,"div",20),e(154,` 10858 `),n(155,"div",40),e(156,` 10859 `),n(157,"div",41),e(158,` 10860 `),n(159,"div",29),e(160,` 10861 `),n(161,"p-floatlabel"),e(162,` 10862 `),n(163,"input",42,4),j("ngModelChange",function(u){return E(s),W(i.priorityName,u)||(i.priorityName=u),S(u)}
10862),h("keydown.enter",function(){return E(s),S(i.addPriorityOption())}),a(),e(165,` 10863 `),n(166,"label",43),e(167,` 10864 `),n(168,"span",24),e(169,"APP_SETTINGS.WORK_ORDER.PRIORITY_NAME"),a(),e(170,` 10865 `),a(),e(171,` 10866 `),a(),e(172,` 10867 `),a(),e(173,` 10868 `),a(),e(174,` 10869 `),n(175,"div",44),e(176,` 10870 `),n(177,"div",45),e(178,` 10871 `),n(179,"div",46),e(180,` 10872 `),n(181,"p-button",47),I(182,"translate"),h("onClick",function(){return E(s),S(i.addPriorityOption())}),e(183,` 10873 `),a(),e(184,` 10874 `),a(),e(185,` 10875 `),n(186,"div",48),e(187,` 10876 `),n(188,"p-button",49),h("onClick",function(){return E(s),S(i.sortPriorityOptionsAlpha())}),e(189,` 10877 `),R(190,"img",50),e(191,` 10878 `),a(),e(192,` 10879 `),a(),e(193,` 10880 `),a(),e(194,` 10881 `),a(),e(195,` 10882 `),n(196,"div",22),e(197,` 10883 `),n(198,"div",51),e(199,` 10884 `),n(200,"label",52),e(201,` 10885 `),n(202,"span",53),e(203,` 10886 APP_SETTINGS.WORK_ORDER.PRIORITIES 10887 `),a(),e(204,` 10888 `),a(),e(205,` 10889 `),n(206,"div",54),j("dragulaModelChange",function(u){return E(s),W(i.priorityOptions,u)||(i.priorityOptions=u),S(u)}),e(207,` 10890 `),G(208,EU,32,4,null,null,CM),a(),e(210,` 10891 `),a(),e(211,` 10892 `),n(212,"small",36),e(213,` 10893 `),n(214,"div",53),e(215,` 10894 CUSTOM_FIELD.ERROR.OPTION_REQUIRED 10895 `),a(),e(216,` 10896 `),a(),e(217,` 10897 `),_(218,xU,3,0),a(),e(219,` 10898 `),a(),e(220,` 10899 `),a(),e(221,` 10900 `),a(),e(222,` 10901 `),a(),e(223,` 10902 `),n(224,"p-accordion-panel",55),e(225,` 10903 `),n(226,"p-accordion-header"),e(227),I(228,"translate"),_(229,CU,3,1,"ng-template",null,1,A),e(231,` 10904 `),a(),e(232,` 10905 `),n(233,"p-accordion-content"),e(234,` 10906 `),n(235,"div",20),e(236,` 10907 `),n(237,"div",21),e(238,` 10908 `),n(239,"div",22),e(240,` 10909 `),n(241,"div",29),e(242,` 10910 `),n(243,"p-floatlabel"),e(244,` 10911 `),n(245,"p-select",56),h("onChange",function(u){return E(s),S(i.updateAvailableStatuses(u,"new"))}),e(246,` 10912 `),_(247,vU,4,0,"ng-template",null,5,A),e(249,` 10913 `),_(250,gU,4,0,"ng-template",null,6,A),e(252,` 10914 `),a(),e(253,` 10915 `),n(254,"label",57),e(255,` 10916 `),n(256,"span",24),e(257,"APP_SETTINGS.WORK_ORDER.NEW_STATUS"),a(),n(258,"span",33),e(259," *"),a(),e(260,` 10917 `),a(),e(261,` 10918 `),a(),e(262,` 10919 `),n(263,"small",36),e(264,` 10920 `),n(265,"div",58),e(266,` 10921 APP_SETTINGS.WORK_ORDER.ERROR.ASSIGNED_AS_NEW_REQUIRED 10922 `),a(),e(267,` 10923 `),a(),e(268,` 10924 `),_(269,IU,3,0),a(),e(270,` 10925 `),n(271,"div",29),e(272,` 10926 `),n(273,"p-floatlabel"),e(274,` 10927 `),n(275,"p-multiselect",59),h("ngModelChange",function(u){return E(s),S(i.updateAvailableStatuses(u,"hold"))}),e(276,` 10928 `),_(277,bU,4,0,"ng-template",null,5,A),e(279,` 10929 `),_(280,yU,4,0,"ng-template",null,6,A),e(282,` 10930 `),a(),e(283,` 10931 `),n(284,"label",60),e(285,` 10932 `),n(286,"span",24),e(287,"APP_SETTINGS.WORK_ORDER.ON_HOLD_STATUSES"),a(),n(288,"span",33),e(289," *"),a(),e(29
109320,` 10933 `),a(),e(291,` 10934 `),a(),e(292,` 10935 `),n(293,"small",36),e(294,` 10936 `),n(295,"div",61),e(296,` 10937 APP_SETTINGS.WORK_ORDER.ERROR.ASSIGNED_AS_ON_HOLD_REQUIRED 10938 `),a(),e(297,` 10939 `),a(),e(298,` 10940 `),_(299,RU,3,0),a(),e(300,` 10941 `),n(301,"div",29),e(302,` 10942 `),n(303,"p-floatlabel"),e(304,` 10943 `),n(305,"p-multiselect",62),h("ngModelChange",function(u){return E(s),S(i.updateAvailableStatuses(u,"closed"))}),e(306,` 10944 `),_(307,wU,4,0,"ng-template",null,5,A),e(309,` 10945 `),_(310,DU,4,0,"ng-template",null,6,A),e(312,` 10946 `),a(),e(313,` 10947 `),n(314,"label",63),e(315,` 10948 `),n(316,"span",24),e(317,"APP_SETTINGS.WORK_ORDER.CLOSED_STATUSES"),a(),n(318,"span",33),e(319," *"),a(),e(320,` 10949 `),a(),e(321,` 10950 `),a(),e(322,` 10951 `),n(323,"small",36),e(324,` 10952 `),n(325,"div",64),e(326,` 10953 APP_SETTINGS.WORK_ORDER.ERROR.ASSIGNED_AS_CLOSED_REQUIRED 10954 `),a(),e(327,` 10955 `),a(),e(328,` 10956 `),_(329,NU,3,0),a(),e(330,` 10957 `),a(),e(331,` 10958 `),a(),e(332,` 10959 `),a(),e(333,` 10960 `),a(),e(334,` 10961 `),a(),e(335,` 10962 `),a(),e(336,` 10963 `),a(),e(337,` 10964 `),n(338,"div",65),e(339,` 10965 `),n(340,"p-button",66),I(341,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(342,` 10966 `),a(),e(343,` 10967 `),n(344,"p-button",67),I(345,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(346,` 10968 `),a(),e(347,` 10969 `),a(),e(348,` 10970 `),a(),e(349,` 10971 `),a(),e(350,` 10972 `),a(),e(351,` 10973`),a(),e(352,` 10974`)}if(o&2){let s;l(10),p("dt",i.accordionCard),l(2),p("displaySpinner",i.displaySpinner),l(2),p("formGroup",i.form),l(2),p("multiple",!0)("dt",i.accordion)("value",ne(100,fM)),l(6),K(` 10975 `,y(23,88,"APP_SETTINGS.WORK_ORDER.GENERAL"),` 10976 `),l(14),f(i.guestWorkRequestsDisabled?-1:36),l(),f(!i.guestWorkRequestsDisabled&&i.validationErrors&&i.validationErrors.WorkOrderGuestForm&&i.form.controls.WorkOrderGuestForm.untouched?37:-1),l(6),p("tabindex",2)("binary",!0),l(4),f(i.validationErrors&&i.validationErrors.Priority&&i.form.controls.Priority.untouched?47:-1),l(6),p("tabindex",3)("binary",!0),l(4),f(i.validationErrors&&i.validationErrors.DueDate&&i.form.controls.DueDate.untouched?57:-1),l(6),p("tabindex",4)("binary",!0),l(4),f(i.validationErrors&&i.validationErrors.HideCommentFromRequester&&i.form.controls.EmailAssignee.untouched?67:-1),l(6),p("tabindex",6)("binary",!0),l(4),f(i.validationErrors&&i.validationErrors.EmailAssignee&&i.form.controls.EmailAssignee.untouched?77:-1),l(),f(i.form.controls.EmailAssignee.value===!0?78:-1),l(),f(i.form.controls.EmailAssignee.value===!0?79:-1),l(5),p("tabindex",7)("autoDisplayFirst",!1)("options",i.defaultPickerViewOptions)("fluid",!0),l(15),f(i.validationErrors&&i.validationErrors.DefaultPicker&&i.form.controls.DefaultPicker.untouched?99:-1),l(17),p("hidden",i.form.controls.AlertMessage.valid||i.form.controls.AlertMessage.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.AlertMessage.errors!=null&&i.form.controls.AlertMessage.errors.maxlength))("translateParams",pe(101,nd,i.form.controls.AlertMessage.value)),l(4),f(i.validationErrors&&i.validationErrors.AlertMessage&&i.form.controls.AlertMessage.untouched?122:-1),l(6),p("tabindex",8)("timeOnly",!0)("showTime",!0)("fluid",!0),l(13),f(i.guestWorkRequestsDisabled?-1:141),l(),p("hidden",!((s=i.form.get("Priority"))!=null&&s.value)),l(3),K(` 10977 `,y(146,90,"APP_SETTINGS.WORK_ORDER.PRIORITIES"),` 10978 `),l(18),H("ngModel",i.priorityName),p("ngModelOptions",ne(103,rs))("fluid",!0),l(18),q("label",y(182,92,"APP_SETTINGS.WORK_ORDER.ADD_PRIORITY")),p("disabled",i.isEditing||!i.priorityName||i.priorityName&&i.priorityName.length<1)("raised",!0),l(7),p("text",!0)("rounded",!0)("raised",!0)("hidden",i.isEditing||i.priorityOptions.length<2),l(2),p("src",i.sortOrder==="desc"?i.sortDescIcon:i.sortAscIcon,jt),l(12),p("hidden",!i.form.controls.PriorityOptions.value),l(4),p("hidden",!i.form.controls.PriorityOptions.value),H("dragulaModel",i.priorityOptions),l(2),k(i.priorityOptions),l(4),p("hidden",i.form.controls.PriorityOptions.valid||i.form.controls.PriorityOptions.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.PriorityOptions.errors!=null&&i.form.controls.PriorityOptions.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.PriorityOptions&&i.form.controls.PriorityOptions.untouched?218:-1),l(9),K(` 10979 `,y(228,94,"APP_SETTINGS.WORK_ORDER.STATUSES"),` 10980 `),l(18),p("tabindex",12)("options",i.availableNewItems)("filter",!0)("resetFilterOnHide",!0)("fluid",!0),l(18),p("hidden",i.form.controls.NewStatus.val
10980id||i.form.controls.NewStatus.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.NewStatus.errors!=null&&i.form.controls.NewStatus.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.NewStatus&&i.form.controls.NewStatus.untouched?269:-1),l(6),p("tabindex",13)("options",i.availableOnHoldItems)("maxSelectedLabels",i.availableNewItems.length)("id","qware.app-settings.work-order.on-hold-e2e")("resetFilterOnHide",!0)("fluid",!0),l(18),p("hidden",i.form.controls.OnHoldStatuses.valid||i.form.controls.OnHoldStatuses.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.OnHoldStatuses.errors!=null&&i.form.controls.OnHoldStatuses.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.OnHoldStatuses&&i.form.controls.OnHoldStatuses.untouched?299:-1),l(6),p("tabindex",14)("options",i.availableClosedItems)("maxSelectedLabels",i.availableClosedItems.length+1)("id","qware.app-settings.work-order.closed-e2e")("fluid",!0)("resetFilterOnHide",!0),l(18),p("hidden",i.form.controls.ClosedStatuses.valid||i.form.controls.ClosedStatuses.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.ClosedStatuses.errors!=null&&i.form.controls.ClosedStatuses.errors.required)),l(4),f(i.validationErrors&&i.validationErrors.ClosedStatuses&&i.form.controls.ClosedStatuses.untouched?329:-1),l(11),q("label",y(341,96,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(345,98,"SHARED.SAVE")),p("text",!0)("disabled",!i.form.valid||!i.form.dirty)}},dependencies:[Mt,Pe,Nt,Ot,Ft,oe,Ie,yt,$n,_n,Jn,pn,Jt,Ne,je,Cr,vr,Ae,se,ge,Le,ye,gi,Ni,wt,me,Te,De,it,et,$,ie],styles:[`qware-work-order-settings .priority-options{margin:0 1rem 1rem}qware-work-order-settings .priority-options .priority-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}qware-work-order-settings .priority-options .priority-option .drag-handle{margin-bottom:.5rem}qware-work-order-settings .priority-options .priority-option .priority-fields{width:20%;margin-right:.5rem}qware-work-order-settings .priority-options .priority-option .priority-fields input{border-width:0 0 1px 0}qware-work-order-settings .priority-options .priority-option .delete-button{flex:1 1 auto}@media screen and (max-width: 768px){qware-work-order-settings .priority-container>div:first-of-type{padding-bottom:0}qware-work-order-settings .priority-container>div:nth-of-type(2){padding-top:0;padding-bottom:0}qware-work-order-settings .priority-container>div:nth-of-type(2) .medium-input{margin:0 1rem 1rem;padding:0}qware-work-order-settings .priority-options{margin:1rem;padding-bottom:.5rem}qware-work-order-settings .priority-options .priority-option>div:nth-of-type(2){flex-direction:column;align-items:initial}qware-work-order-settings .priority-options .priority-option>div:nth-of-type(2) .priority-fields{width:calc(100% - 1.7rem);margin:.85rem}}body>.gu-mirror .priority-option{border:1px solid var(--p-surface-400);padding:.5rem;background-color:var(--p-surface-0)}body>.gu-mirror .priority-option .drag-handle{margin-bottom:.5rem}body>.gu-mirror .priority-option .priority-fields{width:20%;margin-right:.5rem}body>.gu-mirror .priority-option .delete-button{pointer-events:none;flex:1 1 auto} 10981`],encapsulation:2})}return r})();var rd=He(nt());var OU=["additionalFieldsDropdown"];function FU(r,d){r&1&&(e(0,` 10982 `),n(1,"span",11),e(2,"expand_more"),a(),e(3,` 10983 `))}function MU(r,d){r&1&&(e(0,` 10984 `),n(1,"span",11),e(2,"expand_less"),a(),e(3,` 10985 `))}function UU(r,d){r&1&&(e(0,` 10986 `),n(1,"span",11),e(2,"expand_more"),a(),e(3,` 10987 `))}function PU(r,d){if(r&1&&(e(0,` 10988 `),n(1,"p-floatlabel"),e(2,` 10989 `),n(3,"p-inputnumber",12),e(4,` 10990 `),_(5,MU,4,0,"ng-template",null,1,A),e(7,` 10991 `),_(8,UU,4,0,"ng-template",null,2,A),e(10,` 10992 `),a(),e(11,` 10993 `),n(12,"label",13),e(13,` 10994 `),n(14,"span",9),e(15,"EXTERNALGROUP.DISCOUNT_AMOUNT_PER_EVENT"),a(),e(16,` 10995 `),a(),e(17,` 10996 `),a(),e(18,` 10997 `)),r&2){let t=m();l(3),p("tabindex",13)("allowEmpty",!0)("currency",t.currencyType())("showButtons",!0)("min",0)("fluid",!0)}}function GU(r,d){r&1&&(e(0,` 10998 `),n(1,"span",11),e(2,"expand_less"),a(),e(3,` 10999 `))}function kU(r,d){r&1&&(e(0,` 11000 `),n(1,"span",11),e(2,"expand_more"),a(),e(3,` 11001 `))}function VU(r,d){r&1&&(e(0,` 11002 `),n(1,"p-floatlabel"),e(2,` 11003 `),n(3,"p-inputnumber",14),e(4,` 11004 `),_(5,GU,4,0,"ng-template",null,1,A),e(7,` 11005 `),_(8,kU,4,0,"ng-template",null,2,A),e(10,` 11006 `),a(),e(11,` 11007 `),n(12,"label",15),e(13,` 11008 `),n(14,"span",9),e(15,"EXTERNALGROUP.DISCOUNT_AMOUNT_PER_EVENT"),a(),e(16,` 11009 `),a(),e(17,` 11010 `),a(),e(18,` 11011 `)),r&2&&(l(3),p("tabindex",13)("showButtons",!0)("min",0)("max",100)("fluid",!0))}var os=(()=>{class r{additionalFieldsDropdown;autoFocus=ee(!0);currencyType=ee("USD");form=ee.required();submitted=ee(!1);validationErrors=ee();discountTypeOptions=D([]);translate=te(le);constructor(){this.translate.get(["EXTERNALGROUP.NONE","EXTERNALGROUP.FIXED_AMOUNT","EXTERNALGROUP.PERCENTAGE"]).pipe(N()).subscribe(t=>{let o=t;this.discountTypeOptions.set([{label:o["EXTERNALGROUP.NONE"],value:"None"},{label:o["EXTERNALGROUP.FIXED_AMOUNT"],value:"Fixed Amount"},{label:o["EXTERNALGROUP.PERCENTAGE"],value:"Percentage"}])})}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-external-event-discounts"]],viewQuery:function(o,i){if(o&1&&X(OU,7),o&2){let s;Y(s=Q())&&(i.additionalFieldsDropdown=s.first)}},inputs:{autoFocus:[1,"autoFocus"],currencyType:[1,"currencyType"],form:[1,"form"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:37,vars:5,consts:[["dropdownicon",""],["incrementbuttonicon",""],["decrementbuttonicon",""],[1,"user-group-external-event-discounts"],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["formControlName","DiscountType","id","qware.user-group-external.event-discounts.input.discount-type","inputId","qware.user-group-external.event-discounts.input.discount-type","variant","filled","appendTo","body",3,"tabindex","options","fluid"],["id","qware.user-group-external.event-discounts.label.discount-type","for","qware.user-group-external.event-discounts.input.discount-type"],["translate",""],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],[1,"material-icons"],["id","qware.user-group-external.event-discounts.input.discount-amount-fa","name","DiscountAmount","inputId","qware.user-group-external.event-discounts.input.discount-amount-fa","formControlName","DiscountAmount","mode","currency","variant","filled",1,"is-filled",3,"tabindex","allowEmpty","currency","showButtons","min","fluid"],["id","qware.user-group-external.event-discounts.label.discount-amount-fa","for","qware.user-group-external.event-discounts.input.discount-amount-fa"],["id","qware.user-group-external.event-discounts.input.discount-amount-p","name","DiscountAmount","inputId","qware.user-group-external.event-discounts.input.discount-amount-p","formControlName","DiscountAmount","suffix","%","variant","filled",1,"is-filled",3,"tabindex","showButtons","min","max","fluid"],["id","qware.user-group-external.event-discounts.label.discount-amount-p","for","qware.user-group-external.event-discounts.input.discount-amount-p"]],template:function(o,i){o&1&&(n(0,"div",3),e(1,` 11012 `),n(2,"div",4),e(3,` 11013 `),n(4,"div",5),e(5,` 11014 `),e(6,` 11015 `),n(7,"div",6),e(8,` 11016 `),n(9,"p-floatlabel"),e(10,` 11017 `),n(11,"p-select",7),e(12,` 11018 `),_(13,FU,4,0,"ng-template",null,0,A),e(15,` 11019 `),a(),e(16,` 11020 `),n(17,"label",8),e(18,` 11021 `),n(19,"span",9),e(20,"EXTERNALGROUP.DISCOUNT_TYPE"),a(),e(21,` 11022 `),a(),e(22,` 11023 `),a(),e(23,` 11024 `),a(),e(24,` 11025 `),a(),e(25,` 11026 11027 `),n(26,"div",10),e(27,` 11028 `),e(28,` 11029 `),n(29,"div",6),e(30,` 11030 `),_(31,PU,19,6)(32,VU,19,5),a(),e(33,` 11031 `),a(),e(34,` 11032 `),a(),e(35,` 11033`),a(),e(36,` 11034`)),o&2&&(l(2),p("formGroup",i.form()),l(9),p("tabindex",12)("options",i.discountTypeOptions())("fluid",!0),l(20),f(i.form().controls.DiscountType.value==="Fixed Amount"?31:i.form().controls.DiscountType.value==="Percentage"?32:-1))},dependencies:[Ne,se,ge,bi,Te,De,it,$],encapsulation:2,changeDetection:0})}return r})();var yo=He(nt());var qU=()=>["label"],BU=r=>({"role-header":r}),vc=()=>({standalone:!0}),gc=(r,d)=>d.field;function HU(r,d){r&1&&(e(0,` 11035 `),n(1,"span",14),e(2,"expand_more"),a(),e(3,` 11036 `))}function WU(r,d){r&1&&(e(0,` 11037 `),n(1,"span",14),e(2,"search"),a(),e(3,` 11038 `))}function jU(r,d){if(r&1&&(e(0,` 11039 `),n(1,"th",15),e(2,` 11040 `),n(3,"span"),e(4),a(),e(5,` 11041 `),a(),e(6,` 11042 `)),r&2){let t=d.$implicit;l(),p("ngClass",pe(2,BU,t.field==="Manager"||t.field==="Access")),l(3),v(t.header)}}function YU(r,d){if(r&1&&(e(0,` 11043 `),n(1,"tr"),e(2,` 11044 `),G(3,jU,7,4,null,null,gc),a(),e(5,` 11045 `)),r&2){let t=d.$implicit;l(3),k(t)}}function QU(r,d){r&1&&(e(0,`
11046 `),n(1,"span",19),e(2,"SHARED.PENDING_APPROVAL"),a(),e(3,` 11047 `))}function KU(r,d){r&1&&(e(0,` 11048 `),n(1,"span",19),e(2,"SHARED.DISABLED"),a(),e(3,` 11049 `))}function $U(r,d){r&1&&(e(0,` 11050 `),n(1,"span",19),e(2,"SHARED.DELETED"),a(),e(3,` 11051 `))}function zU(r,d){if(r&1&&(e(0,` 11052 `),n(1,"div"),e(2,` 11053 `),n(3,"a",18),e(4),a(),e(5,` 11054 `),_(6,QU,4,0)(7,KU,4,0)(8,$U,4,0),a(),e(9,` 11055 `)),r&2){let t=m(2).$implicit,o=m();l(3),gt("routerLink","",o.userExternalEditRoute(),"/",t.UserId,""),l(),qi("",t.UserFirstName," ",t.UserLastName,""),l(2),f(t.Access?-1:6),l(),f(t.UserState==="DISABLED"?7:-1),l(),f(t.UserState==="DELETED"?8:-1)}}function XU(r,d){if(r&1&&(e(0,` 11056 `),n(1,"div",20),e(2,` 11057 `),n(3,"span"),e(4),a(),e(5,` 11058 `),a(),e(6,` 11059 `)),r&2){let t=m(2).$implicit;l(4),v(t.UserEmail)}}function ZU(r,d){if(r&1){let t=b();e(0,` 11060 `),n(1,"div",21),e(2,` 11061 `),n(3,"p-checkbox",22),j("ngModelChange",function(i){E(t);let s=m(2).$implicit;return W(s.Manager,i)||(s.Manager=i),S(i)}),h("onChange",function(i){E(t);let s=m(2).$implicit,c=m();return S(c.managerOnChange(i,s.UserId))}),a(),e(4,` 11062 `),a(),e(5,` 11063 `)}if(r&2){let t=m(2).$implicit,o=m();l(3),H("ngModel",t.Manager),p("ngModelOptions",ne(4,vc))("binary",!0)("disabled",o.loggedUserId===t.UserId)}}function JU(r,d){if(r&1){let t=b();e(0,` 11064 `),n(1,"div",21),e(2,` 11065 `),n(3,"p-checkbox",22),j("ngModelChange",function(i){E(t);let s=m(2).$implicit;return W(s.Access,i)||(s.Access=i),S(i)}),h("onChange",function(i){E(t);let s=m(2).$implicit,c=m();return S(c.accessOnChange(i,s.UserId))}),a(),e(4,` 11066 `),a(),e(5,` 11067 `)}if(r&2){let t=m(2).$implicit,o=m();l(3),H("ngModel",t.Access),p("ngModelOptions",ne(4,vc))("binary",!0)("disabled",o.loggedUserId===t.UserId)}}function e7(r,d){if(r&1&&(e(0,` 11068 `),n(1,"td"),e(2,` 11069 `),n(3,"span",17),e(4),a(),e(5,` 11070 `),_(6,zU,10,8)(7,XU,7,1)(8,ZU,6,5)(9,JU,6,5),a(),e(10,` 11071 `)),r&2){let t=d.$implicit;l(4),v(t.header),l(2),f(t.field==="UserName"?6:-1),l(),f(t.field==="UserEmail"?7:-1),l(),f(t.field==="Manager"?8:-1),l(),f(t.field==="Access"?9:-1)}}function t7(r,d){if(r&1&&(e(0,` 11072 `),n(1,"tr",16),e(2,` 11073 `),G(3,e7,11,5,null,null,gc),a(),e(5,` 11074 `)),r&2){let t=d.columns;l(3),k(t)}}function i7(r,d){r&1&&(e(0,` 11075 `),n(1,"tr"),e(2,` 11076 `),n(3,"td"),e(4,` 11077 `),n(5,"div",23),e(6,"SHARED.RECORDS_NOT_FOUND"),a(),e(7,` 11078 `),a(),e(8,` 11079 `),a(),e(9,` 11080 `)),r&2&&(l(3),Ve("colspan",5))}function n7(r,d){if(r&1&&(e(0,` 11081 `),n(1,"small",24),e(2,` 11082 `),n(3,"div",25),e(4),a(),e(5,` 11083 `),a(),e(6,` 11084 `)),r&2){let t=d.$implicit;l(4),v(t)}}function a7(r,d){if(r&1&&(e(0,` 11085 `),G(1,n7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.UserExternalGroupAssociations)}}var ls=(()=>{class r{allExternalUsers=[];allExternalUserOptions=[];allUserExternalGroupAssociations=[];externalUserGroupId;fromEditPage=ee(!1);form;submitted=!1;validationErrors;assignedUsersSelectAll=!1;isInternalUser=!1;loggedUserId;tableColumns=[];translations={};userExternalEditRoute=Ye(()=>this.fromEditPage()?"../../../"+P.userExternal+"/"+P.edit:"../../"+P.userExternal+"/"+P.edit);authService=te(de);translate=te(le);constructor(){this.loggedUserId=this.authService.currentUserId,this.isInternalUser=this.authService.currentUserType===Rt.INTERNAL,this.translate.get(["USER.NAME","USER.EMAIL","SHARED.MANAGER","SHARED.ACCESS","SHARED.DISABLED","SHARED.DELETED"]).pipe(N()).subscribe(t=>{this.translations=t,this.tableColumns=[{field:"UserName",header:this.translations["USER.NAME"]},{field:"UserEmail",header:this.translations["USER.EMAIL"]},{field:"Manager",header:this.translations["SHARED.MANAGER"]},{field:"Access",header:this.translations["SHARED.ACCESS"]}]})}onUserChange(t){if(t.length===0)this.allUserExternalGroupAssociations=[];else{let o=this.form.get("UserExternalGroupAssociations")?.value?.map(c=>c.UserId),i=yo.default.difference(o??[],t),s=yo.default.difference(t,o??[]);
11085i.forEach(c=>{if(c!==this.authService.currentUserId){let u=this.allUserExternalGroupAssociations?.find(C=>C.UserId===c);u&&this.allUserExternalGroupAssociations?.splice(this.allUserExternalGroupAssociations.indexOf(u),1);let x=this.allExternalUserOptions?.find(C=>C.value===c);x&&(x.label?.includes("("+this.translations["SHARED.DISABLED"]+")")||x.label?.includes("("+this.translations["SHARED.DELETED"]+")"))&&(this.allExternalUserOptions=this.allExternalUserOptions.filter(C=>C.value!==c))}}),s.forEach(c=>{if(!this.allUserExternalGroupAssociations?.find(x=>x.UserId===c)){let x=this.allExternalUsers?.find(C=>C.Id===c);if(x){let C=this.setUserTenantAssociationFromUser(x);this.allUserExternalGroupAssociations?.push(C)}}})}this.allUserExternalGroupAssociations=yo.default.sortBy(yo.default.cloneDeep(this.allUserExternalGroupAssociations),o=>o.UserFirstName?.toLowerCase()+" "+o.UserLastName?.toLowerCase()),this.allUserExternalGroupAssociations&&this.setFormValue()}accessOnChange(t,o){t&&(this.allUserExternalGroupAssociations.filter(i=>i.UserId===o).forEach(i=>{i.Access=t.checked}),this.setFormValue())}managerOnChange(t,o){t&&(this.allUserExternalGroupAssociations.filter(i=>i.UserId===o).forEach(i=>{i.Manager=t.checked}),this.setFormValue())}setFormValue(t=!1){let o=this.form.get("UserExternalGroupAssociations"),i=this.allUserExternalGroupAssociations.map(s=>{let c=new _a;return c.TenantGroupId=this.externalUserGroupId,c.Access=s.Access,c.Manager=s.Manager,c.UserId=s.UserId,c});if(o?.setValue(i),t){let s=this.form.get("UserIds");s?.setValue(i.filter(c=>c.UserId!==void 0).map(c=>c.UserId)),s?.markAsDirty()}o?.markAsDirty(),this.form.markAsDirty()}setUserTenantAssociationFromUser(t){let o=new _a;return o.UserFirstName=t.FirstName,o.UserLastName=t.LastName,o.UserEmail=t.Email,o.UserId=t.Id,o.UserState=t.State,o.TenantGroupId=this.externalUserGroupId,o.Access=!1,o.Manager=!1,o}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-external-assigned-users"]],inputs:{allExternalUsers:"allExternalUsers",allExternalUserOptions:"allExternalUserOptions",allUserExternalGroupAssociations:"allUserExternalGroupAssociations",externalUserGroupId:"externalUserGroupId",fromEditPage:[1,"fromEditPage"],form:"form",submitted:"submitted",validationErrors:"validationErrors"},standalone:!1,decls:47,vars:18,consts:[["dropdownicon",""],["filtericon",""],[1,"user-group-external-assigned-users"],[1,"grid","flex-inline",3,"formGroup"],[1,"col-12"],[1,"medium-input"],["id","qware.user-group-external.assigned-users.multiselect.select-users","display","chip","formControlName","UserIds","appendTo","body","variant","filled",3,"ngModelChange","tabindex","options","filterFields","maxSelectedLabels","fluid"],["id","qware.user-group-external.assigned-users.label.select-users","for","qware.user-group-external.assigned-users.multiselect.select-users"],["responsiveLayout","stack","id","qware.user-group-external.assigned-users-table",3,"value","paginator","rows","columns","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"material-icons"],[3,"ngClass"],[1,"responsive-border"],[1,"p-datatable-column-title"],[3,"routerLink"],["translate","",1,"badge"],["qwareTruncate",""],[2,"text-align","center"],[3,"ngModelChange","onChange","ngModel","ngModelOptions","binary","disabled"],["translate","",1,"no-results"],[1,"validation-error"],["translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"div",2),e(1,` 11086 `),n(2,"div",3),e(3,` 11087 `),n(4,"div",4),e(5,` 11088 `),n(6,"div",5),e(7,` 11089 `),n(8,"p-floatlabel"),e(9,` 11090 `),n(10,"p-multiselect",6),h("ngModelChange",function(u){return E(s),S(i.onUserChange(u))}),e(11,` 11091 `),_(12,HU,4,0,"ng-template",null,0,A),e(14,` 11092 `),_(15,WU,4,0,"ng-template",null,1,A),e(17,` 11093 `),a(),e(18,` 11094 `),n(19,"label",7),e(20),I(21,"translate"),a(),e(22,` 11095 `),a(),e(23,` 11096 `),a(),e(24,` 11097 `),n(25,"div",5),e(26,` 11098 `),n(27,"p-table",8),e(28,` 11099 `),_(29,YU,6,0,"ng-template",9),e(30,` 11100 `),_(31,t7,6,0,"ng-template",10),e(32,` 11101 `),_(33,i7,10,1,"ng-template",11),e(34,` 11102 `),a(),e(35,` 11103 `),n(36,"small",12),e(37,` 11104 `),n(38,"div",13),e(39,` 11105 EXTERNALGROUP.ERROR.ASSIGNED_USERS_MANAGER 11106 `),a(),e(40,` 11107 `),a(),e(41,` 11108 `),_(42,a7,3,0),a(),e(43,` 11109 `),a(),e(44,` 11110 `),a(),e(45,` 11111`),a(),e(46,` 11112`)}o&2&&(l(2),p("formGroup",i.form),l(8),p("tabindex",11)("options",i.allExternalUserOptions)("filterFields",ne(17,qU))("maxSelectedLabels",i.allExternalUserOptions.length+1)("fluid",!0),l(10),K(` 11113 `,y(21,15,"EXTERNALGROUP.SELECT_USERS"),` 11114 `),l(7),p("value",i.allUserExternalGroupAssociations)("paginator",!0)("rows",10)("columns",i.tableColumns)("scrollable",!0),l(9),p("hidden",i.form.controls.UserExternalGroupAssociations.valid||i.form.controls.UserExternalGroupAssociations.pristine&&!i.submitted),l(2),p("hidden",!(i.form.controls.UserExternalGroupAssociations.errors!=null&&i.form.controls.UserExternalGroupAssociations.errors.atLeastOneAllTrue)),l(4),f(i.validationErrors&&i.validationErrors.UserExternalGroupAssociations&&i.form.controls.UserExternalGroupAssociations.untouched?42:-1))},dependencies:[Pe,yt,Qe,Ne,se,ge,Le,Ni,kt,Te,De,et,ht,$,ie],styles:[".role-header[_ngcontent-%COMP%]{max-width:10%;text-align:center!important;word-wrap:break-word;width:100%}"],changeDetection:0})}return r})();var ss=He(Hn());var r7=["certificate"];function o7(r,d){if(r&1&&(e(0,` 11115 `),n(1,"small",26),e(2,` 11116 `),n(3,"div",7),e(4),a(),e(5,` 11117 `),a(),e(6,` 11118 `)),r&2){let t=d.$implicit;l(4),v(t)}}function l7(r,d){if(r&1&&(e(0,` 11119 `),G(1,o7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Name)}}function s7(r,d){if(r&1&&(e(0,` 11120 `),n(1,"small",26),e(2,` 11121 `),n(3,"div",7),e(4),a(),e(5,` 11122 `),a(),e(6,` 11123 `)),r&2){let t=d.$implicit;l(4),v(t)}}function d7(r,d){if(r&1&&(e(0,` 11124 `),G(1,s7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().PhoneNumber)}}function p7(r,d){if(r&1&&(e(0,` 11125 `),n(1,"small",26),e(2,` 11126 `),n(3,"div",7),e(4),a(),e(5,` 11127 `),a(),e(6,` 11128 `)),r&2){let t=d.$implicit;l(4),v(t)}}function m7(r,d){if(r&1&&(e(0,` 11129 `),G(1,p7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().AddressStreet)}}function c7(r,d){if(r&1&&(e(0,` 11130 `),n(1,"small",26),e(2,` 11131 `),n(3,"div",7),e(4),a(),e(5,` 11132 `),a(),e(6,` 11133 `)),r&2){let t=d.$implicit;l(4),v(t)}}function u7(r,d){if(r&1&&(e(0,` 11134 `),G(1,c7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().AddressCity)}}function _7(r,d){if(r&1&&(e(0,` 11135 `),n(1,"small",26),e(2,` 11136 `),n(3,"div",7),e(4),a(),e(5,` 11137 `),a(),e(6,` 11138 `)),r&2){let t=d.$implicit;l(4),v(t)}}function E7(r,d){if(r&1&&(e(0,` 11139 `),G(1,_7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().AddressState)}}function S7(r,d){if(r&1&&(e(0,` 11140 `),n(1,"small",26),e(2,` 11141 `),n(3,"div",7),e(4),a(),e(5,` 11142 `),a(),e(6,` 11143 `)),r&2){let t=d.$implicit;l(4),v(t)}}function x7(r,d){if(r&1&&(e(0,` 11144 `),G(1,S7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().AddressZip)}}function f7(r,d){r&1&&(e(0,` 11145 `),n(1,"span",8),e(2," *"),a(),e(3,` 11146 `))}function h7(r,d){if(r&1&&(e(0,` 11147 `),n(1,"small",26),e(2,` 11148 `),n(3,"div",7),e(4),a(),e(5,` 11149 `),a(),e(6,` 11150 `)),r&2){let t=d.$implicit;l(4),v(t)}}function C7(r,d){if(r&1&&(e(0,` 11151 `),G(1,h7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().HasCertificateFile)}}function v7(r,d){r&1&&(e(0,` 11152 `),n(1,"span",27),e(2,"event"),a(),e(3,` 11153 `))}function g7(r,d){r&1&&(e(0,` 11154 `),n(1,"span",8),e(2," *"),a(),e(3,` 11155 `))}function T7(r,d){if(r&1&&(e(0,` 11156 `),n(1,"small",26),e(2,` 11157 `),n(3,"div",7),e(4),a(),e(5,` 11158 `),a(),e(6,` 11159 `)),r&2){let t=d.$implicit;l(4),v(t)}}function I7(r,d){if(r&1&&(e(0,` 11160 `),G(1,T7,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().CertificateExpirationDateUTC)}}function b7(r,d){if(r&1&&(e(0,` 11161 `),n(1,"small",26),e(2,` 11162 `),n(3,"div",7),e(4),a(),e(5,` 11163 `),a(),e(6,` 11164 `)),r&2){let t=d.$implicit;l(4),v(t)}}function y7(r,d){if(r&1&&(e(0,` 11165 `),n(1,"div"),e(2,` 11166 `),G(3,b7,7,1,null,null,J),a(),e(5,` 11167 `)),r&2){let t=m(2);l(3),k(t.validationErrors().DefaultEventCategoryId)}}function A7(r,d){if(r&1){let t=b();e(0,` 11168 `),n(1,"div",11),e(2,` 11169 `),e(3,`
11170 `),n(4,"div",4),e(5,` 11171 `),n(6,"qware-autocomplete",28),h("selectChange",function(i){E(t);let s=m();return S(s.eventCategoryChanged(i))})("unselectChange",function(i){E(t);let s=m();return S(s.eventCategoryChanged(i))}),e(7,` 11172 `),a(),e(8,` 11173 `),n(9,"small",9),e(10,` 11174 `),n(11,"div",10),e(12,"EXTERNALGROUP.ERROR.DEFAULT_EVENT_CATEGORY_REQUIRED"),a(),e(13,` 11175 `),a(),e(14,` 11176 `),_(15,y7,6,0),a(),e(16,` 11177 `),a(),e(17,` 11178 `)}if(r&2){let t,o=m();l(6),p("tabindex",9)("options",o.allEventCategoryOptions())("singleSelect",!0)("isRequired",!0),l(3),p("hidden",o.form().controls.DefaultEventCategoryId.valid||o.form().controls.DefaultEventCategoryId.pristine&&!o.submitted()),l(2),p("hidden",!((t=o.form().controls.DefaultEventCategoryId.errors)!=null&&t.required)),l(4),f(o.validationErrors()&&o.validationErrors().DefaultEventCategoryId&&o.form().controls.DefaultEventCategoryId.untouched?15:-1)}}function R7(r,d){if(r&1&&(e(0,` 11179 `),n(1,"small",26),e(2,` 11180 `),n(3,"div",7),e(4),a(),e(5,` 11181 `),a(),e(6,` 11182 `)),r&2){let t=d.$implicit;l(4),v(t)}}function w7(r,d){if(r&1&&(e(0,` 11183 `),n(1,"div"),e(2,` 11184 `),G(3,R7,7,1,null,null,J),a(),e(5,` 11185 `)),r&2){let t=m(2);l(3),k(t.validationErrors().DefaultEventCalendarId)}}function D7(r,d){if(r&1&&(e(0,` 11186 `),n(1,"div",3),e(2,` 11187 `),e(3,` 11188 `),n(4,"div",4),e(5,` 11189 `),n(6,"qware-autocomplete",29),e(7,` 11190 `),a(),e(8,` 11191 `),n(9,"small",9),e(10,` 11192 `),n(11,"div",10),e(12,"EXTERNALGROUP.ERROR.DEFAULT_EVENT_CALENDAR_REQUIRED"),a(),e(13,` 11193 `),a(),e(14,` 11194 `),_(15,w7,6,0),a(),e(16,` 11195 `),a(),e(17,` 11196 `)),r&2){let t,o=m();l(6),p("tabindex",10)("options",o.allEventCalendarOptions())("singleSelect",!0)("isRequired",!0),l(3),p("hidden",o.form().controls.DefaultEventCalendarId.valid||o.form().controls.DefaultEventCalendarId.pristine&&!o.submitted()),l(2),p("hidden",!((t=o.form().controls.DefaultEventCalendarId.errors)!=null&&t.required)),l(4),f(o.validationErrors()&&o.validationErrors().DefaultEventCalendarId&&o.form().controls.DefaultEventCalendarId.untouched?15:-1)}}var $r=(()=>{class r{certificate;allEventCalendarOptions=ee([]);allEventCategoryOptions=ee([]);autoFocus=ee(!0);certificateRequired=ee(!1);disableAttachmentControls=ee(!1);docs=ee([]);editPage=ee(!1);form=ee.required();isInternalUser=ee(!1);submitted=ee(!1);validationErrors=ee();docsChanged=Dt();eventCategoryChange=Dt();textareaFocusChange=Dt();yearRange=D(void 0);minDate=D(new Date);defaultHomePageOptions=[];libraryOptions=Yo;stateOptions=s0;constructor(){this.yearRange.set((0,ss.default)().format("YYYY")+":"+(0,ss.default)().add(50,"years").format("YYYY")),this.minDate.set((0,ss.default)().toDate())}textareaFocus(t){this.textareaFocusChange.emit(t)}setDocs(t){t instanceof Event||this.docsChanged.emit(t)}eventCategoryChanged(t){this.eventCategoryChange.emit(t)}filesChanged(t){let o=t.files.newFiles,i=t.files.existingFiles,s=this.form().get("HasCertificateFile");o&&o.length>0||i&&t.files.existingFiles.length>0?(s?.setValue(!0),o.length>0&&i.length===1&&this.certificate.fileRemoveExisting(0)):s?.setValue(null),t.markDirty&&s?.markAsDirty()}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-group-external-info"]],viewQuery:function(o,i){if(o&1&&X(r7,7),o&2){let s;Y(s=Q())&&(i.certificate=s.first)}},inputs:{allEventCalendarOptions:[1,"allEventCalendarOptions"],allEventCategoryOptions:[1,"allEventCategoryOptions"],autoFocus:[1,"autoFocus"],certificateRequired:[1,"certificateRequired"],disableAttachmentControls:[1,"disableAttachmentControls"],docs:[1,"docs"],editPage:[1,"editPage"],form:[1,"form"],isInternalUser:[1,"isInternalUser"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},outputs:{docsChanged:"docsChanged",eventCategoryChange:"eventCategoryChange",textareaFocusChange:"textareaFocusChange"},standalone:!1,decls:230,vars:64,consts:[["certificate",""],["triggericon",""],[1,"grid","zipper",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.usergroup-external.group-information.input.group-name","type","text","pInputText","","name","Group Name","formControlName","Name","variant","filled",3,"tabindex","qwareFocus","fluid"],["id","qware.usergroup-external.group-information.label.group-name","for","qware.usergroup-external.group-information.input.group-name"],["translate",""],[1,"required-mark"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["inputId","qware.usergroup-external.group-information.input.phone","styleClass","full-width","mask","(999) 999-9999","name","phone","formControlName","PhoneNumber","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.usergroup-external.group-information.label.phone","for","qware.usergroup-external.group-information.input.phone"],["id","qware.usergroup-external.group-information.input.address","type","text","pInputText","","name","Address","formControlName","AddressStreet","variant","filled",3,"tabindex","fluid"],["id","qware.usergroup-external.group-information.label.address","for","qware.usergroup-external.group-information.input.address"],["id","qware.usergroup-external.group-information.input.city","type","text","pInputText","","name","City","formControlName","AddressCity","variant","filled",3,"tabindex","fluid"],["id","qware.usergroup-external.group-information.label.city","for","qware.usergroup-external.group-information.input.city"],["id","qware.usergroup-external.group-information.input.state","formControlName","AddressState","label","EXTERNALGROUP.ADDRESS_STATE","elementId","qware.usergroup-external.group-information.state",3,"tabindex","options","singleSelect","isRequired"],["id","qware.usergroup-external.group-information.input.zip","type","text","pInputText","","name","Zip","formControlName","AddressZip","maxlength","5","variant","filled",3,"tabindex","fluid"],["id","qware.usergroup-external.group-information.label.zip","for","qware.usergroup-external.group-information.input.zip"],[1,"col-12","field-container"],["id","qware.usergroup-external.group-information.certificate.label","for","qware.usergroup-external.group-information.certificate",1,"cert-label"],["tabindex","7","controlId","CertificateUpload","acceptedFileExtensions",".pdf,.jpg,.png,.doc,.docx","id","qware.usergroup-external.group-information.certificate-file-upload",3,"docsCh
11196anged","filesChanged","form","docs","multiple","saveToLibraryOption","getLibraryDocuments","disableAllControls"],["formControlName","CertificateExpirationDateUTC","inputId","qware.usergroup-external.group-information.input.certificate-exp","variant","filled","appendTo","body",1,"is-filled",3,"tabindex","showIcon","showButtonBar","monthNavigator","minDate","yearNavigator","yearRange","fluid"],["id","qware.usergroup-external.group-information.label.certificate-exp","for","qware.usergroup-external.group-information.input.certificate-exp"],[1,"validation-error"],[1,"material-icons"],["formControlName","DefaultEventCategoryId","label","EXTERNALGROUP.DEFAULT_EVENT_CATEGORY","elementId","qware.usergroup-external.group-information.input.default-event-cat","labelId","qware.usergroup-external.group-information.label.default-event-cat","id","qware.usergroup-external.group-information.input.default-event-cat-e2e",3,"selectChange","unselectChange","tabindex","options","singleSelect","isRequired"],["formControlName","DefaultEventCalendarId","label","EXTERNALGROUP.DEFAULT_EVENT_CALENDAR","elementId","qware.usergroup-external.group-information.input.default-event-cal","labelId","qware.usergroup-external.group-information.label.default-event-cal","id","qware.usergroup-external.group-information.input.default-event-cal-e2e",3,"tabindex","options","singleSelect","isRequired"]],template:function(o,i){if(o&1){let s=b();n(0,"div",2),e(1,` 11197 `),n(2,"div",3),e(3,` 11198 `),e(4,` 11199 `),n(5,"div",4),e(6,` 11200 `),n(7,"p-floatlabel"),e(8,` 11201 `),R(9,"input",5),e(10,` 11202 `),n(11,"label",6),e(12,` 11203 `),n(13,"span",7),e(14,"EXTERNALGROUP.GROUP_NAME"),a(),n(15,"span",8),e(16," *"),a(),e(17,` 11204 `),a(),e(18,` 11205 `),a(),e(19,` 11206 `),n(20,"small",9),e(21,` 11207 `),n(22,"div",10),e(23,` 11208 EXTERNALGROUP.ERROR.NAME_REQUIRED 11209 `),a(),e(24,` 11210 `),n(25,"div",10),e(26,` 11211 EXTERNALGROUP.ERROR.NAME_LENGTH 11212 `),a(),e(27,` 11213 `),a(),e(28,` 11214 `),_(29,l7,3,0),a(),e(30,` 11215 `),a(),e(31,` 11216 11217 `),n(32,"div",11),e(33,` 11218 `),e(34,` 11219 `),n(35,"div",4),e(36,` 11220 `),n(37,"p-floatlabel"),e(38,` 11221 `),n(39,"p-inputmask",12),e(40,` 11222 `),a(),e(41,` 11223 `),n(42,"label",13),e(43,` 11224 `),n(44,"span",7),e(45,"EXTERNALGROUP.PHONE"),a(),n(46,"span",8),e(47," *"),a(),e(48,` 11225 `),a(),e(49,` 11226 `),a(),e(50,` 11227 `),n(51,"small",9),e(52,` 11228 `),n(53,"div",10),e(54,` 11229 EXTERNALGROUP.ERROR.PHONENUMBER_REQUIRED 11230 `),a(),e(55,` 11231 `),a(),e(56,` 11232 `),_(57,d7,3,0),a(),e(58,` 11233 `),a(),e(59,` 11234 11235 `),n(60,"div",3),e(61,` 11236 `),e(62,` 11237 `),n(63,"div",4),e(64,` 11238 `),n(65,"p-floatlabel"),e(66,` 11239 `),R(67,"input",14),e(68,` 11240 `),n(69,"label",15),e(70,` 11241 `),n(71,"span",7),e(72,"EXTERNALGROUP.ADDRESS"),a(),n(73,"span",8),e(74," *"),a(),e(75,` 11242 `),a(),e(76,` 11243 `),a(),e(77,` 11244 `),n(78,"small",9),e(79,` 11245 `),n(80,"div",10),e(81,` 11246 EXTERNALGROUP.ERROR.ADDRESS_STREET_REQUIRED 11247 `),a(),e(82,` 11248 `),n(83,"div",10),e(84,` 11249 EXTERNALGROUP.ERROR.ADDRESS_STREET_LENGTH 11250 `),a(),e(85,` 11251 `),a(),e(86,` 11252 `),_(87,m7,3,0),a(),e(88,` 11253 `),a(),e(89,` 11254 11255 `),n(90,"div",11),e(91,` 11256 `),e(92,` 11257 `),n(93,"div",4),e(94,` 11258 `),n(95,"p-floatlabel"),e(96,` 11259 `),R(97,"input",16),e(98,` 11260 `),n(99,"label",17),e(100,` 11261 `),n(101,"span",7),e(102,"EXTERNALGROUP.ADDRESS_CITY"),a(),n(103,"span",8),e(104," *"),a(),e(105,` 11262 `),a(),e(106,` 11263 `),a(),e(107,` 11264 `),n(108,"small",9),e(109,` 11265 `),n(110,"div",10),e(111,` 11266 EXTERNALGROUP.ERROR.ADDRESS_CITY_REQUIRED 11267 `),a(),e(112,` 11268 `),n(113,"div",10),e(114,` 11269 EXTERNALGROUP.ERROR.ADDRESS_CITY_LENGTH 11270 `),a(),e(115,` 11271 `),a(),e(116,` 11272 `),_(117,u7,3,0),a(),e(118,` 11273 `),a(),e(119,` 11274 11275 `),n(120,"div",3),e(121,` 11276 `),e(122,` 11277 `),n(123,"div",4),e(124,` 11278 `),n(125,"qware-autocomplete",18),e(126,` 11279 `),a(),e(127,` 11280 `),n(128,"small",9),e(129,` 11281 `),n(130,"div",10),e(131,"EXTERNALGROUP.ERROR.ADDRESS_STATE_REQUIRED"),a(),e(132,` 11282 `),a(),e(133,` 11283 `),_(134,E7,3,0),a(),e(135,` 11284 `),a(),e(136,` 11285 11286 `),n(137,"div",11),e(138,` 11287 `),e(139,` 11288 `),n(140,"div",4),e(141,` 11289 `),n(142,"p-floatlabel"),e(143,` 11290 `),R(144,"input",19),e(145,` 11291 `),n(146,"label",20),e(147,` 11292 `),n(148,"span",7),e(149,"EXTERNALGROUP.ADDRESS_ZIPCODE"),a(),n(150,"span",8),e(151," *"),a(),e(152,` 11293 `),a(),e(153,` 11294 `),a(),e(154,` 11295 `),n(155,"small",9),e(156,` 11296 `),n(157,"div",10),e(158,` 11297 EXTERNALGROUP.ERROR.ADDRESS_ZIP_REQUIRED 11298 `),a(),e(159,` 11299 `),n(160,"div",10),e(161,` 11300 EXTERNALGROUP.ERROR.ADDRESS_ZIP_NOTNUMBER 11301 `),a(),e(162,` 11302 `),n(163,"div",10),e(164,` 11303 EXTERNALGROUP.ERROR.ADDRESS_ZIP_LENGTH 11304 `),a(),e(165,` 11305 `),a(),e(166,` 11306 `),_(167,x7,3,0),a(),e(168,` 11307 `),a(),e(169,` 11308 11309 `),n(170,"div",21),e(171,` 11310 `),e(172,` 11311 `),n(173,"div",4),e(174,` 11312 `),n(175,"span"),e(176,` 11313 `),n(177,"label",22),e(178,` 11314 `),n(179,"span",7),e(180,"EXTERNALGROUP.CERTIFICATE"),a(),e(181,` 11315 `),_(182,f7,4,0),a(),e(183,` 11316 `),n(184,"qware-attachments",23,0),h("docsChanged",function(u){return E(s),S(i.setDocs(u))})("filesChanged",function(u){return E(s),S(i.filesChanged(u))}),e(186,` 11317 `),a(),e(187,` 11318 `),a(),e(188,` 11319 `),n(189,"small",9),e(190,` 11320 `),n(191,"div",10),e(192,` 11321 EXTERNALGROUP.ERROR.CERTIFICATE_REQUIRED 11322 `),a(),e(193,` 11323 `),a(),e(194,` 11324 `),_(195,C7,3,0),a(),e(196,` 11325 `),a(),e(197,` 11326 11327 `),n(198,"div",3),e(199,` 11328 `),e(200,` 11329 `),n(201,"div",4),e(202,` 11330 `),n(203,"p-floatlabel"),e(204,` 11331 `),n(205,"p-datepicker",24),e(206,` 11332 `),_(207,v7,4,0,"ng-template",null,1,A),e(209,` 11333 `),a(),e(210,` 11334 `),n(211,"label",25),e(212,`
11335 `),n(213,"span",7),e(214,"EXTERNALGROUP.CERTIFICATE_EXP"),a(),e(215,` 11336 `),_(216,g7,4,0),a(),e(217,` 11337 `),a(),e(218,` 11338 `),n(219,"small",9),e(220,` 11339 `),n(221,"div",10),e(222,` 11340 EXTERNALGROUP.ERROR.CERTIFICATE_EXPIRATION_DATE_REQUIRED 11341 `),a(),e(223,` 11342 `),a(),e(224,` 11343 `),_(225,I7,3,0),a(),e(226,` 11344 `),a(),e(227,` 11345 11346 `),_(228,A7,18,7)(229,D7,18,7),a()}if(o&2){let s,c,u,x,C,O,w,F,L,U,V,z,ce;p("formGroup",i.form()),l(9),p("tabindex",1)("qwareFocus",i.autoFocus())("fluid",!0),l(11),p("hidden",i.form().controls.Name.valid||i.form().controls.Name.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.Name.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.Name.errors)!=null&&c.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().Name&&i.form().controls.Name.untouched?29:-1),l(10),p("tabindex","2")("unmask",!0)("autoClear",!1),l(12),p("hidden",i.form().controls.PhoneNumber.valid||i.form().controls.PhoneNumber.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.PhoneNumber.errors)!=null&&u.required)),l(4),f(i.validationErrors()&&i.validationErrors().PhoneNumber&&i.form().controls.PhoneNumber.untouched?57:-1),l(10),p("tabindex",3)("fluid",!0),l(11),p("hidden",i.form().controls.AddressStreet.valid||i.form().controls.AddressStreet.pristine&&!i.submitted()),l(2),p("hidden",!((x=i.form().controls.AddressStreet.errors)!=null&&x.required)),l(3),p("hidden",!((C=i.form().controls.AddressStreet.errors)!=null&&C.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().AddressStreet&&i.form().controls.AddressStreet.untouched?87:-1),l(10),p("tabindex",4)("fluid",!0),l(11),p("hidden",i.form().controls.AddressCity.valid||i.form().controls.AddressCity.pristine&&!i.submitted()),l(2),p("hidden",!((O=i.form().controls.AddressCity.errors)!=null&&O.required)),l(3),p("hidden",!((w=i.form().controls.AddressCity.errors)!=null&&w.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().AddressCity&&i.form().controls.AddressCity.untouched?117:-1),l(8),p("tabindex",5)("options",i.stateOptions)("singleSelect",!0)("isRequired",!0),l(3),p("hidden",i.form().controls.AddressState.valid||i.form().controls.AddressState.pristine&&!i.submitted()),l(2),p("hidden",!((F=i.form().controls.AddressState.errors)!=null&&F.required)),l(4),f(i.validationErrors()&&i.validationErrors().AddressState&&i.form().controls.AddressState.untouched?134:-1),l(10),p("tabindex",6)("fluid",!0),l(11),p("hidden",i.form().controls.AddressZip.valid||i.form().controls.AddressZip.pristine&&!i.submitted()),l(2),p("hidden",!((L=i.form().controls.AddressZip.errors)!=null&&L.required)),l(3),p("hidden",!((U=i.form().controls.AddressZip.errors)!=null&&U.pattern)),l(3),p("hidden",!((V=i.form().controls.AddressZip.errors)!=null&&V.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().AddressZip&&i.form().controls.AddressZip.untouched?167:-1),l(15),f(i.certificateRequired()?182:-1),l(2),p("form",i.form())("docs",i.docs())("multiple",!1)("saveToLibraryOption",i.libraryOptions.HIDE)("getLibraryDocuments",!1)("disableAllControls",i.disableAttachmentControls()),l(5),p("hidden",i.form().controls.HasCertificateFile.valid||i.form().controls.HasCertificateFile.pristine&&!i.submitted()),l(2),p("hidden",!((z=i.form().controls.HasCertificateFile.errors)!=null&&z.required)),l(4),f(i.validationErrors()&&i.validationErrors().HasCertificateFile&&i.form().controls.HasCertificateFile.untouched?195:-1),l(10),p("tabindex",8)("showIcon",!0)("showButtonBar",!0)("monthNavigator",!0)("minDate",i.minDate())("yearNavigator",!0)("yearRange",i.yearRange()||"")("fluid",!0),l(11),f(i.certificateRequired()?216:-1),l(3),p("hidden",i.form().controls.CertificateExpirationDateUTC.valid||i.form().controls.CertificateExpirationDateUTC.pristine&&!i.submitted()),l(2),p("hidden",!((ce=i.form().controls.CertificateExpirationDateUTC.errors)!=null&&ce.required)),l(4),f(i.validationErrors()&&i.validationErrors().CertificateExpirationDateUTC&&i.form().controls.CertificateExpirationDateUTC.untouched?225:-1),l(3),f(i.isInternalUser()?228:-1),l(),f(i.isInternalUser()?229:-1)}},dependencies:[Jn,Ne,je,Ae,se,ge,Gd,Un,ye,ta,wt,Te,De,$],styles:[".cert-label[_ngcontent-%COMP%]{font-size:11px;color:var(--p-surface-800)}.cert-label[_ngcontent-%COMP%] .required-mark[_ngcontent-%COMP%]{color:var(--p-accent-50)}"],changeDetection:0})}return r})();var L7=["userGroupInfo"];function N7(r,d){r&1&&(e(0,` 11347 `),n(1,"span",15),e(2,"EXTERNALGROUP.CREATE_EXT_USER_GROUP"),a(),e(3,` 11348 `))}function O7(r,d){r&1&&(e(0,` 11349 `),n(1,"span",15),e(2,"EXTERNALGROUP.REQUEST_NEW_GROUP"),a(),e(3,` 11350 `))}function F7(r,d){if(r&1){let t=b();e(0,` 11351 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 11352 `),n(3,"span",18),e(4),a(),e(5,` 11353 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 11354 `),a(),e(10,` 11355 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"EXTERNALGROUP.GROUP_INFORMATION"))}}function M7(r,d){if(r&1){let t=b();e(0,` 11356 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 11357 `),n(3,"span",18),e(4),a(),e(5,` 11358 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 11359 `),a(),e(10,` 11360 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"EXTERNALGROUP.ASSIGNED_USERS"))}}function U7(r,d){if(r&1){let t=b();e(0,` 11361 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 11362 `),n(3,"span",18),e(4),a(),e(5,` 11363 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 11364 `),a(),e(10,` 11365 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"EXTERNALGROUP.EVENT_DISCOUNTS"))}}function P7(r,d){if(r&1&&(e(0,` 11366 `),n(1,"p-step",16),e(2,` 11367 `),_(3,F7,11,4,"ng-template",null,1,A),e(5,` 11368 `),a(),e(6,` 11369 `),n(7,"p-step",16),e(8,` 11370 `),_(9,M7,11,4,"ng-template",null,1,A),e(11,` 11371 `),a(),e(12,` 11372 `),n(13,"p-step",16),e(14,` 11373 `),_(15,U7,11,4,"ng-template",null,1,A),e(17,` 11374 `),a(),e(18,` 11375 `)),r&2){let t=m();l(),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1),l(6),ve("p-disabled",t.stepIndex<2),p("value",2)}}var Ic=(()=>{class r{attachmentService;authService;
11375appSettingsService;eventService;externalUserGroupService;fb;toastService;responseService;route;router;translate;userService;userGroupInfo;allEventCalendarOptions=[];allEventCalendars=[];allEventCategoryOptions=[];allExternalUserOptions=[];allExternalUsers=[];certificateRequired=!1;currencyType="USD";displaySpinner=!0;docs=[];form;isInternalUser=!1;isLoaded=!1;submitted=!1;subscriptions;stepIndex=0;steps=[];textareaFocused=!1;timezone;validationErrors;constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.attachmentService=t,this.authService=o,this.appSettingsService=i,this.eventService=s,this.externalUserGroupService=c,this.fb=u,this.toastService=x,this.responseService=C,this.route=O,this.router=w,this.translate=F,this.userService=L,this.isInternalUser=this.authService.currentUserType===Rt.INTERNAL}ngOnInit(){this.createForm();let t=[this.appSettingsService.getAppSettings().pipe(N())];if(this.isInternalUser){t.push(this.eventService.getCalendars()),t.push(this.eventService.getCategories()),t.push(this.userService.getExternalUsers(this.authService.currentUser?.TenantId??""));let o=this.form.get("GroupDetails.DefaultEventCategoryId"),i=this.form.get("GroupDetails.DefaultEventCalendarId"),s=this.form.get("SecurityAccess.UserExternalGroupAssociations");o?.addValidators([T.required]),o?.updateValueAndValidity(),i?.addValidators([T.required]),i?.updateValueAndValidity(),s?.addValidators([Qi.atLeastOneObjectAllTrue(["Access","Manager"])]),s?.updateValueAndValidity()}ue(t).subscribe(o=>{let i=o[0],s=o[1]??[],c=o[2]??[];if(this.allExternalUsers=o[3]??[],this.timezone=i.Timezone??"",this.currencyType=i.CurrencyType??"USD",this.certificateRequired=i.RequireInsuranceCertificate??!1,this.certificateRequired){let C=this.form.get("GroupDetails.CertificateExpirationDateUTC"),O=this.form.get("GroupDetails.HasCertificateFile"),w=this.form.get("GroupDetails.DocumentIds");C?.addValidators([T.required]),C?.updateValueAndValidity(),O?.addValidators([T.required]),O?.updateValueAndValidity(),w?.addValidators([Qi.maxSize(1)]),w?.updateValueAndValidity()}let u=[];this.allEventCalendars=s.filter(C=>C.State===M.ACTIVE),this.allEventCalendarOptions=this.allEventCalendars.map(C=>({label:C.Name,value:C.Id})),u=rd.default.uniq(this.allEventCalendars.filter(C=>C.CategoryId!==void 0).map(C=>C.CategoryId??""));let x=c.filter(C=>C.State===M.ACTIVE&&u.includes(C.Id??""));this.allEventCategoryOptions=x.map(C=>({label:C.Name,value:C.Id})),this.allExternalUserOptions=rd.default.sortBy(this.allExternalUsers.filter(C=>C.State===M.ACTIVE).map(C=>({label:C.fullName(),value:C.Id})),C=>C.label.toLowerCase()),this.displaySpinner=!1})}createForm(){this.form=this.fb.group({GroupDetails:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),PhoneNumber:this.fb.control("",[T.required]),AddressStreet:this.fb.control("",[T.required,T.maxLength(jn)]),AddressCity:this.fb.control("",[T.required,T.maxLength(jn)]),AddressState:this.fb.control("",[T.required]),AddressZip:this.fb.control("",[T.required,T.pattern("^[0-9]*"),T.minLength(5),T.maxLength(5)]),CertificateExpirationDateUTC:this.fb.control(null),HasCertificateFile:this.fb.control(null),DocumentIds:this.fb.control([]),DefaultEventCalendarId:this.fb.control(null),DefaultEventCategoryId:this.fb.control(null)}),SecurityAccess:this.fb.group({UserIds:this.fb.control([]),UserExternalGroupAssociations:this.fb.control([])}),EventDiscounts:this.fb.group({DiscountType:this.fb.control(""),DiscountAmount:this.fb.control("0")})}),this.steps=[{label:"EXTERNALGROUP.GROUP_INFORMATION",value:0,control:this.form.get("GroupDetails")},{label:"EXTERNALGROUP.ASSIGNED_USERS",value:1,control:this.form.get("SecurityAccess")},{label:"EXTERNALGROUP.EVENT_DISCOUNTS",value:2,control:this.form.get("EventDiscounts")}]}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../../"+P.userList],t)}else this.stepIndex--}stepSubmit(t){this.steps[t].control?.valid&&(this.isInternalUser&&t<2?this.stepIndex++:this.submitForm())}submitForm(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Ma().parseForm(this.form.value,this.timezone??"");t.Approved=this.isInternalUser,t.UserExternalGroupAssociations||(t.UserExternalGroupAssociations=[]),this.subscriptions=this.attachmentService.upload().pipe(N(),we(o=>o?this.externalUserGroupService.handleAttachmentUpload(o,t,this.docs,this.userGroupInfo.certificate):wi(()=>new Error("Upload error."))),we(()=>this.externalUserGroupService.createExternalUserGroup(t,this.authService.tenant.Id)),we(()=>this.isInternalUser?Fe({}):this.userService.getExternalUser(this.authService.currentUserId,this.authService.tenant.Id))).subscribe({next:o=>{this.isInternalUser||(this.authService.currentUser=o),this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.CREATE","../../"+P.userList,this.route,{name:t.Name})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(i=>i.control),this.validationErrors)}}),this.fileUpload()}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}fileUpload(){this.userGroupInfo.certificate&&this.userGroupInfo.certificate.fileup.files.length>0?this.userGroupInfo.certificate.fileup.upload():this.attachmentService.clearObservable()}updateTextAreaFocus(t){this.textareaFocused=t}eventCategoryChanged(t){if(t&&t.value){let o=t.value;this.allEventCalendarOptions=this.allEventCalendars.filter(s=>s.CategoryId===o).map(s=>({label:s.Name,value:s.Id}));
11375let i=this.form.get("GroupDetails.DefaultEventCalendarId");if(this.allEventCalendarOptions.length===1){let s=this.allEventCalendarOptions[0];i?.setValue(s)}else i?.setValue(null)}}setDocs(t){t instanceof Event||(this.docs=t)}static \u0275fac=function(o){return new(o||r)(g(ui),g(de),g(dt),g(oi),g(un),g(be),g(Se),g(Re),g(he),g(Be),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-group-external-create"]],viewQuery:function(o,i){if(o&1&&X(L7,7),o&2){let s;Y(s=Q())&&(i.userGroupInfo=s.first)}},standalone:!1,decls:66,vars:34,consts:[["userGroupInfo",""],["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.user-group-external.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.user-group-external.create.header",1,"page-header"],[3,"valueChange","value"],[3,"hidden"],["translate","",1,"page-header"],[3,"docsChanged","textareaFocusChange","eventCategoryChange","form","submitted","validationErrors","allEventCalendarOptions","allEventCategoryOptions","certificateRequired","docs","isInternalUser"],[3,"form","submitted","fromEditPage","validationErrors","allExternalUsers","allExternalUserOptions"],[3,"form","submitted","validationErrors","currencyType"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.usergroup.group-information.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.usergroup.group-information.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["translate",""],[3,"value"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){if(o&1){let s=b();n(0,"div",2),h("keydown.enter",function(){return E(s),S(i.textareaFocused?void 0:i.stepSubmit(i.stepIndex))}),e(1,` 11376 `),n(2,"qware-spinner",3),e(3,` 11377 `),n(4,"div",4),e(5,` 11378 `),n(6,"h3",5),e(7,` 11379 `),_(8,N7,4,0)(9,O7,4,0),a(),e(10,` 11380 `),n(11,"p-stepper",6),j("valueChange",function(u){return E(s),W(i.stepIndex,u)||(i.stepIndex=u),S(u)}),e(12,` 11381 `),n(13,"p-step-list"),e(14,` 11382 `),_(15,P7,19,7),a(),e(16,` 11383 `),n(17,"p-step-panels"),e(18,` 11384 `),n(19,"p-card"),e(20,` 11385 `),n(21,"div",7),e(22,` 11386 `),n(23,"h4",8),e(24,` 11387 EXTERNALGROUP.GROUP_INFORMATION 11388 `),a(),e(25,` 11389 `),n(26,"qware-user-group-external-info",9,0),h("docsChanged",function(u){return E(s),S(i.setDocs(u))})("textareaFocusChange",function(u){return E(s),S(i.updateTextAreaFocus(u))})("eventCategoryChange",function(u){return E(s),S(i.eventCategoryChanged(u))}),e(28,` 11390 `),a(),e(29,` 11391 `),a(),e(30,` 11392 `),n(31,"div",7),e(32,` 11393 `),n(33,"h4",8),e(34,` 11394 EXTERNALGROUP.ASSIGNED_USERS 11395 `),a(),e(35,` 11396 `),n(36,"qware-user-group-external-assigned-users",10),e(37,` 11397 `),a(),e(38,` 11398 `),a(),e(39,` 11399 `),n(40,"div",7),e(41,` 11400 `),n(42,"h4",8),e(43,` 11401 EXTERNALGROUP.EVENT_DISCOUNTS 11402 `),a(),e(44,` 11403 `),n(45,"qware-user-group-external-event-discounts",11),e(46,` 11404 `),a(),e(47,` 11405 `),a(),e(48,` 11406 `),n(49,"div",12),e(50,` 11407 `),n(51,"p-button",13),I(52,"translate"),h("onClick",function(){return E(s),S(i.stepBack())}),e(53,` 11408 `),a(),e(54,` 11409 `),n(55,"p-button",14),I(56,"translate"),h("onClick",function(){return E(s),S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(57,` 11410 `),a(),e(58,` 11411 `),a(),e(59,` 11412 `),a(),e(60,` 11413 `),a(),e(61,` 11414 `),a(),e(62,` 11415 `),a(),e(63,` 11416 `),a(),e(64,` 11417`),a(),e(65,` 11418`)}o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(6),f(i.isInternalUser?8:9),l(3),H("value",i.stepIndex),l(4),f(i.isInternalUser?15:-1),l(6),p("hidden",i.stepIndex!==0),l(5),p("form",i.form.controls.GroupDetails)("submitted",i.submitted)("validationErrors",i.validationErrors)("allEventCalendarOptions",i.allEventCalendarOptions)("allEventCategoryOptions",i.allEventCategoryOptions)("certificateRequired",i.certificateRequired)("docs",i.docs)("isInternalUser",i.isInternalUser),l(5),p("hidden",i.stepIndex!==1),l(5),p("form",i.form.controls.SecurityAccess)("submitted",i.submitted)("fromEditPage",!0)("validationErrors",i.validationErrors)("allExternalUsers",i.allExternalUsers)("allExternalUserOptions",i.allExternalUserOptions),l(4),p("hidden",i.stepIndex!==2),l(5),p("form",i.form.controls.EventDiscounts)("submitted",i.submitted)("validationErrors",i.validationErrors)("currencyType",i.currencyType),l(6),q("label",y(52,30,i.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(56,32,!i.isInternalUser||i.stepIndex===2?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(i.steps[i.stepIndex].control!=null&&i.steps[i.stepIndex].control.valid)))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,os,ls,$r,ie],encapsulation:2})}return r})();var _r=He(nt());var G7=["actionsMenu"],k7=["shades"],V7=["drawer"],q7=["userGroupInfo"],B7=r=>({"lg:col-8":r}),H7=()=>["0"],W7=r=>({opacity:r,display:"inline-flex"});function j7(r,d){if(r&1&&(e(0,` 11419 `),n(1,"a",27),e(2,` 11420 `),n(3,"span",28),e(4),a(),e(5,` 11421 `),n(6,"span",29),e(7),a(),e(8,` 11422 `),a(),e(9,` 11423 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function Y7(r,d){r&1&&(e(0,` 11424 `),n(1,"span",31),e(2,"SHARED.ACTIONS"),a(),e(3,` 11425 `),n(4,"i",32),e(5,"expand_more"),a(),e(6,` 11426 `))}function Q7(r,d){if(r&1){let t=b();e(0,` 11427 `),n(1,"p-button",30),h("onClick",function(i){E(t),m();let s=Ee(12);return S(s.toggle(i))}),e(2,` 11428 `),_(3,Y7,7,0,"ng-template",null,5,A),e(5,` 11429 `),a(),e(6,` 11430 `)}r&2&&(l(),p("raised",!0))}function K7(r,d){if(r&1&&(e(0,` 11431 `),n(1,"a",27),e(2,` 11432 `),n(3,"span",28),e(4),a(),e(5,` 11433 `),n(6,"span",29),e(7),a(),e(8,` 11434 `),a(),e(9,` 11435 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function $7(r,d){if(r&1){let t=b();e(0,` 11436 `),n(1,"div",33),e(2,` 11437 `),n(3,"p-menu",34,6),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 11438 `),_(6,K7,10,2,"ng-template",null,1,A),e(8,` 11439 `),a(),e(9,` 11440 `),n(10,"p-button",35),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 11441 `),n(12,"i",32),e(13,"more_vert"),a(),e(14,` 11442 `),a(),e(15,` 11443 `),a(),e(16,` 11444 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function z7(r,d){r&1&&(e(0,` 11445 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 11446 `))}function X7(r,d){r&1&&(e(0,` 11447 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 11448 `))}function Z7(r,d){if(r&1&&(e(0,` 11449 `),_(1,z7,4,0)(2,X7,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function J7(r,d){r&1&&(e(0,` 11450 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 11451 `))}function eP(r,d){r&1&&(e(0,` 11452 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 11453 `))}
11453function tP(r,d){if(r&1&&(e(0,` 11454 `),_(1,J7,4,0)(2,eP,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function iP(r,d){r&1&&(e(0,` 11455 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 11456 `))}function nP(r,d){r&1&&(e(0,` 11457 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 11458 `))}function aP(r,d){if(r&1&&(e(0,` 11459 `),_(1,iP,4,0)(2,nP,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function rP(r,d){if(r&1&&(e(0,` 11460 `),n(1,"p-accordion-panel",36),e(2,` 11461 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,aP,3,1,"ng-template",null,3,A),e(8,` 11462 `),a(),e(9,` 11463 `),n(10,"p-accordion-content"),e(11,` 11464 `),n(12,"div",21),e(13,` 11465 `),n(14,"qware-user-group-external-event-discounts",37),e(15,` 11466 `),a(),e(16,` 11467 `),a(),e(17,` 11468 `),a(),e(18,` 11469 `),a(),e(19,` 11470 `)),r&2){let t=m();l(4),K(` 11471 `,y(5,5,"EXTERNALGROUP.EVENT_DISCOUNTS"),` 11472 `),l(10),p("form",t.form.controls.EventDiscounts)("submitted",t.submitted)("validationErrors",t.validationErrors)("currencyType",t.currencyType)}}function oP(r,d){r&1&&(e(0,` 11473 `),n(1,"i",32),e(2,"expand_less"),a(),e(3,` 11474 `))}function lP(r,d){r&1&&(e(0,` 11475 `),n(1,"i",32),e(2,"expand_more"),a(),e(3,` 11476 `))}function sP(r,d){if(r&1&&(e(0,` 11477 `),_(1,oP,4,0)(2,lP,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function dP(r,d){r&1&&(e(0,` 11478 `),n(1,"i",32),e(2,"check"),a(),e(3,` 11479 `))}function pP(r,d){if(r&1){let t=b();e(0,` 11480 `),n(1,"p-accordion-panel",38),e(2,` 11481 `),n(3,"p-accordion-header"),e(4),I(5,"translate"),_(6,sP,3,1,"ng-template",null,3,A),e(8,` 11482 `),a(),e(9,` 11483 `),n(10,"p-accordion-content"),e(11,` 11484 `),n(12,"div",21),e(13,` 11485 `),n(14,"div",39),e(15,` 11486 `),n(16,"div",40),e(17,` 11487 `),n(18,"p",41),e(19,"EXTERNALGROUP.USER_REQUEST_LINK_NOTE"),a(),e(20,` 11488 `),n(21,"a",42),e(22),a(),e(23,` 11489 `),n(24,"a",43),h("click",function(){E(t);let i=m();return S(i.showCopyMessage())}),e(25,` 11490 `),n(26,"i",32),e(27,"content_copy"),a(),e(28,` 11491 `),a(),e(29,` 11492 `),n(30,"p-message",44),e(31,` 11493 `),_(32,dP,4,0,"ng-template",null,7,A),e(34,` 11494 `),n(35,"span",45),e(36,"APP_SETTINGS.EVENT.LINK_COPIED_TO_CLIPBOARD"),a(),e(37,` 11495 `),a(),e(38,` 11496 `),a(),e(39,` 11497 `),a(),e(40,` 11498 `),a(),e(41,` 11499 `),a(),e(42,` 11500 `),a(),e(43,` 11501 `)}if(r&2){let t=m();l(4),K(` 11502 `,y(5,5,"EXTERNALGROUP.USER_REQUEST_LINK"),` 11503 `),l(17),p("routerLink",t.userRequestFormRoute),l(),v(t.userRequestFormLink),l(2),p("qwareCopyToClipboard",t.userRequestFormLink),l(6),p("ngStyle",pe(7,W7,t.showCopyLinkMessage?1:0))}}function mP(r,d){if(r&1){let t=b();e(0,` 11504 `),n(1,"p-button",46),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.rejectRequest())}),e(3,` 11505 `),a(),e(4,` 11506 `),n(5,"p-button",47),I(6,"translate"),h("onClick",function(){E(t);let i=m();return S(i.approveRequest())}),e(7,` 11507 `),a(),e(8,` 11508 `)}if(r&2){let t=m();l(),q("label",y(2,6,"SHARED.REJECT_REQUEST")),p("text",!0)("disabled",!t.currentUserIsRequestApprover),l(4),q("label",y(6,8,"SHARED.APPROVE_REQUEST")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid||!t.currentUserIsRequestApprover)}}function cP(r,d){if(r&1){let t=b();e(0,` 11509 `),n(1,"p-button",48),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 11510 `),a(),e(4,` 11511 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function uP(r,d){r&1&&(e(0,` 11512 `),n(1,"div",51),e(2,` 11513 `),n(3,"span",52),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 11514 `),a(),e(6,` 11515 `))}function _P(r,d){if(r&1){let t=b();e(0,` 11516 `),n(1,"qware-spinner",53),e(2,` 11517 `),n(3,"div",54),e(4,` 11518 `),n(5,"qware-entity-history",55),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 11519 `),a(),e(7,` 11520 `),a(),e(8,` 11521 `),a(),e(9,` 11522 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("idMaps",t.historyIdMap)("nameMap",t.historyNameMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function EP(r,d){if(r&1){let t=b();e(0,` 11523 `),n(1,"div",49),e(2,` 11524 `),n(3,"p-drawer",50,8),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 11525 `),_(6,uP,7,0,"ng-template",null,9,A),e(8,` 11526 `),_(9,_P,10,7,"ng-template",null,5,A),e(11,` 11527 `),a(),e(12,` 11528 `),a(),e(13,` 11529 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var bc=(()=>
11529{class r{appSettingsService;attachmentService;authService;confirmationService;documentService;eventService;externalUserGroupService;fb;route;responseService;toastService;translate;userService;actionsMenu;shades;drawer;userGroupInfo;displayDrawerSpinner=D(!1);actionItems=[];allEventCalendars=[];allEventCategories=[];allEventCategoryOptions=[];allExternalUserOptions=[];allExternalUsers=[];allGroupManagerUserIds;allUserExternalGroupAssociations=[];allEventCalendarOptions=[];certificateExpired=!1;certificateRequired=!1;currencyType="USD";currentUserIsManager=!1;currentUserIsRequestApprover=!1;currentUserIsRequestor=!1;disableAllTableCheckboxes=!1;disableAttachmentsComponent=!1;disableSelectionOptions=!1;displaySpinner=!0;docs=[];form;historyArrayProperties=[];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isActive=!1;isApproved=!1;isInternalUser=!1;moreItems=[];selectedEventCategory;shadeFormGroups=[];showCopyLinkMessage=!1;showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;subscriptions;userEnabledSidebar=!1;userGroup;userRequestFormLink;validationErrors;auditLoggingDisabled=!0;userListRoute="../../../"+P.userList;userRequestFormRoute;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};accordion={colorScheme:{light:{headerFirstTopBorderRadius:"4px",headerLastBottomBorderRadius:"4px"}}};timezone;translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L,U){this.appSettingsService=t,this.attachmentService=o,this.authService=i,this.confirmationService=s,this.documentService=c,this.eventService=u,this.externalUserGroupService=x,this.fb=C,this.route=O,this.responseService=w,this.toastService=F,this.translate=L,this.userService=U}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.auditLoggingDisabled=!this.authService?.qwareSubscription?.auditLogging,this.isInternalUser=this.authService.currentUserType===Rt.INTERNAL,this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){let t=this.route.snapshot.params.id;this.historyIdMap=new Map,ue([this.translate.get(["SHARED.DISABLED","SHARED.DISABLE","SHARED.DELETED","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.CANCEL_REQUEST","AUDIT.USER_GROUP","SHARED.AUDIT_LOG","SHARED.PENDING_APPROVAL"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N()),this.externalUserGroupService.getExternalUserGroup(t),this.eventService.getCalendars(),this.eventService.getCategories(),this.documentService.getAllDocuments(this.authService.currentUser?.TenantId??""),this.userService.getExternalUsers(this.authService.currentUser?.TenantId??"")]).subscribe({next:o=>{this.translations=o[0];let i=o[1];this.userGroup=o[2];let s=o[3],c=o[4],u=o[5];this.allExternalUsers=o[6],this.timezone=i.Timezone??"",this.currencyType=i.CurrencyType??"USD",this.userRequestFormRoute="/"+P.systemConfig+"/"+this.authService.tenant.Key+"/"+P.userExternal+"/"+P.requestGroupAccess+"/"+this.userGroup.Id,this.userRequestFormLink=`${location.protocol}/${location.host}/#${this.userRequestFormRoute}`;let x=[];this.userGroup.UserExternalGroupAssociations&&(this.allUserExternalGroupAssociations=_r.default.sortBy(this.userGroup.UserExternalGroupAssociations.map(w=>{let F=this.allExternalUsers.find(L=>L.Id===w.UserId);return F&&(x.push(F),w.UserFirstName=F.FirstName,w.UserLastName=F.LastName,w.UserEmail=F.Email,w.UserState=F.State),w}),w=>(w.UserFirstName+" "+w.UserLastName).toLowerCase()),x=_r.default.sortBy(x,w=>w.fullName().toLowerCase()),this.form.get("SecurityAccess.UserIds")?.setValue(x.map(w=>w.Id??"")));let C=this.allExternalUsers.filter(w=>w.State===M.ACTIVE&&(this.isInternalUser||w.Approved)&&(this.isInternalUser||_r.default.intersection(w.AllExternalTenantGroups?.map(F=>F.Id),this.authService.currentUserManagedExternalGroupIds).length>0)||x.find(F=>F.Id===w.Id)).map(w=>{let F=w.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":"";return F=w.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":F,F=w.Approved?F:F+" ("+this.translations["SHARED.PEND
11529ING_APPROVAL"]+")",{label:w.fullName()+F,value:w.Id,disabled:w.Type===Rt.EXTERNAL&&w.Id===this.authService.currentUserId}});this.allExternalUserOptions=_r.default.sortBy(C,w=>w.label.toLowerCase());let O=[];if(s){this.allEventCalendars=s.filter(F=>F.State===M.ACTIVE),this.allEventCalendarOptions=this.allEventCalendars.filter(F=>F.CategoryId===this.userGroup?.DefaultEventCategoryId).map(F=>({label:F.Name,value:F.Id}));let w=this.allEventCalendarOptions.find(F=>F.value===this.userGroup?.DefaultEventCalendarId);this.form.get("GroupDetails.DefaultEventCalendarId")?.setValue(w??null),O=_r.default.uniq(this.allEventCalendars.filter(F=>F.CategoryId!==void 0).map(F=>F.CategoryId??""))}if(c){this.allEventCategories=c.filter(F=>F.State===M.ACTIVE&&O.includes(F.Id??"")),this.allEventCategoryOptions=this.allEventCategories.map(F=>({label:F.Name,value:F.Id}));let w=this.allEventCategoryOptions.find(F=>F.value===this.userGroup?.DefaultEventCategoryId);this.form.get("GroupDetails.DefaultEventCategoryId")?.setValue(w??null)}if(this.userGroup.CertificateExpirationDateUTC&&(this.userGroup.CertificateExpirationDateUTC=Vt.convertToAppTimezone(this.timezone??"",!0,this.userGroup.CertificateExpirationDateUTC)),this.certificateRequired=i.RequireInsuranceCertificate??!1,this.certificateRequired&&(this.form.get("GroupDetails.CertificateExpirationDateUTC")?.addValidators([T.required]),this.form.get("GroupDetails.HasCertificateFile")?.addValidators([T.required]),this.form.get("GroupDetails.DocumentIds")?.addValidators([Qi.maxSize(1)])),i.GroupRequestApproverIds&&(this.currentUserIsRequestApprover=i.GroupRequestApproverIds.includes(this.authService.currentUserId)),this.allGroupManagerUserIds=this.userGroup.UserExternalGroupAssociations.filter(w=>w.Manager&&w.Access).map(w=>w.UserId??""),this.userGroup.CreatedByUserId===this.authService.currentUserId&&(this.currentUserIsRequestor=!0),this.allGroupManagerUserIds.includes(this.authService.currentUserId)&&(this.currentUserIsManager=!0),this.isApproved=this.userGroup.Approved??!1,this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}],this.isInternalUser&&(this.actionItems=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableUserGroup()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableUserGroup()},{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteUserGroup()},{id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreUserGroup()}]),this.setFormFieldState(),this.actionItems=this.actionItems.filter(w=>w.id!==(this.userGroup?.State===M.DISABLED?"disable.action":"enable.action")),this.actionItems=this.actionItems.filter(w=>w.id!==(this.userGroup?.State===M.DELETED?"delete.action":"restore.action")),this.userGroup.State===M.DELETED&&(this.actionItems=this.actionItems.filter(w=>w.id!=="disable.action")),this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)||(this.actionItems=this.actionItems.filter(w=>w.id!=="restore.action")),this.userGroup.DocumentIds&&this.userGroup.DocumentIds.length>0){let w=this.userGroup.DocumentIds[0];this.docs=u.filter(F=>F.Id===w)}this.setHistoryParams(),this.form.patchValue(new Ma().toForm(this.userGroup)),this.userGroup.State==="DELETED"&&this.form.disable(),this.displaySpinner=!1},error:o=>{this.responseService.onDataError(o,this.userListRoute,this.route)}})}setFormFieldState(){let t=this.form.controls.GroupDetails,o=this.form.controls.SecurityAccess,i=this.form.controls.EventDiscounts;!this.currentUserIsRequestor&&!this.isInternalUser&&!this.currentUserIsManager&&(this.disableAllFormGroupControls(t),this.disableAllFormGroupControls(o),this.disableAllFormGroupControls(i),this.disableAllTableCheckboxes=!0,this.disableAttachmentsComponent=!0),this.isApproved?this.isInternalUser||(t.get("Name")?.disable(),this.disableAllFormGroupControls(i),this.certificateExpired&&(this.disableAllFormGroupControls(o),this.disableAllTableCheckboxes=!0)):this.isInternalUser||(this.disableAllFormGroupControls(o),this.disableAllTableCheckboxes=!0,this.currentUserIsRequestor&&(this.actionItems=[{id:"cancel-request.action",label:this.translations["SHARED.CANCEL_REQUEST"],icon:"block",command:()=>this.cancelRequest()}]))}disableAllFormGroupControls(t,o){for(let i in t.controls)t.controls[i]&&!o?.includes(i)&&t.controls[i].disable()}
11529createForm(){this.form=this.fb.group({GroupDetails:this.fb.group({Name:this.fb.control("",[T.required,T.maxLength(re)]),PhoneNumber:this.fb.control("",[T.required,T.pattern("^[0-9]*"),T.minLength(10),T.maxLength(10)]),AddressStreet:this.fb.control("",[T.required,T.maxLength(jn)]),AddressCity:this.fb.control("",[T.required,T.maxLength(jn)]),AddressState:this.fb.control("",[T.required,T.maxLength(jn)]),AddressZip:this.fb.control("",[T.required,T.pattern("^[0-9]*"),T.minLength(5),T.maxLength(5)]),CertificateExpirationDateUTC:this.fb.control(null),HasCertificateFile:this.fb.control(!1),DocumentIds:this.fb.control([]),DefaultEventCalendarId:this.fb.control(null,[T.required]),DefaultEventCategoryId:this.fb.control(null,[T.required])}),SecurityAccess:this.fb.group({UserIds:this.fb.control([]),UserExternalGroupAssociations:this.fb.control([],[Qi.atLeastOneObjectAllTrue(["Access","Manager"])])}),EventDiscounts:this.fb.group({DiscountType:this.fb.control(""),DiscountAmount:this.fb.control("0")})}),this.shadeFormGroups=[this.form.get("GroupDetails"),this.form.get("SecurityAccess"),this.form.get("EventDiscounts")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.USER_GROUP"]+' "'+this.userGroup?.Name+'"';let t=new Map;t.set("DefaultEventCategoryId",[this.allEventCategories,"Id","Name"]),t.set("DefaultEventCalendarId",[this.allEventCalendars,"Id","Name"]),this.historyIdMap=t;let o=new Map;o.set("Name","EXTERNALGROUP.GROUP_NAME"),o.set("PhoneNumber","EXTERNALGROUP.PHONE"),o.set("Address","EXTERNALGROUP.ADDRESS"),o.set("AddressCity","EXTERNALGROUP.ADDRESS_CITY"),o.set("AddressState","EXTERNALGROUP.ADDRESS_STATE"),o.set("AddressZip","EXTERNALGROUP.ADDRESS_ZIPCODE"),o.set("Name","EXTERNALGROUP.GROUP_NAME"),o.set("DocumentIds","EXTERNALGROUP.CERTIFICATE"),o.set("CertificateExpirationDateUTC","EXTERNALGROUP.CERTIFICATE_EXP"),o.set("DefaultEventCategoryId","EXTERNALGROUP.DEFAULT_EVENT_CATEGORY"),o.set("DefaultEventCalendarId","EXTERNALGROUP.DEFAULT_EVENT_CALENDAR"),o.set("UserExternalGroupAssociations","EXTERNALGROUP.ASSIGNED_USERS"),o.set("EventDiscountType","EXTERNALGROUP.DISCOUNT_TYPE"),o.set("EventDiscountAmount","EXTERNALGROUP.DISCOUNT_AMOUNT_PER_EVENT"),this.historyNameMap=o}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0;let t=new Ma().parseForm(this.form.getRawValue(),this.timezone??"");t.Id=this.userGroup?.Id,t.Approved=this.userGroup?.Approved,t.TenantId=this.authService.tenant.Id,this.subscriptions=this.attachmentService.upload().pipe(N(),we(o=>o?this.externalUserGroupService.handleAttachmentUpload(o,t,this.docs,this.userGroupInfo.certificate):wi(()=>new Error("Upload error."))),we(()=>this.externalUserGroupService.updateUserGroup(t,t.Id??""))).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.SAVE",this.userListRoute,this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}}),this.fileUpload()}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}ngOnDestroy(){this.subscriptions&&!this.subscriptions.closed&&this.subscriptions.unsubscribe()}rejectRequest(){this.translate.get(["SHARED.DELETE_HEADER","EXTERNALGROUP.DELETE_REQUEST_MESSAGE"],{groupName:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["EXTERNALGROUP.DELETE_REQUEST_MESSAGE"],accept:()=>{this.displaySpinner=!0,this.userGroup?.Id&&this.externalUserGroupService.rejectExternalGroup(this.userGroup,this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.REQUEST_DELETED",this.userListRoute,this.route,{name:this.userGroup?.Name})},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}})}})})}approveRequest(){let t=new Ma().parseForm(this.form.getRawValue(),this.timezone??"");t.Approved=!0,t.Id=this.userGroup?.Id??"",t.TenantId=this.userGroup?.TenantId,this.displaySpinner=!0,this.userGroup?.Id&&(this.submitted=!0,this.externalUserGroupService.approveExternalGroup(t,t.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.REQUEST_APPROVED",this.userListRoute,this.route,{name:this.userGroup?.Name},{useCache:!1})},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}cancelRequest(){this.actionsMenu.hide(),this.translate.get(["SHARED.CANCEL_REQUEST_HEADER","SHARED.CANCEL_REQUEST_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"cancelPromptDialog",header:t["SHARED.CANCEL_REQUEST_HEADER"],message:t["SHARED.CANCEL_REQUEST_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.externalUserGroupService.rejectExternalGroup(this.userGroup,this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.REQUEST_CANCELLED",this.userListRoute,this.route,{name:this.userGroup?.Name})},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}disableUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.externalUserGroupService.disableUserGroup(this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.DISABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}enableUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.externalUserGroupService.enableUserGroup(this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.ENABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.externalUserGroupService.deleteUserGroup(this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.DELETE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreUserGroup(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.userGroup?.Name}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.userGroup?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.externalUserGroupService.restoreUserGroup(this.userGroup.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.RESTORE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=_r.default.clone(this.showSidebar)}eventCategoryChanged(t){if(t&&t.value){let o=t.value;this.allEventCalendarOptions=this.allEventCalendars.filter(s=>s.CategoryId===o).map(s=>({label:s.Name,value:s.Id}));
11529let i=this.form.get("GroupDetails.DefaultEventCalendarId");if(this.allEventCalendarOptions.length===1){let s=this.allEventCalendarOptions[0];i?.setValue(s)}else i?.setValue(null)}}setDocs(t){t instanceof Event||(this.docs=t)}fileUpload(){this.userGroupInfo.certificate&&this.userGroupInfo.certificate.fileup.files.length>0?this.userGroupInfo.certificate.fileup.upload():this.attachmentService.clearObservable()}showCopyMessage(){this.showCopyLinkMessage=!0,setTimeout(()=>{this.showCopyLinkMessage=!1},2e3)}static \u0275fac=function(o){return new(o||r)(g(dt),g(ui),g(de),g(mt),g(mn),g(oi),g(un),g(be),g(he),g(Re),g(Se),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-external-group-edit"]],viewQuery:function(o,i){if(o&1&&(X(G7,7),X(k7,7),X(V7,7),X(q7,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first),Y(s=Q())&&(i.userGroupInfo=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:88,vars:48,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["userGroupInfo",""],["content",""],["moreMenu",""],["icon",""],["drawer",""],["header",""],["id","qware.user-groups-external.edit",1,"grid"],["id","qware.user-groups-external.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],["id","qware.user-groups-external.edit.page-header","translate","",1,"page-header"],[1,"top-indent-large","actions-container"],["id","qware.user-groups.edit.actions-menu",3,"model","popup"],["id","qware.user-groups-external.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing"],[3,"dt","multiple","value"],["id","qware.user-groups-external.edit.group-info-shade","value","0"],[1,"accordion-content-padding"],[3,"eventCategoryChange","docsChanged","form","submitted","editPage","validationErrors","autoFocus","allEventCalendarOptions","allEventCategoryOptions","docs","disableAttachmentControls","certificateRequired","isInternalUser"],["id","qware.user-groups-external.edit.assigned-users-shade","value","1"],[3,"form","submitted","fromEditPage","validationErrors","allExternalUsers","externalUserGroupId","allUserExternalGroupAssociations","allExternalUserOptions"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.user-groups-external.edit.button.cancel",3,"routerLink","text","label"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.user-groups.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],[3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["id","qware.user-groups-external.edit.discount-shade","value","2"],[3,"form","submitted","validationErrors","currencyType"],["id","qware.user-groups-external.edit.link-shade","value","3"],[1,"col-12"],[1,"medium-input"],["translate","",2,"margin-bottom","1rem"],[3,"routerLink"],[3,"click","qwareCopyToClipboard"],["severity","success",3,"ngStyle"],["translate",""],["tabindex","1000","type","button","id","qware.user-groups-external.edit.button.reject-request",3,"onClick","text","label","disabled"],["tabindex","999","type","button","id","qware.user-groups-external.edit.button.approve-request",3,"onClick","text","label","disabled"],["tabindex","999","type","button","id","qware.user-groups-external.edit.button.save",3,"onClick","text","disabled","label"],["id","qware.user-group-external.edit.content-drawer-container",1,"content-right-drawer-container","col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.user-group-external.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.user-group-external.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","externalGroup",3,"parentSpinnerStateChange","createdText","idMaps","nameMap","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",10),e(1,` 11530 `),n(2,"div",11),e(3,` 11531 `),n(4,"div",12),e(5,` 11532 `),n(6,"h3",13),e(7,` 11533 EXTERNALGROUP.EDIT_GROUP 11534 `),a(),e(8,` 11535 `),n(9,"div",14),e(10,` 11536 `),n(11,"p-menu",15,0),e(13,` 11537 `),_(14,j7,10,2,"ng-template",null,1,A),e(16,` 11538 `),a(),e(17,` 11539 `),_(18,Q7,7,1),a(),e(19,` 11540 `),_(20,$7,17,4),a(),e(21,` 11541 `),n(22,"qware-spinner",16),e(23,` 11542 `),n(24,"p-card",17),e(25,` 11543 `),n(26,"qware-edit-lock",18),e(27,` 11544 `),n(28,"p-accordion",19,2),e(30,` 11545 `),n(31,"p-accordion-panel",20),e(32,` 11546 `),n(33,"p-accordion-header"),e(34),I(35,"translate"),_(36,Z7,3,1,"ng-template",null,3,A),e(38,` 11547 `),a(),e(39,` 11548 `),n(40,"p-accordion-content"),e(41,` 11549 `),n(42,"div",21),e(43,` 11550 `),n(44,"qware-user-group-external-info",22,4),h("eventCategoryChange",function(u){return E(s),S(i.eventCategoryChanged(u))})("docsChanged",function(u){return E(s),S(i.setDocs(u))}),e(46,` 11551 `),a(),e(47,` 11552 `),a(),e(48,` 11553 `),a(),e(49,` 11554 `),a(),e(50,` 11555 `),n(51,"p-accordion-panel",23),e(52,` 11556 `),n(53,"p-accordion-header"),e(54),I(55,"translate"),_(56,tP,3,1,"ng-template",null,3,A),e(58,` 11557 `),a(),e(59,` 11558 `),n(60,"p-accordion-content"),e(61,` 11559 `),n(62,"div",21),e(63,` 11560 `),n(64,"qware-user-group-external-assigned-users",24),e(65,` 11561 `),a(),e(66,` 11562 `),a(),e(67,` 11563 `),a(),e(68,` 11564 `),a(),e(69,` 11565 `),_(70,rP,20,7)(71,pP,44,9),a(),e(72,` 11566 `),a(),e(73,` 11567 `),n(74,"div",25),e(75,` 11568 `),n(76,"p-button",26),I(77,"translate"),e(78,` 11569 `),a(),e(79,` 11570 `),_(80,mP,9,10)(81,cP,5,5),a(),e(82,` 11571 `),a(),e(83,` 11572 `),a(),e(84,` 11573 `),a(),e(85,` 11574 `),_(86,EP,14,6),a(),e(87,` 11575`)}o&2&&(l(2),p("ngClass",pe(45,B7,!i.auditLoggingDisabled)),l(9),p("model",i.actionItems)("popup",!0),l(7),f((i.isInternalUser||i.currentUserIsRequestor&&!i.isApproved)&&i.actionItems&&i.actionItems.length>0?18:-1),l(2),f(i.auditLoggingDisabled?-1:20),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.userGroup!==void 0&&i.userGroup.State==="DELETED"),l(2),p("dt",i.accordion)("multiple",!0)("value",ne(47,H7)),l(6),K(` 11576 `,y(35,39,"EXTERNALGROUP.GROUP_INFORMATION"),`
11577 `),l(10),p("form",i.form.controls.GroupDetails)("submitted",i.submitted)("editPage",!0)("validationErrors",i.validationErrors)("autoFocus",!0)("allEventCalendarOptions",i.allEventCalendarOptions)("allEventCategoryOptions",i.allEventCategoryOptions)("docs",i.docs)("disableAttachmentControls",i.disableAttachmentsComponent)("certificateRequired",i.certificateRequired)("isInternalUser",i.isInternalUser),l(10),K(` 11578 `,y(55,41,"EXTERNALGROUP.ASSIGNED_USERS"),` 11579 `),l(10),p("form",i.form.controls.SecurityAccess)("submitted",i.submitted)("fromEditPage",!0)("validationErrors",i.validationErrors)("allExternalUsers",i.allExternalUsers)("externalUserGroupId",i.userGroup==null?null:i.userGroup.Id)("allUserExternalGroupAssociations",i.allUserExternalGroupAssociations)("allExternalUserOptions",i.allExternalUserOptions),l(6),f(i.isApproved&&(i.isInternalUser||(i.userGroup==null?null:i.userGroup.EventDiscountType)==="Fixed Amount"||(i.userGroup==null?null:i.userGroup.EventDiscountType)==="Percentage")?70:-1),l(),f(i.isInternalUser||i.isApproved?71:-1),l(5),q("label",y(77,43,"SHARED.CANCEL")),p("routerLink",i.userListRoute)("text",!0),l(4),f(!i.isApproved&&i.isInternalUser?80:(i.userGroup==null?null:i.userGroup.State)!=="DELETED"&&i.isApproved?81:-1),l(6),f(i.auditLoggingDisabled?-1:86))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,$n,_n,Lt,lt,gi,Gt,Ut,me,ot,et,$,os,ls,$r,ie],encapsulation:2})}return r})();var Ao=He(nt());var SP=r=>({"role-header":r}),yc=()=>({standalone:!0}),Ac=(r,d)=>d.field;function xP(r,d){r&1&&(e(0,` 11580 `),n(1,"span",14),e(2,"expand_more"),a(),e(3,` 11581 `))}function fP(r,d){r&1&&(e(0,` 11582 `),n(1,"span",14),e(2,"search"),a(),e(3,` 11583 `))}function hP(r,d){if(r&1&&(e(0,` 11584 `),n(1,"th",15),e(2,` 11585 `),n(3,"span"),e(4),a(),e(5,` 11586 `),a(),e(6,` 11587 `)),r&2){let t=d.$implicit;l(),p("ngClass",pe(2,SP,t.field==="Manager"||t.field==="Access")),l(3),v(t.header)}}function CP(r,d){if(r&1&&(e(0,` 11588 `),n(1,"tr"),e(2,` 11589 `),G(3,hP,7,4,null,null,Ac),a(),e(5,` 11590 `)),r&2){let t=d.$implicit;l(3),k(t)}}function vP(r,d){if(r&1&&(e(0,` 11591 `),n(1,"a",19),e(2),a(),e(3,` 11592 `)),r&2){let t=m(3).$implicit,o=m();l(),gt("routerLink","",o.userGroupExternalEditRoute(),"/",t.TenantGroupId,""),l(),v(t.TenantGroupName)}}function gP(r,d){if(r&1&&e(0),r&2){let t=m(3).$implicit;K(` 11593 `,t.TenantGroupName,` 11594 `)}}function TP(r,d){r&1&&(e(0,` 11595 `),n(1,"span",20),e(2,"SHARED.PENDING_APPROVAL"),a(),e(3,` 11596 `))}function IP(r,d){r&1&&(e(0,` 11597 `),n(1,"span",20),e(2,"SHARED.DISABLED"),a(),e(3,` 11598 `))}function bP(r,d){r&1&&(e(0,` 11599 `),n(1,"span",20),e(2,"SHARED.DELETED"),a(),e(3,` 11600 `))}function yP(r,d){if(r&1&&(e(0,` 11601 `),n(1,"div",18),e(2,` 11602 `),_(3,vP,4,4)(4,gP,1,1)(5,TP,4,0)(6,IP,4,0)(7,bP,4,0),a(),e(8,` 11603 `)),r&2){let t=m(2).$implicit,o=m();l(3),f(o.loggedUserManagedGroupIds().includes(t.TenantGroupId)||o.isInternalUser()?3:4),l(2),f(t.Access?-1:5),l(),f(t.TenantGroupState==="DISABLED"?6:-1),l(),f(t.TenantGroupState==="DELETED"?7:-1)}}function AP(r,d){if(r&1&&(e(0,` 11604 `),n(1,"div",18),e(2,` 11605 `),n(3,"span"),e(4),a(),e(5,` 11606 `),a(),e(6,` 11607 `)),r&2){let t=m(2).$implicit;l(4),v(t.TenantGroupAddress)}}function RP(r,d){if(r&1&&(e(0,` 11608 `),n(1,"div",18),e(2,` 11609 `),n(3,"span"),e(4),I(5,"phoneNumber"),a(),e(6,` 11610 `),a(),e(7,` 11611 `)),r&2){let t=m(2).$implicit;l(4),v(y(5,1,t.TenantGroupPhone))}}function wP(r,d){if(r&1){let t=b();e(0,` 11612 `),n(1,"div",21),e(2,` 11613 `),n(3,"p-checkbox",22),j("ngModelChange",function(i){E(t);let s=m(2).$implicit;return W(s.Manager,i)||(s.Manager=i),S(i)}),h("onChange",function(i){E(t);let s=m(2).$implicit,c=m();return S(c.managerOnChange(i,s.TenantGroupId))}),e(4,` 11614 `),a(),e(5,` 11615 `),a(),e(6,` 11616 `)}if(r&2){let t=m(2).$implicit,o=m();l(3),H("ngModel",t.Manager),p("ngModelOptions",ne(4,yc))("binary",!0)("disabled",o.isLoggedUser())}}function DP(r,d){if(r&1){let t=b();e(0,` 11617 `),n(1,"div",21),e(2,` 11618 `),n(3,"p-checkbox",22),j("ngModelChange",function(i){E(t);let s=m(2).$implicit;return W(s.Access,i)||(s.Access=i),S(i)}),h("onChange",function(i){E(t);let s=m(2).$implicit,c=m();return S(c.accessOnChange(i,s.TenantGroupId))}),e(4,` 11619 `),a(),e(5,` 11620 `),a(),e(6,` 11621 `)}if(r&2){let t=m(2).$implicit,o=m();l(3),H("ngModel",t.Access),p("ngModelOptions",ne(4,yc))("binary",!0)("disabled",o.isLoggedUser())}}function LP(r,d){if(r&1&&(e(0,` 11622 `),n(1,"td"),e(2,` 11623 `),n(3,"span",17),e(4),a(),e(5,` 11624 `),_(6,yP,9,4)(7,AP,7,1)(8,RP,8,3)(9,wP,7,5)(10,DP,7,5),e(11,` 11625 `),a(),e(12,` 11626 `)),r&2){let t,o=d.$implicit;l(4),v(o.header),l(2),f((t=o.field)==="TenantGroupName"?6:t==="TenantGroupAddress"?7:t==="TenantGroupPhone"?8:t==="Manager"?9:t==="Access"?10:-1)}}function NP(r,d){if(r&1&&(e(0,` 11627 `),n(1,"tr",16),e(2,` 11628 `),G(3,LP,13,2,null,null,Ac),a(),e(5,` 11629 `)),r&2){let t=d.columns;l(3),k(t)}}function OP(r,d){r&1&&(e(0,` 11630 `),n(1,"tr"),e(2,` 11631 `),n(3,"td"),e(4,` 11632 `),n(5,"div",23),e(6,"SHARED.RECORDS_NOT_FOUND"),a(),e(7,` 11633 `),a(),e(8,` 11634 `),a(),e(9,` 11635 `)),r&2&&(l(3),Ve("colspan",5))}function FP(r,d){if(r&1&&(e(0,` 11636 `),n(1,"small",24),e(2,` 11637 `),n(3,"div",25),e(4),a(),e(5,` 11638 `),a(),e(6,` 11639 `)),r&2){let t=d.$implicit;l(4),v(t)}}function MP(r,d){if(r&1&&(e(0,` 11640 `),G(1,FP,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().UserExternalGroupAssociations)}}var ds=(()=>
11640{class r{availableExternalTenantGroups=ee([]);availableUserExternalGroupAssociations=ee([]);relativePathDepth=ee(2);form=ee.required();selectedExternalGroups=ee([]);submitted=ee(!1);validationErrors=ee();isInternalUser=D(!1);isLoggedUser=D(!1);loggedUserManagedGroupIds=D([]);tableColumns=D([]);userGroupExternalEditRoute=D("");userId=D(void 0);_externalTenantGroups=D([]);_externalGroupAssociations=D([]);externalTenantGroupOptions=Ye(()=>this._externalTenantGroups().length>0?this._externalTenantGroups():this.availableExternalTenantGroups());externalGroupAssociations=Ye(()=>this._externalGroupAssociations().length>0?this._externalGroupAssociations():this.availableUserExternalGroupAssociations());authService=te(de);route=te(he);translate=te(le);constructor(){this.userId.set(this.route.snapshot.params.id),this.isLoggedUser.set(this.userId()===this.authService.currentUserId),this.loggedUserManagedGroupIds.set(this.authService.currentUser?.UserExternalGroupAssociations.flatMap(i=>i.Manager?i.TenantGroupId??"":[])??[]),this.isInternalUser.set(this.authService.currentUserType===Rt.INTERNAL);let o="../".repeat(this.relativePathDepth());this.userGroupExternalEditRoute.set(o+P.userGroupExternal+"/"+P.edit),this.translate.get(["EXTERNALGROUP.GROUP_NAME","EXTERNALGROUP.ADDRESS","EXTERNALGROUP.PHONE","SHARED.MANAGER","SHARED.ACCESS"]).pipe(N()).subscribe(i=>{let s=i;this.tableColumns.set([{field:"TenantGroupName",header:s["EXTERNALGROUP.GROUP_NAME"]},{field:"TenantGroupAddress",header:s["EXTERNALGROUP.ADDRESS"]},{field:"TenantGroupPhone",header:s["EXTERNALGROUP.PHONE"]},{field:"Manager",header:s["SHARED.MANAGER"]},{field:"Access",header:s["SHARED.ACCESS"]}])})}onGroupChange(t){if(t.length===0)this._externalGroupAssociations.set([]);else{let o=this.form().get("ExternalUserGroupIds")?.value,i=Ao.default.difference(o??[],t),s=Ao.default.difference(t,o??[]),c=Ao.default.cloneDeep(this.externalGroupAssociations()??[]);i.forEach(u=>{let x=c.find(O=>O.TenantGroupId===u);x&&c.splice(c.indexOf(x),1);let C=this.externalTenantGroupOptions().find(O=>O.Id===u);C&&C.State!==M.ACTIVE&&this._externalTenantGroups.set(this.externalTenantGroupOptions().filter(O=>O.Id!==u))}),s.forEach(u=>{if(!c.find(C=>C.TenantGroupId===u)){let C=this.externalTenantGroupOptions().find(O=>O.Id===u);if(C){let O=this.setUserTenantAssociationFromGroup(C);c.push(O)}}}),this._externalGroupAssociations.set(c)}this.externalGroupAssociations()&&this.setFormValue()}accessOnChange(t,o){t&&(this.externalGroupAssociations().filter(i=>i.TenantGroupId===o).forEach(i=>{i.Access=t.checked}),this.setFormValue())}managerOnChange(t,o){t&&(this.externalGroupAssociations().filter(i=>i.TenantGroupId===o).forEach(i=>{i.Manager=t.checked}),this.setFormValue())}setFormValue(){let t=this.form().get("ExternalUserGroupIds"),o=this.form().get("UserExternalGroupAssociations"),i=o?.value??[],s=this.externalTenantGroupOptions().map(x=>x.Id??"")??[],c=i.filter(x=>!s.includes(x.TenantGroupId??"")),u=Ao.default.concat(c,this.externalGroupAssociations());u=u.map(x=>{let C=new _a;return C.TenantGroupId=x.TenantGroupId,C.Access=x.Access,C.Manager=x.Manager,C.UserId=this.userId(),C}),o?.setValue(u),t?.setValue(u.map(x=>x.TenantGroupId??"")),this.form().markAsDirty(),o?.markAsDirty(),t?.markAsDirty()}setUserTenantAssociationFromGroup(t){let o=new _a;o.TenantGroupName=t.Name,o.TenantGroupId=t.Id,o.TenantGroupPhone=t.PhoneNumber;let i=t.AddressStreet+" "+t.AddressCity+", "+t.AddressState+" "+t.AddressZip;return o.TenantGroupAddress=i,o.TenantGroupState=t.State,o.Access=!1,o.Manager=!1,o}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-external-assigned-groups"]],inputs:{availableExternalTenantGroups:[1,"availableExternalTenantGroups"],availableUserExternalGroupAssociations:[1,"availableUserExternalGroupAssociations"],relativePathDepth:[1,"relativePathDepth"],form:[1,"form"],selectedExternalGroups:[1,"selectedExternalGroups"],submitted:[1,"submitted"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:48,vars:16,consts:[["dropdownicon",""],["filtericon",""],[1,"user-external-assigned-groups"],[1,"grid","flex-inline"],[1,"col-12"],[1,"medium-input"],["id","qware.user-external.assigned-groups.multiselect.select-groups","display","chip","optionLabel","Name","optionValue","Id","variant","filled","appendTo","body",3,"ngModelChange","options","ngModel","disabled","maxSelectedLabels","fluid"],["id","qware.user-external.assigned-groups.label.select-groups","for","qware.user-external.assigned-groups.multiselect.select-groups"],["responsiveLayout","stack","id","qware.user-external.assigned-groups-table",3,"value","paginator","rows","columns","scrollable"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"material-icons"],[3,"ngClass"],[1,"responsive-border"],[1,"p-datatable-column-title"],["qwareTruncate",""],[3,"routerLink"],["translate","",1,"badge","ml-1"],[2,"text-align","center"],[3,"ngModelChange","onChange","ngModel","ngModelOptions","binary","disabled"],["translate","",1,"no-results"],[1,"validation-error"],["translate",""]],template:function(o,i){if(o&1){let s=b();n(0,"div",2),e(1,` 11641 `),n(2,"div",3),e(3,`
11642 `),n(4,"div",4),e(5,` 11643 `),e(6,` 11644 `),n(7,"div",5),e(8,` 11645 `),n(9,"p-floatlabel"),e(10,` 11646 `),n(11,"p-multiselect",6),h("ngModelChange",function(u){return E(s),S(i.onGroupChange(u))}),e(12,` 11647 `),_(13,xP,4,0,"ng-template",null,0,A),e(15,` 11648 `),_(16,fP,4,0,"ng-template",null,1,A),e(18,` 11649 `),a(),e(19,` 11650 `),n(20,"label",7),e(21),I(22,"translate"),a(),e(23,` 11651 `),a(),e(24,` 11652 `),a(),e(25,` 11653 `),e(26,` 11654 `),n(27,"div",5),e(28,` 11655 `),n(29,"p-table",8),e(30,` 11656 `),_(31,CP,6,0,"ng-template",9),e(32,` 11657 `),_(33,NP,6,0,"ng-template",10),e(34,` 11658 `),_(35,OP,10,1,"ng-template",11),e(36,` 11659 `),a(),e(37,` 11660 `),n(38,"small",12),e(39,` 11661 `),n(40,"div",13),e(41,` 11662 USER.ERROR.ASSIGNED_EXTERNAL_GROUPS 11663 `),a(),e(42,` 11664 `),a(),e(43,` 11665 `),_(44,MP,3,0),a(),e(45,` 11666 `),a(),e(46,` 11667 `),a(),e(47,` 11668`),a()}if(o&2){let s;l(11),p("options",i.externalTenantGroupOptions())("ngModel",i.selectedExternalGroups())("disabled",i.isLoggedUser())("maxSelectedLabels",i.availableExternalTenantGroups().length+1)("fluid",!0),l(10),K(` 11669 `,y(22,14,"USER.SELECT_GROUPS"),` 11670 `),l(8),p("value",i.externalGroupAssociations())("paginator",!0)("rows",10)("columns",i.tableColumns())("scrollable",!0),l(9),p("hidden",i.form().controls.UserExternalGroupAssociations.valid||i.form().controls.UserExternalGroupAssociations.pristine&&!i.submitted),l(2),p("hidden",!((s=i.form().controls.UserExternalGroupAssociations.errors)!=null&&s.minSize)),l(4),f(i.validationErrors()&&i.validationErrors().UserExternalGroupAssociations&&i.form().controls.UserExternalGroupAssociations.untouched?44:-1)}},dependencies:[Pe,yt,Qe,Ne,se,Le,Ni,kt,et,ht,$,jo,ie],styles:[".role-header[_ngcontent-%COMP%]{max-width:10%;text-align:center!important;word-wrap:break-word;width:100%}"],changeDetection:0})}return r})();var UP=()=>({standalone:!0});function PP(r,d){if(r&1&&(e(0,` 11671 `),n(1,"small",26),e(2,` 11672 `),n(3,"div",5),e(4),a(),e(5,` 11673 `),a(),e(6,` 11674 `)),r&2){let t=d.$implicit;l(4),v(t)}}function GP(r,d){if(r&1&&(e(0,` 11675 `),G(1,PP,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().FirstName)}}function kP(r,d){if(r&1&&(e(0,` 11676 `),n(1,"small",26),e(2,` 11677 `),n(3,"div",5),e(4),a(),e(5,` 11678 `),a(),e(6,` 11679 `)),r&2){let t=d.$implicit;l(4),v(t)}}function VP(r,d){if(r&1&&(e(0,` 11680 `),G(1,kP,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().LastName)}}function qP(r,d){if(r&1&&(e(0,` 11681 `),n(1,"small",26),e(2,` 11682 `),n(3,"div",5),e(4),a(),e(5,` 11683 `),a(),e(6,` 11684 `)),r&2){let t=d.$implicit;l(4),v(t)}}function BP(r,d){if(r&1&&(e(0,` 11685 `),G(1,qP,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().Email)}}function HP(r,d){if(r&1&&(e(0,` 11686 `),n(1,"small",26),e(2,` 11687 `),n(3,"div",5),e(4),a(),e(5,` 11688 `),a(),e(6,` 11689 `)),r&2){let t=d.$implicit;l(4),v(t)}}function WP(r,d){if(r&1&&(e(0,` 11690 `),G(1,HP,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors().PhoneNumber)}}function jP(r,d){r&1&&(e(0,` 11691 `),n(1,"span",5),e(2,"USER.NEW_PASSWORD"),a(),e(3,` 11692 `))}function YP(r,d){r&1&&(e(0,` 11693 `),n(1,"span",5),e(2,"USER.PASSWORD"),n(3,"span",6),e(4," *"),a()(),e(5,` 11694 `))}function QP(r,d){r&1&&(e(0,` 11695 `),n(1,"div",1),e(2,` 11696 `),e(3,` 11697 `),n(4,"div",27),e(5,` 11698 `),n(6,"div",28),e(7,` 11699 `),n(8,"label",29),e(9),I(10,"translate"),a(),e(11,` 11700 `),a(),e(12,` 11701 `),n(13,"div",30),e(14,` 11702 `),n(15,"p-checkbox",31),e(16,` 11703 `),a(),e(17,` 11704 `),a(),e(18,` 11705 `),a(),e(19,` 11706 `),a(),e(20,` 11707 `)),r&2&&(l(9),K(` 11708 `,y(10,3,"USER.REQUEST_MANAGER_PRIVILEGES"),` 11709 `),l(6),p("binary",!0)("tabindex",8))}var zr=(()=>{class r{autoFocus=ee(!0);canEdit=ee();form=ee.required();groupId=ee();isUserEdit=ee(!1);requestEventGroupAccessPage=ee(!1);submitted=ee(!1);userName=ee();validationErrors=ee();static \u0275fac=function(o){return new(o||r)};static \u0275cmp=B({type:r,selectors:[["qware-user-external-details"]],inputs:{autoFocus:[1,"autoFocus"],canEdit:[1,"canEdit"],form:[1,"form"],groupId:[1,"groupId"],isUserEdit:[1,"isUserEdit"],requestEventGroupAccessPage:[1,"requestEventGroupAccessPage"],submitted:[1,"submitted"],userName:[1,"userName"],validationErrors:[1,"validationErrors"]},standalone:!1,decls:192,vars:47,consts:[[1,"grid","zipper","flex-inline",3,"formGroup"],[1,"col-12","lg:col-6","md:col-6","first-column","field-container"],[1,"medium-input"],["id","qware.user-external.details.input.first-name","type","text","pInputText","","name","firstName","formControlName","FirstName","variant","filled",3,"tabindex","qwareFocus","fluid"],["id","qware.user-external.details.label.first-name","for","qware.user-external.details.input.first-name"],["translate",""],[1,"required-mark"],["id","qware.user-external.details.error.first-name",1,"validation-error",3,"hidden"],["translate","",3,"hidden"],[1,"col-12","lg:col-6","md:col-6","second-column","field-container"],["id","qware.user-external.details.input.last-name","type","text","pInputText","","name","lastName","formControlName","LastName","variant","filled",3,"tabindex","fluid"],["id","qware.user-external.details.label.last-name","for","qware.user-external.details.input.last-name"],["id","qware.user-external.details.error.last-name",1,"validation-error",3,"hidden"],["id","qware.user-external.details.input.email","type","text","pInputText","","name","email","formControlName","Email","variant","filled",3,"tabindex","fluid"],["id","qware.user-external.details.label.email","for","qware.user-external.details.input.email"],[1,"validation-error",3,"hidden"],["id","qware.user-external.details.error.email.required","translate","",3,"hidden"],["id","qware.user-external.details.error.email.length","translate","",3,"hidden"],["id","qware.user-external.details.error.email.format","translate","",3,"hidden"],["inputId","qware.user-external.details.input.phone","styleClass","full-width","mask","(999) 999-9999","name","phone","formControlName","PhoneNumber","variant","filled",1,"is-filled",3,"tabindex","unmask","autoClear"],["id","qware.user-external.details.label.phone","for","qware.user-external.details.input.phone"],["hidden","","autocomplete","username","type","text","pInputText","",3,"ngModelChange","ngModel","ngModelOptions"],["inputId","qware.user-external.details.input.new-password","type","password","name","NewPassword","formControlName","NewPassword","autocomplete","new-password","variant","filled",1,"is-filled",3,"tabindex","fluid"],["id","qware.user-external.details.label.new-password","for","qware.user-external.details.input.new-password"],["inputId","qware.user-external.details.input.confirm-password","type","password","name","ConfirmPassword","formControlName","ConfirmPassword","autocomplete","new-password","variant","filled",1,"is-filled",3,"tabindex","fluid"],["id","qware.user-external.details.label.confirm-password","for","qware.user-external.details.input.confirm-password"],[1,"validation-error"],[1,"medium-input","pt-2"],[2,"float","left"],["for","qware.user-external.details.checkbox.manager-privileges"],[2,"float","right"],["formControlName","RequestManagerPrivileges","id","qware.user-external.details.checkbox.manager-privileges",3,"binary","tabindex"]],template:function(o,i){if(o&1&&(n(0,"div",0),e(1,` 11710 `),e(2,` 11711 `),n(3,"div",1),e(4,` 11712 `),e(5,` 11713 `),n(6,"div",2),e(7,` 11714 `),n(8,"p-floatlabel"),e(9,` 11715 `),R(10,"input",3),e(11,` 11716 `),n(12,"label",4),e(13,` 11717 `),n(14,"span",5),e(15,"USER.FIRSTNAME"),a(),n(16,"span",6),e(17," *"),a(),e(18,` 11718 `),a(),e(19,` 11719 `),a(),e(20,` 11720 `),n(21,"small",7),e(22,` 11721 `),n(23,"div",8),e(24,` 11722 USER.ERROR.FIRSTNAME_REQUIRED 11723 `),a(),e(25,` 11724 `),n(26,"div",8),e(27,` 11725 USER.ERROR.FIRSTNAME_LENGTH 11726 `),a(),e(28,` 11727 `),a(),e(29,` 11728 `),_(30,GP,3,0),a(),e(31,` 11729 `),a(),e(32,` 11730 11731 `),n(33,"div",9),e(34,`
11732 `),e(35,` 11733 `),n(36,"div",2),e(37,` 11734 `),n(38,"p-floatlabel"),e(39,` 11735 `),R(40,"input",10),e(41,` 11736 `),n(42,"label",11),e(43,` 11737 `),n(44,"span",5),e(45,"USER.LASTNAME"),a(),n(46,"span",6),e(47," *"),a(),e(48,` 11738 `),a(),e(49,` 11739 `),a(),e(50,` 11740 `),n(51,"small",12),e(52,` 11741 `),n(53,"div",8),e(54,` 11742 USER.ERROR.LASTNAME_REQUIRED 11743 `),a(),e(55,` 11744 `),n(56,"div",8),e(57,` 11745 USER.ERROR.LASTNAME_LENGTH 11746 `),a(),e(58,` 11747 `),a(),e(59,` 11748 `),_(60,VP,3,0),a(),e(61,` 11749 `),a(),e(62,` 11750 11751 `),e(63,` 11752 `),n(64,"div",1),e(65,` 11753 `),e(66,` 11754 `),n(67,"div",2),e(68,` 11755 `),n(69,"p-floatlabel"),e(70,` 11756 `),R(71,"input",13),e(72,` 11757 `),n(73,"label",14),e(74,` 11758 `),n(75,"span",5),e(76,"USER.EMAIL"),a(),n(77,"span",6),e(78," *"),a(),e(79,` 11759 `),a(),e(80,` 11760 `),a(),e(81,` 11761 `),n(82,"small",15),e(83,` 11762 `),n(84,"div",16),e(85,` 11763 USER.ERROR.EMAIL_REQUIRED 11764 `),a(),e(86,` 11765 `),n(87,"div",17),e(88,` 11766 USER.ERROR.EMAIL_LENGTH 11767 `),a(),e(89,` 11768 `),n(90,"div",18),e(91,` 11769 USER.ERROR.EMAIL_FORMAT 11770 `),a(),e(92,` 11771 `),a(),e(93,` 11772 `),_(94,BP,3,0),a(),e(95,` 11773 `),a(),e(96,` 11774 11775 `),n(97,"div",9),e(98,` 11776 `),e(99,` 11777 `),n(100,"div",2),e(101,` 11778 `),n(102,"p-floatlabel"),e(103,` 11779 `),n(104,"p-inputmask",19),e(105,` 11780 `),a(),e(106,` 11781 `),n(107,"label",20),e(108,` 11782 `),n(109,"span",5),e(110,"USER.PHONE"),a(),n(111,"span",6),e(112," *"),a(),e(113,` 11783 `),a(),e(114,` 11784 `),a(),e(115,` 11785 `),n(116,"small",15),e(117,` 11786 `),n(118,"div",8),e(119,` 11787 USER.ERROR.PHONENUMBER_NOTNUMBER 11788 `),a(),e(120,` 11789 `),n(121,"div",8),e(122,` 11790 USER.ERROR.PHONENUMBER_LENGTH 11791 `),a(),e(123,` 11792 `),a(),e(124,` 11793 `),_(125,WP,3,0),a(),e(126,` 11794 `),a(),e(127,` 11795 11796 `),e(128,` 11797 `),n(129,"div",1),e(130,` 11798 `),e(131,` 11799 `),n(132,"input",21),j("ngModelChange",function(c){return W(i.userName,c)||(i.userName=c),c}),a(),e(133,` 11800 `),e(134,` 11801 `),n(135,"div",2),e(136,` 11802 `),n(137,"p-floatlabel"),e(138,` 11803 `),n(139,"p-password",22),e(140,` 11804 `),a(),e(141,` 11805 `),n(142,"label",23),e(143,` 11806 `),_(144,jP,4,0)(145,YP,6,0),a(),e(146,` 11807 `),a(),e(147,` 11808 `),n(148,"small",15),e(149,` 11809 `),n(150,"div",8),e(151,` 11810 LOGIN.PASSWORD_MIN_LENGTH_VALIDATION 11811 `),a(),e(152,` 11812 `),n(153,"div",8),e(154,` 11813 LOGIN.PASSWORD_MAX_LENGTH_VALIDATION 11814 `),a(),e(155,` 11815 `),a(),e(156,` 11816 `),a(),e(157,` 11817 `),a(),e(158,` 11818 11819 `),n(159,"div",9),e(160,` 11820 `),e(161,` 11821 `),n(162,"div",2),e(163,` 11822 `),n(164,"p-floatlabel"),e(165,` 11823 `),n(166,"p-password",24),e(167,` 11824 `),a(),e(168,` 11825 `),n(169,"label",25),e(170,` 11826 `),n(171,"span",5),e(172,"USER.CONFIRM_PASSWORD"),a(),n(173,"span",6),e(174," *"),a(),e(175,` 11827 `),a(),e(176,` 11828 `),a(),e(177,` 11829 `),n(178,"small",15),e(179,` 11830 `),n(180,"div",8),e(181,` 11831 LOGIN.PASSWORD_CONFIRMATION_REQUIRED_VALIDATION 11832 `),a(),e(182,` 11833 `),n(183,"div",8),e(184,` 11834 LOGIN.PASSWORD_MATCH_VALIDATION 11835 `),a(),e(185,` 11836 `),a(),e(186,` 11837 `),a(),e(187,` 11838 `),a(),e(188,` 11839 11840 `),e(189,` 11841 `),_(190,QP,21,5),a(),e(191,` 11842 11843 11844`)),o&2){let s,c,u,x,C,O,w,F,L,U,V,z,ce;p("formGroup",i.form()),l(10),p("tabindex",1)("qwareFocus",i.autoFocus())("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.FirstName.valid||i.form().controls.FirstName.pristine&&!i.submitted()),l(2),p("hidden",!((s=i.form().controls.FirstName.errors)!=null&&s.required)),l(3),p("hidden",!((c=i.form().controls.FirstName.errors)!=null&&c.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().FirstName&&i.form().controls.FirstName.untouched?30:-1),l(10),p("tabindex",2)("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.LastName.valid||i.form().controls.LastName.pristine&&!i.submitted()),l(2),p("hidden",!((u=i.form().controls.LastName.errors)!=null&&u.required)),l(3),p("hidden",!((x=i.form().controls.LastName.errors)!=null&&x.maxlength)),l(4),f(i.validationErrors()&&i.validationErrors().LastName&&i.form().controls.LastName.untouched?60:-1),l(11),p("tabindex",3)("fluid",!0),Ve("disabled",i.canEdit()===!1?!0:null),l(11),p("hidden",i.form().controls.Email.valid||i.form().controls.Email.pristine&&!i.submitted()),l(2),p("hidden",!((C=i.form().controls.Email.errors)!=null&&C.required)),l(3),p("hidden",!((O=i.form().controls.Email.errors)!=null&&O.maxlength)),l(3),p("hidden",!((w=i.form().controls.Email.errors)!=null&&w.pattern)),l(4),f(i.validationErrors()&&i.validationErrors().Email&&i.form().controls.Email.untouched?94:-1),l(10),p("tabindex","4")("unmask",!0)("autoClear",!1),l(12),p("hidden",i.form().controls.PhoneNumber.valid||i.form().controls.PhoneNumber.pristine&&!i.submitted()),l(2),p("hidden",!((F=i.form().controls.PhoneNumber.errors)!=null&&F.pattern)),l(3),p("hidden",!((L=i.form().controls.PhoneNumber.errors)!=null&&L.minlength)),l(4),f(i.validationErrors()&&i.validationErrors().PhoneNumber&&i.form().controls.PhoneNumber.untouched?125:-1),l(7),H("ngModel",i.userName),p("ngModelOptions",ne(46,UP)),l(7),p("tabindex",5)("fluid",!0),l(5),f(i.isUserEdit()?144:145),l(4),p("hidden",i.form().controls.NewPassword.valid||i.form().controls.NewPassword.pristine&&!i.submitted()),l(2),p("hidden",!((U=i.form().controls.NewPassword.errors)!=null&&U.minlength)),l(3),p("hidden",!((V=i.form().controls.NewPassword.errors)!=null&&V.maxlength)),l(13),p("tabindex",6)("fluid",!0),Ve("disabled",i.form().controls.NewPassword.value===""?!0:null),l(12),p("hidden",i.form().controls.ConfirmPassword.valid||i.form().controls.ConfirmPassword.pristine&&!i.submitted()),l(2),p("hidden",!((z=i.form().controls.ConfirmPassword.errors)!=null&&z.required)),l(3),p("hidden",!((ce=i.form().controls.ConfirmPassword.errors)!=null&&ce.MatchPassword)),l(7),f(i.requestEventGroupAccessPage()?190:-1)}},dependencies:[yt,Ne,je,Ae,se,ge,Le,Un,ye,Ya,Te,De,$,ie],encapsulation:2,changeDetection:0})}return r})();function KP(r,d){if(r&1){let t=b();e(0,` 11845 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 11846 `),n(3,"span",16),e(4),a(),e(5,` 11847 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 11848 `),a(),e(10,` 11849 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"SHARED.DETAILS"))}}
11849function $P(r,d){if(r&1){let t=b();e(0,` 11850 `),n(1,"button",15),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 11851 `),n(3,"span",16),e(4),a(),e(5,` 11852 `),n(6,"span",17),e(7),I(8,"translate"),a(),e(9,` 11853 `),a(),e(10,` 11854 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"USER.ASSIGN_GROUPS"))}}function zP(r,d){if(r&1){let t=b();e(0,` 11855 `),n(1,"div",3),e(2,` 11856 `),n(3,"h3",4),e(4,` 11857 USER.CREATE_EXT_USER 11858 `),a(),e(5,` 11859 `),n(6,"p-stepper",5),j("valueChange",function(i){E(t);let s=m();return W(s.stepIndex,i)||(s.stepIndex=i),S(i)}),e(7,` 11860 `),n(8,"p-step-list"),e(9,` 11861 `),n(10,"p-step",6),e(11,` 11862 `),_(12,KP,11,4,"ng-template",null,0,A),e(14,` 11863 `),a(),e(15,` 11864 `),n(16,"p-step",6),e(17,` 11865 `),_(18,$P,11,4,"ng-template",null,0,A),e(20,` 11866 `),a(),e(21,` 11867 `),a(),e(22,` 11868 `),n(23,"p-step-panels"),e(24,` 11869 `),n(25,"p-card"),e(26,` 11870 `),n(27,"div",7),e(28,` 11871 `),n(29,"h4",8),e(30,` 11872 SHARED.DETAILS 11873 `),a(),e(31,` 11874 `),n(32,"qware-user-external-details",9),e(33,` 11875 `),a(),e(34,` 11876 `),a(),e(35,` 11877 `),n(36,"div",7),e(37,` 11878 `),n(38,"h4",10),e(39,` 11879 USER.ASSIGN_GROUPS 11880 `),a(),e(40,` 11881 `),n(41,"qware-user-external-assigned-groups",11),e(42,` 11882 `),a(),e(43,` 11883 `),a(),e(44,` 11884 `),n(45,"div",12),e(46,` 11885 `),n(47,"p-button",13),I(48,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepBack())}),e(49,` 11886 `),a(),e(50,` 11887 `),n(51,"p-button",14),I(52,"translate"),h("onClick",function(){E(t);let i=m();return S(i.stepSubmit(i.stepIndex))})("keydown.enter",function(i){return E(t),S(i.preventDefault())}),e(53,` 11888 `),a(),e(54,` 11889 `),a(),e(55,` 11890 `),a(),e(56,` 11891 `),a(),e(57,` 11892 `),a(),e(58,` 11893 `),a(),e(59,` 11894 `)}if(r&2){let t=m();l(6),H("value",t.stepIndex),l(4),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1),l(11),p("hidden",t.stepIndex!==0),l(5),p("form",t.form.controls.Details)("submitted",t.submitted)("validationErrors",t.validationErrors)("canEdit",!0),l(4),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.SecurityAccess)("submitted",t.submitted)("validationErrors",t.validationErrors)("availableExternalTenantGroups",t.allExternalTenantGroups),l(6),q("label",y(48,20,t.stepIndex===0?"SHARED.CANCEL":"SHARED.BACK")),p("text",!0),l(4),q("label",y(52,22,t.stepIndex===1?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(t.steps[t.stepIndex].control!=null&&t.steps[t.stepIndex].control.valid))}}var wc=(()=>{class r{authService;externalUserGroupService;fb;responseService;route;router;toastService;translate;userService;allExternalTenantGroups=[];canEdit=!0;displaySpinner=!0;form;isLoaded=!1;stepIndex=0;steps=[];submitted=!1;validationErrors;constructor(t,o,i,s,c,u,x,C,O){this.authService=t,this.externalUserGroupService=o,this.fb=i,this.responseService=s,this.route=c,this.router=u,this.toastService=x,this.translate=C,this.userService=O}ngOnInit(){this.createForm(),this.loadData()}loadData(){let t=this.authService.currentUserType===Rt.INTERNAL;this.externalUserGroupService.getAllExternalUserGroups(this.authService.tenant.Id).subscribe(o=>{let i=o;this.allExternalTenantGroups=i.filter(s=>s.State===M.ACTIVE&&(t||s.Approved)&&(t||this.authService.currentUserManagedExternalGroupIds.includes(s.Id??""))),this.steps=[{label:"SHARED.DETAILS",value:0,control:this.form.get("Details")},{label:"USER.ASSIGN_GROUPS",value:1,control:this.form.get("SecurityAccess")}],this.isLoaded=!0,this.displaySpinner=!1})}createForm(){this.form=this.fb.group({Details:this.fb.group({FirstName:this.fb.control("",[T.required,T.maxLength(re)]),LastName:this.fb.control("",[T.required,T.maxLength(re)]),Email:this.fb.control("",[T.required,T.maxLength(re),T.pattern(Ui)]),PhoneNumber:this.fb.control("",[T.pattern("^[0-9]*"),T.minLength(10)]),NewPassword:this.fb.control("",[T.minLength(Nn),T.maxLength(On),T.required]),ConfirmPassword:this.fb.control("",T.required)}),SecurityAccess:this.fb.group({ExternalUserGroupIds:this.fb.control([]),UserExternalGroupAssociations:this.fb.control([])})},{validators:[ia.matchPassword("NewPassword","ConfirmPassword","Details")]})}isDirty(){return this.form.dirty&&!this.submitted}stepBack(){if(this.stepIndex===0){let t={relativeTo:this.route};this.router.navigate(["../../"+P.userList],t)}else this.stepIndex--}stepSubmit(t){this.steps[t].control?.valid&&(t<1?this.stepIndex++:this.submitForm(new Ji().parseExternalUserForm(this.form.value)))}submitForm(t){this.submitted||(this.form.valid?(this.submitted=!0,this.displaySpinner=!0,t.Type=Rt.EXTERNAL,this.userService.createUser(t,this.authService.tenant.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.CREATE","../../"+P.userList,this.route,{name:t.fullName(),email:t.Email})},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(i=>i.control),this.validationErrors)}})):this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(o=>{this.toastService.error(o["SHARED.ERROR_LABEL"],o["SHARED.ERROR.FAILED_VALIDATION"])}))}static \u0275fac=function(o){return new(o||r)(g(de),g(un),g(be),g(Re),g(he),g(Be),g(Se),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-external-create"]],standalone:!1,decls:7,vars:2,consts:[["content",""],[1,"col-12",3,"keydown.enter"],["id","qware.user-external.create.spinner",3,"displaySpinner"],[1,"form-container"],["id","qware.user-external.create.header","translate","",1,"page-header"],[3,"valueChange","value"],[3,"value"],[3,"hidden"],["id","qware.user-external.create.user-details.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","canEdit"],["id","qware.user-external.create.user-assign-groups.label","translate","",1,"page-header"],[3,"form","submitted","validationErrors","availableExternalTenantGroups"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.user-external.create-user.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","999","id","qware.user-external.create-user.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"]],template:function(o,i){o&1&&(n(0,"div",1),h("key
11894down.enter",function(){return i.stepSubmit(i.stepIndex)}),e(1,` 11895 `),n(2,"qware-spinner",2),e(3,` 11896 `),_(4,zP,60,24),a(),e(5,` 11897`),a(),e(6,` 11898`)),o&2&&(l(2),p("displaySpinner",i.displaySpinner),l(2),f(i.isLoaded?4:-1))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,ds,zr,ie],encapsulation:2})}return r})();var Xr=He(nt());var XP=["actionsMenu"],ZP=["shades"],JP=["drawer"],eG=r=>({"lg:col-8":r}),tG=()=>["0"];function iG(r,d){r&1&&(e(0,` 11899 `),n(1,"h3",28),e(2,` 11900 USER.MY_ACCOUNT 11901 `),a(),e(3,` 11902 `))}function nG(r,d){r&1&&(e(0,` 11903 `),n(1,"h3",28),e(2,` 11904 USER.EDIT_USER 11905 `),a(),e(3,` 11906 `))}function aG(r,d){if(r&1&&(e(0,` 11907 `),n(1,"a",29),e(2,` 11908 `),n(3,"span",30),e(4),a(),e(5,` 11909 `),n(6,"span",31),e(7),a(),e(8,` 11910 `),a(),e(9,` 11911 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function rG(r,d){r&1&&(e(0,` 11912 `),n(1,"span",33),e(2,"SHARED.ACTIONS"),a(),e(3,` 11913 `),n(4,"i",34),e(5,"expand_more"),a(),e(6,` 11914 `))}function oG(r,d){if(r&1){let t=b();e(0,` 11915 `),n(1,"p-button",32),h("onClick",function(i){E(t),m();let s=Ee(11);return S(s.toggle(i))}),e(2,` 11916 `),_(3,rG,7,0,"ng-template",null,4,A),e(5,` 11917 `),a(),e(6,` 11918 `)}r&2&&(l(),p("raised",!0))}function lG(r,d){if(r&1&&(e(0,` 11919 `),n(1,"a",29),e(2,` 11920 `),n(3,"span",30),e(4),a(),e(5,` 11921 `),n(6,"span",31),e(7),a(),e(8,` 11922 `),a(),e(9,` 11923 `)),r&2){let t=d.$implicit;l(4),v(t.icon),l(3),v(t.label)}}function sG(r,d){if(r&1){let t=b();e(0,` 11924 `),n(1,"div",35),e(2,` 11925 `),n(3,"p-menu",36,5),h("click",function(){E(t);let i=Ee(4);return S(i.hide())}),e(5,` 11926 `),_(6,lG,10,2,"ng-template",null,1,A),e(8,` 11927 `),a(),e(9,` 11928 `),n(10,"p-button",37),h("onClick",function(i){E(t);let s=Ee(4),c=m();return s.toggle(i),S(c.isActive=!c.isActive)}),e(11,` 11929 `),n(12,"i",34),e(13,"more_vert"),a(),e(14,` 11930 `),a(),e(15,` 11931 `),a(),e(16,` 11932 `)}if(r&2){let t=m();l(3),p("model",t.moreItems)("popup",!0),l(7),p("rounded",!0)("text",!0)}}function dG(r,d){r&1&&(e(0,` 11933 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 11934 `))}function pG(r,d){r&1&&(e(0,` 11935 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 11936 `))}function mG(r,d){if(r&1&&(e(0,` 11937 `),_(1,dG,4,0)(2,pG,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function cG(r,d){r&1&&(e(0,` 11938 `),n(1,"i",34),e(2,"expand_less"),a(),e(3,` 11939 `))}function uG(r,d){r&1&&(e(0,` 11940 `),n(1,"i",34),e(2,"expand_more"),a(),e(3,` 11941 `))}function _G(r,d){if(r&1&&(e(0,` 11942 `),_(1,cG,4,0)(2,uG,4,0)),r&2){let t=d.active;l(),f(t?1:2)}}function EG(r,d){if(r&1){let t=b();e(0,` 11943 `),n(1,"p-button",38),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.rejectRequest())}),e(3,` 11944 `),a(),e(4,` 11945 `),n(5,"p-button",39),I(6,"translate"),h("onClick",function(){E(t);let i=m();return S(i.approveRequest())}),e(7,` 11946 `),a(),e(8,` 11947 `)}if(r&2){let t=m();l(),q("label",y(2,5,"SHARED.REJECT_REQUEST")),p("text",!0),l(4),q("label",y(6,7,"SHARED.APPROVE_REQUEST")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function SG(r,d){if(r&1){let t=b();e(0,` 11948 `),n(1,"p-button",40),I(2,"translate"),h("onClick",function(){E(t);let i=m();return S(i.save())}),e(3,` 11949 `),a(),e(4,` 11950 `)}if(r&2){let t=m();l(),q("label",y(2,3,"SHARED.SAVE")),p("text",!0)("disabled",!t.form.dirty||!t.form.valid)}}function xG(r,d){r&1&&(e(0,` 11951 `),n(1,"div",43),e(2,` 11952 `),n(3,"span",44),e(4,"SHARED.AUDIT_LOG"),a(),e(5,` 11953 `),a(),e(6,` 11954 `))}function fG(r,d){if(r&1){let t=b();e(0,` 11955 `),n(1,"qware-spinner",45),e(2,` 11956 `),n(3,"div",46),e(4,` 11957 `),n(5,"qware-entity-history",47),j("parentSpinnerStateChange",function(i){E(t);let s=m(2);return W(s.displayDrawerSpinner,i)||(s.displayDrawerSpinner=i),S(i)}),e(6,` 11958 `),a(),e(7,` 11959 `),a(),e(8,` 11960 `),a(),e(9,` 11961 `)}if(r&2){let t=m(2);l(),p("displaySpinner",t.displayDrawerSpinner())("isAbsolute",!0),l(4),p("createdText",t.historyCreatedText)("nameMap",t.historyNameMap)("idMaps",t.historyIdMap)("arrayProperties",t.historyArrayProperties),H("parentSpinnerState",t.displayDrawerSpinner)}}function hG(r,d){if(r&1){let t=b();e(0,` 11962 `),n(1,"div",41),e(2,` 11963 `),n(3,"p-drawer",42,6),j("visibleChange",function(i){E(t);let s=m();return W(s.showSidebar,i)||(s.showSidebar=i),S(i)}),h("onHide",function(){E(t);let i=m();return S(i.userEnabledSidebar=!1)}),e(5,` 11964 `),_(6,xG,7,0,"ng-template",null,7,A),e(8,` 11965 `),_(9,fG,10,7,"ng-template",null,4,A),e(11,` 11966 `),a(),e(12,` 11967 `),a(),e(13,` 11968 `)}if(r&2){let t=m();l(),ve("sidebar-init",!t.showSidebar),l(2),H("visible",t.showSidebar),p("modal",t.showMask)("transitionOptions",t.sidebarOptions)("closeOnEscape",!1)}}var ld=(()=>{class r{authService;cacheService;cdr;confirmationService;externalUserGroupService;fb;loginService;toastService;responseService;route;router;translate;userService;actionsMenu;shades;drawer;displayDrawerSpinner=D(!1);actionItems=[];allExternalUserGroups=[];allUserExternalGroupAssociations=[];availableExternalUserGroups=[];defaultSupervisor;displaySpinner=!0;form;historyArrayProperties=[];historyCreatedText;historyIdMap=new Map;historyNameMap=new Map;isAccountUrl=!1;isActive=!1;isApproved=!1;isInternalUser=!1;
11968isLoggedUser=!1;isManagingAccount=!1;isUserGroupDisabled=!1;locale;locationTreeNodes=new Map;loggedUserManagedGroupIds;moreItems=[];securityHeader="";selectedExternalGroups=[];serviceAreaOptions=new Map;showMask=!1;showSidebar=!1;sidebarOptions=qe.REMOVE_ANIMATION;submitted=!1;supervisorOptions=[];user;userEnabledSidebar=!1;userFirstLetter="";userGroupOptions=new Map;validationErrors;auditLoggingDisabled=!0;userListRoute="../../../"+P.userList;accordionCard={colorScheme:{light:{bodyPadding:"0"}}};shadeFormGroups=[];translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L,U){this.authService=t,this.cacheService=o,this.cdr=i,this.confirmationService=s,this.externalUserGroupService=c,this.fb=u,this.loginService=x,this.toastService=C,this.responseService=O,this.route=w,this.router=F,this.translate=L,this.userService=U}configureRightDrawer(){let t=window.innerWidth>=Je.lgbreak;this.showSidebar=t||this.userEnabledSidebar,this.showMask=window.innerWidth<Je.lgbreak,this.showMask&&this.showSidebar?this.drawer?.enableModality():this.drawer?.disableModality(),this.sidebarOptions=this.showSidebar?qe.REMOVE_ANIMATION:qe.ADD_ANIMATION}ngOnInit(){this.auditLoggingDisabled=!this.authService?.qwareSubscription?.auditLogging,this.isInternalUser=this.authService.currentUserType===Rt.INTERNAL,this.isLoggedUser=this.authService.currentUserId===this.route.snapshot.params.id,this.configureRightDrawer(),this.createForm(),this.loadData()}loadData(){let t=this.route.snapshot.params.id;this.isAccountUrl=this.route.snapshot.url[this.route.snapshot.url.length-1]?.path==="account",ue([this.translate.get(["SHARED.DISABLE","SHARED.DELETE","SHARED.ENABLE","SHARED.RESTORE","SHARED.AUDIT_LOG","USER.NO_SUPERVISOR","SHARED.DISABLED","SHARED.DELETED","AUDIT.USER","USER.ERROR.NO_TENANT","USER.ERROR.NO_TENANT_DESCRIPTION","USER.SECURITY_AND_ACCESS","USER.PASSWORD_AND_FAVORITES","SHARED.CANCEL_REQUEST","SHARED.PENDING_APPROVAL"]).pipe(N()),this.userService.getExternalUser(t,this.authService.tenant.Id),this.externalUserGroupService.getAllExternalUserGroups(this.authService.tenant.Id)]).subscribe({next:o=>{this.translations=o[0],this.user=o[1],this.allExternalUserGroups=o[2],this.isApproved=this.user.Approved??!1,this.isManagingAccount=this.authService.currentUser?.Id===this.user.Id;let i=[];if(this.user.UserExternalGroupAssociations){this.user.UserExternalGroupAssociations.forEach(u=>{u.TenantGroupId&&this.allExternalUserGroups.find(C=>C.Id===u.TenantGroupId)&&i.push(u.TenantGroupId)}),this.form.get("SecurityAccess.ExternalUserGroupIds")?.setValue(i);let c=this.user.UserExternalGroupAssociations.filter(u=>this.isInternalUser||this.authService.currentUserManagedExternalGroupIds.includes(u.TenantGroupId??"")||this.isLoggedUser);c.forEach(u=>{let x=this.allExternalUserGroups.find(C=>C.Id===u.TenantGroupId);if(x){u.TenantGroupName=x.Name;let C=x.AddressStreet+" "+x.AddressCity+", "+x.AddressState+" "+x.AddressZip;u.TenantGroupAddress=C,u.TenantGroupPhone=x.PhoneNumber,u.TenantGroupState=x.State}}),this.allUserExternalGroupAssociations=Xr.default.sortBy(c,u=>u.TenantGroupName?.toLowerCase())}let s=this.allExternalUserGroups.filter(c=>(c.State===M.ACTIVE&&(this.isInternalUser||c.Approved)||i.includes(c.Id??""))&&(this.isInternalUser||this.authService.currentUserManagedExternalGroupIds.includes(c.Id??"")||this.isLoggedUser)).map(c=>{let u=c.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":"";return u=c.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":u,u=c.Approved?u:u+" ("+this.translations["SHARED.PENDING_APPROVAL"]+")",c.Name=c.Name+u,c});if(this.availableExternalUserGroups=Xr.default.sortBy(s,c=>c.Name?.toLowerCase()),this.selectedExternalGroups=Xr.default.intersection(this.availableExternalUserGroups.map(c=>c.Id??""),i),this.moreItems=[{id:"audit.log.action",label:this.translations["SHARED.AUDIT_LOG"],icon:"list_alt",command:()=>this.toggleSidebar()}],this.isApproved&&(this.actionItems=[{id:"disable.action",label:this.translations["SHARED.DISABLE"],icon:"block",command:()=>this.disableUser()},{id:"enable.action",label:this.translations["SHARED.ENABLE"],icon:"check",command:()=>this.enableUser()}],this.isInternalUser&&(this.actionItems=Xr.default.concat(this.actionItems,[{id:"delete.action",label:this.translations["SHARED.DELETE"],icon:"delete",command:()=>this.deleteUser()},{id:"restore.action",label:this.translations["SHARED.RESTORE"],icon:"restore",command:()=>this.restoreUser()}]))),this.userFirstLetter=this.user&&this.user.FirstName?this.user.FirstName[0].toUpperCase():"",this.actionItems=this.actionItems.filter(c=>c.id!==(this.user?.State===M.DISABLED?"disable.action":"enable.action")),this.actionItems=this.actionItems.filter(c=>c.id!==(this.user?.State===M.DELETED?"delete.action":"restore.action")),this.user.State===M.DELETED&&(this.actionItems=this.actionItems.filter(c=>c.id!=="disable.action")),this.authService.userHasPrivilege(ae.CAN_RESTORE_DELETED)||(this.actionItems=this.actionItems.filter(c=>c.id!=="restore.action")),!this.supervisorOptions.find(c=>c.value===this.user?.Supervisor)&&this.user.SupervisorUser){let c=this.user.SupervisorUser,u=c.State===M.DISABLED?" ("+this.translations["SHARED.DISABLED"]+")":c.State===M.DELETED?" ("+this.translations["SHARED.DELETED"]+")":"";this.supervisorOptions.push({label:c.fullNameWithEmail()+u,value:c.Id,styleClass:"disabled-ddl-item"})}if(this.user){this.form.patchValue(new Ji().toExternalUserForm(this.user));let c=this.form.get("Details.PhoneNumber");c&&c.value&&c.value.length>0&&We.addPrimeNgFilledClass("qware.user-external.details.input.phone")}this.setHistoryParams(),this.cdr.detectChanges(),this.form.markAsPristine(),this.form.markAsUntouched(),this.user&&this.user.State==="DELETED"&&this.form.disable(),this.displaySpinner=!1},error:o=>{this.responseService.onDataError(o,this.userListRoute,this.route)}})}createForm(){this.form=this.fb.group({Details:this.fb.group({FirstName:this.fb.control("",[T.required,T.maxLength(re)]),LastName:this.fb.control("",[T.required,T.maxLength(re)]),Email:this.fb.control("",[T.required,T.maxLength(re),T.pattern(Ui)]),PhoneNumber:this.fb.control(""),NewPassword:this.fb.control("",[T.minLength(Nn),T.maxLength(On)]),ConfirmPassword:this.fb.control("",T.required)}),SecurityAccess:this.fb.group({ExternalUserGroupIds:this.fb.control([]),UserExternalGroupAssociations:this.fb.control([],[Qi.minSize(1)])})},{validators:[ia.matchPassword("NewPassword","ConfirmPassword","Details")]}),!this.isInternalUser&&!this.isLoggedUser&&this.form.get("Details")?.disable(),this.shadeFormGroups=[this.form.get("Details"),this.form.get("SecurityAccess")]}setHistoryParams(){this.historyCreatedText=this.translations["AUDIT.USER"]+' "'+this.user?.FirstName+" "+this.user?.LastName+'"';let t=new Map;t.set("TenantGroupId",[this.allExternalUserGroups,"Id",i=>i.Name]),this.historyIdMap=t;let o=new Map;o.set("FirstName","USER.FIRSTNAME"),o.set("LastName","USER.LASTNAME"),o.set("Email","USER.EMAIL"),o.set("PhoneNumber","USER.PHONE"),o.set("TenantGroupId","USER.USERGROUP"),this.historyNameMap=o}isDirty(){return this.form.dirty&&!this.submitted}save(){if(!this.submitted)if(this.form.valid){this.submitted=!0,this.displaySpinner=!0,this.form.get("Details")?.enable();let t=new Ji().parseExternalUserForm(this.form.value);t.Id=this.user?.Id,t.UserId=this.user?.Id,t.Type=Rt.EXTERNAL,t.State=this.user?.State??M.ACTIVE,t.UserExternalGroupAssociations&&t.UserExternalGroupAssociations.length>0&&t.UserExternalGroupAssociations?.forEach(o=>o.UserId=this.user?.Id),this.userService.editUser(t,this.authService.tenant.Id).pipe(we(()=>{let o=[];return t.Password&&t.Id!==void 0&&o.push(this.authService.resetPassword(t.Id,t.Password,void 0,!0)),o.length===0?Fe({}):ue(o)}),we(()=>t.Id?this.userService.getUser(t.Id,this.authService.tenant.Id):Fe({}))).subscribe({next:o=>{t.Id===this.authService.currentUserId&&(this.authService.currentUser=o),this.isManagingAccount&&this.isAccountUrl?(this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.SAVE"),this.loginService.handleRedirect()):(this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.SAVE",this.userListRoute,this.route))},error:o=>{this.submitted=!1,!this.isInternalUser&&!this.isLoggedUser&&this.form.get("Details")?.disable(),this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}disableUser(){this.actionsMenu.hide(),this.translate.get(["SHARED.DISABLE_HEADER","SHARED.DISABLE_MESSAGE"],{entity:this.user?.fullName()}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"disablePromptDialog",header:t["SHARED.DISABLE_HEADER"],message:t["SHARED.DISABLE_MESSAGE"],accept:()=>{this.user?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userService.disableUser(this.user.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.DISABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}approveRequest(){this.actionsMenu.hide(),this.submitted=!0;let t=new Ji().parseExternalUserForm(this.form.getRawValue());t.Id=this.user?.Id,t.UserId=this.user?.Id,t.Type=Rt.EXTERNAL,t.State=this.user?.State??M.ACTIVE,t.Approved=!0,t.UserExternalGroupAssociations&&t.UserExternalGroupAssociations.length>0&&t.UserExternalGroupAssociations?.forEach(o=>o.UserId=this.user?.Id),this.userService.editUser(t,this.authService.tenant.Id).pipe(we(()=>{let o=[];return t.Password&&t.Id!==void 0&&o.push(this.authService.resetPassword(t.Id,t.Password,void 0,!0)),o.length===0?Fe({}):ue(o)}),we(()=>t.Id?this.userService.getUser(t.Id,this.authService.tenant.Id):Fe({}))).subscribe({next:o=>{t.Id===this.authService.currentUserId&&(this.authService.currentUser=o),this.isManagingAccount&&this.isAccountUrl?(this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.SAVE"),this.loginService.handleRedirect()):(this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.SAVE",this.userListRoute,this.route))},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.form,this.shades,this.shadeFormGroups)}})}rejectRequest(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","USER.DELETE_REQUEST_MESSAGE"],{email:this.user?.Email,name:this.user?.fullName()}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t[""],message:t[""],accept:()=>{this.displaySpinner=!0,this.user?.Id&&this.userService.deleteUser(this.user.Id).subscribe({next:()=>{this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.REQUEST_DELETED",this.userListRoute,this.route,{name:this.user?.Name})},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}})}})})}enableUser(){this.actionsMenu.hide(),this.translate.get(["SHARED.ENABLE_HEADER","SHARED.ENABLE_MESSAGE","SHARED.ERROR_LABEL","USER.ERROR.TENANTGROUP_DISABLED"],{entity:this.user?.fullName()}).pipe(N()).subscribe(t=>{this.isUserGroupDisabled?this.toastService.error(t["SHARED.ERROR_LABEL"],t["USER.ERROR.TENANTGROUP_DISABLED"]):this.confirmationService.confirm({key:"enablePromptDialog",header:t["SHARED.ENABLE_HEADER"],message:t["SHARED.ENABLE_MESSAGE"],accept:()=>{this.user?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userService.enableUser(this.user.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.ENABLE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}deleteUser(){this.actionsMenu.hide(),this.translate.get(["SHARED.DELETE_HEADER","SHARED.DELETE_MESSAGE"],{entity:this.user?.fullName()}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"deletePromptDialog",header:t["SHARED.DELETE_HEADER"],message:t["SHARED.DELETE_MESSAGE"],accept:()=>{this.user?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userService.deleteUser(this.user.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.DELETE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}restoreUser(){this.actionsMenu.hide(),this.translate.get(["SHARED.RESTORE_HEADER","SHARED.RESTORE_MESSAGE"],{entity:this.user?.fullName()}).pipe(N()).subscribe(t=>{this.confirmationService.confirm({key:"restorePromptDialog",header:t["SHARED.RESTORE_HEADER"],message:t["SHARED.RESTORE_MESSAGE"],accept:()=>{this.user?.Id&&(this.displaySpinner=!0,this.submitted=!0,this.userService.restoreUser(this.user.Id).subscribe({next:()=>{this.cacheService.remove(ze.ALL_USERS),this.cacheService.remove(ze.ALL_TENANT_GROUP_USERS),this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.RESTORE",this.userListRoute,this.route)},error:o=>{this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o)}}))}})})}toggleSidebar(){this.showSidebar=!this.showSidebar,this.userEnabledSidebar=Xr.default.clone(this.showSidebar)}redirect(){if(this.isManagingAccount&&this.isAccountUrl)this.loginService.handleRedirect();else{let t={relativeTo:this.route};this.router.navigate([this.userListRoute],t)}}static \u0275fac=function(o){return new(o||r)(g(de),g(ei),g(Mo),g(mt),g(un),g(be),g(El),g(Se),g(Re),g(he),g(Be),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-external-edit"]],viewQuery:function(o,i){if(o&1&&(X(XP,7),X(ZP,7),X(JP,7)),o&2){let s;Y(s=Q())&&(i.actionsMenu=s.first),Y(s=Q())&&(i.shades=s.first),Y(s=Q())&&(i.drawer=s.first)}},hostBindings:function(o,i){o&1&&h("resize",function(){return i.configureRightDrawer()},!1,vt)},standalone:!1,decls:102,vars:43,consts:[["actionsMenu",""],["item",""],["shades",""],["toggleicon",""],["content",""],["moreMenu",""],["drawer",""],["header",""],["id","qware.user-external.edit",1,"grid"],["id","qware.user-external.edit.card-side",1,"col-12","edit-data-container",3,"ngClass"],[1,"header-container","flex-inline"],[1,"top-indent-large","actions-container"],["id","qware.user-external.edit.actions-menu",3,"model","popup"],["id","qware.user-external.edit.spinner",3,"displaySpinner"],[3,"dt"],[3,"lockEditing","isAbsolute"],[1,"flex-inline","accordian-header"],[1,"flex-column","name-icon"],[1,"name-icon-letter"],[1,"flex-column","user-info"],[3,"multiple","value"],["id","qware.user-external.edit.details-shade","value","0"],[1,"accordion-content-padding"],[3,"form","submitted","validationErrors","autoFocus","isUserEdit"],["id","qware.user-external.edit.assigned-groups-shade",1,"auto-overflow"],["appendTo","body",3,"form","submitted","validationErrors","relativePathDepth","selectedExternalGroups","availableExternalTenantGroups","availableUserExternalGroupAssociations"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","type","button","severity","secondary","id","qware.user-external.edit.button.cancel",3,"onClick","text","label"],["id","qware.user-external.edit.page-header","translate","",1,"page-header"],["pRipple","",1,"flex","items-center","p-menu-item-link"],[1,"p-menu-item-icon","material-icons"],[1,"p-menu-item-label"],["id","qware.user-external.edit.actions-button","type","button","severity","secondary",3,"onClick","raised"],["translate","",1,"p-button-label"],[1,"material-icons"],[1,"top-indent-large","more-container"],[3,"click","model","popup"],["type","button","severity","secondary","styleClass","icon-only-button",3,"onClick","rounded","text"],["tabindex","1000","type","button","id","qware.user-external.edit.button.reject-request",3,"onClick","text","label"],["tabindex","999","type","button","id","qware.user-external.edit.button.approve-request",3,"onClick","text","label","disabled"],["tabindex","999","type","button","id","qware.user-external.edit.button.save",3,"onClick","text","label","disabled"],["id","qware.user-external.edit.content-drawer-container",1,"content-
11968right-drawer-container","col-4"],["position","right","styleClass","inline-drawer",3,"visibleChange","onHide","visible","modal","transitionOptions","closeOnEscape"],["id","qware.users-external.edit.drawer-header",1,"drawer-header"],["translate","",1,"drawer-header-title"],["id","qware.user-external.edit.drawer.spinner",3,"displaySpinner","isAbsolute"],[1,"sidebar-content","no-apply"],["entityType","externalUser",3,"parentSpinnerStateChange","createdText","nameMap","idMaps","arrayProperties","parentSpinnerState"]],template:function(o,i){if(o&1){let s=b();n(0,"div",8),e(1,` 11969 `),n(2,"div",9),e(3,` 11970 `),n(4,"div",10),e(5,` 11971 `),_(6,iG,4,0)(7,nG,4,0),n(8,"div",11),e(9,` 11972 `),n(10,"p-menu",12,0),e(12,` 11973 `),_(13,aG,10,2,"ng-template",null,1,A),e(15,` 11974 `),a(),e(16,` 11975 `),_(17,oG,7,1),a(),e(18,` 11976 `),_(19,sG,17,4),a(),e(20,` 11977 `),n(21,"qware-spinner",13),e(22,` 11978 `),n(23,"p-card",14),e(24,` 11979 `),n(25,"qware-edit-lock",15),e(26,` 11980 `),n(27,"div",16),e(28,` 11981 `),e(29,` 11982 `),n(30,"div",17),e(31,` 11983 `),n(32,"div",18),e(33),a(),e(34,` 11984 `),a(),e(35,` 11985 `),n(36,"div",19),e(37,` 11986 `),n(38,"h4"),e(39),a(),e(40,` 11987 `),a(),e(41,` 11988 `),a(),e(42,` 11989 `),n(43,"p-accordion",20,2),e(45,` 11990 `),n(46,"p-accordion-panel",21),e(47,` 11991 `),n(48,"p-accordion-header"),e(49),I(50,"translate"),_(51,mG,3,1,"ng-template",null,3,A),e(53,` 11992 `),a(),e(54,` 11993 `),n(55,"p-accordion-content"),e(56,` 11994 `),n(57,"div",22),e(58,` 11995 `),n(59,"qware-user-external-details",23),e(60,` 11996 `),a(),e(61,` 11997 `),a(),e(62,` 11998 `),a(),e(63,` 11999 `),a(),e(64,` 12000 `),n(65,"p-accordion-panel",24),e(66,` 12001 `),n(67,"p-accordion-header"),e(68),I(69,"translate"),_(70,_G,3,1,"ng-template",null,3,A),e(72,` 12002 `),a(),e(73,` 12003 `),n(74,"p-accordion-content"),e(75,` 12004 `),n(76,"div",22),e(77,` 12005 `),n(78,"qware-user-external-assigned-groups",25),e(79,` 12006 `),a(),e(80,` 12007 `),a(),e(81,` 12008 `),a(),e(82,` 12009 `),a(),e(83,` 12010 `),a(),e(84,` 12011 `),a(),e(85,` 12012 `),n(86,"div",26),e(87,` 12013 `),n(88,"p-button",27),I(89,"translate"),h("onClick",function(){return E(s),S(i.redirect())}),e(90,` 12014 `),a(),e(91,` 12015 `),e(92,` 12016 `),e(93,` 12017 `),_(94,EG,9,9)(95,SG,5,5),a(),e(96,` 12018 `),a(),e(97,` 12019 `),a(),e(98,` 12020 `),a(),e(99,` 12021 `),_(100,hG,14,6),a(),e(101,` 12022`)}o&2&&(l(2),p("ngClass",pe(40,eG,!i.auditLoggingDisabled)),l(4),f(i.isManagingAccount?6:7),l(4),p("model",i.actionItems)("popup",!0),l(7),f(i.isApproved&&(i.isInternalUser||!i.isLoggedUser)&&i.actionItems&&i.actionItems.length>0?17:-1),l(2),f(i.auditLoggingDisabled?-1:19),l(2),p("displaySpinner",i.displaySpinner),l(2),p("dt",i.accordionCard),l(2),p("lockEditing",i.user!==void 0&&i.user.State==="DELETED")("isAbsolute",!0),l(8),v(i.userFirstLetter),l(6),qi("",i.user==null?null:i.user.FirstName," ",i.user==null?null:i.user.LastName,""),l(4),p("multiple",!0)("value",ne(42,tG)),l(6),K(` 12023 `,y(50,34,"SHARED.DETAILS"),` 12024 `),l(10),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("autoFocus",!1)("isUserEdit",!0),l(9),K(` 12025 `,y(69,36,"USER.ASSIGNED_GROUPS"),` 12026 `),l(10),p("form",i.form.controls.SecurityAccess)("submitted",i.submitted)("validationErrors",i.validationErrors)("relativePathDepth",i.isAccountUrl?4:3)("selectedExternalGroups",i.selectedExternalGroups)("availableExternalTenantGroups",i.availableExternalUserGroups)("availableUserExternalGroupAssociations",i.allUserExternalGroupAssociations),l(10),q("label",y(89,38,"SHARED.CANCEL")),p("text",!0),l(6),f(!i.isApproved&&!i.isLoggedUser?94:-1),l(),f((i.user==null?null:i.user.State)!=="DELETED"&&i.isApproved?95:-1),l(5),f(i.auditLoggingDisabled?-1:100))},dependencies:[Mt,Nt,Ot,Ft,oe,Ie,Qe,Lt,lt,Gt,Ut,me,ot,$,ds,zr,ie],encapsulation:2})}return r})();
12026var CG=["userGroupInfo"],vG=r=>({userGroupName:r});function gG(r,d){if(r&1&&(e(0,` 12027 `),n(1,"div",12),e(2,` 12028 `),R(3,"img",13),e(4,` 12029 `),a(),e(5,` 12030`)),r&2){let t=m();l(3),p("src",t.logoURL,jt)}}function TG(r,d){if(r&1&&(e(0,` 12031 `),n(1,"h3",14),e(2),I(3,"translate"),a(),e(4,` 12032 `)),r&2){let t=m();l(2),K(` 12033 `,$e(3,1,"EVENT.REQUEST_EVENT_GROUP_ACCESS_TO",pe(4,vG,t.userGroupName)),` 12034 `)}}function IG(r,d){r&1&&(e(0,` 12035 `),n(1,"h3",15),e(2,` 12036 EVENT.REQUEST_EVENT_GROUP_ACCESS 12037 `),a(),e(3,` 12038 `))}function bG(r,d){if(r&1){let t=b();e(0,` 12039 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 12040 `),n(3,"span",18),e(4),a(),e(5,` 12041 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 12042 `),a(),e(10,` 12043 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"USER.USER_DETAILS"))}}function yG(r,d){if(r&1){let t=b();e(0,` 12044 `),n(1,"button",17),h("click",function(){let i=E(t).activateCallback;return S(i())}),e(2,` 12045 `),n(3,"span",18),e(4),a(),e(5,` 12046 `),n(6,"span",19),e(7),I(8,"translate"),a(),e(9,` 12047 `),a(),e(10,` 12048 `)}if(r&2){let t=d.value;l(4),v(t+1),l(3),v(y(8,2,"EXTERNALGROUP.GROUP_DETAILS"))}}function AG(r,d){if(r&1&&(e(0,` 12049 `),n(1,"p-step",16),e(2,` 12050 `),_(3,bG,11,4,"ng-template",null,0,A),e(5,` 12051 `),a(),e(6,` 12052 `),n(7,"p-step",16),e(8,` 12053 `),_(9,yG,11,4,"ng-template",null,0,A),e(11,` 12054 `),a(),e(12,` 12055 `)),r&2){let t=m();l(),p("value",0),l(6),ve("p-disabled",t.stepIndex<1),p("value",1)}}function RG(r,d){if(r&1){let t=b();e(0,` 12056 `),n(1,"div",6),e(2,` 12057 `),n(3,"h4",20),e(4,` 12058 EXTERNALGROUP.GROUP_DETAILS 12059 `),a(),e(5,` 12060 `),n(6,"qware-user-group-external-info",21,1),h("docsChanged",function(i){E(t);let s=m();return S(s.setDocs(i))}),e(8,` 12061 `),a(),e(9,` 12062 `),a(),e(10,` 12063 `)}if(r&2){let t=m();l(),p("hidden",t.stepIndex!==1),l(5),p("form",t.form.controls.GroupDetails)("submitted",t.submitted)("validationErrors",t.validationErrors)("docs",t.docs)("certificateRequired",t.certificateRequired)}}var sd=(()=>{class r{appSettingsService;attachmentService;authService;externalUserGroupService;fb;responseService;route;toastService;translate;userService;userGroupInfo;appSettings;certificateRequired=!1;displaySpinner=!0;docs=[];form;groupId;logoURL;qwareLogoDefault="assets/images/qware-logo.png";stepIndex=0;steps=[];submitted=!1;subscriptions;textareaFocused=!1;userGroupName="";validationErrors;constructor(t,o,i,s,c,u,x,C,O,w){this.appSettingsService=t,this.attachmentService=o,this.authService=i,this.externalUserGroupService=s,this.fb=c,this.responseService=u,this.route=x,this.toastService=C,this.translate=O,this.userService=w,this.groupId=this.route.snapshot.params.id}ngOnInit(){this.createForm(),this.steps=[{label:"USER.USER_DETAILS",value:0,control:this.form.get("Details")},{label:"EXTERNALGROUP.GROUP_DETAILS",value:1,control:this.form.get("GroupDetails")}];let t=[this.appSettingsService.getAppSettingsUnauthorized(this.authService.tenantKey).pipe(N())];this.groupId&&t.push(this.externalUserGroupService.getExternalUserGroupName(this.groupId)),ue(t).subscribe(o=>{this.appSettings=o[0];let i=o[1];i&&i.length>0&&(this.userGroupName=i),this.certificateRequired=this.appSettings.RequireInsuranceCertificate??!1,this.appSettings.CompanyLogo?this.logoURL=this.appSettings.CompanyLogo+"?t="+Date.now():this.logoURL=this.qwareLogoDefault,this.groupId||this.addGroupDetailsValidators(this.form.controls.GroupDetails),this.displaySpinner=!1})}createForm(){this.form=this.fb.group({Details:this.fb.group({FirstName:this.fb.control("",{nonNullable:!0,validators:[T.required,T.maxLength(re)]}),LastName:this.fb.control("",{nonNullable:!0,validators:[T.required,T.maxLength(re)]}),Email:this.fb.control("",{nonNullable:!0,validators:[T.required,T.maxLength(re),T.pattern(Ui)]}),PhoneNumber:this.fb.control("",{nonNullable:!0,validators:[T.pattern("^[0-9]*"),T.minLength(10)]}),NewPassword:this.fb.control("",{nonNullable:!0,validators:[T.minLength(Nn),T.maxLength(On),T.required]}),ConfirmPassword:this.fb.control("",{nonNullable:!0,validators:[T.required]}),RequestManagerPrivileges:this.fb.control({value:!this.groupId,disabled:!this.groupId},{nonNullable:!0})}
12063),GroupDetails:this.fb.group({Name:this.fb.control("",{nonNullable:!0}),PhoneNumber:this.fb.control("",{nonNullable:!0}),AddressStreet:this.fb.control("",{nonNullable:!0}),AddressCity:this.fb.control("",{nonNullable:!0}),AddressState:this.fb.control("",{nonNullable:!0}),AddressZip:this.fb.control("",{nonNullable:!0}),CertificateExpirationDateUTC:this.fb.control(null),HasCertificateFile:this.fb.control(null),DocumentIds:this.fb.control([],{nonNullable:!0}),DefaultEventCalendarId:this.fb.control(null),DefaultEventCategoryId:this.fb.control(null)}),SecurityAccess:this.fb.group({UserExternalGroupAssociations:this.fb.control([],{nonNullable:!0})}),EventDiscounts:this.fb.group({DiscountType:this.fb.control(null),DiscountAmount:this.fb.control(null)})},{validators:[ia.matchPassword("NewPassword","ConfirmPassword","Details")]})}stepBack(){this.stepIndex!==0&&this.stepIndex--}stepSubmit(t){if(this.steps[t].control?.valid){let o=this.parseUserDetails(this.form.value);if(this.stepIndex===0&&this.groupId)this.submitForm(o);else if(t<1)this.stepIndex++;else{let i=new Ma().parseForm(this.form.value,this.appSettings?.Timezone??"");this.submitForm(o,i)}}}submitForm(t,o){if(!this.submitted)if(this.form.valid)if(this.submitted=!0,this.displaySpinner=!0,t.Type=Rt.EXTERNAL,t.Approved=!1,t.Audit=Fa.CREATE,!this.groupId&&o)this.subscriptions=this.attachmentService.upload().pipe(N(),we(i=>i?this.externalUserGroupService.handleAttachmentUpload(i,o,this.docs,this.userGroupInfo.certificate):wi(()=>new Error("Upload error."))),we(()=>this.externalUserGroupService.createExternalUserGroupAnonymous(o,this.authService.tenant.Id)),we(i=>{if(i){t.UserExternalGroupAssociations||(t.UserExternalGroupAssociations=[]);let s=this.form.get("Details.RequestManagerPrivileges")?.value,c=new _a;return c.Access=!1,c.Manager=s??!1,c.TenantGroupId=i,t.UserExternalGroupAssociations.push(c),this.userService.createUserAnonymous(t,this.authService.tenant.Id)}else return wi(()=>new Error("Error creating external group."))})).subscribe({next:()=>{this.resetForm(),this.displaySpinner=!1,this.responseService.onSuccess("EXTERNALGROUP.SUCCESS.CREATE",void 0,void 0,{name:o.Name}),this.submitted=!1},error:i=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(i,this.form)}}),this.fileUpload();else{t.UserExternalGroupAssociations||(t.UserExternalGroupAssociations=[]);let i=this.form.get("Details.RequestManagerPrivileges")?.value,s=new _a;s.Access=!1,s.Manager=i??!1,s.TenantGroupId=this.groupId,t.UserExternalGroupAssociations.push(s),this.userService.createUserAnonymous(t,this.authService.tenant.Id??"").subscribe({next:()=>{this.resetForm(),this.displaySpinner=!1,this.responseService.onSuccess("USER.SUCCESS.REQUESTED",void 0,void 0,{name:t.fullName(),email:t.Email}),this.submitted=!1},error:c=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(c,this.form),this.stepIndex=We.getValidationErrorIndex(this.steps.map(u=>u.control),this.validationErrors)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(i=>{this.toastService.error(i["SHARED.ERROR_LABEL"],i["SHARED.ERROR.FAILED_VALIDATION"])})}setDocs(t){t instanceof Event||(this.docs=t)}fileUpload(){this.userGroupInfo.certificate&&this.userGroupInfo.certificate.fileup.files.length>0?this.userGroupInfo.certificate.fileup.upload():this.attachmentService.clearObservable()}parseUserDetails(t){let o=new Ji;return o.TenantId=this.authService.tenant.Id,o.FirstName=t.Details.FirstName,o.LastName=t.Details.LastName,o.Email=t.Details.Email,o.PhoneNumber=t.Details.PhoneNumber,o.Password=t.Details.NewPassword,o}addGroupDetailsValidators(t){let o=t?.get("Name"),i=t?.get("PhoneNumber"),s=t?.get("AddressStreet"),c=t?.get("AddressCity"),u=t?.get("AddressState"),x=t?.get("AddressZip"),C=t?.get("CertificateExpirationDateUTC"),O=t?.get("HasCertificateFile"),w=t?.get("DocumentIds");o?.addValidators([T.required,T.maxLength(re)]),o?.updateValueAndValidity(),i?.addValidators([T.required,T.pattern("^[0-9]*"),T.minLength(10),T.maxLength(10)]),i?.updateValueAndValidity(),s?.setValidators([T.required,T.maxLength(jn)]),s?.updateValueAndValidity(),c?.addValidators([T.required,T.maxLength(jn)]),c?.updateValueAndValidity(),u?.addValidators([T.required,T.maxLength(jn)]),u?.updateValueAndValidity(),x?.addValidators([T.required,T.pattern("^[0-9]*"),T.minLength(5),T.maxLength(5)]),x?.updateValueAndValidity(),this.certificateRequired&&(C?.addValidators([T.required]),C?.updateValueAndValidity(),O?.addValidators([T.required]),O?.updateValueAndValidity()),w?.addValidators([Qi.maxSize(1)]),w?.updateValueAndValidity(),t.markAsPristine(),t.markAsUntouched()}resetForm(){this.form.reset(),this.form.controls.Details.markAsPristine(),this.form.controls.Details.markAsUntouched(),this.stepIndex=0}static \u0275fac=function(o){return new(o||r)(g(dt),g(ui),g(de),g(un),g(be),g(Re),g(he),g(Se),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-user-external-request-group-access"]],viewQuery:function(o,i){if(o&1&&X(CG,5),o&2){let s;Y(s=Q())&&(i.userGroupInfo=s.first)}},standalone:!1,decls:46,vars:22,consts:[["content",""],["userGroupInfo",""],[1,"col-12",3,"keydown.enter"],["id","qware.user-external.request-group-access.spinner",3,"displaySpinner"],[1,"form-container"],[3,"valueChange","value"],[3,"hidden"],["translate","","id","qware.user-external.request-group-access.user-details.label",1,"page-header"],[3,"form","submitted","validationErrors","requestEventGroupAccessPage","groupId"],[1,"flex-inline","align-right","action-bar"],["tabindex","1000","id","qware.user-external.request-group-access.button.cancel","type","button","severity","secondary",3,"onClick","text","hidden","label"],["tabindex","999","id","qware.user-external.request-group-access.button.next","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"col-12",2,"text-align","center"],["id","qware.external-group-request-form.image.qware-logo",1,"white-label-logo",3,"src"],["id","qware.user-external.request-group-access.header",1,"page-header"],["id","qware.user-external.request-group-access.header","translate","",1,"page-header"],[3,"value"],["role","tab",1,"p-step-header",3,"click"],[1,"p-step-number"],[1,"p-step-title"],["translate","","id","qware.user-external.request-group-access.group-detail
12063s.label",1,"page-header"],[3,"docsChanged","form","submitted","validationErrors","docs","certificateRequired"]],template:function(o,i){o&1&&(_(0,gG,6,1),n(1,"div",2),h("keydown.enter",function(){return i.textareaFocused?void 0:i.stepSubmit(i.stepIndex)}),e(2,` 12064 `),n(3,"qware-spinner",3),e(4,` 12065 `),n(5,"div",4),e(6,` 12066 `),_(7,TG,5,6)(8,IG,4,0),n(9,"p-stepper",5),j("valueChange",function(c){return W(i.stepIndex,c)||(i.stepIndex=c),c}),e(10,` 12067 `),n(11,"p-step-list"),e(12,` 12068 `),_(13,AG,13,4),a(),e(14,` 12069 `),n(15,"p-step-panels"),e(16,` 12070 `),n(17,"p-card"),e(18,` 12071 `),n(19,"div",6),e(20,` 12072 `),n(21,"h4",7),e(22,` 12073 USER.USER_DETAILS 12074 `),a(),e(23,` 12075 `),n(24,"qware-user-external-details",8),e(25,` 12076 `),a(),e(26,` 12077 `),a(),e(27,` 12078 `),_(28,RG,11,6),n(29,"div",9),e(30,` 12079 `),n(31,"p-button",10),I(32,"translate"),h("onClick",function(){return i.stepBack()}),e(33,` 12080 `),a(),e(34,` 12081 `),n(35,"p-button",11),I(36,"translate"),h("onClick",function(){return i.stepSubmit(i.stepIndex)})("keydown.enter",function(c){return c.preventDefault()}),e(37,` 12082 `),a(),e(38,` 12083 `),a(),e(39,` 12084 `),a(),e(40,` 12085 `),a(),e(41,` 12086 `),a(),e(42,` 12087 `),a(),e(43,` 12088 `),a(),e(44,` 12089`),a(),e(45,` 12090`)),o&2&&(f(i.logoURL!==void 0?0:-1),l(3),p("displaySpinner",i.displaySpinner),l(4),f(i.groupId?7:8),l(2),H("value",i.stepIndex),l(4),f(i.groupId?-1:13),l(6),p("hidden",i.stepIndex!==0),l(5),p("form",i.form.controls.Details)("submitted",i.submitted)("validationErrors",i.validationErrors)("requestEventGroupAccessPage",!0)("groupId",i.groupId),l(4),f(i.groupId?-1:28),l(3),q("label",y(32,18,"SHARED.BACK")),p("text",!0)("hidden",i.stepIndex===0),l(4),q("label",y(36,20,i.groupId||i.stepIndex===1?"SHARED.SUBMIT":"SHARED.NEXT")),p("text",!0)("disabled",!(i.steps[i.stepIndex].control!=null&&i.steps[i.stepIndex].control.valid)))},dependencies:[oe,Ie,me,ai,ti,ni,ii,$,zr,$r,ie],styles:[".white-label-logo[_ngcontent-%COMP%]{display:block;max-height:95px;max-width:100%;pointer-events:none;margin:auto}"]})}return r})();var dd=He(Hn()),Dc=He(nt());function wG(r,d){r&1&&(e(0,` 12091 `),n(1,"span",24),e(2,"expand_more"),a(),e(3,` 12092 `))}function DG(r,d){if(r&1&&(e(0,` 12093 `),n(1,"small",25),e(2,` 12094 `),n(3,"div",10),e(4),a(),e(5,` 12095 `),a(),e(6,` 12096 `)),r&2){let t=d.$implicit;l(4),v(t)}}function LG(r,d){if(r&1&&(e(0,` 12097 `),G(1,DG,7,1,null,null,J)),r&2){let t=m();l(),k(t.validationErrors.Subscription)}}function NG(r,d){if(r&1&&(e(0,` 12098 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.MONTH"),a()(),e(6,` 12099 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.subCostPerMonth,t.currencyType,"symbol","1.2-2"),"/")}}function OG(r,d){if(r&1&&(e(0,` 12100 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.YEAR"),a()(),e(6,` 12101 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.subCostPerYear,t.currencyType,"symbol","1.2-2"),"/")}}function FG(r,d){if(r&1&&(e(0,` 12102 `),n(1,"div",26),e(2,` 12103 `),n(3,"div"),e(4,` 12104 `),n(5,"div",27),e(6),n(7,"span",10),e(8,"APP_SETTINGS.SUBSCRIPTION.PAID_USERS"),a()(),e(9,` 12105 `),n(10,"div")(11,"span",10),e(12,"APP_SETTINGS.SUBSCRIPTION.PRICE"),a(),e(13),I(14,"currency"),n(15,"span",10),e(16,"APP_SETTINGS.SUBSCRIPTION.USER"),a(),e(17,"/"),n(18,"span",10),e(19,"APP_SETTINGS.SUBSCRIPTION.MONTH"),a()(),e(20,` 12106 `),n(21,"div")(22,"span",10),e(23,"APP_SETTINGS.SUBSCRIPTION.NEXT_BILL_DATE"),a(),n(24,"span"),e(25),I(26,"dateFormat"),a()(),e(27,` 12107 `),n(28,"div")(29,"span",10),e(30,"APP_SETTINGS.SUBSCRIPTION.BILLING_CYCLE"),a(),n(31,"span"),e(32),a()(),e(33,` 12108 `),a(),e(34,` 12109 `),n(35,"div"),e(36,` 12110 `),_(37,NG,7,6)(38,OG,7,6),a(),e(39,` 12111 `),a(),e(40,` 12112 `)),r&2){let t=m();l(6),K("",t.paidUserCount," "),l(7),K(": ",ca(14,5,t.costPerUser,t.currencyType,"symbol","1.0-0"),"/"),l(12),K(": ",$e(26,10,t.nextBillDate,"M/D/YYYY"),""),l(7),K(": ",t.billingFrequency,""),l(5),f(t.billingFrequency===t.billingFreqEnum.MONTHLY?37:t.billingFrequency===t.billingFreqEnum.YEARLY?38:-1)}}function MG(r,d){if(r&1&&(e(0,` 12113 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.MONTH"),a()(),e(6,` 12114 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.eventsCostPerMonth,t.currencyType,"symbol","1.2-2"),"/")}}function UG(r,d){if(r&1&&(e(0,` 12115 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.YEAR"),a()(),e(6,` 12116 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.eventsCostPerYear,t.currencyType,"symbol","1.2-2"),"/")}}
12116function PG(r,d){if(r&1&&(e(0,` 12117 `),n(1,"div",28),e(2,` 12118 `),n(3,"div"),e(4,` 12119 `),n(5,"div",29),e(6,"APP_SETTINGS.SUBSCRIPTION.EVENTS_ADD_ON"),a(),e(7,` 12120 `),n(8,"div")(9,"span",10),e(10,"APP_SETTINGS.SUBSCRIPTION.PRICE"),a(),e(11),I(12,"currency"),n(13,"span",10),e(14,"APP_SETTINGS.SUBSCRIPTION.USER"),a(),e(15,"/"),n(16,"span",10),e(17,"APP_SETTINGS.SUBSCRIPTION.MONTH"),a()(),e(18,` 12121 `),a(),e(19,` 12122 `),n(20,"div"),e(21,` 12123 `),_(22,MG,7,6)(23,UG,7,6),a(),e(24,` 12124 `),a(),e(25,` 12125 `)),r&2){let t=m();l(11),K(": ",ca(12,2,t.addOnCost.EVENTS,t.currencyType,"symbol","1.0-0"),"/"),l(11),f(t.billingFrequency===t.billingFreqEnum.MONTHLY?22:t.billingFrequency===t.billingFreqEnum.YEARLY?23:-1)}}function GG(r,d){if(r&1&&(e(0,` 12126 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.MONTH"),a()(),e(6,` 12127 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.totalCostPerMonth,t.currencyType,"symbol","1.2-2"),"/")}}function kG(r,d){if(r&1&&(e(0,` 12128 `),n(1,"div",27),e(2),I(3,"currency"),n(4,"span",10),e(5,"APP_SETTINGS.SUBSCRIPTION.YEAR"),a()(),e(6,` 12129 `)),r&2){let t=m(2);l(2),K("",ca(3,1,t.totalCostPerYear,t.currencyType,"symbol","1.2-2"),"/")}}function VG(r,d){if(r&1&&(e(0,` 12130 `),n(1,"div",30),e(2,` 12131 `),n(3,"div"),e(4,` 12132 `),n(5,"div",29),e(6,"APP_SETTINGS.SUBSCRIPTION.TOTAL_COST"),a(),e(7,` 12133 `),a(),e(8,` 12134 `),n(9,"div"),e(10,` 12135 `),_(11,GG,7,6)(12,kG,7,6),a(),e(13,` 12136 `),a(),e(14,` 12137 `)),r&2){let t=m();l(11),f(t.billingFrequency===t.billingFreqEnum.MONTHLY?11:t.billingFrequency===t.billingFreqEnum.YEARLY?12:-1)}}var Lc=(()=>{class r{appSettingsService;authService;confirmationService;dialogService;fb;responseService;route;router;tenantService;toastService;translate;userService;addOnCost=Ts;billingFreqEnum=to;billingFrequency;costPerUser;currencyType="USD";currentAmount;displaySpinner=!0;eventsCostPerMonth;eventsCostPerYear;eventsModuleEnabled=!1;nextBillDate;paidUserCount;subCostPerMonth;subCostPerYear;subscriptionForm;submitted=!1;subOptions=[];tenant;timezone;totalCostPerMonth;totalCostPerYear;validationErrors;ref;translations={};constructor(t,o,i,s,c,u,x,C,O,w,F,L){this.appSettingsService=t,this.authService=o,this.confirmationService=i,this.dialogService=s,this.fb=c,this.responseService=u,this.route=x,this.router=C,this.tenantService=O,this.toastService=w,this.translate=F,this.userService=L}ngOnInit(){this.subscriptionForm=this.fb.group({Subscription:this.fb.control(0,[T.required])}),ue([this.translate.get(["SUBSCRIPTION.0","SUBSCRIPTION.1","SUBSCRIPTION.2","SUBSCRIPTION.PRICING.SUBSCRIPTION_PLANS"]).pipe(N()),this.appSettingsService.getAppSettings().pipe(N()),this.tenantService.getTenant(this.authService.tenant.Id),this.userService.getPaidUsers(this.authService.tenant.Id)]).subscribe(t=>{this.translations=t[0];let o=t[1];this.tenant=t[2];let i=t[3];this.timezone=o.Timezone??"",this.currencyType=o.CurrencyType??"USD",this.billingFrequency=this.tenant.BillFrequency,this.eventsModuleEnabled=this.tenant.EventsModule;let s=this.authService.isSuperUser(),c=Vt.convertToAppTimezone(this.timezone,!0,this.tenant.BillingDateUTC),u=Vt.convertToAppTimezone(this.timezone,!0);for(;c<(0,dd.default)(u).startOf("d").toDate();)c=(0,dd.default)(c).add(1,this.billingFrequency===to.YEARLY?"y":"M").toDate();this.nextBillDate=c,this.subOptions=[{label:this.translations["SUBSCRIPTION.0"],value:0,disabled:this.tenant.SubLevel>0&&!s},{label:this.translations["SUBSCRIPTION.1"],value:1,disabled:this.tenant.SubLevel>1&&!s},{label:this.translations["SUBSCRIPTION.2"],value:2}],this.paidUserCount=i.length??0,this.calculateCost(this.authService.tenant.SubLevel??0),this.currentAmount=this.getTotalString(),this.subscriptionForm.get("Subscription")?.setValue(this.tenant.SubLevel??0),this.subscriptionForm.markAsPristine(),this.subscriptionForm.markAsUntouched(),this.displaySpinner=!1})}isDirty(){return this.subscriptionForm.dirty&&!this.submitted}goBack(){let t={relativeTo:this.route};this.router.navigate(["../"],t)}save(){let t=this.currentAmount,o=this.getTotalString();if(t!==o){let i=this.subscriptionForm.get("Subscription")?.value,s=this.translations["SUBSCRIPTION."+i],c=this.billingFrequency?.toLowerCase();this.translate.get(["APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION_CHANGE_HEADER","APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION_CHANGE_MESSAGE"],{level:s,frequency:c,currentAmount:t,newAmount:o}).pipe(N()).subscribe(u=>{this.confirmationService.confirm({key:"savePromptDialog",header:u["APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION_CHANGE_HEADER"],message:u["APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION_CHANGE_MESSAGE"],accept:()=>{this.continueSave()}})})}else this.continueSave()}continueSave(){if(!this.submitted)if(this.subscriptionForm.valid&&this.tenant){this.submitted=!0,this.displaySpinner=!0;let t=this.subscriptionForm.get("Subscription")?.value;Dc.default.isNumber(t)&&(this.tenant.SubLevel=t),this.tenantService.updateTenant(this.tenant).subscribe({next:()=>{let o=this.authService.tenant;o.SubLevel=this.tenant?.SubLevel??0,this.authService.tenant=o,this.displaySpinner=!1,this.responseService.onSuccess("APP_SETTINGS.SUBSCRIPTION.SUCCESS.SAVE","../",this.route)},error:o=>{this.submitted=!1,this.displaySpinner=!1,this.validationErrors=this.responseService.onError(o,this.subscriptionForm)}})}else this.translate.get(["SHARED.ERROR_LABEL","SHARED.ERROR.FAILED_VALIDATION"]).pipe(N()).subscribe(t=>{this.toastService.error(t["SHARED.ERROR_LABEL"],t["SHARED.ERROR.FAILED_VALIDATION"])})}calculateCost(t){let o=r0[t??0];this.costPerUser=o?.cost??0,this.subCostPerMonth=this.costPerUser*(this.paidUserCount??0),this.subCostPerYear=this.subCostPerMonth*12,this.eventsModuleEnabled&&(this.eventsCostPerMonth=Ts.EVENTS*(this.paidUserCount??0),this.eventsCostPerYear=this.eventsCostPerMonth*12,this.totalCostPerMonth=this.subCostPerMonth+this.eventsCostPerMonth,this.totalCostPerYear=this.totalCostPerMonth*12)}getTotalString(){let t=0;return this.eventsModuleEnabled?t=this.billingFrequency===to.YEARLY?this.totalCostPerYear:this.totalCostPerMonth:t=this.billingFrequency===to.YEARLY?this.subCostPerYear:this.subCostPerMonth,t&&(t=new Ra(l0.get(this.currencyType)??"").transform(t,this.currencyType,"symbol","1.2-2")),t}displayPlans(){this.ref=this.dialogService.open(V0,{closable:!0,header:this.translations["SUBSCRIPTION.PRICING.SUBSCRIPTION_PLANS"],dismissableMask:!0,modal:!0,width:"70%",data:{activeLevel:this.tenant?.SubLevel,currencyType:this.currencyType,eventsEnabled:this.tenant?.EventsModule,gisEnabled:this.tenant?.GisModule},styleClass:"pricing-compare-dialog"}),this.ref?.onClose.pipe(N()).subscribe(t=>{t!==void 0&&(this.subscriptionForm.get("Subscription")?.setValue(t),this.calculateCost(t),this.subscriptionForm.markAsDirty())})}static \u0275fac=function(o){return new(o||r)(g(dt),g(de),g(mt),g(Va),g(be),g(Re),g(he),g(Be),g($i),g(Se),g(le),g(ct))};static \u0275cmp=B({type:r,selectors:[["qware-subscription-settings"]],standalone:!1,decls:104,vars:19,consts:[["dropdownicon",""],[1,"col-12",3,"keydown.enter"],[1,"form-container"],["translate","","id","qware.app-settings.page-header",1,"page-header"],["id","qware.app-settings.subscription.spinner",3,"displaySpinner"],[3,"formGroup"],[1,"col-12","field-container"],[1,"medium-input"],["id","qware.app-settings.subscription.dropdown.sub","formControlName","Subscription","variant","filled","appendTo","body",3,"onChange","tabindex","autoDisplayFirst","options","fluid"],["id","qware.app_settings.subscription.label.sub","for","qware.app-settings.subscription.dropdown.sub"],["translate",""],[1,"required-mark"],[1,"summary-container"],[1,"footer-container"],["translate","",3,"click"],[1,"billing-notice"],[1,"billing-contact"],["href","tel:+18886972811"],["href","mailto:[email protected]"],[1,"support-contact"],["href","mailto:[email protected]"],[1,"flex-inline","align-right","action-bar"],["tabindex","999","id","qware.app-settings.subscription.button.cancel","type","button","severity","secondary",3,"onClick","text","label"],["tabindex","998","id","qware.app-settings.subscription.button.save","type","submit",3,"onClick","keydown.enter","text","disabled","label"],[1,"material-icons"],[1,"validation-error"],[1,"summary-data"],[1,"bold"],[1,"events-add-on"],["translate","",1,"bold"],[1,"total-cost"]],template:function(o,i){if(o&1){let s=b();
12137n(0,"div",1),h("keydown.enter",function(){return E(s),S(i.save())}),e(1,` 12138 `),n(2,"div",2),e(3,` 12139 `),n(4,"h3",3),e(5,` 12140 APP_SETTINGS.APP_SETTINGS`),n(6,"span"),e(7," / "),a(),e(8,`APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION 12141 `),a(),e(9,` 12142 `),n(10,"p-card"),e(11,` 12143 `),n(12,"qware-spinner",4),e(13,` 12144 `),n(14,"div",5),e(15,` 12145 `),n(16,"div",6),e(17,` 12146 `),n(18,"div",7),e(19,` 12147 `),n(20,"p-floatlabel"),e(21,` 12148 `),n(22,"p-select",8),h("onChange",function(u){return E(s),S(i.calculateCost(u.value))}),e(23,` 12149 `),_(24,wG,4,0,"ng-template",null,0,A),e(26,` 12150 `),a(),e(27,` 12151 `),n(28,"label",9),e(29,` 12152 `),n(30,"span",10),e(31,"APP_SETTINGS.SUBSCRIPTION.SUBSCRIPTION"),a(),e(32,` 12153 `),n(33,"span",11),e(34," *"),a(),e(35,` 12154 `),a(),e(36,` 12155 `),a(),e(37,` 12156 `),_(38,LG,3,0),a(),e(39,` 12157 `),n(40,"div",12),e(41,` 12158 `),n(42,"h5",10),e(43,"APP_SETTINGS.SUBSCRIPTION.SUMMARY"),a(),e(44,` 12159 `),_(45,FG,41,13)(46,PG,26,7)(47,VG,15,1),n(48,"div",13),e(49,` 12160 `),n(50,"span",14),h("click",function(){return E(s),S(i.displayPlans())}),e(51,"APP_SETTINGS.SUBSCRIPTION.COMPARE_PLANS"),a(),e(52,` 12161 `),a(),e(53,` 12162 `),a(),e(54,` 12163 `),n(55,"div",15),e(56,` 12164 `),n(57,"span",10),e(58,"APP_SETTINGS.SUBSCRIPTION.BILLING_NOTICE"),a(),e(59,": "),n(60,"span",10),e(61,"APP_SETTINGS.SUBSCRIPTION.BILLING_NOTICE_MESSAGE"),a(),e(62,` 12165 `),a(),e(63,` 12166 `),n(64,"div",16),e(65,` 12167 `),n(66,"span",10),e(67,"APP_SETTINGS.SUBSCRIPTION.BILLING_CONTACT"),a(),e(68,": "),n(69,"a",17),e(70,"1-888-697-2811"),a(),e(71," | "),n(72,"a",18),e(73,"[email protected]"),a(),e(74,` 12168 `),a(),e(75,` 12169 `),n(76,"div",19),e(77,` 12170 `),n(78,"span",10),e(79,"APP_SETTINGS.SUBSCRIPTION.SUPPORT_CONTACT"),a(),e(80,": "),n(81,"a",17),e(82,"1-888-697-2811"),a(),e(83," | "),n(84,"a",20),e(85,"[email protected]"),a(),e(86,` 12171 `),a(),e(87,` 12172 `),a(),e(88,` 12173 `),a(),e(89,` 12174 `),n(90,"div",21),e(91,` 12175 `),n(92,"p-button",22),I(93,"translate"),h("onClick",function(){return E(s),S(i.goBack())}),e(94,` 12176 `),a(),e(95,` 12177 `),n(96,"p-button",23),I(97,"translate"),h("onClick",function(){return E(s),S(i.save())})("keydown.enter",function(u){return E(s),S(u.preventDefault())}),e(98,` 12178 `),a(),e(99,` 12179 `),a(),e(100,` 12180 `),a(),e(101,` 12181 `),a(),e(102,` 12182 `),a(),e(103,` 12183`),a()}o&2&&(l(12),p("displaySpinner",i.displaySpinner),l(2),p("formGroup",i.subscriptionForm),l(8),p("tabindex",1)("autoDisplayFirst",!0)("options",i.subOptions)("fluid",!0),l(16),f(i.validationErrors&&i.validationErrors.Subscription&&i.subscriptionForm.controls.Subscription.untouched?38:-1),l(7),f(i.paidUserCount?45:-1),l(),f(i.eventsModuleEnabled?46:-1),l(),f(i.eventsModuleEnabled?47:-1),l(45),q("label",y(93,15,"SHARED.CANCEL")),p("text",!0),l(4),q("label",y(97,17,"SHARED.SAVE")),p("text",!0)("disabled",!i.subscriptionForm.valid||!i.subscriptionForm.dirty))},dependencies:[oe,Ie,Ne,se,ge,me,Te,De,it,$,Ra,Oa,ie],styles:[".form-container[_ngcontent-%COMP%] .app-settings-card[_ngcontent-%COMP%] .field-container[_ngcontent-%COMP%]{padding:1.125em 1.5em}.summary-container[_ngcontent-%COMP%]{border:1px solid var(--p-surface-400);border-radius:4px;margin:0 1rem}.summary-container[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{padding:1rem;margin:0}.summary-container[_ngcontent-%COMP%] .summary-data[_ngcontent-%COMP%], .summary-container[_ngcontent-%COMP%] .events-add-on[_ngcontent-%COMP%], .summary-container[_ngcontent-%COMP%] .total-cost[_ngcontent-%COMP%]{padding:1rem;display:flex;justify-content:space-between}.summary-container[_ngcontent-%COMP%] .summary-data[_ngcontent-%COMP%] .bold[_ngcontent-%COMP%], .summary-container[_ngcontent-%COMP%] .events-add-on[_ngcontent-%COMP%] .bold[_ngcontent-%COMP%], .summary-container[_ngcontent-%COMP%] .total-cost[_ngcontent-%COMP%] .bold[_ngcontent-%COMP%]{font-weight:700}.summary-container[_ngcontent-%COMP%] .footer-container[_ngcontent-%COMP%]{border-top:1px solid var(--p-surface-400);padding:.5rem 1rem}.summary-container[_ngcontent-%COMP%] .footer-container[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:var(--p-accent-50);font-weight:500;cursor:pointer}.billing-notice[_ngcontent-%COMP%]{margin:1.5rem 1rem 1rem;font-size:var(--p-font-size-body3)}.billing-notice[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-of-type{font-weight:700}.billing-contact[_ngcontent-%COMP%], .support-contact[_ngcontent-%COMP%]{margin:0 1rem;font-size:var(--p-font-size-body3)}.billing-contact[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .support-contact[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{font-weight:700}.billing-contact[_ngcontent-%COMP%]{margin-bottom:.5rem}"]})}return r})();var qG=[{path:P.tenantCreate,component:Bm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_TENANT_MANAGEMENT]}},{path:P.tenantList,component:Ym,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_TENANT_MANAGEMENT]}},{path:P.userGroup+"/"+P.create,component:Jm,canActivate:[Xe,Ze,cl],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_USER_GROUP_MANAGEMENT]}},{path:P.userGroup+"/"+P.edit+"/:id",component:ec,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_USER_GROUP_MANAGEMENT]}},{path:P.userGroupExternal+"/"+P.create,component:Ic,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_EXT_USER_GROUP_MANAGEMENT]}},{path:P.userGroupExternal+"/"+P.edit+"/:id",component:bc,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_EXT_USER_GROUP_MANAGEMENT]}},{path:P.userExternal+"/"+P.create,component:wc,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_EXT_USER_MANAGEMENT]}},{path:P.userExternal+"/"+P.edit+"/:id",component:ld,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_EXT_USER_MANAGEMENT]}},{path:P.userExternal+"/"+P.edit+"/:id/account",component:ld,canActivate:[Xe,Ze],canDeactivate:[at]},{path:P.userExternal+"/"+P.requestGroupAccess,component:sd},{path:P.userExternal+"/"+P.requestGroupAccess+"/:id",component:sd},{path:P.user+"/"+P.create,component:ac,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_USER_MANAGEMENT]}},{path:P.user+"/"+P.edit+"/:id",component:td,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_USER_MANAGEMENT]}},{path:P.user+"/"+P.edit+"/:id/account",component:td,canActivate:[Xe,Ze],canDeactivate:[at]},{path:P.userList,component:lc,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_USER_GROUP_MANAGEMENT,ae.CAN_ACCESS_USER_MANAGEMENT,ae.CAN_ACCESS_EXT_USER_GROUP_MANAGEMENT,ae.CAN_ACCESS_EXT_USER_MANAGEMENT]}},{path:P.user+"/"+P.uploadUsers,component:mc,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT,ae.IS_SUPER_USER]}},{path:P.locationType+"/"+P.list,component:om,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_LOCATION_TYPE_MANAGEMENT]}},{path:P.locationType+"/"+P.create,component:im,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_TYPE_MANAGEMENT]}},{path:P.locationType+"/"+P.edit+"/:id",component:am,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_TYPE_MANAGEMENT]}},{path:P.location+"/"+P.list,component:um,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT]}},{path:P.location+"/"+P.create,component:dm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT]}},{path:P.location+"/"+P.edit+"/:id",component:mm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT]}},{path:P.location+"/"+P.bulkEdit,component:pm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT]}},{path:P.location+"/"+P.uploadLocations,component:Sm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LOCATION_MANAGEMENT,ae.IS_SUPER_USER]}},{path:P.serviceArea+"/"+P.list,component:Tm,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_SERVICE_AREA_MANAGEMENT]}},{path:P.serviceArea+"/"+P.create,component:Cm,canActivate:[Xe,Ze,cl],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_SERVICE_AREA_MANAGEMENT]}},{path:P.serviceArea+"/"+P.edit+"/:id",component:vm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_SERVICE_AREA_MANAGEMENT]}},{path:P.vendor+"/"+P.list,component:xc,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_VENDOR_MANAGEMENT],subCheck:Wn.VENDOR_MANAGEMENT}},{path:P.vendor+"/"+P.create,component:_c,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_VENDOR_MANAGEMENT],subCheck:Wn.VENDOR_MANAGEMENT}},{path:P.vendor+"/"+P.edit+"/:id",component:Ec,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_VENDOR_MANAGEMENT],subCheck:Wn.VENDOR_MANAGEMENT}},{path:P.status+"/"+P.create,component:wm,canActivate:[Xe,Ze,cl],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_STATUS_MANAGEMENT]}},{path:P.status+"/"+P.list,component:Nm,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_STATUS_MANAGEMENT]}},{path:P.status+"/"+P.edit+"/:id",component:Dm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_STATUS_MANAGEMENT]}},{path:P.tenant+"/"+P.edit+"/:id",component:Wm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_TENANT_MANAGEMENT]}},{path:P.appSettings,component:J0,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS]}},{path:P.appSettings+"/"+P.subscriptionSettings,component:Lc,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.IS_SUPER_USER]}},{path:P.appSettings+"/"+P.generalSettings,component:qp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS]}},{path:P.appSettings+"/"+P.workOrder,component:hc,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS]}},{path:P.appSettings+"/"+P.inventory,component:Wp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS],subCheck:Wn.INVENTORY_MANAGEMENT}},{path:P.appSettings+"/"+P.event,component:Gp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS],module:no.EVENT}}
12183,{path:P.appSettings+"/"+P.gis,component:Bp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS],module:no.GIS}},{path:P.appSettings+"/"+P.integrations,component:Pp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS],module:no.EVENT}},{path:P.appSettings+"/"+P.integrations+"/"+P.basConnectRejections,component:tp,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS],module:no.EVENT}},{path:P.appSettings+"/"+P.developer,component:Tp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_APPLICATION_SETTINGS]}},{path:P.customField+"/"+P.list,component:vp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CUSTOM_FIELD_MANAGEMENT]}},{path:P.customField+"/"+P.create,component:fp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CUSTOM_FIELD_MANAGEMENT]}},{path:P.customField+"/"+P.edit+"/:id",component:hp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CUSTOM_FIELD_MANAGEMENT]}},{path:P.customFieldLayout+"/"+P.create,component:Ep,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CUSTOM_FIELD_MANAGEMENT]}},{path:P.customFieldLayout+"/"+P.edit+"/:id",component:Sp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CUSTOM_FIELD_MANAGEMENT]}},{path:P.documentLibrary,component:Rp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_UPDATE_DOCUMENT_LIBRARY],subCheck:Wn.DOCUMENT_LIBRARY}},{path:P.labelTemplate+"/"+P.list,component:Xp,canActivate:[Xe,Ze],data:{roles:[ae.CAN_ACCESS_LABEL_TEMPLATE_MANAGEMENT]}},{path:P.labelTemplate+"/"+P.create,component:Qp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LABEL_TEMPLATE_MANAGEMENT]}},{path:P.labelTemplate+"/"+P.edit+"/:id",component:$p,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_LABEL_TEMPLATE_MANAGEMENT]}},{path:P.checklist+"/"+P.list,component:Mm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CHECKLIST_MANAGEMENT],subCheck:Wn.CHECKLISTS}},{path:P.checklist+"/"+P.create,component:op,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CHECKLIST_MANAGEMENT],subCheck:Wn.CHECKLISTS}},{path:P.checklist+"/"+P.edit+"/:id",component:sp,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CHECKLIST_MANAGEMENT],subCheck:Wn.CHECKLISTS}},{path:P.task+"/"+P.create,component:Pm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CHECKLIST_MANAGEMENT],subCheck:Wn.CHECKLISTS}},{path:P.task+"/"+P.edit+"/:id",component:Gm,canActivate:[Xe,Ze],canDeactivate:[at],data:{roles:[ae.CAN_ACCESS_CHECKLIST_MANAGEMENT],subCheck:Wn.CHECKLISTS}}],Nc=Jd.forChild(qG);var vle=(()=>{class r{static \u0275fac=function(o){return new(o||r)};static \u0275mod=sn({type:r});static \u0275inj=ln({providers:[Pa,ui,Sn,Cl,_l,Ha,$t,Va,mn,g0,oi,un,Wi,ja,zt,yi,Td,Id,hn,_i,Oi,Pn,Tt,kn,ct],imports:[tl,_0,Hd,E0,vi,Mn,vl,Na,gl,xl,Zt,Yd,il,Bo,Ho,Qd,Kd,zd,Ii,An,Ri,Xd,Tl,Il,Zd,ul,Ua,Hi,C0,Bi,Dr,Z0,hl,$d,wr,Wa,me,Rn,jd,si,I0,ea,Mr,R0,al,Nc,ka,Ql,f0,Qa,T0,pl,Qt,w0]})}return r})();export{vle as SystemConfigModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.