import{a as K,b as Q,g as X}from"./chunk-XMYYGOSU.js";import{a as S}from"./chunk-Z3NMDQQ2.js";import"./chunk-O3HEDNCE.js";import{a as H}from"./chunk-E42GBCBU.js";import{a as q}from"./chunk-T5HYEUJO.js";import{a as Z}from"./chunk-TGX7UERC.js";import{b as J,d as Y}from"./chunk-PBQKEH5G.js";import"./chunk-LOQVCDFL.js";import{b as $}from"./chunk-S3L2PNDT.js";import"./chunk-NNWHFHRC.js";import"./chunk-H4EID347.js";import"./chunk-5PXX4U2Z.js";import"./chunk-VACV2QME.js";import"./chunk-LDWSFHA3.js";import"./chunk-MX2TZFKO.js";import"./chunk-WSL3XVPI.js";import"./chunk-E65DJUZB.js";import"./chunk-KOXD6BDO.js";import"./chunk-BCBA7LYE.js";import{a as U}from"./chunk-TYWDRTVX.js";import{$a as W,Pa as j,Ra as k,Sa as G}from"./chunk-AWFGQCOU.js";import{a as R,b as p}from"./chunk-CKUQY5IU.js";import"./chunk-IQZCMWOL.js";import{ya as f}from"./chunk-UNUNR43V.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-AO7NUUXN.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};
