1"use strict";(self.webpackChunkweb_alquiler_impresoras=self.webpackChunkweb_alquiler_impresoras||[]).push([[3312],{25119(e,t,s){s.d(t,{L:()=>M});var a=s(65043),n=s(863),i=s(22623),l=s(72033),r=s(30019),o=s(9278),d=s(2667),c=s(70579);const m=new Intl.NumberFormat("es-PE",{style:"currency",currency:"PEN",minimumFractionDigits:2}),x=e=>{const t="string"===typeof e?parseFloat(e):e;return void 0===t||null===t||isNaN(t)?"S/ 0.00":m.format(t)},u=function(e){if(!e)return"N/A";const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e.match(/^(\d{4})-(\d{2})-(\d{2})/):null,s=t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):new Date(e);return Number.isNaN(s.getTime())?"N/A":s.toLocaleDateString("es-PE",{day:"2-digit",month:"2-digit",year:"numeric"})},p={emissionDate:"Emisi\xf3n",confirmedAt:"\xdaltimo pago",updatedAt:"Actualizaci\xf3n"},h=[{value:"emissionDate",label:"Fecha de emisi\xf3n"},{value:"confirmedAt",label:"\xdaltimo pago"},{value:"updatedAt",label:"Actualizaci\xf3n"}],g=(e,t)=>"confirmedAt"===t?e.lastPaymentConfirmedAt:"updatedAt"===t?e.updatedAt:e.emissionDate,y=e=>"Pagado"===e||"Completo"===e?"bg-green-500/20 text-green-300 ring-1 ring-green-400/30":"Pendiente"===e||"Incompleto"===e?"bg-yellow-500/20 text-yellow-300 ring-1 ring-yellow-400/30":"Anulado"===e||"Cancelado"===e?"bg-red-500/20 text-red-300 ring-1 ring-red-400/30":"bg-gray-500/20 text-gray-300 ring-1 ring-gray-400/30",f=e=>Boolean(e.writeOffAt)&&("Pendiente"===e.status||"Incompleto"===e.status),b=()=>(0,c.jsx)("span",{className:"px-2 py-1 text-xs font-medium bg-purple-500/20 text-purple-300 ring-1 ring-purple-400/30 rounded",children:"Restringido"}),N=e=>e?new Date(e)<new Date?"text-red-400":"text-green-400":"text-gray-400",j=e=>{let{dateField:t,isOpen:s,canChange:a,onToggle:i,onChange:l}=e;return(0,c.jsxs)("div",{className:"relative inline-block",children:[a?(0,c.jsxs)("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1 rounded px-1 py-0.5 hover:bg-white/10 transition-colors",children:[(0,c.jsx)("span",{children:p[t]}),(0,c.jsx)(n.A,{className:"h-3.5 w-3.5"})]}):(0,c.jsx)("span",{children:p[t]}),a&&s&&(0,c.jsx)("div",{className:"absolute right-0 top-full z-dropdown mt-1 min-w-[160px] rounded border border-gray-600 bg-[#242735] py-1 shadow-lg",children:h.map(e=>(0,c.jsx)("button",{type:"button",onClick:t=>l(e.value,t),className:"block w-full px-3 py-1.5 text-left text-xs transition-colors ".concat(t===e.value?"bg-blue-500/20 text-blue-200":"text-gray-200 hover:bg-white/10"),children:e.label},e.value))})]})},v=e=>{let{count:t,colCount:s=9}=e;return(0,c.jsx)("tbody",{className:"text-gray-100",children:Array.from({length:t},(e,t)=>(0,c.jsx)("tr",{children:Array.from({length:s},(e,s)=>(0,c.jsx)("td",{className:"px-4 py-3",children:(0,c.jsx)("div",{className:"h-4 bg-gray-700/50 rounded animate-pulse"})},"desktop-skeleton-".concat(t,"-").concat(s)))},"desktop-skeleton-".concat(t)))})},w=e=>{let{count:t}=e;return(0,c.jsx)(c.Fragment,{children:Array.from({length:t},(e,t)=>(0,c.jsxs)("div",{className:"bg-slate-800/50 p-3 border border-slate-700/50 space-y-2",children:[(0,c.jsx)("div",{className:"h-4 bg-gray-700/50 rounded animate-pulse w-3/4"}),(0,c.jsx)("div",{className:"h-3 bg-gray-700/50 rounded animate-pulse w-1/2"}),(0,c.jsx)("div",{className:"h-3 bg-gray-700/50 rounded animate-pulse w-2/3"})]},"mobile-skeleton-".concat(t)))})},D=e=>{let{receipt:t,index:s,dateField:a,showPaymentDate:n,showPendingColumn:i,showCustomerColumn:l=!0,customerName:r,customerLegalName:o,onViewDetails:d}=e;return(0,c.jsxs)("div",{className:"bg-slate-800/50 p-3 border border-slate-700/50 hover:bg-slate-700/30 transition-colors cursor-pointer",style:{animationDelay:"".concat(40*s,"ms")},onClick:()=>d(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||d(t)},role:"button",tabIndex:0,children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,c.jsxs)("div",{className:"text-xs text-gray-400",children:["#",t.id]}),(0,c.jsx)("div",{className:"text-sm font-bold text-purple-400",children:x(t.totalAmount)})]}),l&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"text-sm font-semibold text-gray-100 mb-2",children:r}),o&&(0,c.jsx)("div",{className:"text-xs text-gray-400 mb-2",children:o})]}),(0,c.jsxs)("div",{className:"space-y-1 mb-2",children:[(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-gray-400",children:"Servicio:"}),(0,c.jsxs)("span",{className:"text-gray-300",children:[u(t.serviceStartDate,!0)," - ",u(t.serviceEndDate,!0)]})]}),(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-gray-400",children:"Subtotal:"}),(0,c.jsx)("span",{className:"text-gray-300",children:x(t.subtotal)})]}),parseFloat(t.discountAmount||"0")>0&&(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-gray-400",children:"Descuento:"}),(0,c.jsxs)("span",{className:"text-red-400",children:["-",x(t.discountAmount)]})]}),t.taxApplies&&parseFloat(t.taxAmount||"0")>0&&(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsxs)("span",{className:"text-gray-400",children:["Impuesto (",t.taxRate,"%):"]}),(0,c.jsxs)("span",{className:"text-blue-400",children:["+",x(t.taxAmount)]})]}),(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-gray-400",children:"Completado:"}),(0,c.jsx)("span",{className:"text-green-400 font-medium",children:x(t.completedAmount)})]}),i&&parseFloat(t.pendingAmount||"0")>0&&(0,c.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-gray-400",children:f(t)?"Re
1stringido:":"Pendiente:"}),(0,c.jsx)("span",{className:"font-medium ".concat(f(t)?"text-purple-300":"text-orange-400"),children:x(t.pendingAmount)})]})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-slate-700/30",children:[(0,c.jsxs)("div",{className:"text-xs text-gray-400",children:[p[a],": ",u(g(t,a),"emissionDate"===a)]}),(0,c.jsxs)("div",{className:"text-xs ".concat(N(t.expirationDate)),children:["Vence: ",u(t.expirationDate,!0)]}),n&&t.lastPaymentConfirmedAt&&(0,c.jsxs)("div",{className:"text-xs text-green-400",children:["Pago: ",u(t.lastPaymentConfirmedAt)]}),(0,c.jsx)("span",{className:"px-2 py-1 text-xs font-medium ".concat(y(t.status)," rounded"),children:t.status}),f(t)&&(0,c.jsx)(b,{})]})]})},C=e=>{let{onRetry:t}=e;return(0,c.jsxs)("div",{className:"p-4 text-center text-red-400",children:["Error al cargar recibos."," ",t&&(0,c.jsx)("button",{type:"button",onClick:t,className:"text-blue-400 underline",children:"Reintentar"})]})},A=e=>{let{receipt:t,dateField:s,showPaymentDate:a,showPendingColumn:n,showCustomerColumn:i=!0,customerName:l,customerLegalName:r,onViewDetails:o}=e;return(0,c.jsxs)("tr",{className:"hover:bg-gray-700/20 transition-colors cursor-pointer border-b border-gray-700/40",onClick:()=>o(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||o(t)},role:"button",tabIndex:0,children:[(0,c.jsxs)("td",{className:"px-4 py-3 font-mono text-xs",children:["#",t.id]}),i&&(0,c.jsxs)("td",{className:"px-4 py-3",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-gray-300",children:l}),r&&(0,c.jsx)("div",{className:"text-xs text-gray-400",children:r})]}),(0,c.jsx)("td",{className:"px-4 py-3",children:(0,c.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,c.jsx)("span",{className:"px-2 py-1 text-xs font-medium ".concat(y(t.status)," rounded"),children:t.status}),f(t)&&(0,c.jsx)(b,{})]})}),(0,c.jsxs)("td",{className:"px-4 py-3 text-sm text-gray-300",children:[u(t.serviceStartDate,!0),(0,c.jsx)("br",{}),(0,c.jsxs)("span",{className:"text-xs text-gray-400",children:["al ",u(t.serviceEndDate,!0)]})]}),(0,c.jsxs)("td",{className:"px-4 py-3 text-sm text-gray-300",children:[x(t.subtotal),parseFloat(t.discountAmount||"0")>0&&(0,c.jsxs)("div",{className:"text-xs text-red-400",children:["-",x(t.discountAmount)]}),t.taxApplies&&parseFloat(t.taxAmount||"0")>0&&(0,c.jsxs)("div",{className:"text-xs text-blue-400",children:["+",x(t.taxAmount)," (",t.taxRate,"%)"]})]}),(0,c.jsx)("td",{className:"px-4 py-3 text-sm font-semibold text-green-400",children:x(t.completedAmount)}),n&&(0,c.jsx)("td",{className:"px-4 py-3",children:parseFloat(t.pendingAmount||"0")>0?(0,c.jsx)("div",{className:"text-sm font-semibold ".concat(f(t)?"text-purple-300":"text-orange-400"),children:x(t.pendingAmount)}):(0,c.jsx)("span",{className:"text-xs text-gray-500",children:"-"})}),(0,c.jsx)("td",{className:"px-4 py-3 text-base font-bold text-purple-400",children:x(t.totalAmount)}),(0,c.jsxs)("td",{className:"px-4 py-3 text-sm text-gray-300",children:[u(g(t,s),"emissionDate"===s),(0,c.jsx)("br",{}),(0,c.jsxs)("span",{className:N(t.expirationDate),children:["Vence: ",u(t.expirationDate,!0)]})]}),a&&(0,c.jsx)("td",{className:"px-4 py-3 text-sm text-gray-300",children:t.lastPaymentConfirmedAt?u(t.lastPaymentConfirmedAt):"-"})]})},M=e=>{let{receipts:t,loadState:s={},availableHeight:n="65vh",onLoadMore:m,onViewDetails:x,error:u,onRetry:p,className:h="",columns:g={},dateField:y="emissionDate",onDateFieldChange:f}=e;const{isInitialLoading:b=!1,isFetchingMore:N=!1,hasMore:M=!1}=s,{showPaymentDate:R=!1,showPendingColumn:F=!0,showCustomerColumn:k=!0}=g,{isMobile:P,isDateFieldMenuOpen:S,setIsDateFieldMenuOpen:L,skeletonCount:I,desktopContainerRef:E,mobileContainerRef:H,desktopSentinelRef:O,mobileSentinelRef:K,handleViewDetails:V,getCustomerName:T,getCustomerRazonSocial:q,handleDateFieldChange:z}=(e=>{let{receipts:t,availableHeight:s,isInitialLoading:n,isFetchingMore:i,hasMore:c,showCustomerColumn:m=!0,onLoadMore:x,onViewDetails:u,onDateFieldChange:p}=e;const h=(0,l.W)(),[g,y]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const e=()=>y(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const N=(0,a.useMemo)(()=>{const e=g?80:65;return Math.max(3,Math.min(Math.floor((e=>{var t;if(e.includes("calc(")){const t=e.match(/(\d+)vh/);if(t){const s=parseInt(t[1]||"0")/100*window.innerHeight,a=e.match(/(\d+)px/g),n=a?a.reduce((e,t)=>
1e+parseInt(t),0):0;return Math.max(0,s-n)}}const s=e.match(/(\d+)px/);return s?parseInt(null!==(t=s[1])&&void 0!==t?t:"600"):600})(s)/e),10))},[s,g]),j=(0,a.useMemo)(()=>m?t.map(e=>e.customerId).filter(e=>null!=e):[],[t,m]),{customers:v}=(0,r.i)(j),w=(0,a.useRef)(null),D=(0,a.useRef)(null),C=(0,a.useCallback)(()=>null===x||void 0===x?void 0:x(),[x]),{sentinelRef:A}=(0,o.X)({hasMore:c&&!n,isLoading:i,onLoadMore:C,rootRef:w,rootMargin:"0px 0px 200px 0px",threshold:0,enabled:!g&&Boolean(x)}),{sentinelRef:M}=(0,o.X)({hasMore:c&&!n,isLoading:i,onLoadMore:C,rootRef:D,rootMargin:"0px 0px 200px 0px",threshold:0,enabled:g&&Boolean(x)}),R=(0,a.useCallback)(e=>{u?u(e):h.toRentalReceipt(e.id)},[h,u]),F=(0,a.useCallback)(e=>{if(null==e)return"Cliente no encontrado";const t=v.find(t=>String(t.id)===String(e));return t?(0,d.m6)(t)||"Cliente sin nombre":"Cliente no encontrado"},[v]),k=(0,a.useCallback)(e=>{var t;if(null==e)return null;const s=v.find(t=>String(t.id)===String(e)),a=s,n="company"===(null===a||void 0===a?void 0:a.identityType)?null===(t=a.identity)||void 0===t?void 0:t.legalName:null;return n&&n!==(0,d.m6)(s)?n:null},[v]),P=(0,a.useCallback)(e=>{null===p||void 0===p||p(e),b(!1)},[p]);return{isMobile:g,isDateFieldMenuOpen:f,setIsDateFieldMenuOpen:b,skeletonCount:N,desktopContainerRef:w,mobileContainerRef:D,desktopSentinelRef:A,mobileSentinelRef:M,handleViewDetails:R,getCustomerName:F,getCustomerRazonSocial:k,handleDateFieldChange:P}})({receipts:t,availableHeight:n,isInitialLoading:b,isFetchingMore:N,hasMore:M,showCustomerColumn:k,onLoadMore:m,onViewDetails:x,onDateFieldChange:f}),B=7+(k?1:0)+(F?1:0)+(R?1:0),U=(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto overflow-x-auto custom-scrollbar dark",ref:E,style:{maxHeight:n},children:[(0,c.jsxs)("table",{className:"w-full text-sm",children:[(t.length>0||b)&&(0,c.jsx)("thead",{className:"sticky top-0 bg-[#242735] z-10",children:(0,c.jsxs)("tr",{className:"border-b border-gray-700",children:[(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Id"}),k&&(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Cliente"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Estado"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Servicio"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Subtotal"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Completado"}),F&&(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Pendiente"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Total"}),(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:(0,c.jsx)(j,{dateField:y,isOpen:S,canChange:Boolean(f),onToggle:e=>{e.stopPropagation(),L(e=>!e)},onChange:(e,t)=>
1{t.stopPropagation(),z(e)}})}),R&&(0,c.jsx)("th",{className:"py-2 px-4 text-left text-xs font-semibold text-gray-400",children:"Fecha de Pago"})]})}),b?(0,c.jsx)(v,{count:I,colCount:B}):(0,c.jsx)("tbody",{className:"text-gray-100",children:0===t.length?(0,c.jsx)("tr",{children:(0,c.jsxs)("td",{colSpan:B,className:"px-4 py-8 text-center text-gray-400",children:[(0,c.jsx)(i.A,{className:"w-12 h-12 mx-auto mb-2 text-gray-500"}),(0,c.jsx)("p",{className:"text-sm",children:"No se encontraron recibos"})]})}):t.map(e=>(0,c.jsx)(A,{receipt:e,dateField:y,showPaymentDate:R,showPendingColumn:F,showCustomerColumn:k,customerName:T(e.customerId),customerLegalName:q(e.customerId),onViewDetails:V},e.id))})]}),!b&&t.length>0&&(0,c.jsx)("div",{ref:O,className:"h-4"}),N&&(0,c.jsx)("div",{className:"flex justify-center py-4",children:(0,c.jsxs)("div",{className:"flex space-x-1",children:[(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})}),!M&&!b&&!N&&t.length>0&&(0,c.jsxs)("div",{className:"flex flex-col items-center py-6",children:[(0,c.jsx)("div",{className:"w-12 h-0.5 bg-slate-600/30 rounded-full mb-3"}),(0,c.jsx)("p",{className:"text-xs text-slate-500/60",children:"No hay m\xe1s recibos"})]})]}),Z=(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto custom-scrollbar dark",ref:H,style:{maxHeight:n},children:[b?(0,c.jsx)(w,{count:I}):0===t.length?(0,c.jsx)("div",{className:"flex items-center justify-center",style:{height:n},children:(0,c.jsxs)("div",{className:"text-center text-gray-400",children:[(0,c.jsx)(i.A,{className:"w-12 h-12 mx-auto mb-2 text-gray-500"}),(0,c.jsx)("p",{className:"text-sm",children:"No se encontraron recibos"})]})}):t.map((e,t)=>(0,c.jsx)(D,{receipt:e,index:t,dateField:y,showPaymentDate:R,showPendingColumn:F,showCustomerColumn:k,customerName:T(e.customerId),customerLegalName:q(e.customerId),onViewDetails:V},"renta-".concat(e.id))),!b&&t.length>0&&(0,c.jsx)("div",{ref:K,className:"h-4"}),N&&(0,c.jsxs)("div",{className:"flex space-x-1",children:[(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,c.jsx)("div",{className:"w-1.5 h-1.5 bg-slate-500/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),!M&&!b&&!N&&t.length>0&&(0,c.jsxs)("div",{className:"flex flex-col items-center py-6",children:[(0,c.jsx)("div",{className:"w-12 h-0.5 bg-slate-600/30 rounded-full mb-3"}),(0,c.jsx)("p",{className:"text-xs text-slate-500/60",children:"No hay m\xe1s recibos"})]})]});return u?(0,c.jsx)(C,{onRetry:p}):(0,c.jsx)("div",{className:"bg-[#242735] ".concat(h),children:P?Z:U})}},30019(e,t,s){s.d(t,{i:()=>l});var a=s(89379),n=s(65043),i=s(48693);const l=e=>{var t;const s=(0,n.useMemo)(()=>Array.from(new Set((null!==e&&void 0!==e?e:[]).filter(e=>"number"===typeof e&&Number.isFinite(e)))),[e]),l=(0,i.nK)(s.length>0?{ids:s,limit:s.length}:void 0,{skip:0===s.length}),r=(0,n.useMemo)(()=>{var e,t;return null!==(e=null===(t=l.data)||void 0===t?void 0:t.rows)&&void 0!==e?e:[]},[null===(t=l.data)||void 0===t?void 0:t.rows]),o=(0,n.useMemo)(()=>r.reduce((e,t)=>(e[t.id]=t,e),{}),[r]);return(0,a.A)((0,a.A)({},l),{},{customers:r,entities:o})}},42393(e,t,s){s.d(t,{A:()=>o});var a=s(65043),n=s(1009),i=s(79607),l=s(70579);const r=(0,a.forwardRef)((e,t)=>{let{status:s,onClick:r,onAutoReset:o,autoResetDelayMs:d=1200,className:c="",disableAutoReset:m=!1,disabled:x=!1}=e;(0,a.useEffect)(()=>{if(m)return;if("success"!==s&&"error"!==s)return;const e=setTimeout(()=>null===o||void 0===o?void 0:o(),d);return()=>clearTimeout(e)},[s,d,o,m]);const u="loading"===s||"success"===s||"error"===s;return(0,l.jsx)("button",{ref:t,type:"button",onClick:u?void 0:r,"aria-busy":"loading"===s,"aria-live":"polite",disabled:u||x,"data-status":s,className:["w-full inline-flex items-center justify-center gap-2","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/50","disabled:opacity-60 disabled:cursor-not-allowed","transition motion-reduce:transition-none",c].join(" "),children:"idle"===s?(0,l.jsx)(i.rU$,{"aria-hidden":"true",className:"h-5 w-5"}):"loading"===s?(0,l.jsx)(n.TwU,{"aria-hidden":"true",className:"h-5 w-5 animate-spin"}):"editing"===s?(0,l.jsx)(n.Bc_,{"aria-hidden":"true",className:"h-5 w-5"}):"success"===s?(0,l.jsx)(n.YrT,{"aria-hidden":"true",className:"h-5 w-5 motion-safe:animate-pulse text-green-500"}):"error"===s?(0,l.jsx)(n.yGN,{"aria-hidden":"true",className:"h-5 w-5 motion-safe:animate-pulse text-red-500"}):null})});r.displayName="EditButton";const o=r},46746(e,t,s){s.d(t,{I:()=>o});var a=s(65043),n=s(61486),i=s(77468),l=s(62032);const r=e=>e?e instanceof Error?e:(0,l.SU)(e,{fallbackMessage:"No se pudieron cargar los re
1cibos"}):null;function o(e){var t,s,l,o;const d=null!==(t=e.rentReceiptStatusFilter)&&void 0!==t?t:"all",c=null!==(s=e.rentReceiptSearch)&&void 0!==s?s:"",{rentReceiptStatusParam:m,customerId:x,localId:u,startDate:p,endDate:h,skip:g}=e,y=null!==(l=e.dateField)&&void 0!==l?l:"emissionDate",f=null!==(o=e.debtState)&&void 0!==o?o:"written-off"===d?"written-off":void 0,b="paid"===d,N=(0,a.useMemo)(()=>"".concat(d,"-").concat(null!==f&&void 0!==f?f:"","-").concat(c,"-").concat(null!==x&&void 0!==x?x:"all","-").concat(null!==u&&void 0!==u?u:"all","-").concat(y,"-").concat(p||"","-").concat(h||"","-").concat(b?"confirmedAt":"default"),[d,f,c,x,u,y,p,h,b]),[j,v]=(0,a.useState)({filterKey:N,page:1}),w=j.filterKey===N?j.page:1,D=(0,a.useMemo)(()=>{const e={page:w,limit:20};return m&&m.length>0&&(e.status=m),f&&(e.debtState=f,e.status||(e.status=["Pendiente","Incompleto"])),c.trim()&&(e.search=c.trim()),x&&(e.customerId=x),u&&(e.localId=u),p&&(e.startDate=p),h&&(e.endDate=h),e.dateField=y,e.orderBy=y,e.orderDirection="DESC",b&&"emissionDate"===y&&(e.orderBy="confirmedAt",e.orderDirection="DESC"),e},[w,m,f,c,x,u,p,h,y,b]),{currentData:C,isFetching:A,isLoading:M,error:R,refetch:F}=(0,n.Iu)(D,{skip:g}),{rows:k,isInitialLoading:P,isFetchingMore:S,hasMore:L}=(0,i.f)({filterKey:N,queryData:C,isFetching:A,isLoading:M}),I=(0,a.useCallback)(()=>{L&&!A&&v(e=>({filterKey:N,page:e.filterKey===N?e.page+1:2}))},[N,L,A]);return{receipts:k,isInitialLoading:P,isFetchingMore:S,hasMore:L,loadMore:I,error:r(R),refetch:F}}},72033(e,t,s){s.d(t,{W:()=>r});var a=s(65043),n=s(63362),i=s(73048),l=s(42770);const r=()=>{const e=(0,n.Zp)();return(0,a.useMemo)(()=>(e=>{const t=e=>(0,l.N)("",e),s=function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(t,{replace:s.replace,state:s.state})};return{getHref:t,navigate:s,getOrdersListHref:e=>t((0,i.DZ)(e)),toOrdersList:(e,t)=>s((0,i.DZ)(e),t),getOrderDetailHref:(e,s)=>t((0,i.nk)(e,s)),toOrderDetail:(e,t,a)=>s((0,i.nk)(e,t),a),getOrderServiceHref:(e,s)=>t((0,i.rC)(e,s)),toOrderService:(e,t,a)=>s((0,i.rC)(e,t),a),getRentalReceiptHref:e=>t((0,i.Su)(e)),toRentalReceipt:(e,t)=>s((0,i.Su)(e),t),getLocationsHref:e=>t((0,i.OV)(e)),toLocations:(e,t)=>
1s((0,i.OV)(e),t),getLocationEditHref:e=>t((0,i.T0)(e)),toLocationEdit:(e,t)=>s((0,i.T0)(e),t),getLocationPaymentMethodsHref:e=>t((0,i.NF)(e)),toLocationPaymentMethods:(e,t)=>s((0,i.NF)(e),t),getPaymentMethodsHref:e=>t((0,i.G4)(e)),toPaymentMethods:(e,t)=>s((0,i.G4)(e),t),getPaymentMethodEditHref:e=>t((0,i.$f)(e)),toPaymentMethodEdit:(e,t)=>s((0,i.$f)(e),t),getOperationRoutingHref:()=>t((0,i.ZU)()),toOperationRouting:e=>s((0,i.ZU)(),e)}})(e),[e])}},77468(e,t,s){s.d(t,{f:()=>d});var a=s(89379),n=s(65043);const i=e=>e&&"object"===typeof e&&"rows"in e&&e.rows||[],l=e=>e&&"object"===typeof e&&"pagination"in e&&e.pagination||{page:1,limit:20,total:0,hasMore:!1},r=e=>{const t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))},o=(e,t)=>{const s=new Set(e.map(e=>e.id)),a=t.filter(e=>!s.has(e.id));return[...e,...a]};function d(e){let{filterKey:t,queryData:s,isFetching:d,isLoading:c,extractRows:m=i,extractPagination:x=l,enabled:u=!0}=e;const[p,h]=(0,n.useState)({filterKey:t,rows:[],isResetting:!1,lastAppendedPage:0});let g=p;const y=t!==p.filterKey,f=s!==p.queryData;if(y||u&&s&&f){let e=y?{filterKey:t,rows:[],isResetting:!0,lastAppendedPage:0}:p;if(!y&&u&&s){const n=m(s),i=(e=>{const t=e.page;return"number"===typeof t&&t>0?t:1})(x(s));e=1===i?{filterKey:t,queryData:s,rows:r(n),isResetting:!1,lastAppendedPage:1}:i>e.lastAppendedPage?{filterKey:t,queryData:s,rows:o(e.rows,n),isResetting:!1,lastAppendedPage:i}:(0,a.A)((0,a.A)({},e),{},{filterKey:t,queryData:s})}g=e,h(e)}const b=g.queryData?x(g.queryData):{page:1,limit:20,total:0,hasMore:!1};let N=b.hasMore;if(void 0===N){const e=b.page,t=b.pages,s=b.limit,a=b.total;N=void 0!==t?e<t:void 0!==s&&void 0!==a&&e*s<a}const j=(c||g.isResetting)&&0===g.rows.length,v=d&&!j;return{rows:g.rows,isInitialLoading:j,isFetchingMore:v,hasMore:N}}}}]); 2//# sourceMappingURL=3312.b7af647d.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.