PageSourceSearch

https://www.elevolt.co.ke/_next/static/chunks/pages/hr/[tenant]/payroll/disbursements-82908f7f2c281f4c.js

js elevolt.co.ke collected 2026-10-04 21:47:56 UTC 11,951 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5410e22c-ce38-4b0e-ab10-8c69dfb951a7",e._sentryDebugIdIdentifier="sentry-dbid-5410e22c-ce38-4b0e-ab10-8c69dfb951a7")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2708],{85350:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/hr/[tenant]/payroll/disbursements",function(){return s(40911)}])},40911:function(e,t,s){"use strict";s.r(t);var a=s(52322),l=s(47023),n=s(10988),i=s(65232),r=s(17047),c=s(1973),o=s(63798),d=s(47477),u=s(77590),x=s(2709),h=s(23825),m=s(75588),p=s(42399),b=s(40511),g=s(19317),f=s(76467),j=s(84475),y=s(64792),v=s(34485),w=s(59417),N=s(99603),Z=s(36160),C=s.n(Z),k=s(5632),_=s(13980),S=s.n(_),A=s(2784),D=s(62202),P=s(39691),T=s(63346),B=s(79337),I=s(76974);let R=e=>{var t;let{batch:s,onView:l,onEdit:i,onSubmit:r,onApprove:c,onReject:o,onProcess:u,onDelete:x}=e,h=s.status;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50 transition-colors duration-150",children:[(0,a.jsxs)("td",{className:"px-4 py-3",children:[(0,a.jsx)(f.Z,{variant:"labelValue",children:s.description||"Untitled Batch"}),(0,a.jsxs)(f.Z,{className:"block mt-0.5",variant:"caption",children:[(null===(t=s.created_by)||void 0===t?void 0:t.name)||"Unknown"," \xb7"," ",(0,d.p6)(s.created_at)]})]}),(0,a.jsx)("td",{className:"px-4 py-3 hidden md:table-cell",children:!!s.
1category&&(0,a.jsx)(n.Z,{label:v.wk[s.category]||s.category})}),(0,a.jsxs)("td",{className:"px-4 py-3 text-right",children:[(0,a.jsx)(f.Z,{variant:"labelValue",children:(0,y.x)(s.total_amount||0)}),(0,a.jsxs)(f.Z,{className:"block",variant:"caption",children:[s.total_transactions||0," txn",1!==s.total_transactions?"s":""]})]}),(0,a.jsx)("td",{className:"px-4 py-3 text-center",children:(0,a.jsx)(b.Z,{size:"sm",status:h,type:"disbursement"})}),(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(g.Z,{menuIcon:(0,a.jsx)(N.G,{"aria-label":"Open batch actions menu",className:"text-lg text-gray-500 hover:text-gray-700 cursor-pointer",icon:w.iV1,size:"1x"}),menuItems:[{text:"View",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.Mdf}),action:()=>l(s),show:()=>!0},{text:"Edit",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.Xcf}),action:()=>i(s),show:()=>(0,v.m1)(h)},{text:"Submit for Approval",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.XCy}),action:()=>r(s),show:()=>(0,v.DS)(h)},{text:"Approve",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.LEp}),action:()=>c(s),show:()=>(0,v.YT)(h)},{text:"Reject",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.NBC}),action:()=>o(s),show:()=>(0,v.WP)(h)},{text:"Process",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.zc}),action:()=>u(s),show:()=>(0,v.yD)(h)},{text:"Delete",icon:(0,a.jsx)(N.G,{className:"mr-1",icon:w.$aW}),action:()=>x(s),show:()=>(0,v.Z2)(h)}],subject:s})})})]})};R.propTypes={batch:S().object.isRequired,onView:S().func.isRequired,onEdit:S().func.isRequired,onSubmit:S().func.isRequired,onApprove:S().func.isRequired,onReject:S().func.isRequired,onProcess:S().func.isRequired,onDelete:S().func.isRequired};let E=e=>{let{tenantName:t}=e,s=(0,k.useRouter)(),[n,d]=(0,A.useState)(1),[b,g]=(0,A.useState)(""),[j,Z]=(0,A.useState)(""),[_,S]=(0,A.useState)(!1),[I,E]=(0,A.useState)(null),[q,F]=(0,A.useState)(!1),[G,z]=(0,A.useState)(null),{data:L,isLoading:O,isFetching:V,error:U}=(0,x.Cn)({page:n,status:b||void 0,category:j||void 0}),X=(null==L?void 0:L.data)||[],W=(null==L?void 0:L.meta)||{},Y=(0,x.vj)({}),H=(0,x.dZ)({}),J=(0,x.t1)({}),M=(0,A.useCallback)(e=>{s.push("/hr/".concat(t,"/payroll/disbursements/").concat(e.id))},[s,t]),$=(0,A.useCallback)(e=>{E(e),S(!0)},[]),K=(0,A.useCallback)(e=>{(0,r.Z)({title:"Submit for Approval",message:'Submit "'.concat(e.description||"this batch",'" (').concat((0,y.x)(e.total_amount),") for approval?"),confirmButtonText:"Submit",handler:async()=>{try{await Y.mutateAsync({batchId:e.id}),D.default.success("Batch submitted for approval")}catch(e){var t,s;D.default.error((null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(t=s.data)||void 0===t?void 0:t.error)||"Failed to submit")}}})},[Y]),Q=(0,A.useCallback)(e=>
1{(0,r.Z)({title:"Approve Batch",message:'Approve "'.concat(e.description||"this batch",'" (').concat((0,y.x)(e.total_amount),")?"),confirmButtonText:"Approve",handler:async()=>{try{await H.mutateAsync({batchId:e.id}),D.default.success("Batch approved")}catch(e){var t,s;D.default.error((null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(t=s.data)||void 0===t?void 0:t.error)||"Failed to approve")}}})},[H]),ee=(0,A.useCallback)(e=>{z(e),F(!0)},[]),et=(0,A.useCallback)(e=>{s.push("/hr/".concat(t,"/payroll/disbursements/").concat(e.id))},[s,t]),es=(0,A.useCallback)(e=>{(0,r.Z)({title:"Delete Batch",message:"Delete this batch? This action cannot be undone.",confirmButtonText:"Delete",handler:async()=>{try{await J.mutateAsync({batchId:e.id}),D.default.success("Batch deleted")}catch(e){var t,s;D.default.error((null==e?void 0:null===(s=e.response)||void 0===s?void 0:null===(t=s.data)||void 0===t?void 0:t.error)||"Failed to delete")}}})},[J]),ea=(0,A.useCallback)(()=>{S(!1),E(null)},[]),el=(0,A.useCallback)(()=>{F(!1),z(null)},[]),en=[{href:"/hr/".concat(t,"/payroll"),name:"Payroll",nodeType:"Link"},{href:"/hr/".concat(t,"/payroll/disbursements"),name:"Disbursements",nodeType:"Link"}],ei=[{value:"",label:"All Statuses"},...(0,v.r1)()],er=[{value:"",label:"All Categories"},...(0,v.Lr)()];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B.Z,{title:"".concat((0,u.kC)((0,u.parseUnderScore)(t))," - Disbursements")}),(0,a.jsx)(m.Z,{actions:(0,a.jsxs)(l.Z,{onClick:()=>S(!0),children:[(0,a.jsx)(N.G,{className:"mr-2",icon:w.r8p}),"New Batch"]}),breadcrumbs:en,description:"Pay contractors, invoices and reimbursements outside the normal payroll run",tenantName:t,title:"Disbursements"}),(0,a.jsxs)("main",{className:"container flex flex-col gap-4 mx-auto px-4 md:px-8 lg:px-12 pb-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"bg-white p-3 rounded-xl text-left border flex flex-col gap-2 md:gap-3",children:[(0,a.jsx)(f.Z,{variant:"bodySmall",weight:"font-semibold",children:"Total Batches"}),(0,a.jsx)(f.Z,{size:"text-2xl",weight:"font-semibold",children:String(W.total||X.length||0)})]}),(0,a.jsxs)("div",{className:"bg-white p-3 rounded-xl text-left border flex flex-col gap-2 md:gap-3",children:[(0,a.jsx)(f.Z,{variant:"bodySmall",weight:"font-semibold",children:"Pending Approval"}),(0,a.jsx)(f.Z,{size:"text-2xl",weight:"font-semibold",children:String(X.filter(e=>"pending_approval"===e.status).length)})]}),(0,a.jsxs)("div",{className:"bg-white p-3 rounded-xl text-left border flex flex-col gap-2 md:gap-3",children:[(0,a.jsx)(f.Z,{variant:"bodySmall",weight:"font-semibold",children:"Total Amount"}),(0,a.jsx)(f.Z,{size:"text-2xl",weight:"font-semibold",children:(0,y.x)(X.reduce((e,t)=>e+(t.total_amount||0),0))})]}),(0,a.jsxs)("div",{className:"bg-white p-3 rounded-xl text-left border flex flex-col gap-2 md:gap-3",children:[(0,a.jsx)(f.Z,{variant:"bodySmall",weight:"font-semibold",children:"Completed"}),(0,a.jsx)(f.Z,{size:"text-2xl",weight:"font-semibold",children:String(X.filter(e=>"completed"===e.status).length)})]})]}),(0,a.jsxs)(i.ZP,{children:[(0,a.jsx)(i.Ol,{padding:{y:0},children:(0,a.jsxs)("div",{className:"w-full flex justify-between items-center",children:[(0,a.jsx)(f.Z,{variant:"sectionHeader",children:"Disbursement Batches"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 py-1",children:[(0,a.jsx)(o.P,{name:"status",onChange:e=>{g(e.target.value),d(1)},options:ei,selected:b}),(0,a.jsx)(o.P,{name:"category",onChange:e=>{Z(e.target.value),d(1)},options:er,selected:j})]})]})}),(0,a.jsxs)(i.eW,{padding:0,children:[!!(O||U||C()(X))&&(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)(c.Z,{description:U?"Please try refreshing the page.":"Create a new batch to get started.",design:"wrapped",isError:!!U,isLoading:O,message:U?"Failed to load batches":"No disbursement batches"})}),!!(!O&&!U&&!C()(X))&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.Z,{isFetching:V,children:(0,a.jsx)("div",{className:"flex flex-col",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-4 py-3 text-left",children:(0,a.jsx)(f.Z,{variant:"label",children:"Description"})}),(0,a.jsx)("th",{className:"px-4 py-3 text-left hidden md:table-cell",children:(0,a.jsx)(f.Z,{variant:"label",children:"Category"})}),(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:(0,a.jsx)(f.Z,{variant:"label",children:"Amount"})}),(0,a.jsx)("th",{className:"px-4 py-3 text-center",children:(0,a.jsx)(f.Z,{variant:"label",children:"Status"})}),(0,a.jsx)("th",{className:"px-4 py-3 text-right",children:(0,a.jsx)(f.Z,{variant:"label",children:"Actions"})})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-gray-200",children:X.map(e=>(0,a.jsx)(R,{batch:e,onApprove:Q,onDelete:es,onEdit:$,onProcess:et,onReject:ee,onSubmit:K,onView:M},e.id))})]})})}),W.last_page>1&&(0,a.jsx)("div",{className:"p-4 flex justify-center",children:(0,a.jsx)(p.Z,{currentPage:W.current_page,onPageChange:d,totalPages:W.last_page})})]})]})]})]}),(0,a.jsx)(P.Z,{batch:I,onClose:ea,show:_}),(0,a.jsx)(T.Z,{batch:G,onClose:el,show:q})]})};E.propTypes={tenantName:S().string.isRequired},E.getInitialProps=async e=>{let{tenant:t}=e.query;return{tenantName:t}},t.default=(0,j.withAuthSync)((0,I.Z)(E))},17047:function(e,t,s){"use strict";var a=s(52322),l=s(2784),n=s(94217);s(56486);var i=s(47023),r=s(59578),c=s(42369),o=s(76467);let d=e=>{let{onClose:t,handler:s,preOnCloseFn:n,title:d,message:u,details:x,confirmButtonText:h,cancelButtonText:m,initialIsLoading:p,suppressRecording:b}=e,[g,f]=(0,l.useState)(!1),j=p||g,y=(0,l.useCallback)(async()=>{f(!0);try{await s(),n(),t()}catch(e){f(!1),(0,r.N2)(e,"ConfirmDialogContent")}},[s,n,t]),v=(0,l.useCallback)(()=>{g||(n(),t())},[g,n,t]);return(0,a.jsxs)("div",{className:"confirm-dialog flex flex-col bg-white py-3 px-3 sm:py-4 sm:px-4 roun
1ded shadow-sm relative".concat(b?" ".concat("fs-exclude"):""),"data-hj-suppress":b||void 0,"data-hs-do-not-collect":b?"true":void 0,children:[!!j&&(0,a.jsx)(c.J,{fixed:!1,size:"sm"}),(0,a.jsx)("div",{className:"w-full border-gray-200",children:(0,a.jsx)(o.Z,{className:"leading-none",variant:"heading5",children:d})}),(0,a.jsx)("hr",{className:"-mx-3 sm:-mx-4 my-2 sm:my-3"}),(0,a.jsxs)("div",{className:"w-full py-2",children:[(0,a.jsx)(o.Z,{variant:"body",children:u}),!!x&&(0,a.jsx)(o.Z,{className:"mt-2 break-all",color:"text-gray-600",variant:"caption",children:x})]}),(0,a.jsx)("hr",{className:"-mx-3 sm:-mx-4 my-2 sm:my-3"}),(0,a.jsxs)("div",{className:"w-full flex flex-col-reverse sm:flex-row sm:justify-between gap-2 border-gray-200",children:[(0,a.jsx)(i.Z,{className:"w-full sm:w-auto",design:"secondary",disabled:g,onClick:v,children:m}),(0,a.jsx)(i.Z,{className:"w-full sm:w-auto",design:"primary",disabled:g,isLoading:g,onClick:y,children:h})]})]})};t.Z=e=>{let{handler:t,preOnCloseFn:s=()=>{},title:l="Are you sure?",message:i="It may not be possible to undo this action. Are you sure you want to proceed?",details:r="",confirmButtonText:c="Yes, Proceed.",cancelButtonText:o="No, Let me check.",canExit:u=!0,isLoading:x=!1,suppressRecording:h=!1}=e;(0,n._1)({closeOnEscape:u,closeOnClickOutside:u,customUI:e=>{let{onClose:n}=e;return(0,a.jsx)(d,{cancelButtonText:o,confirmButtonText:c,details:r,handler:t,initialIsLoading:x,message:i,onClose:n,preOnCloseFn:s,suppressRecording:h,title:l})}})}}},function(e){e.O(0,[4976,5351,9603,6383,1985,9436,9400,889,974,2370,2790,2888,9774,179],function(){return e(e.s=85350)}),_N_E=e.O()}]);

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.