(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{AVcX:function(e,t,i){"use strict";i.r(t),i.d(t,"BasicModule",function(){return R});var r=i("PCNd"),n=i("tyNb"),o=i("mrSG"),c=i("R0Ic"),s=i("0EQZ"),a=i("FvrZ"),l=i("0IaG"),d=i("8yBR"),h=i("fXoL"),u=i("bUwk"),p=i("Xi3o"),f=i("Olgc"),b=i("ofXK"),v=i("bTqV"),m=i("Xa2L"),g=i("bSwM"),_=i("NFeN"),w=i("sYmb");function S(e,t){1&e&&(h.Ub(0,"div",7),h.Pb(1,"mat-spinner"),h.Tb())}function O(e,t){if(1&e){const e=h.Vb();h.Ub(0,"mat-tree-node"),h.Pb(1,"button",11),h.Ub(2,"mat-checkbox",12),h.bc("change",function(){h.wc(e);const i=t.$implicit;return h.fc(2).toggle(i)}),h.Hc(3),h.gc(4,"translate"),h.Tb(),h.Tb()}if(2&e){const e=t.$implicit,i=h.fc(2);h.Cb(2),h.lc("checked",i.selection.isSelected(e.data.id)),h.Cb(1),h.Ic(h.hc(4,2,e.data.header))}}function C(e,t){if(1&e){const e=h.Vb();h.Ub(0,"mat-nested-tree-node"),h.Ub(1,"div"),h.Ub(2,"button",13),h.Ub(3,"mat-icon"),h.Hc(4),h.Tb(),h.Tb(),h.Ub(5,"mat-checkbox",14),h.bc("change",function(){h.wc(e);const i=t.$implicit;return h.fc(2).toggle(i)}),h.Hc(6),h.gc(7,"translate"),h.Tb(),h.Tb(),h.Ub(8,"div",15),h.Qb(9,16),h.Tb(),h.Tb()}if(2&e){const e=t.$implicit,i=h.fc(2);h.Cb(4),h.Ic(i.ctrl.isExpanded(e)?"expand_more":"chevron_right"),h.Cb(1),h.lc("checked",i.selected(e,!1))("indeterminate",i.selected(e,!0)),h.Cb(1),h.Ic(h.hc(7,5,e.data.header)),h.Cb(2),h.lc("@expand",i.ctrl.isExpanded(e)?"expanded":"collapsed")}}function y(e,t){if(1&e&&(h.Ub(0,"mat-tree",8),h.Fc(1,O,5,4,"mat-tree-node",9),h.Fc(2,C,10,7,"mat-nested-tree-node",10),h.Tb()),2&e){const e=h.fc();h.lc("dataSource",e.tree)("treeControl",e.ctrl),h.Cb(2),h.lc("matTreeNodeDefWhen",e.expandable)}}let T=(()=>{class e{constructor(e,t,i,r,n){this._id=e,this._httpService=t,this._i18nService=i,this._toastService=r,this._dialogRef=n,this._loading=!0,this.expandable=(e,t)=>{var i;return null===(i=t.children)||void 0===i?void 0:i.length},this.selected=(e,t)=>{if(this._tree.data){const i=this._ctrl.getDescendants(e);let r=i.some(e=>this._selection.isSelected(e.data.id));return t&&r&&(r=!i.every(e=>this._selection.isSelected(e.data.id))),r}},this.toggle=e=>{this._selection.toggle(e.data.id);const t=this._ctrl.getDescendants(e);t.length&&(this._selection.isSelected(e.data.id)?this._selection.select(...t.map(e=>e.data.id)):this._selection.deselect(...t.map(e=>e.data.id)));let i=e.parent;for(;i;)this._selection.isSelected(i.data.id)?this.selected(i,!1)||this._selection.deselect(i.data.id):this.selected(i,!1)&&this._selection.select(i.data.id),i=i.parent},this.save=()=>Object(o.a)(this,void 0,void 0,function*(){void 0!==this._httpService.post(`roles/${this._id}/menu`,this._selection.selected).catch(e=>Object(o.a)(this,void 0,void 0,function*(){var t,i;switch(e.status){case 410:this._toastService.show(this._i18nService.translate("routes.basic.role.error.gone."+(null===(i=null===(t=e.error)||void 0===t?void 0:t.propertyName)||void 0===i?void 0:i.toLowerCase()))),this._dialogRef.close({success:!1});break;case 422:this._toastService.show(this._i18nService.translate("shared.notification.fail")),this._dialogRef.close({success:!1});break;default:this._dialogRef.close({success:!1})}}))&&(this._toastService.show(this._i18nService.translate("shared.notification.success")),this._dialogRef.close({success:!0}))}),this._ctrl=new a.j(e=>e.children),this._tree=new d.d,this._selection=new s.c(!0),this._httpService.get(`roles/${this._id}/menu`).then(e=>{var t,i;if(null===(t=e.menu.children)||void 0===t?void 0:t.length){const t=[...e.menu.children];for(;t.length;){const e=t.pop();(null===(i=e.children)||void 0===i?void 0:i.length)&&(e.children.forEach(t=>t.parent=e),t.push(...e.children))}}this._selection.select(...e.permission),this._tree.data=e.menu.children;for(let r of this._tree.data)this._ctrl.expandDescendants(r);this._loading=!1})}get loading(){return this._loading}get ctrl(){return this._ctrl}get tree(){return this._tree}get selection(){return this._selection}}return e.\u0275fac=function(t){return new(t||e)(h.Ob(l.a),h.Ob(u.a),h.Ob(p.a),h.Ob(f.a),h.Ob(l.g))},e.\u0275cmp=h.Ib({type:e,selectors:[["app-basic-role-menu"]],decls:16,vars:15,consts:[["mat-dialog-title",""],["mat-dialog-content",""],["class","loading",4,"ngIf","ngIfElse"],["$tree",""],["mat-dialog-actions","","align","end"],["mat-button","","color","primary",3,"click"],["mat-button","","mat-dialog-close","","cdkFocusInitial",""],[1,"loading"],[3,"dataSource","treeControl"],[4,"matTreeNodeDef"],[4,"matTreeNodeDef","matTreeNodeDefWhen"],["mat-icon-button","","disabled",""],[3,"checked","change"],["mat-icon-button","","matTreeNodeToggle",""],[3,"checked","indeterminate","change"],[1,"mat-nested-tree-node-children"],["matTreeNodeOutlet",""]],template:function(e,t){if(1&e&&(h.Ub(0,"h2",0),h.Hc(1),h.gc(2,"translate"),h.Tb(),h.Ub(3,"div",1),h.Fc(4,S,2,0,"div",2),h.Fc(5,y,3,3,"ng-template",null,3,h.Gc),h.Tb(),h.Ub(7,"div",4),h.Ub(8,"button",5),h.bc("click",function(){return t.save()}),h.Hc(9),h.gc(10,"uppercase"),h.gc(11,"translate"),h.Tb(),h.Ub(12,"button",6),h.Hc(13),h.gc(14,"uppercase"),h.gc(15,"translate"),h.Tb(),h.Tb()),2&e){const e=h.uc(6);h.Cb(1),h.Ic(h.hc(2,5,"routes.basic.role.menu")),h.Cb(3),h.lc("ngIf",t.loading)("ngIfElse",e),h.Cb(5),h.Ic(h.hc(10,7,h.hc(11,9,"shared.dialog.ok"))),h.Cb(4),h.Ic(h.hc(14,11,h.hc(15,13,"shared.dialog.cancel")))}},directives:[l.h,l.e,b.n,l.c,v.a,l.d,m.b,d.b,d.f,d.e,g.b,d.a,d.h,_.a,d.g],pipes:[w.d,b.v],styles:[".loading[_ngcontent-%COMP%]{display:flex;padding:50px 0;justify-content:center}.mat-nested-tree-node-children[_ngcontent-%COMP%]{padding-left:24px;overflow:hidden}.mat-dialog-content[_ngcontent-%COMP%]{padding:0 16px}.mat-dialog-actions[_ngcontent-%COMP%]{margin-right:-8px}"],data:{animation:[Object(c.m)("expand",[Object(c.j)("collapsed",Object(c.k)({height:"0"})),Object(c.j)("expanded",Object(c.k)({height:"*"})),Object(c.l)("collapsed <=> expanded",Object(c.e)("200ms cubic-bezier(.4, 0, .2, 1)"))])]}}),e})();var x=i("S+vS"),k=i("TmDA"),U=i("Qu3c");const j=["$crud"];function I(e,t){if(1&e){const e=h.Vb();h.Ub(0,"button",3),h.bc("click",function(){h.wc(e);const i=t.$implicit;return h.fc().menu(i.id)}),h.gc(1,"translate"),h.Ub(2,"mat-icon"),h.Hc(3,"menu"),h.Tb(),h.Tb()}2&e&&h.mc("matTooltip",h.hc(1,1,"routes.basic.role.menu"))}let $=(()=>{class e{constructor(e,t,i){this._dialogService=e,this._i18nService=t,this._toastService=i,this.error=e=>{var t,i,r,n;switch(e.status){case 409:return this._toastService.show(this._i18nService.translate("routes.basic.role.error.conflict."+(null===(i=null===(t=e.error)||void 0===t?void 0:t.propertyName)||void 0===i?void 0:i.toLowerCase()))),!1;case 410:return this._toastService.show(this._i18nService.translate("routes.basic.role.error.gone."+(null===(n=null===(r=e.error)||void 0===r?void 0:r.propertyName)||void 0===n?void 0:n.toLowerCase()))),!0;case 422:return this._toastService.show(this._i18nService.translate("shared.notification.fail")),!0;default:return!0}},this.menu=e=>Object(o.a)(this,void 0,void 0,function*(){var t=yield this._dialogService.open(T,{data:e});t&&!t.success&&this._template.refresh()})}ngAfterViewInit(){setTimeout(()=>{this._defination=[{id:"name",header:"routes.basic.role.name",filter:{field:"text"},editor:{field:"text",required:!0}},{id:"remark",header:"routes.basic.role.remark",editor:{field:"text"}}]})}get defination(){return this._defination}}return e.\u0275fac=function(t){return new(t||e)(h.Ob(x.a),h.Ob(p.a),h.Ob(f.a))},e.\u0275cmp=h.Ib({type:e,selectors:[["app-basic-role"]],viewQuery:function(e,t){if(1&e&&h.Oc(j,!0),2&e){let e;h.tc(e=h.cc())&&(t._template=e.first)}},decls:4,vars:4,consts:[[3,"defination","api","row-operation-template","error"],["$crud",""],["$menu",""],["mat-icon-button","",3,"matTooltip","click"]],template:function(e,t){if(1&e&&(h.Ub(0,"crud-template",0,1),h.Fc(2,I,4,3,"ng-template",null,2,h.Gc),h.Tb()),2&e){const e=h.uc(3);h.lc("defination",t.defination)("api","roles")("row-operation-template",e)("error",t.error)}},directives:[k.a,v.a,U.c,_.a],pipes:[w.d],styles:[""]}),e})();var N=i("FFMq"),M=i("hZOD");const P=["$crud"],F=["$role"];function L(e,t){1&e&&(h.Hc(0),h.gc(1,"join"),h.gc(2,"field")),2&e&&h.Ic(h.hc(1,1,h.ic(2,3,t.$implicit.role,"name")))}function q(e,t){if(1&e){const e=h.Vb();h.Ub(0,"button",4),h.bc("click",function(){h.wc(e);const i=t.$implicit;return h.fc().password(i.id)}),h.gc(1,"translate"),h.Ub(2,"mat-icon"),h.Hc(3,"lock_open"),h.Tb(),h.Tb()}2&e&&h.mc("matTooltip",h.hc(1,1,"routes.basic.user.password"))}const D=[{path:"role",component:$},{path:"user",component:(()=>{class e{constructor(e,t,i,r){this._dialogService=e,this._httpService=t,this._i18nService=i,this._toastService=r,this.error=e=>{var t,i,r,n;switch(e.status){case 409:return this._toastService.show(this._i18nService.translate("routes.basic.user.error.conflict."+(null===(i=null===(t=e.error)||void 0===t?void 0:t.propertyName)||void 0===i?void 0:i.toLowerCase()))),!1;case 410:return this._toastService.show(this._i18nService.translate("routes.basic.user.error.gone."+(null===(n=null===(r=e.error)||void 0===r?void 0:r.propertyName)||void 0===n?void 0:n.toLowerCase()))),!0;case 422:return this._toastService.show(this._i18nService.translate("shared.notification.fail")),!0;default:return!0}},this.password=e=>Object(o.a)(this,void 0,void 0,function*(){(yield this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm")))&&void 0!==this._httpService.delete(`users/${e}/password`).catch(e=>Object(o.a)(this,void 0,void 0,function*(){var t,i;switch(e.status){case 410:this._toastService.show(this._i18nService.translate("routes.basic.user.error.gone."+(null===(i=null===(t=e.error)||void 0===t?void 0:t.propertyName)||void 0===i?void 0:i.toLowerCase()))),this._template.refresh();break;case 422:this._toastService.show(this._i18nService.translate("shared.notification.fail"))}}))&&this._toastService.show(this._i18nService.translate("shared.notification.success"))})}ngAfterViewInit(){return Object(o.a)(this,void 0,void 0,function*(){const e=yield this._httpService.get("roles");this._defination=[{id:"name",header:"routes.basic.user.name",filter:{field:"text"},editor:{field:"text",required:!0}},{id:"account",header:"routes.basic.user.account",filter:{field:"text"},editor:{field:"text",required:!0}},{id:"role",header:"routes.basic.user.role",template:this._role,sortable:!1,filter:{field:"select",range:e.items},editor:{field:"multi-select",range:e.items,convertor:e=>e.map(e=>e.id)}}]})}get defination(){return this._defination}}return e.\u0275fac=function(t){return new(t||e)(h.Ob(x.a),h.Ob(u.a),h.Ob(p.a),h.Ob(f.a))},e.\u0275cmp=h.Ib({type:e,selectors:[["app-basic-user"]],viewQuery:function(e,t){if(1&e&&(h.Oc(P,!0),h.Oc(F,!0)),2&e){let e;h.tc(e=h.cc())&&(t._template=e.first),h.tc(e=h.cc())&&(t._role=e.first)}},decls:6,vars:4,consts:[[3,"defination","api","row-operation-template","error"],["$crud",""],["$role",""],["$password",""],["mat-icon-button","",3,"matTooltip","click"]],template:function(e,t){if(1&e&&(h.Ub(0,"crud-template",0,1),h.Fc(2,L,3,6,"ng-template",null,2,h.Gc),h.Fc(4,q,4,3,"ng-template",null,3,h.Gc),h.Tb()),2&e){const e=h.uc(5);h.lc("defination",t.defination)("api","users")("row-operation-template",e)("error",t.error)}},directives:[k.a,v.a,U.c,_.a],pipes:[N.a,M.a,w.d],styles:[""]}),e})()},{path:"item",component:(()=>{class e{constructor(e,t,i,r){this._dialogService=e,this._httpService=t,this._i18nService=i,this._toastService=r,this._pkColumn="itemlistcode",this._dfs=e=>{var t;const i=[];if(null==e?void 0:e.length){const r=[...e.reverse()];for(;r.length;){const e=r.pop();i.push(e),(null===(t=e.children)||void 0===t?void 0:t.length)&&r.push(...e.children.reverse())}}return i},this.error=e=>{var t,i,r,n;switch(e.status){case 409:return this._toastService.show(this._i18nService.translate("routes.basic.item.error.conflict."+(null===(i=null===(t=e.error)||void 0===t?void 0:t.propertyName)||void 0===i?void 0:i.toLowerCase()))),!1;case 410:return this._toastService.show(this._i18nService.translate("routes.basic.item.error.gone."+(null===(n=null===(r=e.error)||void 0===r?void 0:r.propertyName)||void 0===n?void 0:n.toLowerCase()))),!0;case 422:return this._toastService.show(this._i18nService.translate("shared.notification.fail")),!1;default:return!0}}}ngAfterViewInit(){return Object(o.a)(this,void 0,void 0,function*(){this._defination=[{id:"code",header:"routes.basic.item.code",editor:{field:"text",required:!0},filter:{field:"text"}},{id:"name",header:"routes.basic.item.name",editor:{field:"text",required:!0},filter:{field:"text"}}],this._api="items"})}get defination(){return this._defination}get api(){return this._api}get pkColumn(){return this._pkColumn}}return e.\u0275fac=function(t){return new(t||e)(h.Ob(x.a),h.Ob(u.a),h.Ob(p.a),h.Ob(f.a))},e.\u0275cmp=h.Ib({type:e,selectors:[["app-item"]],decls:2,vars:4,consts:[[3,"defination","error","api","query"],["$crud",""]],template:function(e,t){1&e&&h.Pb(0,"crud-template",0,1),2&e&&h.lc("defination",t.defination)("error",t.error)("api",t.api)("query","name=qualityState")},directives:[k.a],styles:[".indent[_ngcontent-%COMP%]{padding-left:16px}.tooltip-ul[_ngcontent-%COMP%]{margin-top:-8px;margin-bottom:0;padding-left:0;list-style-type:disc;list-style-position:inside}.tooltip-ul[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#fff}.mat-dialog-content[_ngcontent-%COMP%] .mat-progress-bar[_ngcontent-%COMP%] + p[_ngcontent-%COMP%]{margin-top:12px}.mat-dialog-actions[_ngcontent-%COMP%]{margin-right:-8px}"]}),e})()}];let H=(()=>{class e{}return e.\u0275mod=h.Mb({type:e}),e.\u0275inj=h.Lb({factory:function(t){return new(t||e)},imports:[[n.h.forChild(D)],n.h]}),e})();var V=i("95ze");let R=(()=>{class e{}return e.\u0275mod=h.Mb({type:e}),e.\u0275inj=h.Lb({factory:function(t){return new(t||e)},imports:[[r.a,H,V.a]]}),e})()}}]);