import{a as K,b as Q,g as X}from"./chunk-SLY7WPMG.js";import{a as S}from"./chunk-C4RDYGCN.js";import"./chunk-PNGCCGNF.js";import{a as H}from"./chunk-WX6WNZ4M.js";import{a as q}from"./chunk-Q3SFMCJW.js";import{b as J,d as Y}from"./chunk-C75OUXE7.js";import{b as W,c as U}from"./chunk-WMWTQN62.js";import{c as $}from"./chunk-LVPRCERD.js";import"./chunk-LOQVCDFL.js";import"./chunk-JUPL4ISO.js";import"./chunk-KAXLY5F7.js";import{d as G}from"./chunk-2MX6A4WK.js";import"./chunk-4WSBNV33.js";import{a as k}from"./chunk-PVSWDINP.js";import{a as Z}from"./chunk-WGY6JGJR.js";import"./chunk-OJKN3TNK.js";import{b as j}from"./chunk-QF5VF47J.js";import{a as R,b as p}from"./chunk-LJIIRAVZ.js";import"./chunk-ZJ6PV7CL.js";import"./chunk-NHAEOK7K.js";import"./chunk-KOXD6BDO.js";import{q as f}from"./chunk-OIJW4GMG.js";import{$b as a,$c as P,Bb as z,Cb as g,Jc as N,Qb as E,Rc as v,Sc as C,Wb as T,Wc as O,ac as r,bc as M,fc as L,jb as s,jc as V,kc as B,ob as c,uc as w,va as D,vc as o,wa as x,wc as m,xb as h,xc as I}from"./chunk-3FIHWXA5.js";import{b as F,i as ie}from"./chunk-QOJKCMZT.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(W))}}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:j.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(G),c(k),c(P),c(U))}}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 Ve=[{path:"",component:_,pathMatch:"full"},{path:"**",redirectTo:""}];export{Ve as routes};
