(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,46981,e=>{"use strict";var t=e.i(843476),a=e.i(522016),s=e.i(271645),l=e.i(618566),n=e.i(970065),c=e.i(167881),r=e.i(23750),d=e.i(62870),i=e.i(270598),o=e.i(272944),u=e.i(551956);e.s(["default",0,function(){let e=(0,l.useRouter)(),m=(0,s.useMemo)(()=>(0,o.getApiService)(),[]),{success:x,error:h}=(0,i.useToast)(),[p,y]=(0,s.useState)([]),[j,g]=(0,s.useState)([]),[v,S]=(0,s.useState)(!1),[f,b]=(0,s.useState)({employeeId:"",accountId:"",paymentDate:new Date().toISOString().split("T")[0],amount:0,notes:""});(0,s.useEffect)(()=>{(async()=>{let[e,t]=await Promise.all([m.listEmployees({pageSize:200}),m.listAccounts({pageSize:200})]);e.success&&e.data&&y(e.data.results||[]),t.success&&t.data&&g(t.data.results||[])})()},[m]);let N=async t=>{if(t.preventDefault(),!f.employeeId||!f.accountId)return void h("Employee and account are required");if(!f.amount||f.amount<=0)return void h("Amount must be greater than 0");S(!0);let a={employeeId:f.employeeId,accountId:f.accountId,paymentDate:f.paymentDate,amount:Number(f.amount),notes:f.notes.trim()||void 0},s=await m.createSalaryPayment(a);s.success?(x("Salary payment recorded"),e.push("/accounts/salaries")):h("Failed to record salary payment",s.error),S(!1)};return(0,t.jsxs)("div",{className:"flex-1 space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Record Salary Payment"}),(0,t.jsx)("p",{className:"text-muted-foreground mt-2",children:"Log employee salary payment details"})]}),(0,t.jsx)(a.default,{href:"/accounts/salaries",children:(0,t.jsx)(c.Button,{variant:"outline",children:"Back"})})]}),(0,t.jsxs)(n.Card,{className:"bg-card border-border",children:[(0,t.jsx)(n.CardHeader,{children:(0,t.jsx)(n.CardTitle,{children:"Payment Details"})}),(0,t.jsx)(n.CardContent,{children:(0,t.jsxs)("form",{onSubmit:N,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:"Employee"}),(0,t.jsxs)(d.Select,{value:f.employeeId,onValueChange:e=>b(t=>({...t,employeeId:e})),children:[(0,t.jsx)(d.SelectTrigger,{className:"mt-2",children:(0,t.jsx)(d.SelectValue,{placeholder:"Select employee"})}),(0,t.jsx)(d.SelectContent,{children:p.map(e=>(0,t.jsx)(d.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:"Pay From Account"}),(0,t.jsxs)(d.Select,{value:f.accountId,onValueChange:e=>b(t=>({...t,accountId:e})),children:[(0,t.jsx)(d.SelectTrigger,{className:"mt-2",children:(0,t.jsx)(d.SelectValue,{placeholder:"Select account"})}),(0,t.jsx)(d.SelectContent,{children:j.map(e=>(0,t.jsxs)(d.SelectItem,{value:e.id,children:[e.name," (",e.type,")"]},e.id))})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:"Payment Date"}),(0,t.jsx)(r.Input,{type:"date",value:f.paymentDate,onChange:e=>b(t=>({...t,paymentDate:e.target.value})),className:"mt-2"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"text-sm text-muted-foreground",children:["Amount (",u.config.locale.currencySymbol,")"]}),(0,t.jsx)(r.Input,{type:"number",value:f.amount,onChange:e=>b(t=>({...t,amount:Number(e.target.value)})),className:"mt-2"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:"Notes"}),(0,t.jsx)(r.Input,{value:f.notes,onChange:e=>b(t=>({...t,notes:e.target.value})),className:"mt-2"})]}),(0,t.jsxs)("div",{className:"flex gap-3 justify-end",children:[(0,t.jsx)(c.Button,{type:"button",variant:"outline",onClick:()=>e.back(),children:"Cancel"}),(0,t.jsx)(c.Button,{type:"submit",disabled:v,children:v?"Saving...":"Record Payment"})]})]})})]})]})}])}]);