import{a as K,b as Q,g as X}from"./chunk-3R3JQT2U.js";import"./chunk-X5SCZGS7.js";import{a as S}from"./chunk-ITK25TXJ.js";import{a as H}from"./chunk-24UZAOXE.js";import{a as q}from"./chunk-5KQ2KAPG.js";import{a as Z}from"./chunk-OVHB4I7R.js";import{b as J,d as Y}from"./chunk-RJZDHW72.js";import"./chunk-LOQVCDFL.js";import{b as $}from"./chunk-62O6FFGL.js";import"./chunk-XYH3EOIT.js";import"./chunk-H4EID347.js";import"./chunk-5PXX4U2Z.js";import"./chunk-54I3UVFJ.js";import"./chunk-LDWSFHA3.js";import"./chunk-YINFBISR.js";import"./chunk-47SYTII4.js";import"./chunk-WSL3XVPI.js";import"./chunk-YO44C22F.js";import"./chunk-KOXD6BDO.js";import"./chunk-M5V46HC4.js";import{a as U}from"./chunk-NSTZ6K2D.js";import{Qa as j,Sa as k,Ta as G,ab as W}from"./chunk-JTDXTMDS.js";import{a as R,b as p}from"./chunk-NSGLSIBS.js";import"./chunk-6VC7H3CZ.js";import{ya as f}from"./chunk-QSMHDGIB.js";import{$c as O,Ab as h,Ac as o,Bc as m,Cc as I,Eb as z,Fb as g,Pc as N,Tb as E,Wc as v,Xc as C,Zb as T,cc as a,dc as r,ec as M,gd as P,ic as L,mb as s,oc as V,pc as B,rb as c,wa as D,xa as x,zc as w}from"./chunk-QMYHTLAJ.js";import"./chunk-FK6H3RFT.js";import"./chunk-53LFMTPK.js";import{d as F,n as ie}from"./chunk-HE7HQ6LI.js";import{a as A}from"./chunk-K4ALXBGI.js";ie();function oe(n,t){if(n&1&&(a(0,"div",0)(1,"div",1),o(2,"\u0418\u0418\u041D/\u0411\u0418\u041D"),r(),a(3,"div",2),o(4),r(),a(5,"div",1),o(6,"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F"),r(),a(7,"div",2),o(8),r(),a(9,"div",1),o(10,"\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446"),r(),a(11,"div",2),o(12),r(),a(13,"div",1),o(14,"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430"),r(),a(15,"div",2),o(16),v(17,"phoneFormat"),r(),a(18,"div",1),o(19,"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F"),r(),a(20,"div",2),o(21),r(),a(22,"div",1),o(23,"\u0410\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C"),r(),a(24,"div",2),o(25),r()()),n&2){let e=B();s(4),m(e.data.xin),s(4),m(e.data.name),s(4),m(e.data.owner),s(4),m(C(17,6,e.data.phone)),s(5),m(e.data.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442"),s(4),m(e.data.salesCount)}}var ee=(()=>{class n{constructor(e){this.data=e}static{this.\u0275fac=function(i){return new(i||n)(c(k))}}static{this.\u0275cmp=h({type:n,selectors:[["tis-organization-view"]],decls:1,vars:1,consts:[[1,"info-wrapper"],[1,"label"],[1,"info"]],template:function(i,u){i&1&&g(0,oe,26,8,"div",0),i&2&&T(u.data?0:-1)},dependencies:[f,S],styles:[".info-wrapper[_ngcontent-%COMP%]{display:grid;width:fit-content;align-items:center;grid-template-columns:repeat(2,minmax(180px,min-content));gap:var(--space-vertical-mnudge);margin-top:var(--space-vertical-l)}.label[_ngcontent-%COMP%]{grid-column:1/2;color:var(--color-font-secondary)}.info[_ngcontent-%COMP%]{grid-column:2/4;font:var(--font-body-1-strong)}"],changeDetection:0})}}return n})();var te=[{caption:"\u041D\u043E\u043C\u0435\u0440",dataField:"number",width:"67px",minWidth:67,isCustom:!0},{caption:"\u0418\u0418\u041D/\u0411\u0418\u041D",dataField:"xin",showDashIfEmpty:!0,minWidth:130},{caption:"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F",dataField:"name",width:"25%",minWidth:130},{caption:"\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446",dataField:"owner",minWidth:130},{caption:"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430",dataField:"phone",showDashIfEmpty:!0,width:"18%",minWidth:130,isCustom:!0},{caption:"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F",dataField:"hasLicense",calculateCellValue:n=>n.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442",width:"100px"},{caption:"\u0410\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C",dataField:"salesCount",minWidth:130}];var ae=(n,t)=>({phone:n,number:t});function re(n,t){if(n&1&&(o(0),v(1,"phoneFormat")),n&2){let e=t.$implicit;I(" ",C(1,1,e.phone),`
`)}}function ue(n,t){if(n&1&&o(0),n&2){let e=t.index;I(" ",e+1,`
`)}}var _=class y extends H{get criteria(){return{search:{xin:this.searchValue,name:this.searchValue,phone:this.searchValue}}}constructor(t,e,i,u,l,d){super(l,d),this._organizationService=t,this._serviceCenterService=e,this._dialogService=i,this._toastService=u,this.columns=te,this.menuItems=[{text:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C",action:b=>this.viewOrganization(b)},{text:"\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0426\u0422\u041E",action:b=>this.openAssignServicCenterDialog(b)}]}getLoadMethod(t){return this._organizationService.getAll(t)}viewOrganization(t){let e=this.drawerService.open(ee,{data:t,header:"\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438",submitButton:{stylingMode:"outlined",variant:"secondary",label:"\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0426\u0422\u041E",icon:U.PeopleCommunity}});e.submitted.pipe(p(e)).subscribe(()=>{this.openAssignServicCenterDialog(t),e.close()})}openAssignServicCenterDialog(t){if(t.serviceCenterId){this._serviceCenterService.getById(t.serviceCenterId).pipe(p(this)).subscribe(e=>{this._initAssignServiceCenterDialog(t,e)});return}this._initAssignServiceCenterDialog(t)}_initAssignServiceCenterDialog(t,e){let i=this._dialogService.open(K,A({data:{organization:t,currentServiceCenter:e??null}},X));i.canceled.pipe(p(i)).subscribe(()=>i.close()),i.submitted.pipe(p(i)).subscribe(u=>{if(u.invalid){u.markAllAsTouched();return}let l={client:t.id,serviceCenter:u.get("serviceCenterId")?.value};this._organizationService.assignServiceCenter(l).pipe(p(i)).subscribe(()=>{i.close(),this._toastService.add(Q),this.table?.refresh()})})}static{this.\u0275fac=function(e){return new(e||y)(c(Y),c(J),c(j),c(W),c(P),c(G))}}static{this.\u0275cmp=h({type:y,selectors:[["tis-organization-list"]],features:[z],decls:9,vars:16,consts:[["table",""],["phone",""],["number","","name",""],["title","\u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438",1,"header",3,"showBackButton"],["searchPlaceholder","\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u044E, \u043D\u043E\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443 \u0438\u043B\u0438 \u0418\u0418\u041D/\u0411\u0418\u041D",3,"rowDblClicked","changedSearch","allowColumnResizing","data","columns","menuItems","enableContextMenu","enablePagination","hoverable","pageNavigation","enableToolbar","enableFilters","enableSpinner","customTemplates"]],template:function(e,i){if(e&1){let u=L();M(0,"tis-subheader",3),a(1,"tis-main-layout")(2,"tis-table",4,0),V("rowDblClicked",function(d){return D(u),x(i.viewOrganization(d))})("changedSearch",function(d){return D(u),x(i.changedSearch(d))}),r()(),g(4,re,2,3,"ng-template",null,1,O)(6,ue,1,1,"ng-template",null,2,O)}if(e&2){let u=w(5),l=w(7);E("showBackButton",!1),s(2),E("allowColumnResizing",!0)("data",i.dataSource)("columns",i.columns)("menuItems",i.menuItems)("enableContextMenu",!0)("enablePagination",!0)("hoverable",!0)("pageNavigation",!0)("enableToolbar",!0)("enableFilters",!1)("enableSpinner",!0)("customTemplates",N(13,ae,u,l))}},dependencies:[f,q,Z,$,S],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:100%}.header[_ngcontent-%COMP%]{top:0;position:sticky;z-index:10}"],changeDetection:0})}};_=F([R()],_);var Me=[{path:"",component:_,pathMatch:"full"},{path:"**",redirectTo:""}];export{Me as routes};
