import{a as J,b as K,g as Q}from"./chunk-ADZGUKFZ.js";import{a as f}from"./chunk-MLGLFM7E.js";import{a as H,c as Y}from"./chunk-HZ34NCLP.js";import"./chunk-V4WESMSJ.js";import{b as $}from"./chunk-AJTKPNL2.js";import{a as X}from"./chunk-F5MI6XGL.js";import"./chunk-K3PQIV7F.js";import"./chunk-SMMIHGJB.js";import{d as q}from"./chunk-7PKMSCVL.js";import"./chunk-WL2OYEJL.js";import{a as Z}from"./chunk-RVEFR64E.js";import"./chunk-7SSPIKUV.js";import"./chunk-S332DHRQ.js";import"./chunk-KGCVL6CP.js";import"./chunk-JSG72ZNQ.js";import"./chunk-JAY45DEO.js";import"./chunk-LINAD4CC.js";import"./chunk-UBQPCB4A.js";import"./chunk-RTVR37QC.js";import"./chunk-ZATDFETU.js";import{Ma as G}from"./chunk-QHAVDXDG.js";import{_ as V,aa as U,ba as j,na as W}from"./chunk-27KSTDMK.js";import"./chunk-RTL4XZI4.js";import"./chunk-QGNMEQRN.js";import"./chunk-F4GTCTBH.js";import"./chunk-WXQVX7WD.js";import"./chunk-OWZ5YAMH.js";import"./chunk-KXX3UDJ3.js";import"./chunk-PDYJ5OYY.js";import{z as v}from"./chunk-GQAU5ACB.js";import{Bb as m,Ec as D,Ib as p,Jc as n,Kc as l,Lc as b,Mb as y,Nb as F,S as E,Xc as N,Zc as P,ac as A,cc as T,ea as S,fd as h,gd as g,hc as _,ic as z,jc as M,kc as L,kd as x,lc as a,mc as r,r as O,sb as c,tc as R,vc as B,yd as k}from"./chunk-ISMRT7VU.js";import"./chunk-GMHSUEGX.js";import{a as I,h as w}from"./chunk-M5TX2NVG.js";function ae(t,d){if(t&1&&(a(0,"div",0)(1,"div",1),n(2,"\u0418\u0418\u041D/\u0411\u0418\u041D"),r(),a(3,"div",2),n(4),r(),a(5,"div",1),n(6,"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F"),r(),a(7,"div",2),n(8),r(),a(9,"div",1),n(10,"\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446"),r(),a(11,"div",2),n(12),r(),a(13,"div",1),n(14,"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430"),r(),a(15,"div",2),n(16),h(17,"phoneFormat"),r(),a(18,"div",1),n(19,"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F"),r(),a(20,"div",2),n(21),r(),a(22,"div",1),n(23,"\u0410\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C"),r(),a(24,"div",2),n(25),r()()),t&2){let e=B();c(4),l(e.data.xin),c(4),l(e.data.name),c(4),l(e.data.owner),c(4),l(g(17,6,e.data.phone)),c(5),l(e.data.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442"),c(4),l(e.data.salesCount)}}var ee=(()=>{class t{constructor(e){this.data=e}static{this.\u0275fac=function(i){return new(i||t)(m(U))}}static{this.\u0275cmp=p({type:t,selectors:[["tis-organization-view"]],decls:1,vars:1,consts:[[1,"info-wrapper"],[1,"label"],[1,"info"]],template:function(i,o){i&1&&A(0,ae,26,8,"div",0),i&2&&T(o.data?0:-1)},dependencies:[f],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-10);margin-top:var(--space-vertical-16)}.label[_ngcontent-%COMP%]{grid-column:1/2;color:var(--color-font-secondary)}.info[_ngcontent-%COMP%]{grid-column:2/4;font:var(--font-14-medium)}
/*# sourceMappingURL=organization-view.component-TOZDFX5W.css.map */`],changeDetection:0})}}return t})();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:t=>t.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442",width:"100px"},{caption:"\u0410\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C",dataField:"salesCount",minWidth:130}];var re=()=>({filtering:!0,sorting:!0,paging:!0}),ue=(t,d)=>({phone:t,number:d});function se(t,d){if(t&1&&(n(0),h(1,"phoneFormat")),t&2){let e=d.$implicit;b(" ",g(1,1,e.phone),`
`)}}function ce(t,d){if(t&1&&n(0),t&2){let e=d.index;b(" ",e+1,`
`)}}var ie=(()=>{class t extends ${constructor(e,i,o,u,s,ne){super(s,ne),this._organizationService=e,this._serviceCenterService=i,this._dialogService=o,this._toastService=u,this.columns=te,this.menuItems=[{text:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C",action:C=>this.viewOrganization(C)},{text:"\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0426\u0422\u041E",action:C=>this.openAssignServicCenterDialog(C)}]}getLoadMethod(){return O({data:[],count:0})}onLoad(e){return w(this,null,function*(){return this.loadDataViewData(e,i=>this._organizationService.getAllDataView(i),{searchText:this.searchValue,defaultSort:{field:"id",desc:!0},defaultTake:10})})}viewOrganization(e){let i=this.drawerService.open(ee,{data:e,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:G.PeopleCommunity}});i.submitted.pipe(S(i.closed),v(this.destroyRef)).subscribe(()=>{this.openAssignServicCenterDialog(e),i.close()})}openAssignServicCenterDialog(e){if(e.serviceCenterId){this._serviceCenterService.getById(e.serviceCenterId).pipe(v(this.destroyRef)).subscribe(i=>{this._initAssignServiceCenterDialog(e,i)});return}this._initAssignServiceCenterDialog(e)}_initAssignServiceCenterDialog(e,i){let o=this._dialogService.open(J,I({data:{organization:e,currentServiceCenter:i??null}},Q));o.canceled.pipe(E(1)).subscribe(()=>o.close()),o.submitted.pipe(S(o.closed),v(this.destroyRef)).subscribe(u=>{if(u.invalid){u.markAllAsTouched();return}let s={client:e.id,serviceCenter:u.get("serviceCenterId")?.value};this._organizationService.assignServiceCenter(s).pipe(E(1)).subscribe(()=>{o.close(),this._toastService.add(K),this.table?.refresh()})})}static{this.\u0275fac=function(i){return new(i||t)(m(Y),m(H),m(V),m(W),m(k),m(j))}}static{this.\u0275cmp=p({type:t,selectors:[["tis-organization-list"]],features:[y],decls:9,vars:19,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","enableSearch","remoteOperations","customTemplates"]],template:function(i,o){if(i&1&&(L(0,"tis-subheader",3),z(1,"tis-main-layout")(2,"tis-table",4,0),R("rowDblClicked",function(s){return o.viewOrganization(s)})("changedSearch",function(s){return o.changedSearch(s)}),M()(),F(4,se,2,3,"ng-template",null,1,x)(6,ce,1,1,"ng-template",null,2,x)),i&2){let u=D(5),s=D(7);_("showBackButton",!1),c(2),_("allowColumnResizing",!0)("data",o.dataSource)("columns",o.columns)("menuItems",o.menuItems)("enableContextMenu",!0)("enablePagination",!0)("hoverable",!0)("pageNavigation",!0)("enableToolbar",!0)("enableFilters",!1)("enableSpinner",!0)("enableSearch",!0)("remoteOperations",N(15,re))("customTemplates",P(16,ue,u,s))}},dependencies:[X,Z,q,f],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:100%}.header[_ngcontent-%COMP%]{top:0;position:sticky;z-index:10}
/*# sourceMappingURL=organization-list.component-UEEIUU4E.css.map */`],changeDetection:0})}}return t})();var Me=[{path:"",component:ie,pathMatch:"full"},{path:"**",redirectTo:""}];export{Me as routes};
//# sourceMappingURL=organizations.routes-TKZJKI5B.js.map
