import{a as X,b as ee,g as te}from"./chunk-CXIO4J57.js";import{a as E}from"./chunk-IPWSZFYD.js";import{a as K}from"./chunk-SDQAGZQK.js";import{a as $}from"./chunk-AMAS4Z3P.js";import{a as Y}from"./chunk-RDILTRSG.js";import{b as Q,d as ie}from"./chunk-42Q3G32I.js";import"./chunk-7SSPIKUV.js";import{a as H}from"./chunk-6X6346LN.js";import"./chunk-TL6VKVO7.js";import"./chunk-VFX53AYF.js";import"./chunk-TJ76EKZB.js";import"./chunk-JAY45DEO.js";import"./chunk-LINAD4CC.js";import"./chunk-GVW75DLG.js";import{f as J}from"./chunk-XSARCGYY.js";import{Ka as G,Ma as W,Na as Z,Ya as q}from"./chunk-HE5QLLAI.js";import"./chunk-2MCAID7M.js";import{a as k,b as p}from"./chunk-2RGQU2W2.js";import"./chunk-FWAWZDGH.js";import"./chunk-WUNNKW5D.js";import"./chunk-IFY4UZPR.js";import"./chunk-SRKRR7GV.js";import"./chunk-C2ZF4U5U.js";import"./chunk-PDYJ5OYY.js";import"./chunk-AEEDSABA.js";import"./chunk-JLM6CY35.js";import{ua as f}from"./chunk-KCGGIUK4.js";import{Cb as g,Dc as I,Gb as F,Hb as M,Ic as o,Jc as d,Kc as w,Xb as T,Yc as U,Zb as z,cc as x,dc as L,ec as R,ed as v,fc as B,fd as C,gc as r,hc as u,jd as y,kb as m,mc as V,sc as N,ta as b,ua as D,uc as P,vb as c,yd as j}from"./chunk-4HRPSKID.js";import"./chunk-AKP2VPKK.js";import"./chunk-ML3VIXIY.js";import{d as A,n as ae}from"./chunk-INB5GR2I.js";import{a as O}from"./chunk-B7YGBANW.js";ae();function ue(n,e){if(n&1&&(r(0,"div",0)(1,"div",1),o(2,"\u0418\u0418\u041D/\u0411\u0418\u041D"),u(),r(3,"div",2),o(4),u(),r(5,"div",1),o(6,"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F"),u(),r(7,"div",2),o(8),u(),r(9,"div",1),o(10,"\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446"),u(),r(11,"div",2),o(12),u(),r(13,"div",1),o(14,"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430"),u(),r(15,"div",2),o(16),v(17,"phoneFormat"),u(),r(18,"div",1),o(19,"\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F"),u(),r(20,"div",2),o(21),u(),r(22,"div",1),o(23,"\u0410\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C"),u(),r(24,"div",2),o(25),u()()),n&2){let t=P();m(4),d(t.data.xin),m(4),d(t.data.name),m(4),d(t.data.owner),m(4),d(C(17,6,t.data.phone)),m(5),d(t.data.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442"),m(4),d(t.data.salesCount)}}var ne=(()=>{let e=class e{constructor(i){this.data=i}};e.\u0275fac=function(a){return new(a||e)(c(W))},e.\u0275cmp=g({type:e,selectors:[["tis-organization-view"]],decls:1,vars:1,consts:[[1,"info-wrapper"],[1,"label"],[1,"info"]],template:function(a,s){a&1&&T(0,ue,26,8,"div",0),a&2&&z(s.data?0:-1)},dependencies:[f,E],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)}
/*# sourceMappingURL=organization-view.component-SJ364RY4.css.map */`],changeDetection:0});let n=e;return n})();var oe=[{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 se=(n,e)=>({phone:n,number:e});function me(n,e){if(n&1&&(o(0),v(1,"phoneFormat")),n&2){let t=e.$implicit;w(" ",C(1,1,t.phone),`
`)}}function ce(n,e){if(n&1&&o(0),n&2){let t=e.index;w(" ",t+1,`
`)}}var l,S=(l=class extends K{get criteria(){return{search:{xin:this.searchValue,name:this.searchValue,phone:this.searchValue}}}constructor(e,t,i,a,s,h){super(s,h),this._organizationService=e,this._serviceCenterService=t,this._dialogService=i,this._toastService=a,this.columns=oe,this.menuItems=[{text:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C",action:_=>this.viewOrganization(_)},{text:"\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u0426\u0422\u041E",action:_=>this.openAssignServicCenterDialog(_)}]}getLoadMethod(e){return this._organizationService.getAll(e)}viewOrganization(e){let t=this.drawerService.open(ne,{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:J.PeopleCommunity}});t.submitted.pipe(p(t)).subscribe(()=>{this.openAssignServicCenterDialog(e),t.close()})}openAssignServicCenterDialog(e){if(e.serviceCenterId){this._serviceCenterService.getById(e.serviceCenterId).pipe(p(this)).subscribe(t=>{this._initAssignServiceCenterDialog(e,t)});return}this._initAssignServiceCenterDialog(e)}_initAssignServiceCenterDialog(e,t){let i=this._dialogService.open(X,O({data:{organization:e,currentServiceCenter:t??null}},te));i.canceled.pipe(p(i)).subscribe(()=>i.close()),i.submitted.pipe(p(i)).subscribe(a=>{if(a.invalid){a.markAllAsTouched();return}let s={client:e.id,serviceCenter:a.get("serviceCenterId")?.value};this._organizationService.assignServiceCenter(s).pipe(p(i)).subscribe(()=>{i.close(),this._toastService.add(ee),this.table?.refresh()})})}},l.\u0275fac=function(t){return new(t||l)(c(ie),c(Q),c(G),c(q),c(j),c(Z))},l.\u0275cmp=g({type:l,selectors:[["tis-organization-list"]],features:[F],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(t,i){if(t&1){let a=V();B(0,"tis-subheader",3),L(1,"tis-main-layout")(2,"tis-table",4,0),N("rowDblClicked",function(h){return b(a),D(i.viewOrganization(h))})("changedSearch",function(h){return b(a),D(i.changedSearch(h))}),R()(),M(4,me,2,3,"ng-template",null,1,y)(6,ce,1,1,"ng-template",null,2,y)}if(t&2){let a=I(5),s=I(7);x("showBackButton",!1),m(2),x("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",U(13,se,a,s))}},dependencies:[f,$,Y,H,E],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}),l);S=A([k()],S);var Be=[{path:"",component:S,pathMatch:"full"},{path:"**",redirectTo:""}];export{Be as routes};
//# sourceMappingURL=organizations.routes-EDGATGPT.js.map
