PageSourceSearch

https://superkoopjes.be/assets/AdminPayouts-C3NSqGSU.js

js superkoopjes.be collected 2026-10-02 01:18:50 UTC 61,085 bytes, 15 lines download raw bytes

1import{a_ as at,aY as Ce,a$ as Ie,s as T,t as re,bI as De,j as e,aK as Fe,aL as Re,aM as Me,aN as Ae,cT as xt,ai as Pe,bn as _t,G as $e,O as We,E as Ze,a0 as Xe,D as ne,r as se,C as pe,e as fe,f as _e,B as H,P as jt,d as ge,T as yt,M as vt,k as W,I as je,ao as Ve,ap as Ke,aq as He,ar as Ge,as as he,aO as Ye,aP as Ue,d1 as bt,d2 as wt,bp as ut,bq as ht,br as Oe,bs as qe,b1 as Qe,Q as kt,bG as lt,at as Nt,aw as St,ax as Ct,F as It,ay as Dt,aB as ot,N as Et}from"./index-C-GMF1w8.js";import{T as et,a as tt,b as ke,c as Y,d as st,e as K}from"./table-DAJQRSYQ.js";import{T as mt}from"./textarea-D7e56OfZ.js";import{u as ze,w as Tt}from"./xlsx-DjuO7_Ju.js";import{f as Ne}from"./format-X9aLhBQp.js";import{C as Ft}from"./calendar-b8oTkxu5.js";import{U as Rt}from"./upload-B3ibASZs.js";import{L as ct}from"./link-DPkKlVTa.js";import{F as nt}from"./file-spreadsheet-Bcp8RF2i.js";import{H as Mt}from"./history-DMmoKOpj.js";function pt(){const d=at(),{data:Z,isLoading:B}=Ce({queryKey:["seller-payouts"],queryFn:async()=>{const{data:u,error:r}=await T.from("seller_payouts").select("*").order("created_at",{ascending:!1});if(r)throw r;return u}}),{data:g,isLoading:P}=Ce({queryKey:["pending-escrow-holds"],queryFn:async()=>{const{data:u,error:r}=await T.from("escrow_holds").select("*").eq("status","released").is("payout_batch_id",null).is("paid_out_at",null).order("released_at",{ascending:!0});if(r)throw r;return u}}),y=Ie({mutationFn:async u=>{const{data:r,error:S}=await T.rpc("generate_payout_batch_number");if(S)throw S;const{data:c,error:x}=await T.from("seller_payouts").insert({seller_id:u.sellerId,batch_number:r,total_amount:u.totalAmount,bank_iban:u.bankIban,bank_bic:u.bankBic,bank_account_holder:u.bankAccountHolder,items_count:u.escrowIds.length,status:"pending"}).select().single();if(x)throw x;const{error:A}=await T.from("escrow_holds").update({payout_batch_id:c.id}).in("id",u.escrowIds);if(A)throw A;const{data:a}=await T.from("profiles").select("first_name, last_name, email, preferred_language").eq("id",u.sellerId).single();if(a!=null&&a.email){const{data:j}=await T.from("notification_preferences").select("email_payout_ready").eq("user_id",u.sellerId).maybeSingle();if((j==null?void 0:j.email_payout_ready)!==!1){const C=`${a.first_name||""} ${a.last_name||""}`.trim()||"Verkoper",_=u.bankIban.slice(-4);await T.functions.invoke("send-email",{body:{type:"payout_batch_ready",to:a.email,language:a.preferred_language||"nl",data:{sellerName:C,batchNumber:r,totalAmount:u.totalAmount,currency:"€",itemsCount:u.escrowIds.length,bankAccountLast4:_,appUrl:window.location.origin}}}).catch(G=>{console.error("Failed to send payout ready email:",G)})}}return c},onSuccess:()=>{d.invalidateQueries({queryKey:["seller-payouts"]}),d.invalidateQueries({queryKey:["pending-escrow-holds"]}),re.success("Payout batch created successfully")},onError:u=>{re.error("Failed to create payout batch: "+u.message)}}),N=async u=>{const{data:r,error:S}=await T.from("seller_payout_history").select("*").eq("payout_id",u).order("created_at",{ascending:!1});if(S)throw S;return r||[]},F=Ie({mutationFn:async u=>{var A,a;const{data:r}=await T.from("seller_payouts").select("status").eq("id",u.payoutId).single(),S={status:u.status,updated_at:new Date().toISOString()};if(u.notes&&(S.notes=u.notes),u.status==="completed"){S.paid_at=new Date().toISOString();const{data:j}=await T.from("seller_payouts").select("id").eq("id",u.payoutId).single();j&&await T.from("escrow_holds").update({paid_out_at:new Date().toISOString()}).eq("payout_batch_id",u.payoutId)}const{data:c,error:x}=await T.from("seller_payouts").update(S).eq("id",u.payoutId).select().single();if(x)throw x;if(c){const{data:j}=await T.auth.getUser();await T.from("seller_payout_history").insert({payout_id:u.payoutId,previous_status:(r==null?void 0:r.status)||null,new_status:u.status,changed_by:((A=j==null?void 0:j.user)==null?void 0:A.id)||null,notes:u.notes||null})}if(c){const{data:j}=await T.from("profiles").select("first_name, last_name, email, preferred_language").eq("id",c.seller_id).single();if(j!=null&&j.email){const C=`${j.first_name||""} ${j.last_name||""}`.trim()||"Verkoper",_=((a=c.bank_iban)==null?void 0:a.slice(-4))||"****";let G=null,X=null,U={sellerName:C,batchNumber:c.batch_number,totalAmount:c.total_amount,currency:"€",itemsCount:c.items_count,appUrl:window.location.origin};if(u.status==="completed"?(G="payout_batch_completed",X="email_payout_completed",U.bankAccountLast4=_,U.completedAt=c.paid_at):u.status==="failed"?(G="payout_batch_failed",X="email_payout_failed",U.bankAccountLast4=_,U.failureReason=u.notes,U.failedAt=c.updated_at):u.status==="cancelled"&&(G="payout_batch_cancelled",X="email_payout_cancelled",U.cancellationReason=u.notes,U.cancelledAt=c.updated_at),G&&X){const{data:de}=await T.from("notification_preferences").select(X).eq("user_id",c.seller_id).maybeSingle();(de==null?void 0:de[X])!==!1&&await T.functions.invoke("send-email",{body:{type:G,to:j.email,language:j.preferred_language||"nl",data:U}}).catch(oe=>{console.error(`Failed to send ${G} email:`,oe)})}}}return c},onSuccess:()=>{d.invalidateQueries({queryKey:["seller-payouts"]}),d.invalidateQueries({queryKey:["pending-escrow-holds"]}),re.success("Payout status updated")},onError:u=>{re.error("Failed to update payout: "+u.message)}});return{payouts:Z,payoutsLoading:B,pendingEscrows:g,escrowsLoading:P,createPayoutBatch:y.mutate,isCreatingBatch:y.isPending,updatePayoutStatus:F.mutate,isUpdatingStatus:F.isPending,fetchPayoutHistory:N}}const At=d=>({pending:"In afwachting",processing:"In behandeling",completed:"Voltooid",failed:"Mislukt",cancelled:"Geannuleerd"})[d]||d,ft=d=>({"Batch Nummer":d.batch_number,Rekeninghouder:d.bank_account_holder,IBAN:d.bank_iban,BIC:d.bank_bic||"","Bedrag (€)":Number(d.total_amount).toFixed(2),"Aantal Items":d.items_count,Status:At(d.status),Aangemaakt:Ne(new Date(d.created_at),"dd-MM-yyyy HH:mm",{locale:De}),Bijgewerkt:Ne(new Date(d.updated_at),"dd-MM-yyyy HH:mm",{locale:De}),Notities:d.notes||""}),Ot=(d,Z)=>{const B=d.map(ft),g=ze.json_to_sheet(B),P=ze.sheet_to_csv(g),y=new Blob([P],{type:"text/csv;charset=utf-8;"}),N=document.createElement("a"),F=URL.createObjectURL(y);N.setAttribute("href",F),N.setAttribute("download",`uitbetalingen_${Ne(new Date,"yyyy-MM-dd")}.csv`),N.style.visibility="hidden",document.body.appendChild(N),N.click(),document.body.removeChild(N)},qt=(d,Z)=>{const B=d.map(ft),g=ze.json_to_sheet(B),P=50,y=Object.keys(B[0]||{}).map(F=>({wch:Math.min(P,Math.max(F.length,...B.map(u=>String(u[F]||"").length)))}));g["!cols"]=y;const N=ze.book_new();ze.book_append_sheet(N,g,"Uitbetalingen"),Tt(N,`uitbetalingen_${Ne(new Date,"yyyy-MM-dd")}.xlsx`)};function Lt({open:d,onOpenChange:Z,payoutId:B,batchNumber:g,history:P,isLoading:y}){const N=r=>
1{switch(r){case"pending":return e.jsx($e,{className:"w-4 h-4 text-muted-foreground"});case"processing":return e.jsx(Xe,{className:"w-4 h-4 text-primary"});case"completed":return e.jsx(Ze,{className:"w-4 h-4 text-green-500"});case"failed":return e.jsx(We,{className:"w-4 h-4 text-destructive"});case"cancelled":return e.jsx(We,{className:"w-4 h-4 text-muted-foreground"});default:return e.jsx($e,{className:"w-4 h-4"})}},F=r=>{switch(r){case"pending":return"In afwachting";case"processing":return"In behandeling";case"completed":return"Voltooid";case"failed":return"Mislukt";case"cancelled":return"Geannuleerd";default:return r}},u=r=>{switch(r){case"pending":return e.jsx(ne,{variant:"secondary",children:F(r)});case"processing":return e.jsx(ne,{variant:"default",children:F(r)});case"completed":return e.jsx(ne,{variant:"default",className:"bg-green-500",children:F(r)});case"failed":return e.jsx(ne,{variant:"destructive",children:F(r)});case"cancelled":return e.jsx(ne,{variant:"outline",children:F(r)});default:return e.jsx(ne,{children:r})}};return e.jsx(Fe,{open:d,onOpenChange:Z,children:e.jsxs(Re,{className:"max-w-2xl",children:[e.jsxs(Me,{children:[e.jsx(Ae,{children:"Uitbetalings Geschiedenis"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Batch: ",g]})]}),e.jsx(xt,{className:"max-h-[500px] pr-4",children:y?e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((r,S)=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx(Pe,{className:"h-10 w-10 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Pe,{className:"h-4 w-32"}),e.jsx(Pe,{className:"h-4 w-full"})]})]},S))}):!P||P.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Geen geschiedenis beschikbaar"}):e.jsx("div",{className:"space-y-6",children:P.map((r,S)=>e.jsxs("div",{className:"relative flex gap-4",children:[S<P.length-1&&e.jsx("div",{className:"absolute left-5 top-10 bottom-0 w-0.5 bg-border"}),e.jsx("div",{className:"relative flex-shrink-0",children:e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border-2 border-border bg-background",children:N(r.new_status)})}),e.jsxs("div",{className:"flex-1 space-y-2 pb-4",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r.previous_status?e.jsxs(e.Fragment,{children:[u(r.previous_status),e.jsx("span",{className:"text-muted-foreground",children:"→"}),u(r.new_status)]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),u(r.new_status)]})}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Ne(new Date(r.created_at),"dd MMM yyyy - HH:mm",{locale:De})}),r.admin_email&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(_t,{className:"w-3 h-3"}),e.jsx("span",{children:r.admin_email})]}),r.notes&&e.jsxs("div",{className:"mt-2 rounded-md bg-muted p-3 text-sm",children:[e.jsx("p",{className:"font-medium mb-1",children:"Notities:"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.notes})]})]})]},r.id))})})]})})}function Bt(){const d=at(),[Z,B]=se.useState(!1),[g,P]=se.useState(null),[y,N]=se.useState({schedule_name:"",frequency:"weekly",day_of_week:1,day_of_month:1,time_of_day:"09:00",recipient_emails:"",include_pending_actions:!0,include_statistics:!0,is_active:!0}),{data:F,isLoading:u}=Ce({queryKey:["payout-report-schedules"],queryFn:async()=>{const{data:a,error:j}=await T.from("payout_report_schedules").select("*").order("created_at",{ascending:!1});if(j)throw j;return a}}),r=Ie({mutationFn:async a=>{const j=a.recipient_emails.split(",").map(_=>_.trim()).filter(_=>_),C={schedule_name:a.schedule_name,frequency:a.frequency,day_of_week:a.frequency==="weekly"?a.day_of_week:null,day_of_month:a.frequency==="monthly"?a.day_of_month:null,time_of_day:a.time_of_day,recipient_emails:j,include_pending_actions:a.include_pending_actions,include_statistics:a.include_statistics,is_active:a.is_active};if(g){const{error:_}=await T.from("payout_report_schedules").update(C).eq("id",g.id);if(_)throw _}else{const{error:_}=await T.from("payout_report_schedules").insert(C);if(_)throw _}},onSuccess:()=>{d.invalidateQueries({queryKey:["payout-report-schedules"]}),re.success(g?"Schema bijgewerkt":"Schema aangemaakt"),B(!1),c()},onError:a=>{re.error("Fout: "+a.message)}}),S=Ie({mutationFn:async a=>{const{error:j}=await T.from("payout_report_schedules").delete().eq("id",a);if(j)throw j},onSuccess:()=>{d.invalidateQueries({queryKey:["payout-report-schedules"]}),re.success("Schema verwijderd")},onError:a=>{re.error("Fout: "+a.message)}}),c=()=>{N({schedule_name:"",frequency:"weekly",day_of_week:1,day_of_month:1,time_of_day:"09:00",recipient_emails:"",include_pending_actions:!0,include_statistics:!0,is_active:!0}),P(null)},x=a=>{P(a),N({schedule_name:a.schedule_name,frequency:a.frequency,day_of_week:a.day_of_week||1,day_of_month:a.day_of_month||1,time_of_day:a.time_of_day,recipient_emails:a.recipient_emails.join(", "),include_pending_actions:a.include_pending_actions,include_statistics:a.include_statistics,is_active:a.is_active}),B(!0)},A=a=>["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"][a];return e.jsxs(pe,{children:[e.jsxs(fe,{className:"flex flex-row items-center justify-between",children:[e.jsxs(_e,{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"w-5 h-5"}),"Geplande Rapporten"]}),e.jsxs(H,{onClick:()=>{c(),B(!0)},children:[e.jsx(jt,{className:"w-4 h-4 mr-2"}),"Nieuw Schema"]})]}),e.jsx(ge,{children:u?e.jsx("p",{className:"text-muted-foreground",children:"Laden..."}):F&&F.length>0?e.jsx("div",{className:"space-y-4",children:F.map(a=>e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:a.schedule_name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.frequency==="weekly"?`Elke ${A(
1a.day_of_week)} om ${a.time_of_day}`:`Maandelijks op dag ${a.day_of_month} om ${a.time_of_day}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{variant:a.is_active?"default":"secondary",children:a.is_active?"Actief":"Inactief"}),e.jsx(H,{variant:"ghost",size:"sm",onClick:()=>x(a),children:"Bewerken"}),e.jsx(H,{variant:"ghost",size:"sm",onClick:()=>S.mutate(a.id),children:e.jsx(yt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:[a.recipient_emails.length," ontvanger(s)"]})]}),a.last_sent_at&&e.jsxs("span",{className:"text-muted-foreground",children:["Laatst verzonden: ",new Date(a.last_sent_at).toLocaleDateString("nl-NL")]})]})]},a.id))}):e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"Geen geplande rapporten. Maak uw eerste schema aan."})}),e.jsx(Fe,{open:Z,onOpenChange:B,children:e.jsxs(Re,{className:"max-w-2xl",children:[e.jsx(Me,{children:e.jsx(Ae,{children:g?"Schema Bewerken":"Nieuw Rapport Schema"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"schedule_name",children:"Schema Naam"}),e.jsx(je,{id:"schedule_name",value:y.schedule_name,onChange:a=>N({...y,schedule_name:a.target.value}),placeholder:"Bijv. Wekelijks Uitbetalingsrapport"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Frequentie"}),e.jsxs(Ve,{value:y.frequency,onValueChange:a=>N({...y,frequency:a}),children:[e.jsx(Ke,{children:e.jsx(He,{})}),e.jsxs(Ge,{children:[e.jsx(he,{value:"weekly",children:"Wekelijks"}),e.jsx(he,{value:"monthly",children:"Maandelijks"})]})]})]}),y.frequency==="weekly"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Dag van de Week"}),e.jsxs(Ve,{value:y.day_of_week.toString(),onValueChange:a=>N({...y,day_of_week:parseInt(a)}),children:[e.jsx(Ke,{children:e.jsx(He,{})}),e.jsx(Ge,{children:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"].map((a,j)=>e.jsx(he,{value:j.toString(),children:a},j))})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Dag van de Maand"}),e.jsx(je,{type:"number",min:"1",max:"31",value:y.day_of_month,onChange:a=>N({...y,day_of_month:parseInt(a.target.value)})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Tijdstip"}),e.jsx(je,{type:"time",value:y.time_of_day,onChange:a=>N({...y,time_of_day:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Ontvangers (comma-gescheiden emails)"}),e.jsx(je,{value:y.recipient_emails,onChange:a=>N({...y,recipient_emails:a.target.value}),placeholder:"[email protected], [email protected]"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(W,{htmlFor:"include_stats",children:"Inclusief Statistieken"}),e.jsx(Ye,{id:"include_stats",checked:y.include_statistics,onCheckedChange:a=>N({...y,include_statistics:a})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(W,{htmlFor:"include_actions",children:"Inclusief Vereiste Acties"}),e.jsx(Ye,{id:"include_actions",checked:y.include_pending_actions,onCheckedChange:a=>N({...y,include_pending_actions:a})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(W,{htmlFor:"is_active",children:"Actief"}),e.jsx(Ye,{id:"is_active",checked:y.is_active,onCheckedChange:a=>N({...y,is_active:a})})]})]})]}),e.jsxs(Ue,{children:[e.jsx(H,{variant:"outline",onClick:()=>B(!1),children:"Annuleren"}),e.jsx(H,{onClick:()=>r.mutate(y),disabled:r.isPending,children:g?"Bijwerken":"Aanmaken"})]})]})})]})}function Pt(){const d=at(),{data:Z,isLoading:B}=Ce({queryKey:["bank-transactions"],queryFn:async()=>{const{data:c,error:x}=await T.from("bank_transactions").select("*").order("transaction_date",{ascending:!1});if(x)throw x;return c}}),{data:g,isLoading:P}=Ce({queryKey:["reconciliation-discrepancies"],queryFn:async()=>{const{data:c,error:x}=await T.from("payout_reconciliation_discrepancies").select("*").order("created_at",{ascending:!1});if(x)throw x;return c}}),{data:y,isLoading:N}=Ce({queryKey:["bank-statement-imports"],queryFn:async()=>{const{data:c,error:x}=await T.from("bank_statement_imports").select("*").order("imported_at",{ascending:!1});if(x)throw x;return c}}),F=Ie({mutationFn:async c=>{const x=crypto.randomUUID(),{data:A,error:a}=await T.from("bank_statement_imports").insert({id:x,import_name:c.importName,file_name:c.fileName,statement_date_from:c.dateFrom,statement_date_to:c.dateTo,total_transactions:c.transactions.length}).select().single();if(a)throw a;const j=c.transactions.map(_=>({..._,import_batch_id:x,currency:"EUR"})),{error:C}=await T.from("bank_transactions").insert(j);if(C)throw C;return await u(),A},onSuccess:()=>{d.invalidateQueries({queryKey:["bank-transactions"]}),d.invalidateQueries({queryKey:["bank-statement-imports"]}),d.invalidateQueries({queryKey:["reconciliation-discrepancies"]}),re.success("Bank transacties geïmporteerd en gematcht")},onError:c=>{re.error("Import mislukt: "+c.message)}}),u=async()=>{const{data:c}
1=await T.from("bank_transactions").select("*").eq("status","pending"),{data:x}=await T.from("seller_payouts").select("*").eq("status","completed");if(!c||!x)return;const A=[],a=[];for(const _ of c){const G=x.filter(X=>{const U=Math.abs(Number(X.total_amount)-_.amount)<.01,de=new Date(_.transaction_date),oe=new Date(X.paid_at),R=Math.abs((de.getTime()-oe.getTime())/(1e3*60*60*24));return U&&R<=3});G.length===1?A.push({transactionId:_.id,payoutId:G[0].id}):G.length>1&&a.push({discrepancy_type:"duplicate",severity:"medium",transaction_id:_.id,description:`Meerdere uitbetalingen gevonden voor transactie ${_.transaction_reference}`})}for(const _ of A)await T.from("bank_transactions").update({status:"matched",matched_payout_id:_.payoutId,matched_at:new Date().toISOString()}).eq("id",_.transactionId);a.length>0&&await T.from("payout_reconciliation_discrepancies").insert(a);const j=A.map(_=>_.payoutId),C=x.filter(_=>!j.includes(_.id));for(const _ of C)await T.from("payout_reconciliation_discrepancies").insert({discrepancy_type:"missing_transaction",severity:"high",payout_id:_.id,expected_amount:Number(_.total_amount),description:`Geen banktransactie gevonden voor uitbetaling ${_.batch_number}`})},r=Ie({mutationFn:async c=>{const{error:x}=await T.from("bank_transactions").update({status:"matched",matched_payout_id:c.payoutId,matched_at:new Date().toISOString()}).eq("id",c.transactionId);if(x)throw x},onSuccess:()=>{d.invalidateQueries({queryKey:["bank-transactions"]}),d.invalidateQueries({queryKey:["reconciliation-discrepancies"]}),re.success("Transactie manueel gematcht")},onError:c=>{re.error("Matching mislukt: "+c.message)}}),S=Ie({mutationFn:async c=>{const{error:x}=await T.from("payout_reconciliation_discrepancies").update({resolution_status:c.status,resolved_at:c.status!=="investigating"?new Date().toISOString():null,resolution_notes:c.notes}).eq("id",c.discrepancyId);if(x)throw x},onSuccess:()=>{d.invalidateQueries({queryKey:["reconciliation-discrepancies"]}),re.success("Discrepantie bijgewerkt")},onError:c=>{re.error("Update mislukt: "+c.message)}});return{transactions:Z,transactionsLoading:B,discrepancies:g,discrepanciesLoading:P,imports:y,importsLoading:N,importTransactions:F.mutate,isImporting:F.isPending,manualMatch:r.mutate,isMatching:r.isPending,resolveDiscrepancy:S.mutate,isResolving:S.isPending}}var gt={exports:{}};/* @license
2Papa Parse
3v5.5.3
4https://github.com/mholt/PapaParse
5License: MIT
6*/(function(d,Z){((B,g)=>{d.exports=g()})(bt,function B(){var g=typeof self<"u"?self:typeof window<"u"?window:g!==void 0?g:{},P,y=!g.document&&!!g.postMessage,N=g.IS_PAPA_WORKER||!1,F={},u=0,r={};function S(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(s){var i=de(s);i.chunkSize=parseInt(i.chunkSize),s.step||s.chunk||(i.chunkSize=null),this._handle=new j(i),(this._handle.streamer=this)._config=i}).call(this,t),this.parseChunk=function(s,i){var o=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<o){let p=this._config.newline;p||(n=this._config.quoteChar||'"',p=this._handle.guessLineEndings(s,n)),s=[...s.split(p).slice(o)].join(p)}this.isFirstChunk&&R(this._config.beforeFirstChunk)&&(n=this._config.beforeFirstChunk(s))!==void 0&&(s=n),this.isFirstChunk=!1,this._halted=!1;var o=this._partialLine+s,n=(this._partialLine="",this._handle.parse(o,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(s=n.meta.cursor,o=(this._finished||(this._partialLine=o.substring(s-this._baseIndex),this._baseIndex=s),n&&n.data&&(this._rowCount+=n.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),N)g.postMessage({results:n,workerId:r.WORKER_ID,finished:o});else if(R(this._config.chunk)&&!i){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!o||!R(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),o||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(s){R(this._config.error)?this._config.error(s):N&&this._config.error&&g.postMessage({workerId:r.WORKER_ID,error:s,finished:!1})}}function c(t){var s;(t=t||{}).chunkSize||(t.chunkSize=r.RemoteChunkSize),S.call(this,t),this._nextChunk=y?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(i){this._input=i,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(s=new XMLHttpRequest,this._config.withCredentials&&(s.withCredentials=this._config.withCredentials),y||(s.onload=oe(this._chunkLoaded,this),s.onerror=oe(this._chunkError,this)),s.open(this._config.downloadRequestBody?"POST":"GET",this._input,!y),this._config.downloadRequestHeaders){var i,o=this._config.downloadRequestHeaders;for(i in o)s.setRequestHeader(i,o[i])}var n;this._config.chunkSize&&(n=this._start+this._config.chunkSize-1,s.setRequestHeader("Range","bytes="+this._start+"-"+n));try{s.send(this._config.downloadRequestBody)}catch(p){this._chunkError(p.message)}y&&s.status===0&&this._chunkError()}},this._chunkLoaded=function(){s.readyState===4&&(s.status<200||400<=s.status?this._chunkError():(this._start+=this._config.chunkSize||s.responseText.length,this._finished=!this._config.chunkSize||this._start>=(i=>(i=i.getResponseHeader("Content-Range"))!==null?parseInt(i.substring(i.lastIndexOf("/")+1)):-1)(s),this.parseChunk(s.responseText)))},this._chunkError=function(i){i=s.statusText||i,this._sendError(new Error(i))}}function x(t){(t=t||{}).chunkSize||(t.chunkSize=r.LocalChunkSize),S.call(this,t);var s,i,o=typeof FileReader<"u";this.stream=function(n){this._input=n,i=n.slice||n.webkitSlice||n.mozSlice,o?((s=new FileReader).onload=oe(this._chunkLoaded,this),s.onerror=oe(this._chunkError,this)):s=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var n=this._input,p=(this._config.chunkSize&&(p=Math.min(this._start+this._config.chunkSize,this._input.size),n=i.call(n,this._start,p)),s.readAsText(n,this._config.encoding));o||this._chunkLoaded({target:{result:p}})},this._chunkLoaded=function(n){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(s.error)}}function A(t){var s;S.call(this,t=t||{}),this.stream=function(i){return s=i,this._nextChunk()},this._nextChunk=function(){var i,o;if(!this._finished)return i=this._config.chunkSize,s=i?(o=s.substring(0,i),s.substring(i)):(o=s,""),this._finished=!s,this.parseChunk(o)}}function a(t){S.call(this,t=t||{});var s=[],i=!0,o=!1;this.pause=function(){S.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){S.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){o&&s.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),s.length?this.parseChunk(s.shift()):i=!0},this._streamData=oe(function(n){try{s.push(typeof n=="string"?n:n.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(s.shift()))}catch(p){this._streamError(p)}},this),this._streamError=oe(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=oe(function(){this._streamCleanUp(),o=!0,this._streamData("")},this),this._streamCleanUp=oe(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function j(t){var s,i,o,n,p=Math.pow(2,53),m=-p,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,z=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,w=this,O=0,f=0,ae=!1,b=!1,I=[],h={data:[],errors:[],meta:{}};
vendor: 10,952 bytes, lines 6-14
6function ee(D){return t.skipEmptyLines==="greedy"?D.join("").trim()==="":D.length===1&&D[0].length===0}function J(){if(h&&o&&(me("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+r.DefaultDelimiter+"'"),o=!1),t.skipEmptyLines&&(h.data=h.data.filter(function(v){return!ee(v)})),le()){let v=function($,te){R(t.transformHeader)&&($=t.transformHeader($,te)),I.push($)};if(h)if(Array.isArray(h.data[0])){for(var D=0;le()&&D<h.data.length;D++)h.data[D].forEach(v);h.data.splice(0,1)}else h.data.forEach(v)}function M(v,$){for(var te=t.header?{}:[],q=0;q<v.length;q++){var L=q,E=v[q],E=((xe,k)=>(V=>(t.dynamicTypingFunction&&t.dynamicTyping[V]===void 0&&(t.dynamicTyping[V]=t.dynamicTypingFunction(V)),(t.dynamicTyping[V]||t.dynamicTyping)===!0))(xe)?k==="true"||k==="TRUE"||k!=="false"&&k!=="FALSE"&&((V=>{if(l.test(V)&&(V=parseFloat(V),m<V&&V<p))return 1})(k)?parseFloat(k):z.test(k)?new Date(k):k===""?null:k):k)(L=t.header?q>=I.length?"__parsed_extra":I[q]:L,E=t.transform?t.transform(E,L):E);L==="__parsed_extra"?(te[L]=te[L]||[],te[L].push(E)):te[L]=E}return t.header&&(q>I.length?me("FieldMismatch","TooManyFields","Too many fields: expected "+I.length+" fields but parsed "+q,f+$):q<I.length&&me("FieldMismatch","TooFewFields","Too few fields: expected "+I.length+" fields but parsed "+q,f+$)),te}var Q;h&&(t.header||t.dynamicTyping||t.transform)&&(Q=1,!h.data.length||Array.isArray(h.data[0])?(h.data=h.data.map(M),Q=h.data.length):h.data=M(h.data,0),t.header&&h.meta&&(h.meta.fields=I),f+=Q)}function le(){return t.header&&I.length===0}function me(D,M,Q,v){D={type:D,code:M,message:Q},v!==void 0&&(D.row=v),h.errors.push(D)}R(t.step)&&(n=t.step,t.step=function(D){h=D,le()?J():(J(),h.data.length!==0&&(O+=D.data.length,t.preview&&O>t.preview?i.abort():(h.data=h.data[0],n(h,w))))}),this.parse=function(D,M,Q){var v=t.quoteChar||'"',v=(t.newline||(t.newline=this.guessLineEndings(D,v)),o=!1,t.delimiter?R(t.delimiter)&&(t.delimiter=t.delimiter(D),h.meta.delimiter=t.delimiter):((v=(($,te,q,L,E)=>{var xe,k,V,Se;E=E||[",","	","|",";",r.RECORD_SEP,r.UNIT_SEP];for(var Ee=0;Ee<E.length;Ee++){for(var ye,Le=E[Ee],ce=0,ve=0,ie=0,ue=(V=void 0,new _({comments:L,delimiter:Le,newline:te,preview:10}).parse($)),we=0;we<ue.data.length;we++)q&&ee(ue.data[we])?ie++:(ye=ue.data[we].length,ve+=ye,V===void 0?V=ye:0<ye&&(ce+=Math.abs(ye-V),V=ye));0<ue.data.length&&(ve/=ue.data.length-ie),(k===void 0||ce<=k)&&(Se===void 0||Se<ve)&&1.99<ve&&(k=ce,xe=Le,Se=ve)}return{successful:!!(t.delimiter=xe),bestDelimiter:xe}})(D,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=v.bestDelimiter:(o=!0,t.delimiter=r.DefaultDelimiter),h.meta.delimiter=t.delimiter),de(t));return t.preview&&t.header&&v.preview++,s=D,i=new _(v),h=i.parse(s,M,Q),J(),ae?{meta:{paused:!0}}:h||{meta:{paused:!1}}},this.paused=function(){return ae},this.pause=function(){ae=!0,i.abort(),s=R(t.chunk)?"":s.substring(i.getCharIndex())},this.resume=function(){w.streamer._halted?(ae=!1,w.streamer.parseChunk(s,!0)):setTimeout(w.resume,3)},this.aborted=function(){return b},this.abort=function(){b=!0,i.abort(),h.meta.aborted=!0,R(t.complete)&&t.complete(h),s=""},this.guessLineEndings=function($,v){$=$.substring(0,1048576);var v=new RegExp(C(v)+"([^]*?)"+C(v),"gm"),Q=($=$.replace(v,"")).split("\r"),v=$.split(`
7`),$=1<v.length&&v[0].length<Q[0].length;if(Q.length===1||$)return`
8`;for(var te=0,q=0;q<Q.length;q++)Q[q][0]===`
9`&&te++;return te>=Q.length/2?`\r
10`:"\r"}}function C(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(t){var s=(t=t||{}).delimiter,i=t.newline,o=t.comments,n=t.step,p=t.preview,m=t.fastMode,l=null,z=!1,w=t.quoteChar==null?'"':t.quoteChar,O=w;if(t.escapeChar!==void 0&&(O=t.escapeChar),(typeof s!="string"||-1<r.BAD_DELIMITERS.indexOf(s))&&(s=","),o===s)throw new Error("Comment character same as delimiter");o===!0?o="#":(typeof o!="string"||-1<r.BAD_DELIMITERS.indexOf(o))&&(o=!1),i!==`
11`&&i!=="\r"&&i!==`\r
12`&&(i=`
13`);var f=0,ae=!1;this.parse=function(b,I,h){if(typeof b!="string")throw new Error("Input must be a string");var ee=b.length,J=s.length,le=i.length,me=o.length,D=R(n),M=[],Q=[],v=[],$=f=0;if(!b)return ce();if(m||m!==!1&&b.indexOf(w)===-1){for(var te=b.split(i),q=0;q<te.length;q++){if(v=te[q],f+=v.length,q!==te.length-1)f+=i.length;else if(h)return ce();if(!o||v.substring(0,me)!==o){if(D){if(M=[],Se(v.split(s)),ve(),ae)return ce()}else Se(v.split(s));if(p&&p<=q)return M=M.slice(0,p),ce(!0)}}return ce()}for(var L=b.indexOf(s,f),E=b.indexOf(i,f),xe=new RegExp(C(O)+C(w),"g"),k=b.indexOf(w,f);;)if(b[f]===w)for(k=f,f++;;){if((k=b.indexOf(w,k+1))===-1)return h||Q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:M.length,index:f}),ye();if(k===ee-1)return ye(b.substring(f,k).replace(xe,w));if(w===O&&b[k+1]===O)k++;else if(w===O||k===0||b[k-1]!==O){L!==-1&&L<k+1&&(L=b.indexOf(s,k+1));var V=Ee((E=E!==-1&&E<k+1?b.indexOf(i,k+1):E)===-1?L:Math.min(L,E));if(b.substr(k+1+V,J)===s){v.push(b.substring(f,k).replace(xe,w)),b[f=k+1+V+J]!==w&&(k=b.indexOf(w,f)),L=b.indexOf(s,f),E=b.indexOf(i,f);break}if(V=Ee(E),b.substring(k+1+V,k+1+V+le)===i){if(v.push(b.substring(f,k).replace(xe,w)),Le(k+1+V+le),L=b.indexOf(s,f),k=b.indexOf(w,f),D&&(ve(),ae))return ce();if(p&&M.length>=p)return ce(!0);break}Q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:M.length,index:f}),k++}}else if(o&&v.length===0&&b.substring(f,f+me)===o){if(E===-1)return ce();f=E+le,E=b.indexOf(i,f),L=b.indexOf(s,f)}else if(L!==-1&&(L<E||E===-1))v.push(b.substring(f,L)),f=L+J,L=b.indexOf(s,f);else{if(E===-1)break;if(v.push(b.substring(f,E)),Le(E+le),D&&(ve(),ae))return ce();if(p&&M.length>=p)return ce(!0)}return ye();function Se(ie){M.push(ie),$=f}function Ee(ie){var ue=0;return ue=ie!==-1&&(ie=b.substring(k+1,ie))&&ie.trim()===""?ie.length:ue}function ye(ie){return h||(ie===void 0&&(ie=b.substring(f)),v.push(ie),f=ee,Se(v),D&&ve()),ce()}function Le(ie){f=ie,Se(v),v=[],E=b.indexOf(i,f)}function ce(ie){if(t.header&&!I&&M.length&&!z){var ue=M[0],we=Object.create(null),Je=new Set(ue);let it=!1;for(let Te=0;Te<ue.length;Te++){let be=ue[Te];if(we[be=R(t.transformHeader)?t.transformHeader(be,Te):be]){let Be,rt=we[be];for(;Be=be+"_"+rt,rt++,Je.has(Be););Je.add(Be),ue[Te]=Be,we[be]++,it=!0,(l=l===null?{}:l)[Be]=be}else we[be]=1,ue[Te]=be;Je.add(be)}it&&console.warn("Duplicate headers found and renamed."),z=!0}return{data:M,errors:Q,meta:{delimiter:s,linebreak:i,aborted:ae,truncated:!!ie,cursor:$+(I||0),renamedHeaders:l}}}function ve(){n(ce()),M=[],Q=[]}},this.abort=function(){ae=!0},this.getCharIndex=function(){return f}}function G(t){var s=t.data,i=F[s.workerId],o=!1;if(s.error)i.userError(s.error,s.file);else if(s.results&&s.results.data){var n={abort:function(){o=!0,X(s.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:U,resume:U};if(R(i.userStep)){for(var p=0;p<s.results.data.length&&(i.userStep({data:s.results.data[p],errors:s.results.errors,meta:s.results.meta},n),!o);p++);delete s.results}else R(i.userChunk)&&(i.userChunk(s.results,n,s.file),delete s.results)}s.finished&&!o&&X(s.workerId,s.results)}function X(t,s){var i=F[t];R(i.userComplete)&&i.userComplete(s),i.terminate(),delete F[t]}function U(){throw new Error("Not implemented.")}function de(t){if(typeof t!="object"||t===null)return t;var s,i=Array.isArray(t)?[]:{};for(s in t)i[s]=de(t[s]);return i}function oe(t,s){return function(){t.apply(s,arguments)}}function R(t){return typeof t=="function"}return r.parse=function(t,s){var i=(s=s||{}).dynamicTyping||!1;if(R(i)&&(s.dynamicTypingFunction=i,i={}),s.dynamicTyping=i,s.transform=!!R(s.transform)&&s.transform,!s.worker||!r.WORKERS_SUPPORTED)return i=null,r.NODE_STREAM_INPUT,typeof t=="string"?(t=(o=>o.charCodeAt(0)!==65279?o:o.slice(1))(t),i=new(s.download?c:A)(s)):t.readable===!0&&R(t.read)&&R(t.on)?i=new a(s):(g.File&&t instanceof File||t instanceof Object)&&(i=new x(s)),i.stream(t);(i=(()=>{var o;return!!r.WORKERS_SUPPORTED&&(o=(()=>{var n=g.URL||g.webkitURL||null,p=B.toString();return r.BLOB_URL||(r.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",p,")();"],{type:"text/javascript"})))})(),(o=new g.Worker(o)).onmessage=G,o.id=u++,F[o.id]=o)})()).userStep=s.step,i.userChunk=s.chunk,i.userComplete=s.complete,i.userError=s.error,s.step=R(s.step),s.chunk=R(s.chunk),s.complete=R(s.complete),s.error=R(s.error),delete s.worker,i.postMessage({input:t,config:s,workerId:i.id})},r.unparse=function(t,s){var i=!1,o=!0,n=",",p=`\r
14`,m='"',l=m+m,z=!1,w=null,O=!1,f=((()=>{if(typeof s=="object"){if(typeof s.delimiter!="string"||r.BAD_DELIMITERS.filter(function(I){return s.delimiter.indexOf(I)!==-1}).length||(n=s.delimiter),typeof s.quotes!="boolean"&&typeof s.quotes!="function"&&!Array.isArray(s.quotes)||(i=s.quotes),typeof s.skipEmptyLines!="boolean"&&typeof s.skipEmptyLines!="string"||(z=s.skipEmptyLines),typeof s.newline=="string"&&(p=s.newline),typeof s.quoteChar=="string"&&(m=s.quoteChar),typeof s.header=="boolean"&&(o=s.header),Array.isArray(s.columns)){if(s.columns.length===0)throw new Error("Option columns is empty");w=s.columns}s.escapeChar!==void 0&&(l=s.escapeChar+m),s.escapeFormulae instanceof RegExp?O=s.escapeFormulae:typeof s.escapeFormulae=="boolean"&&s.escapeFormulae&&(O=/^[=+\-@\t\r].*$/)}})(),new RegExp(C(m),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return ae(null,t,z);if(typeof t[0]=="object")return ae(w||Object.keys(t[0]),t,z)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||w),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),ae(t.fields||[],t.data||[],z);throw new Error("Unable to serialize unrecognized input");function ae(I,h,ee){var J="",le=(typeof I=="string"&&(I=JSON.parse(I)),typeof h=="string"&&(h=JSON.parse(h)),Array.isArray(I)&&0<I.length),me=!Array.isArray(h[0]);if(le&&o){for(var D=0;D<I.length;D++)0<D&&(J+=n),J+=b(I[D],D);0<h.length&&(J+=p)}for(var M=0;M<h.length;M++){var Q=(le?I:h[M]).length,v=!1,$=le?Object.keys(h[M]).length===0:h[M].length===0;if(ee&&!le&&(v=ee==="greedy"?h[M].join("").trim()==="":h[M].length===1&&h[M][0].length===0),ee==="greedy"&&le){for(var te=[],q=0;q<Q;q++){var L=me?I[q]:q;te.push(h[M][L])}v=te.join("").trim()===""}if(!v){for(var E=0;E<Q;E++){0<E&&!$&&(J+=n);var xe=le&&me?I[E]:E;J+=b(h[M][xe],E)}M<h.length-1&&(!ee||0<Q&&!$)&&(J+=p)}}return J}function b(I,h){var ee,J;return I==null?"":I.constructor===Date?JSON.stringify(I).slice(1,25):(J=!1,O&&typeof I=="str
14ing"&&O.test(I)&&(I="'"+I,J=!0),ee=I.toString().replace(f,l),(J=J||i===!0||typeof i=="function"&&i(I,h)||Array.isArray(i)&&i[h]||((le,me)=>{for(var D=0;D<me.length;D++)if(-1<le.indexOf(me[D]))return!0;return!1})(ee,r.BAD_DELIMITERS)||-1<ee.indexOf(n)||ee.charAt(0)===" "||ee.charAt(ee.length-1)===" ")?m+ee+m:ee)}},r.RECORD_SEP="�",r.UNIT_SEP="�",r.BYTE_ORDER_MARK="\uFEFF",r.BAD_DELIMITERS=["\r",`
15`,'"',r.BYTE_ORDER_MARK],r.WORKERS_SUPPORTED=!y&&!!g.Worker,r.NODE_STREAM_INPUT=1,r.LocalChunkSize=10485760,r.RemoteChunkSize=5242880,r.DefaultDelimiter=",",r.Parser=_,r.ParserHandle=j,r.NetworkStreamer=c,r.FileStreamer=x,r.StringStreamer=A,r.ReadableStreamStreamer=a,g.jQuery&&((P=g.jQuery).fn.parse=function(t){var s=t.config||{},i=[];return this.each(function(p){if(!(P(this).prop("tagName").toUpperCase()==="INPUT"&&P(this).attr("type").toLowerCase()==="file"&&g.FileReader)||!this.files||this.files.length===0)return!0;for(var m=0;m<this.files.length;m++)i.push({file:this.files[m],inputElem:this,instanceConfig:P.extend({},s)})}),o(),this;function o(){if(i.length===0)R(t.complete)&&t.complete();else{var p,m,l,z,w=i[0];if(R(t.before)){var O=t.before(w.file,w.inputElem);if(typeof O=="object"){if(O.action==="abort")return p="AbortError",m=w.file,l=w.inputElem,z=O.reason,void(R(t.error)&&t.error({name:p},m,l,z));if(O.action==="skip")return void n();typeof O.config=="object"&&(w.instanceConfig=P.extend(w.instanceConfig,O.config))}else if(O==="skip")return void n()}var f=w.instanceConfig.complete;w.instanceConfig.complete=function(ae){R(f)&&f(ae,w.file,w.inputElem),n()},r.parse(w.file,w.instanceConfig)}}function n(){i.splice(0,1),o()}}),N&&(g.onmessage=function(t){t=t.data,r.WORKER_ID===void 0&&t&&(r.WORKER_ID=t.workerId),typeof t.input=="string"?g.postMessage({workerId:r.WORKER_ID,results:r.parse(t.input,t.config),finished:!0}):(g.File&&t.input instanceof File||t.input instanceof Object)&&(t=r.parse(t.input,t.config))&&g.postMessage({workerId:r.WORKER_ID,results:t,finished:!0})}),(c.prototype=Object.create(S.prototype)).constructor=c,(x.prototype=Object.create(S.prototype)).constructor=x,(A.prototype=Object.create(A.prototype)).constructor=A,(a.prototype=Object.create(S.prototype)).constructor=a,r})})(gt);var Ut=gt.exports;const dt=wt(Ut);function zt(){var o;const{transactions:d,discrepancies:Z,imports:B,importTransactions:g,isImporting:P,manualMatch:y,resolveDiscrepancy:N}=Pt(),{payouts:F}=pt(),[u,r]=se.useState(!1),[S,c]=se.useState({open:!1,transactionId:null}),[x,A]=se.useState({open:!1,discrepancy:null}),[a,j]=se.useState({importName:"",dateFrom:"",dateTo:"",file:null}),[C,_]=se.useState({status:"investigating",notes:""}),[G,X]=se.useState(""),U=async n=>{var m;const p=(m=n.target.files)==null?void 0:m[0];p&&(j({...a,file:p}),dt.parse(p,{header:!0,complete:l=>{re.success(`${l.data.length} transacties geladen`)},error:l=>{re.error("CSV parsing mislukt: "+l.message)}}))},de=()=>{if(!a.file||!a.importName||!a.dateFrom||!a.dateTo){re.error("Vul alle velden in");return}dt.parse(a.file,{header:!0,complete:n=>{const p=n.data.filter(m=>m.date&&m.amount).map(m=>({transaction_date:m.date||m.Date||m.datum,transaction_reference:m.reference||m.Reference||m.referentie||crypto.randomUUID().substring(0,8),description:m.description||m.Description||m.omschrijving||"",amount:parseFloat(String(m.amount||m.Amount||m.bedrag).replace(",",".")),counterparty_name:m.counterparty||m.Counterparty||m.tegenpartij||"",counterparty_account:m.account||m.Account||m.rekening||""}));g({transactions:p,importName:a.importName,fileName:a.file.name,dateFrom:a.dateFrom,dateTo:a.dateTo}),r(!1),j({importName:"",dateFrom:"",dateTo:"",file:null})}})},oe=()=>{if(!S.transactionId||!G){re.error("Selecteer een uitbetaling");return}y({transactionId:S.transactionId,payoutId:G}),c({open:!1,transactionId:null}),X("")},R=()=>{x.discrepancy&&(N({discrepancyId:x.discrepancy.id,status:C.status,notes:C.notes}),A({open:!1,discrepancy:null}),_({status:"investigating",notes:""}))},t=n=>{switch(n){case"matched":return e.jsxs(ne,{variant:"default",className:"bg-green-500",children:[e.jsx(Ze,{className:"w-3 h-3 mr-1"}),"Gematcht"]});
15case"pending":return e.jsx(ne,{variant:"secondary",children:"In afwachting"});case"discrepancy":return e.jsxs(ne,{variant:"destructive",children:[e.jsx(kt,{className:"w-3 h-3 mr-1"}),"Discrepantie"]});case"ignored":return e.jsx(ne,{variant:"outline",children:"Genegeerd"});default:return e.jsx(ne,{children:n})}},s=n=>{const p={low:"secondary",medium:"default",high:"destructive",critical:"destructive"};return e.jsx(ne,{variant:p[n],children:n})},i={total:(d==null?void 0:d.length)||0,matched:(d==null?void 0:d.filter(n=>n.status==="matched").length)||0,pending:(d==null?void 0:d.filter(n=>n.status==="pending").length)||0,discrepancies:(Z==null?void 0:Z.filter(n=>n.resolution_status==="open").length)||0};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Uitbetalingen Reconciliatie"}),e.jsx("p",{className:"text-muted-foreground",children:"Match banktransacties met uitbetalingen"})]}),e.jsxs(H,{onClick:()=>r(!0),children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Importeer Bankafschrift"]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(pe,{children:[e.jsx(fe,{className:"pb-2",children:e.jsx(_e,{className:"text-sm font-medium text-muted-foreground",children:"Totaal Transacties"})}),e.jsx(ge,{children:e.jsx("div",{className:"text-2xl font-bold",children:i.total})})]}),e.jsxs(pe,{children:[e.jsx(fe,{className:"pb-2",children:e.jsx(_e,{className:"text-sm font-medium text-muted-foreground",children:"Gematcht"})}),e.jsx(ge,{children:e.jsx("div",{className:"text-2xl font-bold text-green-600",children:i.matched})})]}),e.jsxs(pe,{children:[e.jsx(fe,{className:"pb-2",children:e.jsx(_e,{className:"text-sm font-medium text-muted-foreground",children:"In Afwachting"})}),e.jsx(ge,{children:e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:i.pending})})]}),e.jsxs(pe,{children:[e.jsx(fe,{className:"pb-2",children:e.jsx(_e,{className:"text-sm font-medium text-muted-foreground",children:"Discrepanties"})}),e.jsx(ge,{children:e.jsx("div",{className:"text-2xl font-bold text-destructive",children:i.discrepancies})})]})]}),e.jsxs(ut,{defaultValue:"transactions",className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Oe,{value:"transactions",children:"Transacties"}),e.jsx(Oe,{value:"discrepancies",children:"Discrepanties"}),e.jsx(Oe,{value:"imports",children:"Import Geschiedenis"})]}),e.jsx(qe,{value:"transactions",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsx(_e,{children:"Bank Transacties"})}),e.jsx(ge,{children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(et,{children:[e.jsx(tt,{children:e.jsxs(ke,{children:[e.jsx(Y,{children:"Datum"}),e.jsx(Y,{children:"Referentie"}),e.jsx(Y,{children:"Tegenpartij"}),e.jsx(Y,{children:"Bedrag"}),e.jsx(Y,{children:"Status"}),e.jsx(Y,{children:"Acties"})]})}),e.jsx(st,{children:d&&d.length>0?d.map(n=>e.jsxs(ke,{children:[e.jsx(K,{children:Ne(new Date(n.transaction_date),"dd MMM yyyy",{locale:De})}),e.jsx(K,{className:"font-mono text-sm",children:n.transaction_reference}),e.jsx(K,{children:n.counterparty_name}),e.jsxs(K,{className:"font-semibold",children:["€",n.amount.toFixed(2)]}),e.jsx(K,{children:t(n.status)}),e.jsx(K,{children:n.status==="pending"&&e.jsxs(H,{size:"sm",variant:"outline",onClick:()=>c({open:!0,transactionId:n.id}),children:[e.jsx(ct,{className:"w-4 h-4 mr-1"}),"Match"]})})]},n.id)):e.jsx(ke,{children:e.jsx(K,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"Geen transacties gevonden. Importeer een bankafschrift."})})})]})})})]})}),e.jsx(qe,{value:"discrepancies",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsx(_e,{children:"Discrepanties"})}),e.jsx(ge,{children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(et,{children:[e.jsx(tt,{children:e.jsxs(ke,{children:[e.jsx(Y,{children:"Type"}),e.jsx(Y,{children:"Ernst"}),e.jsx(Y,{children:"Beschrijving"}),e.jsx(Y,{children:"Verschil"}),e.jsx(Y,{children:"Status"}),e.jsx(Y,{children:"Acties"})]})}),e.jsx(st,{children:Z&&Z.length>0?Z.map(n=>e.jsxs(ke,{children:[e.jsx(K,{className:"capitalize",children:n.discrepancy_type.replace("_"," ")}),e.jsx(K,{children:s(n.severity)}),e.jsx(K,{children:n.description}),e.jsx(K,{children:n.difference_amount&&e.jsxs("span",{className:"font-semibold text-destructive",children:["€",Math.abs(n.difference_amount).toFixed(2)]})}),e.jsx(K,{className:"capitalize",children:n.resolution_status}),e.jsx(K,{children:n.resolution_status==="open"&&e.jsx(H,{size:"sm",variant:"outline",onClick:()=>A({open:!0,discrepancy:n}),children:"Oplossen"})})]},n.id)):e.jsx(ke,{children:e.jsx(K,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"Geen discrepanties gevonden"})})})]})})})]})}),e.jsx(qe,{value:"imports",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsx(_e,{children:"Import Geschiedenis"})}),e.jsx(ge,{children:e.jsx("div",{className:"space-y-4",children:B&&B.length>0?B.map(n=>e.jsx("div",{className:"border rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:n.import_name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.file_name}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Periode: ",Ne(new Date(n.statement_date_from),"dd MMM yyyy",{locale:De})," - ",Ne(new Date(n.statement_date_to),"dd MMM yyyy",{locale:De})]})]}),e.jsxs("div",{className:"text-right text-sm",children:[e.jsxs("div",{children:["Totaal: ",n.total_transactions]}),e.jsxs("div",{className:"text-green-600",children:["Gematcht: ",n.matched_transactions]}),e.jsxs("div",{className:"text-destructive",children:["Discrepanties: ",n.discrepancies_found]})]})]})},n.id)):e.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"Geen imports gevonden"})})})]})})]}),e.jsx(Fe,{open:u,onOpenChange:r,children:e.jsxs(Re,{children:[e.jsxs(Me,{children:[e.jsx(Ae,{children:"Bankafschrift Importeren"}),e.jsx(Qe,{children:"Upload een CSV bestand met banktransacties. Zorg dat de kolommen: date, reference, description, amount, counterparty bevatten."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"importName",children:"Import Naam"}),e.jsx(je,{id:"importName",value:a.importName,onChange:n=>j({...a,importName:n.target.value}),placeholder:"Bijv. Januari 2025 Afschrift"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"dateFrom",children:"Van Datum"}),e.jsx(je,{id:"dateFrom",type:"date",value:a.dateFrom,onChange:n=>j({...a,dateFrom:n.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"dateTo",children:"Tot Datum"}),e.jsx(je,{id:"dateTo",type:"date",value:a.dateTo,onChange:n=>j({...a,dateTo:n.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"file",children:"CSV Bestand"}),e.jsx(je,{id:"file",type:"file",accept:".csv",onChange:U})]})]}),e.jsxs(Ue,{children:[e.jsx(H,{variant:"outline",onClick:()=>r(!1),children:"Annuleren"}),e.jsxs(H,{onClick:de,disabled:P,children:[e.jsx(nt,{className:"w-4 h-4 mr-2"}),"Importeren"]})]})]})}),e.jsx(Fe,{open:S.open,onOpenChange:n=>c({...S,open:n}),children:e.jsxs(Re,{children:[e.jsxs(Me,{children:[e.jsx(Ae,{children:"Manueel Matchen"}),e.jsx(Qe,{children:"Selecteer de uitbetaling die overeenkomt met deze transactie"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Uitbetaling"}),e.jsxs(Ve,{value:G,onValueChange:X,children:[e.jsx(Ke,{children:e.jsx(He,{placeholder:"Selecteer een uitbetaling"})}),e.jsx(Ge,{children:F==null?void 0:F.filter(n=>n.status==="completed").map(n=>e.jsxs(he,{value:n.id,children:[n.batch_number," - €",Number(n.total_amount).toFixed(2)," - ",n.bank_account_holder]},n.id))})]})]}),e.jsxs(Ue,{children:[e.jsx(H,{variant:"outline",onClick:()=>c({open:!1,transactionId:null}),children:"Annuleren"}),e.jsxs(H,{onClick:oe,children:[e.jsx(ct,{className:"w-4 h-4 mr-2"}),"Matchen"]})]})]})}),e.jsx(Fe,{open:x.open,onOpenChange:n=>A({...x,open:n}),children:e.jsxs(Re,{children:[e.jsxs(Me,{children:[e.jsx(Ae,{children:"Discrepantie Oplossen"}),e.jsx(Qe,{children:(o=x.discrepancy)==null?void 0:o.description})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Status"}),e.jsxs(Ve,{value:C.status,onValueChange:n=>_({...C,status:n}),children:[e.jsx(Ke,{children:e.jsx(He,{})}),e.jsxs(Ge,{children:[e.jsx(he,{value:"investigating",children:"In Onderzoek"}),e.jsx(he,{value:"resolved",children:"Opgelost"}),e.jsx(he,{value:"accepted",children:"Geaccepteerd"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"notes",children:"Notities"}),e.jsx(mt,{id:"notes",value:C.notes,onChange:n=>_({...C,notes:n.target.value}),placeholder:"Voeg uitleg toe over de resolutie...",rows:4})]})]}),e.jsxs(Ue,{children:[e.jsx(H,{variant:"outline",onClick:()=>A({open:!1,discrepancy:null}),children:"Annuleren"}),e.jsx(H,{onClick:R,children:"Bijwerken"})]})]})})]})}function Xt(){const{payouts:d,payoutsLoading:Z,updatePayoutStatus:B,isUpdatingStatus:g,fetchPayoutHistory:P}=pt(),{toast:y}=Et(),[N,F]=se.useState(""),[u,r]=se.useState("all"),[S,c]=se.useState(""),[x,A]=se.useState(""),[a,j]=se.useState(null),[C,_]=se.useState({open:!1,action:null}),[G,X]=se.useState(""),[U,de]=se.useState({open:!1,payoutId:null,batchNumber:""}),{data:oe,isLoading:R}=Ce({queryKey:["payout-history",U.payoutId],queryFn:()=>U.payoutId?P(U.payoutId):null,enabled:U.open&&!!U.payoutId}),t=se.useMemo(()=>d?{total:d.length,pending:d.filter(l=>l.status==="pending").length,processing:d.filter(l=>l.status==="processing").length,completed:d.filter(l=>l.status==="completed").length,totalAmount:d.filter(l=>l.status==="completed").reduce((l,z)=>l+Number(z.total_amount),0)}:{total:0,pending:0,processing:0,completed:0,totalAmount:0},[d]),s=se.useMemo(()=>d?d.filter(l=>{var z,w,O;if(u!=="all"&&l.status!==u)return!1;if(N){const f=N.toLowerCase(),ae=(z=l.batch_number)==null?void 0:z.toLowerCase().includes(f),b=(w=l.bank_iban)==null?void 0:w.toLowerCase().includes(f),I=(O=l.bank_account_holder)==null?void 0:O.toLowerCase().includes(f);if(!ae&&!b&&!I)return!1}return!(S&&new Date(l.created_at)<new Date(S)||x&&new Date(l.created_at)>new Date(x))}):[],[d,N,u,S,x]),i=l=>
15{switch(l){case"pending":return e.jsxs(ne,{variant:"secondary",children:[e.jsx($e,{className:"w-3 h-3 mr-1"}),"In afwachting"]});case"processing":return e.jsxs(ne,{variant:"default",children:[e.jsx(Xe,{className:"w-3 h-3 mr-1"}),"In behandeling"]});case"completed":return e.jsxs(ne,{variant:"default",className:"bg-green-500",children:[e.jsx(Ze,{className:"w-3 h-3 mr-1"}),"Voltooid"]});case"failed":return e.jsxs(ne,{variant:"destructive",children:[e.jsx(We,{className:"w-3 h-3 mr-1"}),"Mislukt"]});case"cancelled":return e.jsxs(ne,{variant:"outline",children:[e.jsx(We,{className:"w-3 h-3 mr-1"}),"Geannuleerd"]});default:return e.jsx(ne,{children:l})}},o=(l,z)=>{j(l),_({open:!0,action:z}),X("")},n=()=>{!a||!C.action||(B({payoutId:a.id,status:C.action,notes:G||void 0}),_({open:!1,action:null}),j(null),X(""))},p=l=>{if(s.length===0){y({title:"Geen gegevens om te exporteren",description:"Er zijn geen uitbetalingen die voldoen aan de filters.",variant:"destructive"});return}try{l==="csv"?(Ot(s),y({title:"Export geslaagd",description:`${s.length} uitbetalingen geëxporteerd naar CSV.`})):(qt(s),y({title:"Export geslaagd",description:`${s.length} uitbetalingen geëxporteerd naar Excel.`}))}catch{y({title:"Export mislukt",description:"Er is een fout opgetreden bij het exporteren van gegevens.",variant:"destructive"})}},m=({title:l,value:z,icon:w,color:O})=>e.jsxs(pe,{children:[e.jsxs(fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:l}),e.jsx(w,{className:`h-4 w-4 ${O}`})]}),e.jsx(ge,{children:e.jsx("div",{className:"text-2xl font-bold",children:z})})]});return Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Uitbetalingen Beheer"}),e.jsx("p",{className:"text-muted-foreground",children:"Beheer en volg alle verkoper uitbetalingen"})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[...Array(4)].map((l,z)=>e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsx(Pe,{className:"h-4 w-24"})}),e.jsx(ge,{children:e.jsx(Pe,{className:"h-8 w-16"})})]},z))})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Uitbetalingen Beheer"}),e.jsx("p",{className:"text-muted-foreground",children:"Beheer en volg alle verkoper uitbetalingen"})]}),e.jsxs(ut,{defaultValue:"payouts",className:"space-y-6",children:[e.jsxs(ht,{children:[e.jsx(Oe,{value:"payouts",children:"Uitbetalingen"}),e.jsx(Oe,{value:"reports",children:"Geplande Rapporten"}),e.jsx(Oe,{value:"reconciliation",children:"Reconciliatie"})]}),e.jsxs(qe,{value:"payouts",className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-5",children:[e.jsx(m,{title:"Totaal Batches",value:t.total,icon:lt,color:"text-blue-500"}),e.jsx(m,{title:"In Afwachting",value:t.pending,icon:$e,color:"text-yellow-500"}),e.jsx(m,{title:"In Behandeling",value:t.processing,icon:Xe,color:"text-orange-500"}),e.jsx(m,{title:"Voltooid",value:t.completed,icon:Ze,color:"text-green-500"}),e.jsx(m,{title:"Totaal Uitbetaald",value:`€${t.totalAmount.toFixed(2)}`,icon:lt,color:"text-green-600"})]}),e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsx(_e,{children:"Filters"})}),e.jsxs(ge,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Zoeken"}),e.jsxs("div",{className:"relative",children:[e.jsx(Nt,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(je,{placeholder:"Batch nummer, IBAN...",value:N,onChange:l=>F(l.target.value),className:"pl-8"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Status"}),e.jsxs(Ve,{value:u,onValueChange:r,children:[e.jsx(Ke,{children:e.jsx(He,{})}),e.jsxs(Ge,{children:[e.jsx(he,{value:"all",children:"Alle statussen"}),e.jsx(he,{value:"pending",children:"In afwachting"}),e.jsx(he,{value:"processing",children:"In behandeling"}),e.jsx(he,{value:"completed",children:"Voltooid"}),e.jsx(he,{value:"failed",children:"Mislukt"}),e.jsx(he,{value:"cancelled",children:"Geannuleerd"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Van datum"}),e.jsx(je,{type:"date",value:S,onChange:l=>c(l.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Tot datum"}),e.jsx(je,{type:"date",value:x,onChange:l=>A(l.target.value)})]})]}),(N||u!=="all"||S||x)&&e.jsx("div",{className:"mt-4",children:e.jsx(H,{variant:"outline",size:"sm",onClick:()=>{F(""),r("all"),c(""),A("")},children:"Filters wissen"})})]})]}),e.jsxs(pe,{children:[e.jsxs(fe,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[e.jsxs(_e,{children:["Uitbetalingen (",s.length,")"]}),e.jsxs(St,{children:[e.jsx(Ct,{asChild:!0,children:e.jsxs(H,{variant:"outline",size:"sm",disabled:s.length===0,children:[e.jsx(It,{className:"w-4 h-4 mr-2"}),"Exporteer"]})}),e.jsxs(Dt,{align:"end",children:[e.jsxs(ot,{onClick:()=>p("csv"),children:[e.jsx(nt,{className:"w-4 h-4 mr-2"}),"Exporteer als CSV"]}),e.jsxs(ot,{onClick:()=>p("excel"),children:[e.jsx(nt,{className:"w-4 h-4 mr-2"}),"Exporteer als Excel"]})]})]})]}),e.jsx(ge,{children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(et,{children:[e.jsx(tt,{children:e.jsxs(ke,{children:[e.jsx(Y,{children:"Batch"}),e.jsx(Y,{children:"Verkoper"}),e.jsx(Y,{children:"Bedrag"}),e.jsx(Y,{children:"Items"}),e.jsx(Y,{children:"Bankgegevens"}),e.jsx(Y,{children:"Status"}),e.jsx(Y,{children:"Datum"}),e.jsx(Y,{children:"Acties"})]})}),e.jsx(st,{children:s.length===0?e.jsx(ke,{children:e.jsx(K,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"Geen uitbetalingen gevonden"})}):s.map(l=>e.jsxs(ke,{children:[e.jsx(K,{className:"font-medium",children:l.batch_number}),e.jsx(K,{children:l.bank_account_holder}),e.jsxs(K,{className:"font-semibold",children:["€",Number(l.total_amount).toFixed(2)]}),e.jsx(K,{children:l.items_count}),e.jsx(K,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{children:l.bank_iban}),l.bank_bic&&e.jsx("div",{className:"text-muted-foreground text-xs",children:l.bank_bic})]})}),e.jsx(K,{children:i(l.status)}),e.jsx(K,{className:"text-sm",children:Ne(new Date(l.created_at),"dd MMM yyyy",{locale:De})}),e.jsx(K,{children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(H,{size:"sm",variant:"ghost",onClick:()=>de({open:!0,payoutId:l.id,batchNumber:l.batch_number}),children:e.jsx(Mt,{className:"w-4 h-4"})}),l.status==="pending"&&e.jsx(H,{size:"sm",variant:"outline",onClick:()=>o(l,"processing"),disabled:g,children:"Start"}),l.status==="processing"&&e.jsxs(e.Fragment,{children:[e.jsx(H,{size:"sm",variant:"default",onClick:()=>o(l,"completed"),disabled:g,children:"Voltooid"}),e.jsx(H,{size:"sm",variant:"destructive",onClick:()=>o(l,"failed"),disabled:g,children:"Mislukt"})]}),(l.status==="pending"||l.status==="processing")&&e.jsx(H,{size:"sm",variant:"outline",onClick:()=>o(l,"cancelled"),disabled:g,children:"Annuleer"})]})})]},l.id))})]})})})]}),e.jsx(Fe,{open:C.open,onOpenChange:l=>_({...C,open:l}),children:e.jsxs(Re,{children:[e.jsxs(Me,{children:[e.jsxs(Ae,{children:[C.action==="processing"&&"
15Start Uitbetaling",C.action==="completed"&&"Bevestig Voltooiing",C.action==="failed"&&"Markeer als Mislukt",C.action==="cancelled"&&"Annuleer Uitbetaling"]}),e.jsx(Qe,{children:a&&e.jsxs(e.Fragment,{children:["Batch: ",a.batch_number,e.jsx("br",{}),"Bedrag: €",Number(a.total_amount).toFixed(2),e.jsx("br",{}),"Verkoper: ",a.bank_account_holder]})})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"notes",children:C.action==="failed"||C.action==="cancelled"?"Reden (verplicht)":"Notities (optioneel)"}),e.jsx(mt,{id:"notes",value:G,onChange:l=>X(l.target.value),placeholder:C.action==="failed"?"Geef een reden voor het mislukken...":C.action==="cancelled"?"Geef een reden voor annulering...":"Voeg eventuele notities toe...",rows:3})]})}),e.jsxs(Ue,{children:[e.jsx(H,{variant:"outline",onClick:()=>_({open:!1,action:null}),children:"Annuleren"}),e.jsx(H,{onClick:n,disabled:g||(C.action==="failed"||C.action==="cancelled")&&!G.trim(),children:"Bevestigen"})]})]})}),e.jsx(Lt,{open:U.open,onOpenChange:l=>de({...U,open:l}),payoutId:U.payoutId,batchNumber:U.batchNumber,history:oe,isLoading:R})]}),e.jsx(qe,{value:"reports",children:e.jsx(Bt,{})}),e.jsx(qe,{value:"reconciliation",children:e.jsx(zt,{})})]})]})}export{Xt as default};

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.