import{a as L}from"./chunk-OFSPPASQ.js";import{E as O,F as W,c as j,h as B,o as H}from"./chunk-MDIMQ3H3.js";import{a as I}from"./chunk-3DEA4WWC.js";import{q as J}from"./chunk-TKVDP62Z.js";import{Ad as k,Bb as m,Ca as _,Db as u,Fa as w,Ha as h,Jb as a,Kb as r,Kc as T,Lb as f,Lc as V,Ub as d,Xb as C,Za as o,Zb as p,ad as E,eb as N,ib as D,jb as v,mc as s,nc as y,oa as P,oc as S,pc as b,rc as R,sc as A,tc as F,va as c,wa as g,xd as M}from"./chunk-GJDGQISV.js";function G(t,i){if(t&1&&(a(0,"span"),s(1),r()),t&2){let e=p();o(),b(" Showing ",e.pageData.Filter.PageNumber*e.total-e.total+1," - ",e.pageData.Filter.PageNumber*e.total," ")}}function K(t,i){if(t&1&&(a(0,"span"),s(1),r()),t&2){let e=p();o(),b(" Showing ",e.pageData.Filter.RowCount*e.pageData.Filter.PageNumber-e.pageData.Filter.RowCount+1," - ",e.pageData.Filter.RowCount*e.pageData.Filter.PageNumber-e.pageData.Filter.RowCount+e.total," ")}}function Q(t,i){if(t&1){let e=d();a(0,"span",7),C("click",function(){c(e);let l=p();return g(l.StoreRowsCountAPIResult())}),a(1,"i",8),s(2,"?"),r()()}}function U(t,i){if(t&1&&(a(0,"span"),s(1),T(2,"number"),r()),t&2){let e=p();o(),y(V(2,1,e.totalAllData()))}}function X(t,i){if(t&1){let e=d();s(0," Page "),a(1,"input",9),C("keyup",function(l){c(e);let x=p();return g(x.onJumpToPage(l))}),F("ngModelChange",function(l){c(e);let x=p();return A(x.pageNumber,l)||(x.pageNumber=l),g(l)}),r()}if(t&2){let e=p();o(),R("ngModel",e.pageNumber)}}function Y(t,i){if(t&1&&s(0),t&2){let e=p();S(" ",e.pageNumber," Page ")}}function Z(t,i){if(t&1){let e=d();a(0,"a",10),C("click",function(){c(e);let l=p();return g(l.onPreviousPage())}),f(1,"i",11),s(2," Previous"),r()}}function $(t,i){if(t&1){let e=d();a(0,"a",10),C("click",function(){c(e);let l=p();return g(l.onNextPage())}),f(1,"i",12),s(2," Next"),r()}}var q=class t{constructor(i){this.httpService=i;h(()=>{this.reloadRowCount()&&this.totalAllData()>0&&I.IsNotEmpty(this.api)&&(this.StoreRowsCountAPIResult(),this.reloadRowCount.set(!1))})}editPageNumber=!0;pageData;total;api;nextButtonAlwaysVisible=!1;jumpToPage=new _;previousPage=new _;nextPage=new _;set _totalAllData(i){this.totalAllData.set(i)}totalAllData=w(-1);reloadRowCount=E(!1);pageNumber=1;showingNumber=this.pageNumber;onJumpToPage(i){i.key==="Enter"&&(this.pageData.Filter.PageNumber=this.pageNumber,this.showingNumber=this.pageNumber,this.jumpToPage.emit())}onPreviousPage(){this.pageData.Filter.PageNumber-=1,this.pageNumber=this.pageData.Filter.PageNumber,this.showingNumber=this.pageNumber,this.previousPage.emit()}onNextPage(){this.pageData.Filter.PageNumber+=1,this.pageNumber=this.pageData.Filter.PageNumber,this.showingNumber=this.pageNumber,this.nextPage.emit()}StoreRowsCountAPIResult(){this.httpService.post("/api/"+this.api,this.pageData.Filter).subscribe(i=>{this.totalAllData.set(i.Count?i.Count:i)})}static \u0275fac=function(e){return new(e||t)(N(J))};static \u0275cmp=D({type:t,selectors:[["POS-complex-pagination"]],inputs:{editPageNumber:"editPageNumber",pageData:"pageData",total:"total",api:"api",nextButtonAlwaysVisible:"nextButtonAlwaysVisible",_totalAllData:[0,"totalAllData","_totalAllData"],reloadRowCount:[1,"reloadRowCount"]},outputs:{jumpToPage:"jumpToPage",previousPage:"previousPage",nextPage:"nextPage",reloadRowCount:"reloadRowCountChange"},standalone:!1,decls:15,vars:7,consts:[[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"fw-bold","fst-italic","hidden-xxs"],[1,"me-2"],[2,"cursor","pointer"],[1,"btn-group"],[1,"btn","btn-outline-secondary","btn-sm","text-primary"],[2,"cursor","pointer",3,"click"],[1,"border","p-3"],["type","text","autoNum","",1,"text-end",2,"width","45px",3,"keyup","ngModelChange","ngModel"],[1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-arrow-left"],[1,"fa-solid","fa-arrow-right"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),m(3,G,2,2,"span"),m(4,K,2,2,"span"),a(5,"span",3),s(6,"of"),r(),m(7,Q,3,0,"span",4),m(8,U,3,3,"span"),s(9," records ~ "),m(10,X,2,1)(11,Y,1,1),r()(),a(12,"div",5),m(13,Z,3,0,"a",6),m(14,$,3,0,"a",6),r()()),e&2&&(o(3),u(n.pageData.Filter.RowCount==n.total?3:-1),o(),u(n.pageData.Filter.RowCount!=n.total?4:-1),o(3),u(n.totalAllData()==-1?7:-1),o(),u(n.totalAllData()>0?8:-1),o(2),u(n.editPageNumber?10:11),o(3),u(n.pageData.Filter.PageNumber!=1?13:-1),o(),u(n.total>=n.pageData.Filter.RowCount||n.nextButtonAlwaysVisible?14:-1))},dependencies:()=>[j,B,H,L,M],encapsulation:2})},z=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=v({type:t});static \u0275inj=P({imports:[k,O,W]})};export{q as a,z as b};
