1import{c as Ee,y as qe,n as De,r as p,o as ue,_ as Ie,j as e,w as xe,J as X,aa as $,a5 as he,p as F,a4 as Ae,Y as pe,D as v,X as Be,s as N,z as Pe,I as Fe}from"./index-NmHdCup1.js";import{u as be}from"./useMutation-BEMNXiTY.js";import{S as q}from"./StatCard-DxVHbTiD.js";import{T as Ke,a as Le,b as G,c as C,d as Me,e as _}from"./table-8tVcFVu5.js";import{B as fe}from"./badge-IB6Bu8li.js";import{T as _e}from"./textarea-Csw0T9FQ.js";import{S as B}from"./separator-Cuvzj_V3.js";import{D as ze,a as Ue,b as Oe,c as Ye}from"./dialog-CVr3tyJN.js";import{t as Ve,i as Qe,a as He,d as Xe}from"./TableToolbar-CeOVqUUl.js";import{K as $e,n as S,a as ge}from"./kyc-status-CEJMPcjK.js";import{i as Ge}from"./edge-function-3QT6ylKi.js";import{S as J}from"./shield-CDb9MjUO.js";import{T as Y}from"./triangle-alert-DiKAGgw3.js";import{C as W}from"./circle-x-BHh3ynTQ.js";import{E as Je}from"./eye-9SulhYJZ.js";import{P as We}from"./pencil-D8P6qnJ0.js";import{F as je}from"./file-text-vUtiW8CJ.js";import{E as Ze}from"./external-link-DW6178ZQ.js";import"./trending-up-nqpyb1pH.js";import"./index-CV_fVOUW.js";import"./index-xZz23ZBa.js";import"./popover-C_WfTyCo.js";import"./calendar-Iyyejjp6.js";import"./subDays-DFGRju98.js";import"./en-US-CXXYYhpC.js";import"./endOfMonth-CkEvJJVO.js";import"./format-CzsMfetM.js";import"./chevron-left-C3zWuoMY.js";import"./select-CWTseNAf.js";import"./index-BdQq_4o_.js";import"./index-C6A1aari.js";import"./index-C1PHMdrf.js";import"./chevron-up-DU24dtpL.js";import"./endOfDay-CXmX-rkk.js";import"./search-CFKmQYkw.js";import"./download-BYyxxrKg.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const es=Ee("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Fs=()=>{var ae,re,ne,ie,le,ce;const{toast:m}=qe(),u=De(),[b,K]=p.useState(""),[j,g]=p.useState({}),[L,ve]=p.useState("all"),[V,Ne]=p.useState({}),[t,k]=p.useState(null),[D,I]=p.useState(""),[Z,w]=p.useState(!1),[d,x]=p.useState({}),{data:n,isLoading:we}=ue({queryKey:["admin_kyc_submissions"],queryFn:async()=>{const{data:s,error:a}=await N.from("merchant_kyc").select("*, merchants(name, email)").order("submitted_at",{ascending:!1});if(a)throw a;const r=[...new Set(s.map(o=>o.merchant_id))],{data:i}=await N.from("kyc_directors").select("*").in("merchant_id",r);return s.map(o=>({...o,directors:(i==null?void 0:i.filter(c=>c.merchant_id===o.merchant_id))??[]}))}}),[ee,ye]=Ie(),M=ee.get("open");p.useEffect(()=>{if(!M||!n)return;const s=n.find(r=>r.id===M||r.merchant_id===M);s&&(k(s),I(""),w(!1));const a=new URLSearchParams(ee);a.delete("open"),ye(a,{replace:!0})},[M,n]);const{data:z}=ue({queryKey:["merchant_owner_emails"],queryFn:async()=>{const{data:s,error:a}=await N.rpc("get_merchant_owner_emails");if(a)throw a;return s}}),Q=p.useMemo(()=>{const s=new Map;return z==null||z.forEach(a=>s.set(a.merchant_id,a.owner_email)),s},[z]),y=be({mutationFn:async({id:s,merchantId:a,status:r,reason:i})=>{const o={status:r,reviewed_at:new Date().toISOString()};i&&(o.rejection_reason=i);const{error:c}=await N.from("merchant_kyc").update(o).eq("id",s);if(c)throw c;(r==="approved"||r==="rejected"||r==="changes_requested")&&N.functions.invoke("send-kyc-email",{body:{merchant_id:a,status:r,rejection_reason:i||null}}).catch(f=>console.error("KYC email error:",f))},onSuccess:(s,a)=>{u.invalidateQueries({queryKey:["admin_kyc_submissions"]}),m({title:a.status==="approved"?"KYC Approved":a.status==="rejected"?"KYC Rejected":a.status==="changes_requested"?"Changes Requested":"Status updated"}),k(null),I("")},onError:s=>m({title:"Error",description:s.message,variant:"destructive"})}),se=be({mutationFn:async({kycId:s,merchantId:a,kycPatch:r,merchantPatch:i,accountEmail:o})=>{if(o&&await Ge("admin-update-account-email",{merchant_id:a,new_email:o}),Object.keys(r).length>0){const{error:c}=await N.from("merchant_kyc").update(r).eq("id",s);if(c)throw c}if(Object.keys(i).length>0){const{error:c}=await N.from("merchants").update(i).eq("id",a);if(c)throw c}await N.from("audit_log").insert({action:"kyc.business_details.updated",reference:s,metadata:{kyc:r,merchant:i,...o?{account_email:o}:{}}})},onSuccess:(s,a)=>
6{u.invalidateQueries({queryKey:["admin_kyc_submissions"]}),u.invalidateQueries({queryKey:["merchants"]}),u.invalidateQueries({queryKey:["merchant_owner_emails"]}),m({title:"Business details updated"}),w(!1),k(r=>r&&{...r,...a.kycPatch,merchants:{...r.merchants??{},...a.merchantPatch}})},onError:s=>m({title:"Error",description:s.message,variant:"destructive"})}),Ce=[{label:"Status",key:"status",options:$e.filter(s=>s.value!=="not_started")}],T=p.useMemo(()=>{if(!n)return[];const{from:s,to:a}=Ve(L,V);return n.filter(r=>{var i,o;if(j.status&&j.status!=="all"&&S(r.status)!==j.status)return!1;if(b){const c=b.toLowerCase(),f=(((i=r.merchants)==null?void 0:i.name)??"").toLowerCase(),R=(((o=r.merchants)==null?void 0:o.email)??"").toLowerCase();if(!f.includes(c)&&!R.includes(c)&&!r.merchant_id.toLowerCase().includes(c))return!1}return!!Qe(r.submitted_at||r.created_at,s,a)})},[n,b,j,L,V]),te=(n==null?void 0:n.length)??0,Se=(n==null?void 0:n.filter(s=>S(s.status)==="draft").length)??0,H=(n==null?void 0:n.filter(s=>S(s.status)==="under_review").length)??0,ke=(n==null?void 0:n.filter(s=>S(s.status)==="changes_requested").length)??0,Te=(n==null?void 0:n.filter(s=>S(s.status)==="approved").length)??0,Re=(n==null?void 0:n.filter(s=>S(s.status)==="rejected").length)??0;return we?e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{className:"h-8 w-48"}),e.jsx(xe,{className:"h-[400px] rounded-xl"})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(J,{className:"h-6 w-6"})," KYC Review"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Review and manage merchant verification submissions"})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",children:[e.jsx(q,{label:"Total Submissions",value:String(te),icon:J}),e.jsx(q,{label:"Draft",value:String(Se),icon:X}),e.jsx(q,{label:"Under Review",value:String(H),changeType:H>0?"negative":"neutral",change:H>0?"Needs attention":"All clear",icon:Y}),e.jsx(q,{label:"Changes Requested",value:String(ke),icon:Y}),e.jsx(q,{label:"Approved",value:String(Te),changeType:"positive",icon:$}),e.jsx(q,{label:"Rejected",value:String(Re),icon:W})]}),e.jsx(He,{searchPlaceholder:"Search by merchant name or email...",searchValue:b,onSearchChange:K,filters:Ce,filterValues:j,onFilterChange:(s,a)=>g(r=>({...r,[s]:a})),timePreset:L,onTimePresetChange:(s,a)=>{ve(s),a&&Ne(a)},customDateRange:V,onExportCsv:()=>Xe(T.map(s=>{var a,r;return{merchant:((a=s.merchants)==null?void 0:a.name)??"",email:((r=s.merchants)==null?void 0:r.email)??"",status:s.status,business_type:s.business_type??"",submitted_at:s.submitted_at??"",reviewed_at:s.reviewed_at??""}}),"kyc-submissions"),totalCount:te,filteredCount:T.length}),e.jsxs("div",{className:"rounded-xl border border-border/70 bg-card shadow-card",children:[e.jsx("ul",{className:"divide-y divide-border/60 md:hidden",children:T.length===0?e.jsx("li",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No KYC submissions found"}):T.map(s=>{var R,E,A;const a=ge[S(s.status)],r=a.icon,i=(R=s.merchants)==null?void 0:R.name,o=(E=s.merchants)==null?void 0:E.email,c=(i??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(U=>U[0]).join("").toUpperCase()||"?",f=o||[(A=s.business_type)==null?void 0:A.replace(/_/g," "),s.submitted_at?he(s.submitted_at):null].filter(Boolean).join(" · ");return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{k(s),I(""),w(!1)},className:"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/40 active:bg-muted/60",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-accent/10 text-sm font-semibold text-accent ring-1 ring-inset ring-accent/20",children:c}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-sm font-semibold",children:i??"â"}),e.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:f||"â"})]}),e.jsxs("span",{className:F("inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[12px] font-semibold",a.toneClass),children:[e.jsx(r,{className:"h-3 w-3"}),a.label]}),e.jsx(Ae,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})},s.id)})}),e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ke,{children:[e.jsx(Le,{children:e.jsxs(G,{children:[e.jsx(C,{children:"Merchant"}),e.jsx(C,{children:"Business Type"}),e.jsx(C,{children:"Category"}),e.jsx(C,{children:"State"}),e.jsx(C,{children:"Status"}),e.jsx(C,{children:"Submitted"}),e.jsx(C,{children:"Reviewed"}),e.jsx(C,{className:"w-[80px]",children:"Actions"})]})}),e.jsx(Me,{children:T.length===0?e.jsx(G,{children:e.jsx(_,{colSpan:8,className:"text-center text-muted-foreground py-8",children:"No KYC submissions foun
6d"})}):T.map(s=>{var i,o,c;const a=ge[S(s.status)],r=a.icon;return e.jsxs(G,{children:[e.jsx(_,{children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:((i=s.merchants)==null?void 0:i.name)??"â"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:((o=s.merchants)==null?void 0:o.email)??""})]})}),e.jsx(_,{className:"text-sm capitalize",children:((c=s.business_type)==null?void 0:c.replace(/_/g," "))??"â"}),e.jsx(_,{className:"text-sm capitalize",children:s.business_category??"â"}),e.jsx(_,{className:"text-sm",children:s.state??"â"}),e.jsx(_,{children:e.jsxs("span",{className:F("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold",a.toneClass),children:[e.jsx(r,{className:"h-3 w-3"}),a.label]})}),e.jsx(_,{className:"text-xs text-muted-foreground",children:s.submitted_at?pe(s.submitted_at):"â"}),e.jsx(_,{className:"text-xs text-muted-foreground",children:s.reviewed_at?pe(s.reviewed_at):"â"}),e.jsx(_,{children:e.jsx(v,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{k(s),I(""),w(!1)},children:e.jsx(Je,{className:"h-3.5 w-3.5"})})})]},s.id)})})]})})]}),e.jsx(ze,{open:!!t,onOpenChange:s=>{s||(k(null),w(!1))},children:e.jsxs(Ue,{className:"sm:max-w-2xl max-h-[90dvh] sm:max-h-[85vh] overflow-y-auto",children:[e.jsx(Oe,{className:"text-left",children:e.jsxs(Ye,{className:"flex items-start gap-2 pr-6 leading-snug break-words sm:items-center",children:[e.jsx(J,{className:"h-5 w-5 shrink-0"}),"KYC Review â ",((ae=t==null?void 0:t.merchants)==null?void 0:ae.name)??"Merchant"]})}),t&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(fe,{className:F("gap-1.5 text-xs font-semibold px-2.5 py-1",t.status==="approved"?"bg-success/15 text-success border border-success/30":t.status==="rejected"?"bg-destructive/15 text-destructive border border-destructive/30":t.status==="changes_requested"?"bg-[hsl(24,70%,47%)]/15 text-[hsl(24,70%,47%)] border border-[hsl(24,70%,47%)]/30":"bg-warning/15 text-warning border border-warning/30"),children:[t.status==="approved"&&e.jsx($,{className:"h-3 w-3"}),t.status==="rejected"&&e.jsx(W,{className:"h-3 w-3"}),t.status==="changes_requested"&&e.jsx(Y,{className:"h-3 w-3"}),(t.status==="submitted"||t.status==="under_review")&&e.jsx(X,{className:"h-3 w-3"}),t.status.replace(/_/g," ").toUpperCase()]}),t.submitted_at&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Submitted ",he(t.submitted_at)]})]}),t.status==="rejected"&&t.rejection_reason&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-destructive",children:"Rejection Reason"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.rejection_reason})]}),t.status==="changes_requested"&&t.rejection_reason&&e.jsxs("div",{className:"rounded-lg border border-[hsl(24,70%,47%)]/30 bg-[hsl(24,70%,47%)]/5 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-[hsl(24,70%,47%)]",children:"Requested Changes"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.rejection_reason})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Business Information"}),Z?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(v,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>w(!1),children:[e.jsx(Be,{className:"h-3 w-3"})," Cancel"]}),e.jsxs(v,{size:"sm",className:"h-7 gap-1.5 text-xs",disabled:se.isPending||!((re=d.business_name)!=null&&re.trim()),onClick:()=>{var A,U,oe,de;const s={},a=((A=t.merchants)==null?void 0:A.name)??"";d.business_name!==a&&(s.name=d.business_name.trim());const r=((U=t.merchants)==null?void 0:U.email)??"",i=(d.business_email??"").trim();if(i!==r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){m({title:"Invalid email address",variant:"destructive"});return}s.email=i.toLowerCase()}const o=Q.get(t.merchant_id)??"",c=(d.account_email??"").trim().toLowerCase();let f;if(c!==o.toLowerCase()){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c)){m({title:"Invalid account email address",variant:"destructive"});return}f=c}const R=["business_type","rc_number","tin","business_category","business_description","business_address","city","state","lga"],E={};for(const O of R){const me=((de=(oe=d[O]??"").trim)==null?void 0:de.call(oe))??d[O];me!==(t[O]??"")&&(E[O]=me||null)}if(Object.keys(s).length===0&&Object.keys(E).length===0&&!f){w(!1);return}se.mutate({kycId:t.id,merchantId:t.merchant_id,kycPatch:E,merchantPatch:s,accountEmail:f})},children:[e.jsx(es,{className:"h-3 w-3"})," Save"]})]}):e.jsxs(v,{variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{var s,a;x({business_name:((s=t.merchants)==null?void 0:s.name)??"",business_email:((a=t.merchants)==null?void 0:a.email)??"",account_email:Q.get(t.merchant_id)??"",business_type:t.business_type??"",rc_number:t.rc_number??"",tin:t.tin??"",business_category:t.business_category??"",business_description:t.business_description??"",business_address:t.business_address??"",city:t.city??"",state:t.state??"",lga:t.lga??""}),w(!0)},children:[e.jsx(We,{className:"h-3 w-3"})," Edit"]})]}),Z?e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(h,{label:"Business N
6ame",value:d.business_name,onChange:s=>x(a=>({...a,business_name:s})),span:!0}),e.jsx(h,{label:"Business Email",value:d.business_email,onChange:s=>x(a=>({...a,business_email:s}))}),e.jsx(h,{label:"Account Email (sign-in)",value:d.account_email,onChange:s=>x(a=>({...a,account_email:s}))}),e.jsx(h,{label:"Business Type",value:d.business_type,onChange:s=>x(a=>({...a,business_type:s}))}),e.jsx(h,{label:"RC Number",value:d.rc_number,onChange:s=>x(a=>({...a,rc_number:s}))}),e.jsx(h,{label:"TIN",value:d.tin,onChange:s=>x(a=>({...a,tin:s}))}),e.jsx(h,{label:"Category",value:d.business_category,onChange:s=>x(a=>({...a,business_category:s}))}),e.jsx(h,{label:"Description",value:d.business_description,onChange:s=>x(a=>({...a,business_description:s})),span:!0,textarea:!0}),e.jsx(h,{label:"Street Address",value:d.business_address,onChange:s=>x(a=>({...a,business_address:s})),span:!0}),e.jsx(h,{label:"City",value:d.city,onChange:s=>x(a=>({...a,city:s}))}),e.jsx(h,{label:"State",value:d.state,onChange:s=>x(a=>({...a,state:s}))}),e.jsx(h,{label:"LGA",value:d.lga,onChange:s=>x(a=>({...a,lga:s}))})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2",children:[e.jsx(l,{label:"Business Name",value:(ne=t.merchants)==null?void 0:ne.name,span:!0}),e.jsx(l,{label:"Business Email",value:(ie=t.merchants)==null?void 0:ie.email}),e.jsx(l,{label:"Account Email",value:Q.get(t.merchant_id)}),e.jsx(l,{label:"Business Type",value:(le=t.business_type)==null?void 0:le.replace(/_/g," ")}),e.jsx(l,{label:"RC Number",value:t.rc_number}),e.jsx(l,{label:"TIN",value:t.tin}),e.jsx(l,{label:"Category",value:t.business_category}),e.jsx(l,{label:"Description",value:t.business_description,span:!0})]}),e.jsx(B,{className:"my-4"}),e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Address"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2",children:[e.jsx(l,{label:"Street",value:t.business_address,span:!0}),e.jsx(l,{label:"City",value:t.city}),e.jsx(l,{label:"State",value:t.state}),e.jsx(l,{label:"LGA",value:t.lga})]})]})]}),e.jsx(B,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Directors / Owners"}),((ce=t.directors)==null?void 0:ce.length)>0?t.directors.map((s,a)=>{var r;return e.jsxs("div",{className:"mb-3",children:[t.directors.length>1&&e.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:["Director ",a+1," â ",s.share_percentage,"% shareholding"]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2",children:[e.jsx(l,{label:"First Name",value:s.first_name}),e.jsx(l,{label:"Last Name",value:s.last_name}),e.jsx(l,{label:"BVN",value:s.bvn}),e.jsx(l,{label:"Phone",value:s.phone}),e.jsx(l,{label:"Date of Birth",value:s.dob}),e.jsx(l,{label:"ID Type",value:(r=s.id_type)==null?void 0:r.replace(/_/g," ")}),e.jsx(l,{label:"ID Number",value:s.id_number})]}),e.jsx("div",{className:"mt-2",children:e.jsx(P,{label:`Director ${a+1} ID Document`,path:s.id_document_url})})]},s.id)}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No directors added"})]}),e.jsx(B,{}),(t.website_url||t.instagram_handle||t.twitter_handle||t.facebook_url||t.linkedin_url)&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Online Presence"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2",children:[e.jsx(l,{label:"Website",value:t.website_url,span:!0}),e.jsx(l,{label:"Instagram",value:t.instagram_handle}),e.jsx(l,{label:"Twitter / X",value:t.twitter_handle}),e.jsx(l,{label:"Facebook",value:t.facebook_url,span:!0}),e.jsx(l,{label:"LinkedIn",value:t.linkedin_url,span:!0})]})]}),e.jsx(B,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Uploaded Documents"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{label:"CAC Certificate",path:t.cac_certificate_url}),e.jsx(P,{label:"Memorandum & Articles (MEMART)",path:t.memart_url}),e.jsx(P,{label:"Status Report",path:t.status_report_url}),e.jsx(P,{label:"Utility Bill",path:t.utility_bill_url})]})]}),(t.status==="submitted"||t.status==="under_review"||t.status==="rejected"||t.status==="changes_requested")&&e.jsxs(e.Fragment,{children:[e.jsx(B,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Review Actions"}),t.status!=="approved"&&e.jsx("div",{className:"space-y-2",children:e.jsx(_e,{placeholder:"Reason for rejection or requested changes...",value:D,onChange:s=>I(s.target.value),rows:2})})]}),e.jsxs("div",{className:"sticky -bottom-4 z-10 -mx-4 -mb-4 grid grid-cols-2 gap-2 border-t bg-card/95 px-4 py-3 backdrop-blur [&>button]:w-full sm:static sm:!-mt-2 sm:mx-0 sm:mb-0 sm:flex sm:flex-wrap sm:border-0 sm:bg-transparent sm:p-0 sm:backdrop-blur-none sm:[&>button]:w-auto",children:[t.status!=="under_review"&&t.status!=="approved"&&e.jsxs(v,{variant:"outline",size:"sm",className:"gap-1.5",disabled:y.isPending,onClick:()=>y.mutate({id:t.id,merchantId:t.merchant_id,status:"under_review"}),children:[e.jsx(X,{className:"h-3.5 w-3.5"})," Mark Under Review"]}),e.jsxs(v,{variant:"outline",size:"sm",className:"gap-1.5 border-[hsl(24,70%,47%)] text-[hsl(24,70%,47%)] hover:bg-[hsl(24,70%,47%)]/10",disabled:y.isPending||!D.trim(),onClick:()=>y.mutate({id:t.id,merchantId:t.merchant_id,status:"changes_requested",reason:D}),children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," Request Changes"]}),e.jsxs(v,{size:"sm",className:"gap-1.5 bg-accent hover:bg-accent/90",disabled:y.isPending,onClick:()=>y.mutate({id:t.id,merchantId:t.merchant_id,status:"approved"}),children:[e.jsx($,{className:"h-3.5 w-3.5"})," Approve"]}),e.jsxs(v,{variant:"destructive",size:"sm",className:"gap-1.5",disabled:y.isPending||!D.trim(),onClick:()=>y.mutate({id:t.id,merchantId:t.merchant_id,status:"rejected",reason:D}),children:[e.jsx(W,{className:"h-3.5 w-3.5"})," Reject"]})]})]})]})]})})]})},l=({label:m,value:u,span:b})=>e.jsxs("div",{className:F("min-w-0",b&&"sm:col-span-2"),children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:m}),e.jsx("p",{className:"font-medium capitalize break-words",children:u||"â"})]}),h=({label:m,value:u,onChange:b,span:K,textarea:j})=>e.jsxs("div",{className:F("min-w-0 space-y-1.5",K&&"sm:col-span-2"),children:[e.jsx(Pe,{className:"text-xs text-muted-foreground",children:m}),j?e.jsx(_e,{value:u??"",onChange:g=>b(g.target.value),rows:2,className:"text-sm"}):e.jsx(Fe,{value:u??"",onChange:g=>b(g.target.value),className:"h-9 text-sm"})]}),P=({label:m,path:u})=>{const[b,K]=p.useState(null),j=async()=>
6{if(!u)return;const{data:g,error:L}=await N.storage.from("kyc-documents").createSignedUrl(u,3600);g!=null&&g.signedUrl&&window.open(g.signedUrl,"_blank")};return u?e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border p-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 shrink-0 text-accent"}),e.jsx("span",{className:"text-sm font-medium break-words",children:m})]}),e.jsxs(v,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5 text-xs",onClick:j,children:[e.jsx(Ze,{className:"h-3 w-3"})," View"]})]}):e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border p-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-sm break-words",children:m})]}),e.jsx(fe,{variant:"secondary",className:"shrink-0 text-xs",children:"Not uploaded"})]})};export{Fs 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.