1import{_ as A,g as U,h as p,y as L,r as n,c as i,o as r,a as u,i as D,b as h,l as _,w as a,e as m,t as c,v as P,d as g,F as w}from"./index-Bvw2d2UK.js";import{A as C}from"./FieldAdjusterFee-Cvv4OVz8.js";/* empty css */import"./vue-the-mask-D--JAlcK.js";import"./EditDeskAdjusterSchedule-DKSXAoD7.js";import"./EditFieldAdjusterSchedule-Dom0hkw5.js";import"./ViewFieldAdjusterPendingSchedule-3JfzAMr9.js";import{C as F}from"./ContentSlot-Dvl4M1ZN.js";import{C as E}from"./CollapsibleCard-BAhrbBKx.js";import"./DateTimePicker-C2FQYbyx.js";import"./Calendar-DY61ZhRl.js";import"./Subtract_Icon-BERHdLp2.js";import"./Add_Icon-DQBuDaNw.js";const N={name:"AuthLevelTable",components:{AddAuthUserModal:C},props:["level"],data(){return{companyName:null,currentPage:1,isLoading:!0,FEATURE_TOGGLE_ENUM:L,params:{level:this.$props.level,skip:0,take:10,sortBy:4,sortDesc:!0},results:{},selectedUSer:null,sortDesc:!0,userDetails:{},openAddUserPopup:!1}},computed:{...U(["hasPermission","isFeatureEnabled"]),confirmModalId(){return`modal-${this.$props.level}-confirm-modal`},computedFields(){return this.isFeatureEnabled(L.EmbeddedFloodClaims)?this.fields:this.fields.filter(e=>!e.isFeatureFlood)},fields(){return this.$props.level==1?[{key:"userName",label:"User",sortable:!0,tdClass:"text-font-primary"},{key:"laeThreshold",label:"Lae Threshold",sortable:!0},{key:"lossThreshold",label:"Loss Threshold",sortable:!0},{key:"floodLAEThreshold",label:"Flood Lae Threshold",sortable:!0,isFeatureFlood:!0},{key:"floodlossThreshold",label:"Flood Loss Threshold",sortable:!0,isFeatureFlood:!0},{key:"action",label:""}]:[{key:"userName",label:"User",sortable:!0,tdClass:"text-font-primary"},{key:"action",label:""}]}},watch:{level(e){this.params.level=e,this.currentPage=1,this.params.skip=0,this.fillTable()}},methods:{onCloseAddUserModal(){this.openAddUserPopup=!1,this.userDetails={}},deleteUser(e){const l=this.$createElement,v=l("div",{domProps:{innerHTML:`Are you sure you want to delete ${e.userName} <br />from level ${this.$props.level} ?`}});this.$bvModal.msgBoxConfirm([v],{title:"Delete User",okVariant:"warning",okTitle:"Yes",cancelTitle:"No",centered:!0}).then(f=>{f&&(this.isLoading=!0,p.delete(`/api/authlevel/delete/${e.id}`).then(()=>{this.currentPage=1,this.params.skip=(this.currentPage-1)*this.params.take,this.fillTable()}).catch(()=>{this.isLoading=!1}))}).catch()},clear(){this.companyName=null,this.$nextTick(()=>this.fillTable())},fillTable(){this.isLoading=!0,p.post("/api/authlevel/levelfiltered",this.params).then(e=>{this.results=e.data,this.isLoading=!1}).catch(()=>{this.isLoading=!1})},updateDataList(e){e&&this.$nextTick(()=>{this.params.skip=(this.currentPage-1)*this.params.take,this.isLoading=!0,this.fillTable()})},setUserDetails(e){e?this.userDetails={id:e.id,userId:e.userId,userName:e.userName.toString(),laeThreshold:e.laeThreshold.toString(),lossThreshold:e.lossThreshold.toString(),level:Number(this.$props.level),floodLAEThreshold:e.floodLAEThreshold.toString(),floodlossThreshold:e.floodlossThreshold.toString()}:this.userDetails={},this.userDetails.editUser=!!e,this.openAddUserPopup=!0},async saveUser(e){this.openAddUserPopup=!1,this.userDetails&&this.userDetails.id?this.updateUser(e):this.addNewUser(e)},async updateUser(e){this.isLoading=!0,p.put("/api/authlevel/save",{...e,level:this.$props.level}).then(()=>{this.currentPage=1,this.params.sortBy=4,this.params.sortDesc=!0,this.updateDataList(!0)}).catch(()=>{this.isLoading=!1})},async addNewUser(e){this.isLoading=!0,p.post("/api/authlevel/add",{...e,level:this.$props.level}).then(()=>{this.currentPage=1,this.params.sortBy=4,this.params.sortDesc=!0,this.updateDataList(!0)}).catch(()=>{this.isLoading=!1})}},created(){this.fillTable()}},M={key:0},B=["onClick"],S={key:1},V=["onClick"],$={class:"h-100 heading sm"};function R(e,l,v,f,s,o){const b=n("b-table"),T=n("b-overlay"),y=n("b-pagination"),d=n("AddAuthUserModal");return r(),i("div",null,[u(T,{"spinner-variant":"spinner",show:s.isLoading,class:"mt-4 h-100",opacity:"0.85",blur:"5px"},{default:a(()=>[s.results.totalRecords>0?(r(),i("div",M,[u(b,{"sticky-header":"",hover:"",striped:"",bordered:"","select-mode":"single","sort-by":s.params.sortBy,"onUpdate:sortBy":l[0]||(l[0]=t=>s.params.sortBy=t),"sort-desc":s.params.sortDesc,"onUpdate:sortDesc":l[1]||(l[1]=t=>s.params.sortDesc=t),onSortChanged:l[2]||(l[2]=t=>o.updateDataList(!1)),"primary-key":"id",items:s.results.data,fields:o.computedFields,"per-page":0,"current-page":s.currentPage,small:""},{"cell(laeThreshold)":a(t=>[m(c(e.filterFunction("currency",t.item.laeThreshold)),1)]),"cell(lossThreshold)":a(t=>[m(c(e.filterFunction("currency",t.item.lossThreshold)),1)]),"cell(floodLAEThreshold)":a(t=>[m(c(e.filterFunction("currency",t.item.floodLAEThreshold)),1)]),"cell(floodlossThreshold)":a(t=>[m(c(e.filterFunction("currency",t.item.floodlossThreshold)),1)]),"cell(action)":a(t=>[e.$props.level==1&&e.hasPermission("AdminAuthorizationlevelsEditUser")?(r(),i("button",{key:0,class:"btn btn-link",onClick:k=>o.setUserDetails(t.item)}," Edit ",8,B)):h("",!0),e.$props.level==1&&e.hasPermission("AdminAuthorizationlevelsEditUser")?(r(),i("span",S,"|")):h("",!0),s.results.totalRecords>1&&e.hasPermission("AdminAuthorizationlevelsAddDeleteUser")?(r(),i("button",{key:2,class:"btn btn-link",onClick:k=>o.deleteUser(t.item)}," Delete ",8,V)):h("",!0)]),_:1},8,["sort-by","sort-desc","items","fields","current-page"])])):h("",!0)],void 0,!0),_:1},8,["show"]),s.results.totalRecords>0?(r(),D(y,{key:0,modelValue:s.currentPage,"onUpdate:modelValue":l[3]||(l[3]=t=>s.currentPage=t),"total-rows":s.results.totalRecords,perPage:s.params.take,onChange:l[4]||(l[4]=t=>o.updateDataList(!0))},null,8,["modelValue","total-rows","perPage"])):h("",!0),_(g("div",$," No Users ",512),[[P,!s.isLoading&&s.results.totalRecords===0]]),u(d,{showModal:s.openAddUserPopup,userDetails:s.userDetails,level:e.$props.level,onClosed:o.onCloseAddUserModal,onSave:o.saveUser},null,8,["showModal","userDetails","level","onClosed","onSave"])])}const x=A(N,[["render",R],["__scopeId","data-v-9f41651a"]]),z={name:"AddThirdParty",components:{AuthLevelTable:x,CollapsibleCard:E,ContentSlot:F},data(){return{showModal:!1,authLevel:1,authLevelOptions:[{label:"Level 1",value:1},{label:"Level 2",value:2}]}},computed:{...U(["hasPermission","isFeatureEnabled"]),submitDisabled(){return!this.isFormValid()},accept(){return this.allowedTypes.join(",")}},methods:{navigateBack(e){this.$router.push({name:e})},showAddThirdParty(){this.showModal=!0},hideAddThirdParty(){this.showModal=!1}}},G={class:"flex mt-8 wrapper items-end"},I={key:0,class:"flex-1 flex justify-end"};function O(e,l,v,f,s,o){const b=n("v-select"),T=n("b-form-group"),y=n("AuthLevelTable");return r(),i(w,null,[g("div",G,[u(T,{label:"Level","label-for":"authLevel",class:"mb-0"},{default:a(()=>[u(b,{modelValue:s.authLevel,"onUpdate:modelValue":l[0]||(l[0]=d=>s.authLevel=d),id:"authLevel",options:s.authLevelOptions,label:"label",class:"w-32 bg-white",reduce:d=>d.value,searchable:!1,clearable:!1},null,8,["modelValue","options","reduce"])],void 0,!0),_:1}),e.hasPermission("AdminAuthorizationlevelsAddDeleteUser")?(r(),i("div",I,[g("button",{onClick:l[1]||(l[1]=d=>e.$refs.authLevelTable.setUserDetails()),class:"btn btn-quote-primary"},"Add User")])):h("",!0)]),u(y,{level:s.authLevel,ref:"authLevelTable",class:"m-4"},null,8,["level"])],64)}
1const le=A(z,[["render",O]]);export{le as default};
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.