import{d as H,e as K}from"./chunk-5H5H6C4Y.js";import"./chunk-QEMINC2A.js";import"./chunk-P4KRQVGS.js";import"./chunk-HVLAIORG.js";import"./chunk-7NRTBDEV.js";import"./chunk-WTAT2E5Z.js";import"./chunk-4KB2I3K5.js";import"./chunk-4EEGS4SZ.js";import"./chunk-Y46LOK5X.js";import"./chunk-3PEMIHKH.js";import"./chunk-DFPET44C.js";import{D as L,L as y,N as ie,ea as z,q as W,y as w}from"./chunk-3SGEAGU4.js";import"./chunk-AXJC5PD4.js";import"./chunk-KX2PR432.js";import{c as V,d as $,e as B}from"./chunk-PCQVD4UN.js";import{c as j}from"./chunk-FUKRVTQR.js";import{h as N,i as ee,n as U,o as te}from"./chunk-HMHHBN2H.js";import"./chunk-LTTEKZWN.js";import"./chunk-JD7XHN2Y.js";import"./chunk-PNYIEM2I.js";import"./chunk-WAKTITOT.js";import"./chunk-DIZJ6SFW.js";import"./chunk-NGFJDF4M.js";import{F as G,G as Z,e as O,f as X}from"./chunk-DQXXLIFV.js";import{n as P}from"./chunk-BKF2JYPP.js";import"./chunk-OFEKULYN.js";import"./chunk-T3Q3DASN.js";import"./chunk-PYC6L6XB.js";import"./chunk-BEQYW66E.js";import{$b as n,Ab as c,Ac as R,Ad as k,Bb as g,Dd as _,Fd as D,Gb as p,Ic as I,Jc as m,Ld as x,Pc as F,Qc as C,Rb as a,ac as o,bc as l,ea as E,fd as S,kc as h,nb as r,ob as v,td as M,ud as A,yc as d,zc as u}from"./chunk-LU6Q5ONP.js";import"./chunk-5VMFMKJR.js";x();ie();S();Z();x();var T=t=>({value:t});function re(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,T,e.value.canSelect)),r(2),a("id",e.value.function+"-write")("field",i.checkboxWriteField)("model",m(12,T,e.value.canUpdate)),r(2),a("id",e.value.function+"-delete")("field",i.checkboxDeleteField)("model",m(14,T,e.value.canDelete))}}var Y=(()=>{class t{get permissionMap$(){return this.userAuthService.permissions.permissionMap$}constructor(e){this.userAuthService=e,this.checkboxReadField={id:"value",component:y,disabled:!0,caption:"Read"},this.checkboxWriteField={id:"value",component:y,disabled:!0,caption:"Write"},this.checkboxDeleteField={id:"value",component:y,disabled:!0,caption:"Delete"}}static{this.\u0275fac=function(i){return new(i||t)(v(G))}}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,re,11,16,"li",2),F(3,"async"),F(4,"keyvalue"),o()()),i&2&&(r(2),a("ngForOf",C(4,3,C(3,1,s.permissionMap$))))},dependencies:[M,w,k,_],encapsulation:2})}}return t})();S();var q=(()=>{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:[H],encapsulation:2})}}return t})();X();S();te();ee();x();var ae=()=>({worker:"Fake Worker Code"}),J=t=>({worker:t});function de(t,f){t&1&&(n(0,"div"),d(1," CAN UPDATE OTHERS TIME RECORDS "),o())}function le(t,f){t&1&&(n(0,"div"),d(1," CAN DELETE OWN TIME RECORDS "),o())}function se(t,f){t&1&&(n(0,"div"),d(1," CAN DELETE TIME RECORDS "),o())}function pe(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,de,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,le,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,se,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),R("",e.selectedFeature.signature,`
`),r(6),a("pawAuthFeature","TimeRecords.UpdateOthersRecord")("pawAuthFeatureParams",I(19,ae)),r(6),u(e.identity.employee==null?null:e.identity.employee.workerCode),r(2),a("pawAuthFeature","TimeRecords.DeleteOwnRecord")("pawAuthFeatureParams",m(20,J,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,J,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:L,onChange:s=>{this.selectFeature(s)}},this.featureSelectModel={featureId:""},this.selectedFeature={featureId:"",signature:""},this.inputFieldTest={id:"test",component:W,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);O.isSet(i)&&(this.selectedFeature={featureId:e,signature:i.toString()})}static{this.\u0275fac=function(i){return new(i||t)(v(U),v(N))}}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,pe,45,24,"div",0),i&2&&a("ngIf",s.identity)},dependencies:[A,w,V,j],styles:["[_nghost-%COMP%]   .sb-feature-signature[_ngcontent-%COMP%]{resize:none;width:50%;height:120px}"]})}}return t})();S();var De=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=g({type:t})}static{this.\u0275inj=E({imports:[D,K,z,$,B,P.forChild([{path:"",component:q,children:[{path:"",redirectTo:"permissions",pathMatch:"full"},{path:"permissions",component:Y},{path:"features",component:Q}]}])]})}}return t})();export{De as SbGuideSecurityModule};
