import{e as C}from"./chunk-BTNSHOI7.js";import{e as I}from"./chunk-L2U5MHO4.js";import{La as w,a as _}from"./chunk-6PWFR42O.js";import{a as v,b as s}from"./chunk-IGFM5CCE.js";import{Ac as S,Bc as g,Ca as f,Db as m,I as d,K as b,g as r,ma as h,o as u,wb as n,zc as p,zd as y}from"./chunk-I3FGJX2C.js";import{d as l,n as j}from"./chunk-INB5GR2I.js";import{j as o}from"./chunk-B7YGBANW.js";j();var T=["table"],i,D=(i=class{get criteria(){return this._criteria}get filterData(){return this._filterData}get translate(){return this.localizationService.getSync.bind(this.localizationService)}get filters(){return this._filters}set filters(e){this._filters=e}constructor(e,t){this.cdr=e,this.drawerService=t,this._priceService=h(C),this._searchSubject=new r,this._warehouseIdSubject=new r,this._accountIdSubject=new r,this._cashboxIdSubject=new r,this._criteria=null,this.localizationService=h(I),this.filtersSn=f(null),this.orderBy="Id",this.isAscending=!0,this.tableHeight="450px",this.disableDynamicTableHeight=!1,this.filterSubmitted=new r,this.filterCanceled=new r}ngOnInit(){this.dataSource=new _({key:"id",cacheRawData:!1,load:e=>o(this,null,function*(){let t=this._getSortDescriptors(e)?.[0],c={criteria:this.criteria??null,skip:e.skip??0,take:e.take??100,orderBy:t?t.selector.toString():this.orderBy,isAscending:t?!t.desc:this.isAscending},a=yield u(this.getLoadMethod(c).pipe(b(1)));return this.table&&!this.disableDynamicTableHeight&&(this.table.dataGrid.height=a.data.length>10?this.tableHeight:"100%",this.cdr.markForCheck()),{data:a.data,totalCount:a.count}})}),this._searchSubject.pipe(d(300),s(this)).subscribe(e=>{this.searchValue=e,this.table.refresh()}),this._warehouseIdSubject.pipe(s(this)).subscribe(e=>{this.warehouseId=e,this.table?.refresh()}),this._accountIdSubject.pipe(s(this)).subscribe(e=>{this.accountId=e,this.table?.refresh()}),this._cashboxIdSubject.pipe(s(this)).subscribe(e=>{this.cashboxId=e,this.table?.refresh()})}openFilters(){let e=this.drawerService.open(this.filterComponent,{data:this.filterData,header:this.localizationService.getSync("\u0424\u0438\u043B\u044C\u0442\u0440\u044B"),submitButton:{label:this.localizationService.getSync("\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C"),variant:"success"},cancelButton:this.localizationService.getSync("\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B")});e.submitted.pipe(s(this)).subscribe(t=>{this.previousFilters=this.filters,this.filters=t,this.filtersSn.set(t),e.close(),this.table.refresh(),this.filterSubmitted.next(t),this.cdr.detectChanges()}),e.canceled.pipe(s(this)).subscribe(()=>{this.previousFilters=this.filters,this.filters=null,this.filtersSn.set(null),this.table.refresh(),this.filterCanceled.next(),this.cdr.detectChanges()})}changedSearch(e){this._searchSubject.next(e)}changedWarehouse(e,t){this._warehouseIdSubject.next(e),t&&t.router.navigate([],{relativeTo:t.route,queryParams:{warehouseId:e},queryParamsHandling:"merge"})}changedAccount(e,t){this._accountIdSubject.next(e),t&&t.router.navigate([],{relativeTo:t.route,queryParams:{accountId:e},queryParamsHandling:"merge"})}changedCashbox(e,t){this._cashboxIdSubject.next(e),t&&t.router.navigate([],{relativeTo:t.route,queryParams:{cashboxId:e},queryParamsHandling:"merge"})}defaultPrice(e){return this._priceService.defaultPrice(e)}_getSortDescriptors(e){return Array.isArray(e.sort)?e.sort:[]}},i.\u0275fac=function(t){return new(t||i)(n(y),n(w))},i.\u0275cmp=m({type:i,selectors:[["tis-base-table-view"]],viewQuery:function(t,c){if(t&1&&p(T,5),t&2){let a;S(a=g())&&(c.table=a.first)}},decls:0,vars:0,template:function(t,c){},encapsulation:2}),i);D=l([v()],D);export{D as a};
//# sourceMappingURL=chunk-CCXXK3LT.js.map
