import{c as V,d as z}from"./chunk-C2WGQZZS.js";import"./chunk-4NKYXKKW.js";import"./chunk-LNWF7VZ2.js";import"./chunk-T6NRFYFX.js";import"./chunk-RQCMKSAN.js";import"./chunk-JI65IOIM.js";import{I as L,f as S,j as $,l as B,u as w}from"./chunk-57DG2VC5.js";import"./chunk-NMMBNW5X.js";import"./chunk-5IDV7BCW.js";import"./chunk-CVFNZXIB.js";import{e as U,f as W,g as j}from"./chunk-EU5XKS65.js";import{c as N}from"./chunk-XALE2GEX.js";import{p as P,q as O,s as G}from"./chunk-GJIGZB63.js";import"./chunk-TOJME4VO.js";import"./chunk-2CD72B3Z.js";import"./chunk-4TDNJBFX.js";import"./chunk-4LZAXRJQ.js";import"./chunk-XHRSSCXW.js";import{b as D}from"./chunk-5VDVFGVW.js";import{p as _}from"./chunk-NLMVBXFK.js";import"./chunk-BUHB7MLU.js";import"./chunk-KUS3L5XF.js";import{Ad as M,Bc as d,Cc as u,Dc as E,Dd as A,Eb as c,Fb as b,Fd as k,Kb as p,Lc as g,Mc as m,Rc as y,Sc as F,Vb as a,cc as n,dc as o,ec as l,la as T,nc as h,rb as r,sb as v,td as R,ud as I}from"./chunk-J476KISY.js";var C=t=>({value:t});function X(t,f){if(t&1&&(n(0,"li",3)(1,"div",4)(2,"div",5)(3,"span"),d(4),o()(),n(5,"div",6),l(6,"paw-input-field",7),o(),n(7,"div",6),l(8,"paw-input-field",7),o(),n(9,"div",6),l(10,"paw-input-field",7),o()()()),t&2){let e=f.$implicit,i=h();r(4),u(e.value.function),r(2),a("id",e.value.function+"-read")("field",i.checkboxReadField)("model",m(10,C,e.value.canSelect)),r(2),a("id",e.value.function+"-write")("field",i.checkboxWriteField)("model",m(12,C,e.value.canUpdate)),r(2),a("id",e.value.function+"-delete")("field",i.checkboxDeleteField)("model",m(14,C,e.value.canDelete))}}var H=(()=>{class t{get permissionMap$(){return this.userAuthService.permissions.permissionMap$}constructor(e){this.userAuthService=e,this.checkboxReadField={id:"value",component:w,disabled:!0,caption:"Read"},this.checkboxWriteField={id:"value",component:w,disabled:!0,caption:"Write"},this.checkboxDeleteField={id:"value",component:w,disabled:!0,caption:"Delete"}}static{this.\u0275fac=function(i){return new(i||t)(v(P))}}static{this.\u0275cmp=c({type:t,selectors:[["paw-sb-guide-permissions"]],standalone:!1,decls:5,vars:5,consts:[[1,"p-4"],[1,"paw-list"],["class","pb-2",4,"ngFor","ngForOf"],[1,"pb-2"],[1,"flex","paw-border-bottom","paw-items-middle"],[1,"flex-[6]"],[1,"flex-[2]"],[3,"id","field","model"]],template:function(i,s){i&1&&(n(0,"div",0)(1,"ul",1),p(2,X,11,16,"li",2),y(3,"async"),y(4,"keyvalue"),o()()),i&2&&(r(2),a("ngForOf",F(4,3,F(3,1,s.permissionMap$))))},dependencies:[R,S,M,A],encapsulation:2})}}return t})();var K=(()=>{class t{constructor(){this.mainOptions={navigation:[{id:"permissions",label:"Permissions",link:"./permissions"},{id:"features",label:"Features",link:"./features"}]}}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=c({type:t,selectors:[["paw-sb-guide-security"]],standalone:!1,decls:1,vars:1,consts:[[3,"optionsDef"]],template:function(i,s){i&1&&l(0,"paw-main-view",0),i&2&&a("optionsDef",s.mainOptions)},dependencies:[V],encapsulation:2})}}return t})();var Z=()=>({worker:"Fake Worker Code"}),Y=t=>({worker:t});function ee(t,f){t&1&&(n(0,"div"),d(1," CAN UPDATE OTHERS TIME RECORDS "),o())}function te(t,f){t&1&&(n(0,"div"),d(1," CAN DELETE OWN TIME RECORDS "),o())}function ie(t,f){t&1&&(n(0,"div"),d(1," CAN DELETE TIME RECORDS "),o())}function ne(t,f){if(t&1&&(n(0,"div")(1,"div"),l(2,"paw-input-field",1),o(),n(3,"div",2)(4,"textarea",3),d(5),o()(),n(6,"div")(7,"div")(8,"span"),d(9,"TEST 'TimeRecords.UpdateOthersRecord'"),o()(),n(10,"div"),p(11,ee,2,0,"div",4),o()(),n(12,"div")(13,"div")(14,"span"),d(15,"TEST 'TimeRecords.DeleteOwnRecord' for identity "),n(16,"span",5),d(17),o()()(),n(18,"div"),p(19,te,2,0,"div",6),o()(),n(20,"div")(21,"div")(22,"span"),d(23,"TEST 'TimeRecords.DeleteRecord' for identity "),n(24,"span",5),d(25),o()()(),n(26,"div"),p(27,ie,2,0,"div",6),o()(),n(28,"div")(29,"div")(30,"span"),d(31,"Input field TEST 'TimeRecords.DeleteRecord' for identity "),n(32,"span",5),d(33),o()()(),n(34,"div"),l(35,"paw-input-field",7),o(),n(36,"div",8),d(37," Action will be enabled when no permissions "),l(38,"paw-action",9),o(),n(39,"div",8),d(40," Will see action if have permission "),l(41,"paw-action",9),o(),n(42,"div",8),d(43," Action will be hidden when no permissions "),l(44,"paw-action",9),o()()()),t&2){let e=h();r(2),a("field",e.featureSelectField)("model",e.featureSelectModel),r(3),E("",e.selectedFeature.signature,`
`),r(6),a("pawAuthFeature","TimeRecords.UpdateOthersRecord")("pawAuthFeatureParams",g(19,Z)),r(6),u(e.identity.employee==null?null:e.identity.employee.workerCode),r(2),a("pawAuthFeature","TimeRecords.DeleteOwnRecord")("pawAuthFeatureParams",m(20,Y,e.identity.employee==null?null:e.identity.employee.workerCode))("pawAuthFeatureShowNotAllowed",!0),r(6),u(e.identity.employee==null?null:e.identity.employee.workerCode),r(2),a("pawAuthFeature","TimeRecords.DeleteRecord")("pawAuthFeatureParams",m(22,Y,e.identity.employee==null?null:e.identity.employee.workerCode))("pawAuthFeatureShowNotAllowed",!0),r(6),u(e.identity.employee==null?null:e.identity.employee.workerCode),r(2),a("field",e.inputFieldTest)("model",e.inputFieldTestModel),r(3),a("action",e.actionTest),r(3),a("action",e.actionTest2),r(3),a("action",e.actionTest3)}}var q=(()=>{class t{get identity(){return this.authService.authUser}constructor(e,i){this.featureService=e,this.authService=i,this.featureSelectField={id:"featureId",label:"Select feature",component:B,onChange:s=>{this.selectFeature(s)}},this.featureSelectModel={featureId:""},this.selectedFeature={featureId:"",signature:""},this.inputFieldTest={id:"test",component:$,label:"Test field",featureId:"TimeRecords.DeleteRecord",featureParams:{worker:this.identity?.employee?.workerCode}},this.inputFieldTestModel={test:"You can not edit this field"},this.actionTest={id:"permission-action-test",label:"Will see if have permissions",featureId:"TimeRecords.DeleteRecord",featureParams:{worker:this.identity?.employee?.workerCode}},this.actionTest2={id:"permission-action-test-2",label:"Update own time records",featureId:"TimeRecords.UpdateOwnRecord",featureParams:{worker:this.identity?.employee?.workerCode},onSelected:()=>{console.log("Clicked")}},this.actionTest3={id:"permission-action-test-1",label:"Update own time records",hideFeatureId:"TimeRecords.DeleteRecord",featureParams:{worker:this.identity?.employee?.workerCode},onSelected:()=>{console.log("Clicked")}}}ngOnInit(){let e=[];for(let i in this.featureService.features)e.push(i);this.featureSelectModel.featureId=e[0],this.featureSelectField.options=e,this.selectFeature(this.featureSelectModel.featureId)}selectFeature(e){let i=this.featureService.getFeature(e);D.isSet(i)&&(this.selectedFeature={featureId:e,signature:i.toString()})}static{this.\u0275fac=function(i){return new(i||t)(v(G),v(O))}}static{this.\u0275cmp=c({type:t,selectors:[["paw-sb-guide-features"]],standalone:!1,decls:1,vars:1,consts:[[4,"ngIf"],[1,"paw-label-width-m",3,"field","model"],[1,"pt-4"],["disabled","",1,"sb-feature-signature"],[4,"pawAuthFeature","pawAuthFeatureParams"],[1,"paw-text-strong"],[4,"pawAuthFeature","pawAuthFeatureParams","pawAuthFeatureShowNotAllowed"],[3,"field","model"],[1,""],[3,"action"]],template:function(i,s){i&1&&p(0,ne,45,24,"div",0),i&2&&a("ngIf",s.identity)},dependencies:[I,S,U,N],styles:["[_nghost-%COMP%]   .sb-feature-signature[_ngcontent-%COMP%]{resize:none;width:50%;height:120px}"]})}}return t})();var ge=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=T({imports:[k,z,L,W,j,_.forChild([{path:"",component:K,children:[{path:"",redirectTo:"permissions",pathMatch:"full"},{path:"permissions",component:H},{path:"features",component:q}]}])]})}}return t})();export{ge as SbGuideSecurityModule};
