import{a as ie,b as ne,g as oe}from"./chunk-GTBN6ZKU.js";import"./chunk-GXAY6YYW.js";import{a as E}from"./chunk-ELNHEHXE.js";import{a as ee}from"./chunk-TUAL6EZO.js";import{a as X}from"./chunk-NLXRVFDY.js";import{a as K}from"./chunk-P7KQ7LX4.js";import{a as te,c as ae}from"./chunk-WUEJ7YXP.js";import"./chunk-UQ5SBR3X.js";import"./chunk-7SSPIKUV.js";import"./chunk-SMMIHGJB.js";import{a as Q}from"./chunk-EJEVRE4J.js";import"./chunk-SYE2YM6F.js";import"./chunk-E65EA4Y7.js";import"./chunk-5T6TZLDM.js";import"./chunk-SMAIR2YP.js";import"./chunk-JAY45DEO.js";import"./chunk-LINAD4CC.js";import"./chunk-ZBAZR7FK.js";import{f as H}from"./chunk-Y5ITWXM5.js";import{Ha as q,Ja as J,Ka as Y,Xa as $}from"./chunk-NNMVEAHQ.js";import{a as Z,b as p}from"./chunk-KXDO3JYP.js";import"./chunk-LUCOJAXQ.js";import"./chunk-HQUUBXQJ.js";import"./chunk-RTKDH4JU.js";import"./chunk-IFY4UZPR.js";import"./chunk-UU4K5RCK.js";import"./chunk-JBWPPKX4.js";import"./chunk-7N232KV6.js";import"./chunk-PDYJ5OYY.js";import"./chunk-NDLDFKR2.js";import{$c as v,Cb as g,Dc as o,Ec as d,Fc as I,Gb as M,Hb as z,Rc as k,Tc as G,Ue as C,Wb as L,Yb as R,ad as f,bc as x,cc as B,dc as V,ec as N,ed as y,fc as r,gc as u,k as T,kb as m,lc as P,nc as U,pc as j,sd as W,ta as b,ua as D,vb as c,yc as w}from"./chunk-PVUKHE45.js";import"./chunk-AKP2VPKK.js";import"./chunk-GVXHDKBW.js";import{d as F,n as se}from"./chunk-VD6R3735.js";import{a as O,j as A}from"./chunk-MZPAXKJS.js";se();function ce(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=j();m(4),d(t.data.xin),m(4),d(t.data.name),m(4),d(t.data.owner),m(4),d(f(17,6,t.data.phone)),m(5),d(t.data.hasLicense?"\u0414\u0430":"\u041D\u0435\u0442"),m(4),d(t.data.salesCount)}}var re=(()=>{let e=class e{constructor(i){this.data=i}};e.\u0275fac=function(a){return new(a||e)(c(J))},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&&L(0,ce,26,8,"div",0),a&2&&R(s.data?0:-1)},dependencies:[C,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 ue=[{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 le=()=>({filtering:!0,sorting:!0,paging:!0}),de=(n,e)=>({phone:n,number:e});function pe(n,e){if(n&1&&(o(0),v(1,"phoneFormat")),n&2){let t=e.$implicit;I(" ",f(1,1,t.phone),`
`)}}function he(n,e){if(n&1&&o(0),n&2){let t=e.index;I(" ",t+1,`
`)}}var l,S=(l=class extends ee{constructor(e,t,i,a,s,h){super(s,h),this._organizationService=e,this._serviceCenterService=t,this._dialogService=i,this._toastService=a,this.columns=ue,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(){return T({data:[],count:0})}onLoad(e){return A(this,null,function*(){return this.loadDataViewData(e,t=>this._organizationService.getAllDataView(t),{searchText:this.searchValue,defaultSort:{field:"id",desc:!0},defaultTake:10})})}viewOrganization(e){let t=this.drawerService.open(re,{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:H.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(ie,O({data:{organization:e,currentServiceCenter:t??null}},oe));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(ne),this.table?.refresh()})})}},l.\u0275fac=function(t){return new(t||l)(c(ae),c(te),c(q),c($),c(W),c(Y))},l.\u0275cmp=g({type:l,selectors:[["tis-organization-list"]],features:[M],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(t,i){if(t&1){let a=P();N(0,"tis-subheader",3),B(1,"tis-main-layout")(2,"tis-table",4,0),U("rowDblClicked",function(h){return b(a),D(i.viewOrganization(h))})("changedSearch",function(h){return b(a),D(i.changedSearch(h))}),V()(),z(4,pe,2,3,"ng-template",null,1,y)(6,he,1,1,"ng-template",null,2,y)}if(t&2){let a=w(5),s=w(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)("enableSearch",!0)("remoteOperations",k(15,le))("customTemplates",G(16,de,a,s))}},dependencies:[C,X,K,Q,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=F([Z()],S);var je=[{path:"",component:S,pathMatch:"full"},{path:"**",redirectTo:""}];export{je as routes};
//# sourceMappingURL=organizations.routes-RLERWRHR.js.map
