import{a as j}from"./chunk-VESPME54.js";import{a as V}from"./chunk-44QN564A.js";import{a as C}from"./chunk-WQP4LGDK.js";import{a as D}from"./chunk-4NKYXKKW.js";import{d as b}from"./chunk-T6NRFYFX.js";import"./chunk-RQCMKSAN.js";import{a as L}from"./chunk-JI65IOIM.js";import{O as m,j as R}from"./chunk-57DG2VC5.js";import"./chunk-NMMBNW5X.js";import"./chunk-5IDV7BCW.js";import"./chunk-CVFNZXIB.js";import"./chunk-EU5XKS65.js";import"./chunk-XALE2GEX.js";import{m as F,n as I}from"./chunk-GJIGZB63.js";import"./chunk-TOJME4VO.js";import"./chunk-2CD72B3Z.js";import"./chunk-4TDNJBFX.js";import"./chunk-4LZAXRJQ.js";import"./chunk-XHRSSCXW.js";import"./chunk-5VDVFGVW.js";import{k as P,p as A}from"./chunk-NLMVBXFK.js";import"./chunk-BUHB7MLU.js";import"./chunk-KUS3L5XF.js";import{Eb as S,Fb as y,Fd as M,Ib as _,Vb as u,a as c,cc as h,dc as w,la as v,lc as g,rb as f,sb as n}from"./chunk-J476KISY.js";var k=(()=>{class o extends V{constructor(t,s,i,a){super(),this.postalCodesService=t,this.apiService=s,this.router=i,this.viewSwitchService=a,this.postalCodesFilterFields=[{id:"keywords",component:R,label:"SearchFilter",icon:"far fa-search"}],this.filterModel={keywords:""},this.filtersConfig={keywords:{isPinned:!0}},this.columns=[{id:"post",colId:"AcPost",label:"Code",width:100,pinned:"left",render:{component:C,params:{getParams:e=>({label:e.post,link:["/postal-codes/postal-codes-main/edit",e.post]})}}},{id:"name",colId:"AcName",label:"Name",flex:1,render:{component:C,params:{getParams:e=>{let l=e.name&&e.name.trim()!=="";return{label:l?e.name:"",link:l?["/postal-codes/postal-codes-main/edit",e.post]:null}}}}}],this.settings={id:"postal-codes-list",selectableRows:!1,loadData:(e,l,d)=>{let r={Start:e,Length:l-e};d?.column&&(r.SortColumn=d.column),d?.order&&(r.SortOrder=d.order),this.filterModel.keywords&&(r.Keywords=this.filterModel.keywords);let N=new URLSearchParams;Object.keys(r).forEach(p=>{r[p]!==null&&r[p]!==void 0&&N.append(p,r[p].toString())});let T=`${F.postalCodes.list}`;return this.apiService.post(T,r)}}}ngOnInit(){this.setViewActions(),this.viewSwitchService.unset()}ngOnDestroy(){this.postalCodesService.unset(),this.viewSwitchService.unset()}setViewActions(){this.mainView?.setViewActions(this.getViewActions())}getViewActions(){return[{id:"create",icon:"far fa-file",type:"paw-action-icon",onSelected:()=>this.createPostalCode()}]}createPostalCode(){this.router.navigate(["/postal-codes/postal-codes-main/create"])}onFilter(t){t&&(this.filterModel=c(c({},this.filterModel),t),this.gridApi&&this.gridApi.reloadData())}onGridReady(t){this.gridApi=t}onRowSelected(t){t.post&&this.router.navigate(["/postal-codes/postal-codes-main/edit",t.post])}static{this.\u0275fac=function(s){return new(s||o)(n(j),n(I),n(P),n(L))}}static{this.\u0275cmp=S({type:o,selectors:[["paw-postal-codes-list"]],standalone:!1,features:[_],decls:5,vars:5,consts:[[1,"paw-area-v","paw-holder"],[1,"paw-col","paw-content-bg","paw-padding-bottom-s","paw-padding-top-s","paw-padding-left-m","paw-padding-right-m"],[3,"filter","fields","filterModel","filtersConfig"],[1,"paw-col-d"],[3,"ready","rowSelected","cols","settings"]],template:function(s,i){s&1&&(h(0,"div",0)(1,"div",1)(2,"paw-filters",2),g("filter",function(e){return i.onFilter(e)}),w()(),h(3,"div",3)(4,"paw-datagrid",4),g("ready",function(e){return i.onGridReady(e)})("rowSelected",function(e){return i.onRowSelected(e)}),w()()()),s&2&&(f(2),u("fields",i.postalCodesFilterFields)("filterModel",i.filterModel)("filtersConfig",i.filtersConfig),f(2),u("cols",i.columns)("settings",i.settings))},dependencies:[m,b],encapsulation:2})}}return o})();var te=(()=>{class o{static{this.\u0275fac=function(s){return new(s||o)}}static{this.\u0275mod=y({type:o})}static{this.\u0275inj=v({imports:[M,m,D,A.forChild([{path:"",component:k}])]})}}return o})();export{te as PostalCodesListModule};
