1import{b as ae}from"./chunk-XXB6JV2Q.js";import{a as Z}from"./chunk-QL4UQJ6S.js";import{j as ne}from"./chunk-RPUNETX2.js";import{a as ee}from"./chunk-LUXXSIMG.js";import{i as $}from"./chunk-CPEBHIBT.js";import{$o as z,Do as Y,Go as H,Io as W,b as g,lp as J,ls as K,os as Q,qs as X,r as L}from"./chunk-4VX57KYA.js";import{a as te,h as ie}from"./chunk-ICOJPCH6.js";import{J as j,e as V,h as q,p as G}from"./chunk-2RHXVHSI.js";import{c as B,f as k}from"./chunk-QHWGP72R.js";import{oa as F,pa as O}from"./chunk-53C2BKEB.js";import{Ba as y,Bc as R,Db as l,Eb as u,Fa as M,Ga as b,Gc as _,Ic as h,Vc as c,Xc as w,ad as I,bd as A,cd as N,dc as S,ed as x,gc as C,hc as f,qc as E,sc as P,tc as U,uc as T,vc as n,wc as r,xc as D}from"./chunk-3UDGN2PZ.js";import{a as v,h as p}from"./chunk-RVFOIZLJ.js";function se(a,s){if(a&1&&(n(0,"tr")(1,"td")(2,"p",14),c(3,"No Data."),r()()()),a&2){let o=h(2);l(),C("colspan",o.listPe==null?null:o.listPe.length)}}function le(a,s){if(a&1){let o=R();n(0,"tr",15)(1,"td"),c(2),r(),n(3,"td")(4,"button",16),_("click",function(){let e=M(o).$implicit,d=h(2);return b(d.delete(e))}),n(5,"mat-icon"),c(6,"delete"),r()()()()}if(a&2){let o=s.$implicit;l(2),w(" ",o.procuringEntity==null?null:o.procuringEntity.name," ")}}function ce(a,s){if(a&1&&(n(0,"div",2)(1,"div",9)(2,"div",4)(3,"span")(4,"strong",5),c(5," Assigned Procuring Entity "),r()()()(),n(6,"div",10)(7,"mat-card",11)(8,"table",12)(9,"thead")(10,"th",13),c(11," Name of Procuring Entity "),r(),n(12,"th",13),c(13,"Actions"),r()(),n(14,"tbody"),S(15,se,4,1,"tr"),U(16,le,7,1,"tr",17,P),r()()()()()),a&2){let o=h();l(15),E(15,(o.listPe==null?null:o.listPe.length)==0?15:-1),l(),T(o.listPe)}}var we=(()=>{let s=class s{constructor(i,t,e,d,m,oe){this._bottomSheetRef=i,this.notificationService=t,this.apollo=e,this.alertDialogService=d,this.settingService=m,this.checkMicroPending=!1,this.loading=!1,this.field={type:ee.paginatedselect,query:J,apolloNamespace:g.uaa,optionName:"name",optionValue:"uuid",searchFields:["name"],sortField:"name",dynamicPipes:[],icon:"account_balance",hint:"",label:"Select PE (Multiple is allowed)",key:"selectedRoleUid",mapFunction:re=>v({},re),mustHaveFilters:[],multiple:!0,rowClass:"col12",pageSize:1e3,validations:[{message:"This field is Required",validator:V.required,name:"required"}]},this.user=oe.user}ngOnInit(){this.initiateUpdate().then()}initiateUpdate(){return p(this,null,function*(){this.loading=!0;try{let t=(yield this.apollo.fetchData({query:H,apolloNamespace:g.uaa,variables:{userUuid:this.user.uuid}})).data.getUserProcuringEntities;t&&(this.listPe=t.data)}catch{}this.loading=!1})}delete(i){return p(this,null,function*(){let t={procuringEntityUuids:[i.procuringEntity?.uuid],userUuid:this.user.uuid,uuid:i.uuid},e=yield this.apollo.mutate({mutation:z,apolloNamespace:g.uaa,variables:{userProcuringEntityRequestDTO:t}});e?.data?.deleteUserProcuringEntity?.code===9e3?(this.notificationService.successMessage("Deleted successfully"),this.loading=!1,this._bottomSheetRef.dismiss()):this.notificationService?.errorMessage(e?.data?.deleteUserProcuringEntity?.message)})}selectSubRole(i){this.selectedSubRoleUid=i?.value}getMicroProcurementRetirementStatusByUser(i){return p(this,null,function*(){try{return(yield this.apollo.fetchData({query:W,apolloNamespace:g.app,variables:{userUuid:i}}))?.data?.getMicroProcurementRetirementStatusByUser?.data}catch{return!1}})}saveChanges(){return p(this,null,function*(){if(this.checkMicroPending=!1,this.user&&(this.checkMicroPending=yield this.getMicroProcurementRetirementStatusByUser(this.user?.uuid)),this.checkMicroPending){this.alertDialogService.openDialog({title:"Unretired Micro Procurement",status:"warning",showCancelBtn:!1,message:"This user has a pending micro procurement item to retire before adding another department or PE"}).then(e=>p(this,null,function*(){}));return}let i={procuringEntityUuids:this.selectedSubRoleUid,userUuid:this.user.uuid};this.loading=!0;let t=v({},i);try{let e=yield this.apollo.mutate({mutation:Y,apolloNamespace:g.uaa,variables:{userProcuringEntityRequestDTO:t}});if(e.data.createUserProcuringEntity.code==9005)this.notificationService.errorMessage("Failed to add pe to user");else{if(e.data.createUserProcuringEntity.code!=9e3)throw new Error;this.notificationService.successMessage("Saved Successfully"),this.loading=!1,this._bottomSheetRef.dismiss()}}catch{this.notificationService.errorMessage("Failed to save")}this.loading=!1})}close(){this._bottomSheetRef.dismiss()}};s.\u0275fac=function(t){return new(t||s)(u(X),u(L),u(K),u(ae),u($),u(Q))},s.\u0275cmp=y({type:s,selectors:[["app-assign-user-delegate"]],standalone:!0,features:[x],decls:13,vars:8,consts:[[1,"p-4"],["class","row"],[1,"row"],[1,"col-md-12"],[1,"role-name"],[1,"role-header"],[1,"col-sm-12"],[3,"field","ngModel","ngModelChange","fieldValue"],["loadingMessage","Saving data ...",3,"confirmFirst","saveDisabled","savingData","save","cancel"],[1,"col-md-12","mb-2"],[1,"col-sm-12","w-full","!pl-0"],["appearance","outlined",1,"p-0","overflow-x-auto","ml-1","mr-1","mb-4"],[1,"w-full","table","table-bordered"],[1,"pt-3","pb-3","border"],[1,"text-center","mt-2"],[1,"border"],["mat-mini-fab","","color","warn",3,"click"],["class","border"]],template:function(t,e){t&1&&(n(0,"div",0),S(1,ce,18,1,"div",1),n(2,"div",2)(3,"div",3)(4,"div",4)(5,"span")(6,"strong",5),c(7," Add multiple PE to this user "),r()()()()(),D(8,"hr"),n(9,"div",6)(10,"app-paginated-select",7),N("ngModelChange",function(m){return A(e.selectedSubRoleUid,m)||(e.selectedSubRoleUid=m),m}),_("fieldValue",function(m){return e.selectSubRole(m)}),r()(),n(11,"div",6)(12,"app-save-area",8),_("save",function(){return e.saveChanges()})("cancel",function(){return e.close()}),r()()()),t&2&&(l(),E(1,(e.listPe==null?null:e.listPe.length)!=0?1:-1),l(8),f("@fadeIn",void 0),l(),f("field",e.field),I("ngModel",e.selectedSubRoleUid),l(),f("@fadeIn",void 0),l(),f("confirmFirst",!0)("saveDisabled",!e.selectedSubRoleUid)("savingData",e.loading))},dependencies:[ie,te,k,B,O,F,ne,j,q,G,Z],styles:["tr[_ngcontent-%COMP%]:nth-child(2n){background-color:#f4f6fb!important}table[_ngcontent-%COMP%]{width:100%;border:1px solid rgba(0,0,0,.1)}table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding-left:10px!important}table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-left:10px!important;color:#000!important;font-weight:bolder!important;background-color:#0000001a!important;opacity:.8!important}"]});let a=s;return a})();export{we as a};
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.