-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path863.fc3e4882e043efa9.js
1 lines (1 loc) · 7.77 KB
/
863.fc3e4882e043efa9.js
1
"use strict";(self.webpackChunkcashwarden_web_ng=self.webpackChunkcashwarden_web_ng||[]).push([[863],{6863:(U,u,s)=>{s.r(u),s.d(u,{MemberModule:()=>B});var T=s(8418),a=s(9094),e=s(4650),_=s(5156),h=s(9651),p=s(6895),d=s(433),g=s(1098),y=s(6704),f=s(6616),b=s(7044),M=s(1811),J=s(5635),C=s(8231);function A(t,m){1&t&&(e.TgZ(0,"div",14),e._uU(1),e.ALo(2,"i18n"),e.qZA()),2&t&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"app.member.update"),""))}function F(t,m){1&t&&(e.TgZ(0,"div",14),e._uU(1),e.ALo(2,"i18n"),e.qZA()),2&t&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"app.member.create")))}function Q(t,m){if(1&t&&(e.TgZ(0,"nz-option",15),e._uU(1),e.qZA()),2&t){const n=m.$implicit;e.Q6J("nzLabel",n.label)("nzValue",n.value),e.xp6(1),e.hij(" ",n.label," ")}}function I(t,m){if(1&t){const n=e.EpF();e.TgZ(0,"se",4),e.ALo(1,"i18n"),e.TgZ(2,"input",16),e.NdJ("ngModelChange",function(i){e.CHM(n);const r=e.oxw();return e.KtG(r.form.password=i)}),e.qZA()()}if(2&t){const n=e.oxw();e.Q6J("label",e.lcZ(1,2,"app.member.password")),e.xp6(2),e.Q6J("ngModel",n.form.password)}}function Y(t,m){if(1&t){const n=e.EpF();e.TgZ(0,"se",17),e.ALo(1,"i18n"),e.ALo(2,"i18n"),e.TgZ(3,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(n);const r=e.oxw();return e.KtG(r.form.password=i)}),e.qZA()()}if(2&t){const n=e.oxw();e.Q6J("label",e.lcZ(1,3,"app.member.password"))("extra",e.lcZ(2,5,"app.member.update_password.help")),e.xp6(3),e.Q6J("ngModel",n.form.password)}}s(9553);let x=(()=>{class t{constructor(n,o,i,r,c){this.modal=n,this.msgSrv=o,this.http=i,this.cdr=r,this.i18n=c,this.record={},this.types=[],this.form={name:"",email:"",password:"",role:""}}ngOnInit(){this.record.id&&(this.form=this.record)}save(n){this.http.request(this.record.id?"put":"post","/api/members"+(this.record.id?`/${this.record.id}`:""),{body:n}).subscribe(r=>{r.code||(this.msgSrv.success(this.i18n.fanyi("app.form.save-success")),this.modal.close(r))})}close(){this.modal.destroy()}}return t.\u0275fac=function(n){return new(n||t)(e.Y36(_.Lf),e.Y36(h.dD),e.Y36(a.lP),e.Y36(e.sBO),e.Y36(a.Oi))},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-member-form"]],decls:24,vars:24,consts:[[1,"modal-header"],["class","modal-title",4,"ngIf"],["nz-form","","se-container","1.0","labelWidth","100",3,"ngSubmit"],["f","ngForm"],[3,"label"],["type","text","nz-input","","name","name","required","",3,"ngModel","ngModelChange"],["type","text","nz-input","","name","email","required","",3,"ngModel","ngModelChange"],["name","role","required","",3,"ngModel","ngModelChange"],["nzCustomContent","",3,"nzLabel","nzValue",4,"ngFor","ngForOf"],[3,"label",4,"ngIf"],[3,"label","extra",4,"ngIf"],["col","1"],["nz-button","","type","button",3,"click"],["nz-button","","nzType","primary",3,"disabled"],[1,"modal-title"],["nzCustomContent","",3,"nzLabel","nzValue"],["type","password","nz-input","","name","password","required","",3,"ngModel","ngModelChange"],[3,"label","extra"],["type","password","nz-input","","name","password",3,"ngModel","ngModelChange"]],template:function(n,o){if(1&n&&(e.TgZ(0,"div",0),e.YNc(1,A,3,3,"div",1),e.YNc(2,F,3,3,"div",1),e.qZA(),e.TgZ(3,"form",2,3),e.NdJ("ngSubmit",function(){return o.save(o.form)}),e.TgZ(5,"se",4),e.ALo(6,"i18n"),e.TgZ(7,"input",5),e.NdJ("ngModelChange",function(r){return o.form.name=r}),e.qZA()(),e.TgZ(8,"se",4),e.ALo(9,"i18n"),e.TgZ(10,"input",6),e.NdJ("ngModelChange",function(r){return o.form.email=r}),e.qZA()(),e.TgZ(11,"se",4),e.ALo(12,"i18n"),e.TgZ(13,"nz-select",7),e.NdJ("ngModelChange",function(r){return o.form.role=r}),e.YNc(14,Q,2,3,"nz-option",8),e.qZA()(),e.YNc(15,I,3,4,"se",9),e.YNc(16,Y,4,7,"se",10),e.TgZ(17,"se",11)(18,"button",12),e.NdJ("click",function(){return o.close()}),e._uU(19),e.ALo(20,"i18n"),e.qZA(),e.TgZ(21,"button",13),e._uU(22),e.ALo(23,"i18n"),e.qZA()()()),2&n){const i=e.MAs(4);e.xp6(1),e.Q6J("ngIf",o.record.id),e.xp6(1),e.Q6J("ngIf",!o.record.id),e.xp6(3),e.Q6J("label",e.lcZ(6,14,"app.member.name")),e.xp6(2),e.Q6J("ngModel",o.form.name),e.xp6(1),e.Q6J("label",e.lcZ(9,16,"app.member.email")),e.xp6(2),e.Q6J("ngModel",o.form.email),e.xp6(1),e.Q6J("label",e.lcZ(12,18,"app.member.role")),e.xp6(2),e.Q6J("ngModel",o.form.role),e.xp6(1),e.Q6J("ngForOf",o.types),e.xp6(1),e.Q6J("ngIf",!o.record.id),e.xp6(1),e.Q6J("ngIf",o.record.id),e.xp6(3),e.Oqu(e.lcZ(20,20,"app.form.close")),e.xp6(2),e.Q6J("disabled",i.invalid),e.xp6(1),e.Oqu(e.lcZ(23,22,"app.form.save"))}},dependencies:[p.sg,p.O5,d._Y,d.Fj,d.JJ,d.JL,d.Q7,d.On,d.F,g.nV,g.d_,y.Lr,f.ix,b.w,M.dQ,J.Zp,C.Ip,C.Vq,a.Ck],encapsulation:2}),t})();var L=s(9959),N=s(1427),Z=s(3679),O=s(1971);const S=["st"];function w(t,m){if(1&t){const n=e.EpF();e.TgZ(0,"div",2)(1,"button",7),e.NdJ("click",function(){e.CHM(n);const i=e.oxw();return e.KtG(i.form())}),e._uU(2),e.ALo(3,"i18n"),e.qZA()()}2&t&&(e.xp6(2),e.Oqu(e.lcZ(3,1,"app.form.create")))}const R=function(){return{xs:6,sm:16,md:24,lg:32}};let v=(()=>{class t{constructor(n,o,i,r,c,G){this.http=n,this.msg=o,this.modal=i,this.cdr=r,this.settings=c,this.i18n=G,this.url="/api/members",this.loading=!0,this.list=[],this.q={page:1,pageSize:100,name:""},this.types=[],this.searchSchema={properties:{name:{type:"string",title:this.i18n.fanyi("app.member.name")}}},this.columns=[{title:this.i18n.fanyi("app.member.name"),index:"name"},{title:this.i18n.fanyi("app.member.email"),index:"email"},{title:this.i18n.fanyi("app.member.role"),index:"role"},{title:this.i18n.fanyi("app.member.created_at"),type:"date",index:"created_at"},{title:"",buttons:[{icon:"edit",click:l=>this.form(l),iif:l=>"admin"!==l.role&&this.isAdmin,iifBehavior:"disabled"},{icon:"usergroup-delete",click:l=>this.updateRole(l,"disabled"),iif:l=>"admin"!==l.role&&"disabled"!==l.role&&this.isAdmin,tooltip:`${this.i18n.fanyi("app.member.disable.help")}`}]}],this.isAdmin=!1}ngOnInit(){this.getTypes(),this.index(),this.user=this.settings.user,this.isAdmin="admin"===this.user.role}index(){this.loading=!0,this.http.get(this.url,this.q).subscribe(n=>{this.list=n.items,this.pagination=n.pagination,this.loading=!1,this.cdr.detectChanges()})}getTypes(){this.http.get(`${this.url}/types`).subscribe(n=>{this.types=n})}delete(n){this.http.delete(`${this.url}/${n.id}`).subscribe(o=>{o.code||this.msg.success(this.i18n.fanyi("app.delete.success")),this.index()})}updateRole(n,o){this.http.put(`${this.url}/${n.id}`,{role:o}).subscribe(i=>{i.code||this.msg.success(this.i18n.fanyi("app.update.success")),this.index()})}form(n={}){this.modal.create(x,{record:n,types:this.types},{size:"md"}).subscribe(o=>{this.index(),this.cdr.detectChanges()})}submit(n){this.q=n,this.index()}reset(){this.q.name="",this.index()}}return t.\u0275fac=function(n){return new(n||t)(e.Y36(a.lP),e.Y36(h.dD),e.Y36(a.Te),e.Y36(e.sBO),e.Y36(a.gb),e.Y36(a.Oi))},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-member-index"]],viewQuery:function(n,o){if(1&n&&e.Gf(S,5),2&n){let i;e.iGM(i=e.CRH())&&(o.st=i.first)}},decls:9,vars:6,consts:[[1,"pt-md"],["nz-row","",3,"nzGutter"],["nz-col",""],["mode","search",3,"schema","formSubmit","formReset"],["nz-col","",4,"ngIf"],[3,"data","columns"],["st",""],["nz-button","","nzType","primary",3,"click"]],template:function(n,o){1&n&&(e.TgZ(0,"div",0)(1,"nz-card")(2,"div",1)(3,"div",2)(4,"sf",3),e.NdJ("formSubmit",function(r){return o.submit(r)})("formReset",function(){return o.reset()}),e.qZA()(),e.YNc(5,w,4,3,"div",4),e.qZA()()(),e.TgZ(6,"nz-card"),e._UZ(7,"st",5,6),e.qZA()),2&n&&(e.xp6(2),e.Q6J("nzGutter",e.DdM(5,R)),e.xp6(2),e.Q6J("schema",o.searchSchema),e.xp6(1),e.Q6J("ngIf",o.isAdmin),e.xp6(2),e.Q6J("data",o.list)("columns",o.columns))},dependencies:[p.O5,L.kJ,N.A5,Z.t3,Z.SK,f.ix,b.w,M.dQ,O.bd,a.Ck],encapsulation:2}),t})();var z=s(9132);const $=[{path:"index",component:v}];let q=(()=>{class t{}return t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({imports:[z.Bz.forChild($),z.Bz]}),t})(),B=(()=>{class t{}return t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({imports:[T.m8,q]}),t})()}}]);