1import{a as Y}from"./chunk-Y3ATY43H.js";import"./chunk-5GTHTHUT.js";import{b as X}from"./chunk-QU5ZQTAF.js";import{b as G}from"./chunk-X3ZTDRBE.js";import{a as D}from"./chunk-CVFGBHMA.js";import{G as H,b as R,c as U,h as z,n as q,p as J}from"./chunk-OW6Z7FU2.js";import{b as B}from"./chunk-VR4LST6R.js";import"./chunk-VY6SPNUF.js";import{g as j}from"./chunk-E5UCSKBX.js";import"./chunk-WOT4CZSS.js";import"./chunk-XPG43UEF.js";import{a as L}from"./chunk-R5FILQJL.js";import"./chunk-GHPKYICJ.js";import"./chunk-5DNELMSQ.js";import"./chunk-IXPQ4YSX.js";import{a as W}from"./chunk-EMTLGGWS.js";import"./chunk-CFWNEYCF.js";import"./chunk-WCXEBYJG.js";import"./chunk-X3OOVOFF.js";import"./chunk-AXIZ66QO.js";import"./chunk-ZRR533S2.js";import{e as K,h as Q}from"./chunk-DCHDPVE2.js";import"./chunk-44NCBIU6.js";import"./chunk-5EURWJ5U.js";import"./chunk-ZNHBYH4P.js";import"./chunk-FT5JUZ6Y.js";import"./chunk-BYDGKSEJ.js";import"./chunk-FHHRU6AR.js";import"./chunk-E6DR7SCE.js";import"./chunk-ZO6NNOUN.js";import"./chunk-D72VTV4J.js";import"./chunk-XS6SHF3A.js";import"./chunk-W5PWV7UU.js";import"./chunk-KFFT3W7Z.js";import"./chunk-GNAZMTIA.js";import"./chunk-HRDOBA46.js";import"./chunk-DRTO2RYR.js";import"./chunk-Y52S3CXK.js";import"./chunk-S5EK5JRJ.js";import"./chunk-2LL7AVK7.js";import"./chunk-DUGZJGFN.js";import"./chunk-QB4CW3DZ.js";import"./chunk-G4SGAC4J.js";import"./chunk-7DJH2DDJ.js";import"./chunk-PXVWTEQG.js";import"./chunk-KKZS3G5S.js";import"./chunk-ERHERRAM.js";import"./chunk-4NYYINTD.js";import"./chunk-5GJ343PP.js";import"./chunk-CJLZHYZK.js";import{Ac as n,Bc as x,Da as d,Ea as u,Gd as I,Ia as k,Id as O,Jc as v,Pc as _,Rb as V,Sc as c,Ua as T,Xb as A,_d as P,de as N,fd as o,gd as E,hd as m,ld as f,md as C,nd as F,sc as y,tc as M,va as h,vc as S,wc as b,xc as w,yb as s,zc as i}from"./chunk-RL33O6RN.js";
1import"./chunk-FQIUDVNS.js";var $=(l,p)=>p.slug;function ee(l,p){if(l&1){let e=v();i(0,"button",21),_("click",function(){let t=d(e).$implicit,r=c(2);return u(r.removeProductFromFeature(t))}),o(1),n()}if(l&2){let e=p.$implicit;s(),m(" ",e.name," ")}}function te(l,p){if(l&1){let e=v();i(0,"button",22),_("click",function(){let t=d(e).$implicit,r=c(2);return u(r.addProductToFeature(t))}),o(1),n()}if(l&2){let e=p.$implicit;s(),m(" ",e.name," ")}}function ne(l,p){if(l&1){let e=v();i(0,"button",21),_("click",function(){d(e);let t=c(2);return u(t.removePermissionFromFeature())}),o(1),n()}if(l&2){let e=c(2);s(),m(" ",e.currentFeature.permissionName," ")}}function ie(l,p){if(l&1){let e=v();i(0,"button",22),_("click",function(){let t=d(e).$implicit,r=c(2);return u(r.addPermissionToFeature(t))}),o(1),n()}if(l&2){let e=p.$implicit;s(),m(" ",e.name," ")}}function re(l,p){if(l&1){let e=v();i(0,"div",4)(1,"div",6)(2,"div",7),o(3,"Feature Edit"),n(),i(4,"button",8),_("click",function(){d(e);let t=c();return u(t.currentFeature=void 0)}),x(5,"mat-icon",9),n()(),i(6,"div",10)(7,"div"),o(8),n(),i(9,"div")(10,"strong"),o(11,"Slug"),n(),i(12,"input",11),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.slug,t)||(r.currentFeature.slug=t),u(t)}),n()(),i(13,"div")(14,"strong"),o(15,"Name"),n(),i(16,"input",11),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.name,t)||(r.currentFeature.name=t),u(t)}),n()(),i(17,"div")(18,"strong"),o(19,"Table Label"),n(),i(20,"input",11),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.tableLabel,t)||(r.currentFeature.tableLabel=t),u(t)}),n()(),i(21,"div")(22,"div")(23,"strong"),o(24,"Description"),n()(),i(25,"div")(26,"textarea",11),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.description,t)||(r.currentFeature.description=t),u(t)}),n()()(),i(27,"div")(28,"strong"),o(29,"Priority"),n(),i(30,"input",12),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.priority,t)||(r.currentFeature.priority=t),u(t)}),n()(),i(31,"div")(32,"strong"),o(33,"Tier"),n(),i(34,"input",12),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.tier,t)||(r.currentFeature.tier=t),u(t)}),n()(),i(35,"div")(36,"strong"),o(37,"Products"),n(),x(38,"br"),o(39),x(40,"br"),i(41,"div",13),b(42,ee,2,1,"button",14,S),n(),i(44,"div",15)(45,"strong"),o(46,"Available Products"),n(),i(47,"div",13),b(48,te,2,1,"button",16,S),n()()(),i(50,"div")(51,"div",15)(52,"strong"),o(53,"Assigned Permission"),n(),y(54,ne,2,1,"button",14),n(),i(55,"div")(56,"strong"),o(57,"Available Permissions"),n(),i(58,"div",13),b(59,ie,2,1,"button",16,S),n()()(),i(61,"div",17)(62,"input",18),F("ngModelChange",function(t){d(e);let r=c();return C(r.currentFeature.visible,t)||(r.currentFeature.visible=t),u(t)}),n(),i(63,"label",19),x(64,"span",20),i(65,"div"),o(66,"Visible"),n()(),x(67,"br"),n(),i(68,"button",3),_("click",function(){d(e);let t=c();return u(t.saveFeature(t.currentFeature))}),o(69,"Save"),n()()()}if(l&2){let e=c();s(8),E(e.currentFeature._id),s(4),f("ngModel",e.currentFeature.slug),s(4),f("ngModel",e.currentFeature.name),s(4),f("ngModel",e.currentFeature.tableLabel),s(6),f("ngModel",e.currentFeature.description),s(4),f("ngModel",e.currentFeature.priority),s(4),f("ngModel",e.currentFeature.tier),s(5),m(" Products Length: ",e.currentFeature.products.length," "),s(3),w(e.getProductForFeature(e.currentFeature)),s(6),w(e.getProductsForFeature(e.currentFeature)),s(6),M(e.currentFeature.permissionId?54:-1),s(5),w(e.availablePermissionsForFeature(e.currentFeature)),s(3),f("ngModel",e.currentFeature.visible)}}function oe(l,p){if(l&1&&(i(0,"div"),o(1),n()),l&2){let e=p.$implicit;s(),E(e)}}function ae(l,p){if(l&1){let e=v();i(0,"div",25),_("click",function(){let t=d(e).$implicit,r=c(2);return u(r.setFeature(t))}),i(1,"div")(2,"strong"),o(3,"Slug"),n(),o(4),n(),i(5,"div")(6,"strong"),o(7,"Name"),n(),o(8),n(),i(9,"div")(10,"strong"),o(11,"Table Label"),n(),o(12),n(),i(13,"div")(14,"strong"),o(15,"Description"),n(),o(16),n(),i(17,"div")(18,"strong"),o(19,"Priority"),n(),o(20),n(),i(21,"div")(22,"strong"),o(23,"Products"),n(),x(24,"br"),o(25),x(26,"br"),b(27,oe,2,1,"div",null,S),n(),i(29,"div")(30,"strong"),o(31,"Tier"),n(),o(32),n(),i(33,"div")(34,"strong"),o(35,"Assigned Permission"),n(),o(36),n(),i(37,"div")(38,"strong"),o(39,"Visible"),n(),o(40),n()()}if(l&2){let e=p.$implicit;s(4),m(" ",e.slug," "),s(4),m(" ",e.name," "),s(4),m(" ",e.tableLabel," "),s(4),m(" ",e.de
1scription," "),s(4),m(" ",e.priority," "),s(5),m(" Products Length: ",e.products.length," "),s(2),w(e.products),s(5),m(" ",e.tier," "),s(4),m(" ",e.permissionName," "),s(4),m(" ",e.visible," ")}}function se(l,p){if(l&1&&(i(0,"div",6)(1,"div",7),o(2,"Feature List"),n()(),i(3,"div",23),b(4,ae,41,9,"div",24,$),I(6,"sort"),n()),l&2){let e=c();s(4),w(O(6,0,e.features(),"feature.priority"))}}var Z=(()=>{class l extends L{constructor(){super(...arguments),this.permissionsService=h(Y),this.paymentService2=h(D),this.authQuery=h(j),this.notificationService=h(B),this.document=h(k),this.window=h(W),this.authorized=!1,this.features=N.required(),this.permissions=P.required(),this.newproducts=P.required(),this.isLoading=!0,this.setupPage=()=>{this.isLoading=!1,console.log("Authorized!",{permissions:this.permissions(),features:this.features()})},this.exportFeatures=()=>{let e=JSON.parse(JSON.stringify(this.features())),a={};for(let t of this.newproducts())a[t._id]=t.slug;e=e.map(t=>{let r=t;return r.products=r.products.map(g=>a[g]),delete r.__v,delete r._id,delete r.permissionId,r}),this.exportToFile(e,"features.json")},this.exportToFile=(e,a)=>{if(!e){console.error("Console.save: No data");return}a||(a="console.json"),typeof e=="object"&&(e=JSON.stringify(e,void 0,4));let t=new Blob([e],{type:"text/json"}),r=this.document.createEvent("MouseEvents"),g=this.document.createElement("a");g.download=a,g.href=URL.createObjectURL(t),g.dataset.downloadurl=["text/json",g.download,g.href].join(":"),r.initMouseEvent("click",!0,!1,this.window,0,0,0,0,0,!1,!1,!1,!1,0,null),g.dispatchEvent(r)},this.getProductForFeature=e=>{if(e.products.length>0)return this.newproducts().filter(a=>e.products.find(t=>t===a._id))},this.getProductsForFeature=e=>e.products.length<1?this.newproducts():this.newproducts().filter(t=>!e.products.find(r=>r===t._id)),this.availablePermissionsForFeature=e=>e.permissionId&&e.permissionName?[]:this.permissions().filter(t=>!this.features().find(r=>r.permissionId===t._id)),this.addPermissionToFeature=e=>{this.currentFeature.permissionId=e._id,this.currentFeature.permissionName=e.name},this.createFeature=()=>{this.currentFeature={slug:"",name:"",tableLabel:"",priority:0,description:"",products:[],tier:0,permissionId:null,permissionName:null,visible:!0}},this.addProductToFeature=e=>{this.currentFeature.products.push(e._id)},this.removePermissionFromFeature=()=>{this.currentFeature.permissionId=null,this.currentFeature.permissionName=null},this.removeProductFromFeature=e=>{this.currentFeature.products=this.currentFeature.products.filter(a=>a!==e._id)},this.setFeature=e=>{this.currentFeature=e},this.saveFeature=async e=>{console.log("Save current feature",e);try{if(e._id){let a=await this.paymentService2.putFeatures(e);if(console.log({updatedFeatureResponse:a}),a.status==="OK"){let t=this.features().findIndex(r=>r._id===a.data._id);this.currentFeature=a.data,this.features()[t]=this.currentFeature}}else{let a=await this.paymentService2.postFeatures(e);console.log({newFeatureResponse:a}),a.status==="OK"&&(this.features.update(t=>[...t,a.data]),this.currentFeature=a.data)}this.notificationService.success("Success","Saving feature worked fine")}catch{this.notificationService.error("No. Not working","Something went badly wrong... Maybe")}}}ngOnInit(){this.setupPage()}static{this.\u0275fac=(()=>{let e;return function(t){return(e||(e=T(l)))(t||l)}})()}static{this.\u0275cmp=V({type:l,selectors:[["features-admin"]],inputs:{features:[1,"features"],permissions:[1,"permissions"],newproducts:[1,"newproducts"]},outputs:{features:"featuresChange"},features:[A],decls:9,vars:2,consts:[[1,"p-4","pt-0"],[1,"flex","gap-2","mb-4"],["mat-flat-button","",3,"click"],["mat-flat-button","","color","primary",3,"click"],[1,"mb-4"],[1,"overflow-wrapper","flex-col"],[1,"flex","w-full","items-center","mb-2"],[1,"text-xl","font-medium"],["mat-icon-button","",1,"tt-mat-button-small",3,"click"],["svgIcon","heroicons_outline:x",1,"icon-size-3"],[1,"bg-components-card-bg-color","rounded","p-4"],[3,"ngModelChange","ngModel"],["type","number",3,"ngModelChange","ngModel"],[1,"flex","flex-wrap","gap-1"],["mat-stroked-button","","color","primary",1,"tt-mat-button-small"],[1,"flex","flex-col"],["mat-stroked-button","","color","warn",1,"tt-mat-button-small"],[1,"flex","center",2,"min-width","40px"],["type","checkbox","id","visible",1,"round","green","thin","small",3,"ngModelChange","ngModel"],["for","visible","t
1itle","Select / Unselect"],[2,"color","black"],["mat-stroked-button","","color","primary",1,"tt-mat-button-small",3,"click"],["mat-stroked-button","","color","warn",1,"tt-mat-button-small",3,"click"],[1,"grid","gap-4","grid-cols-1","md:grid-cols-2","lg:grid-cols-3"],[1,"card-feature","bg-components-card-bg-color","p-4","rounded","cursor-pointer","hover:shadow"],[1,"card-feature","bg-components-card-bg-color","p-4","rounded","cursor-pointer","hover:shadow",3,"click"]],template:function(a,t){a&1&&(i(0,"div",0)(1,"div",1)(2,"button",2),_("click",function(){return t.exportFeatures()}),o(3,"Export Features"),n(),i(4,"button",3),_("click",function(){return t.createFeature()}),o(5,"Create new feature"),n()(),y(6,re,70,10,"div",4),i(7,"div",5),y(8,se,7,3),n()()),a&2&&(s(6),M(t.currentFeature?6:-1),s(2),M(t.features()&&t.features().length>0?8:-1))},dependencies:[Q,K,X,H,U,J,R,z,q,G],styles:[`.example-element-detail[_ngcontent-%COMP%]{overflow:hidden;display:flex}tr.example-detail-row[_ngcontent-%COMP%]{height:0}.example-element-row[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom-width:0}.mat-mdc-table[_ngcontent-%COMP%]{max-height:calc(100dvh - 269px);min-height:calc(100dvh - 269px)}.mat-mdc-table[_ngcontent-%COMP%] .mat-mdc-cell[_ngcontent-%COMP%]{vertical-align:middle}.mat-mdc-table[_ngcontent-%COMP%] tr.mat-mdc-header-row[_ngcontent-%COMP%]{height:48px;position:sticky;top:0;z-index:10;background-color:var(--color-background-body)!important}.mat-mdc-table[_ngcontent-%COMP%] tr.mat-mdc-header-row[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{vertical-align:middle}.mat-mdc-table[_ngcontent-%COMP%] .mat-mdc-cell[_ngcontent-%COMP%]{background-color:transparent!important}.mat-mdc-table[_ngcontent-%COMP%] .mat-column-name[_ngcontent-%COMP%]{width:40%}.mat-mdc-table[_ngcontent-%COMP%] .mat-column-email[_ngcontent-%COMP%]{width:35%}.mat-mdc-table[_ngcontent-%COMP%] .mat-column-created[_ngcontent-%COMP%]{width:20%}.mat-mdc-table[_ngcontent-%COMP%] .mat-column-expand[_ngcontent-%COMP%]{width:5%} 2 3/*# sourceMappingURL=features-admin.component-XHPHFFV6.css.map */`]})}}return l})();var le=[{path:"",component:Z,data:{icon:"heroicons_outline:credit-card",title:"Features Control"}}],ye=le;export{ye as default}; 4//# sourceMappingURL=features-admin.routes-YP2OIMAQ.js.map
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.