PageSourceSearch

https://visaaidbd.com/assets/SaasApplicants-Da282A6p.js

js visaaidbd.com collected 2026-10-09 22:04:55 UTC 18,928 bytes, 1 lines download raw bytes

1import{r as n,s as y,j as e,a8 as P,t as le,I as r,S as g,a as f,b as v,d as N,e as p,B as _,M as ne,G as re,T as ie,F as de,u as b}from"./index-t8iIANdV.js";import{S as ce}from"./SaasLayout-D3FsKv-W.js";import{C as L,a as F}from"./card-CBzzzPl-.js";import{D as H,a as K,b as J,c as W}from"./dialog-CHWKU7ua.js";import{T as oe,a as me,b as G,c as m,d as xe,e as o}from"./table-DFpdnPlt.js";import{T as Y,a as Q,b as x,c as u}from"./tabs-CMdAJoCc.js";import{D as ue,a as he,E as pe,b as je,c as M}from"./dropdown-menu-D-CacTKU.js";import{P as ge}from"./plus-Dm22To4t.js";import{L as O}from"./loader-circle-BdctGLMk.js";import{E as fe}from"./eye-Bm4GKPHJ.js";import{P as ve}from"./pencil-CwGVXbLg.js";import{T as Ne}from"./trash-2-Hl0Z3UJp.js";import{U as be}from"./user-Dx1T4k6h.js";import{F as Z}from"./file-text-BDwlayQC.js";import"./NavLink-BkXttT7M.js";import"./index-BqJHXgvW.js";import"./skeleton-C9aEk_h0.js";import"./shield-check-xVxoD3cn.js";import"./clipboard-list-dcw4me8g.js";import"./file-check-Co5Uhd8Z.js";import"./store-PvGtaBHv.js";import"./dollar-sign-CFFDTXly.js";import"./wallet-BzqQ8Dps.js";import"./message-square-DnZiHe7m.js";import"./NotificationBell-C5xe3Rra.js";import"./popover-C65m8-bf.js";import"./credit-card-D_w8mWm-.js";import"./avatar-DH6WUtT0.js";const B=[{key:"pending",label:"Pending",class:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"},{key:"processing",label:"Processing",class:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"},{key:"docs_submitted",label:"Docs Submitted",class:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400"},{key:"embassy_submitted",label:"At Embassy",class:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"},{key:"interview_scheduled",label:"Interview",class:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400"},{key:"approved",label:"Approved",class:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400"},{key:"rejected",label:"Rejected",class:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"}],ye=["Canada","UK","Australia","USA","Germany","Japan","Malaysia","South Korea"],_e=["Student Visa","Work Permit","Tourist Visa","Business Visa"],we=["Male","Female","Other"],X={name:"",email:"",phone:"",passport_number:"",nid_number:"",date_of_birth:"",gender:"",nationality:"Bangladeshi",address:"",guardian_name:"",guardian_phone:"",country:"",visa_type:"",visa_status:"pending",assigned_counselor:"",assigned_officer:"",notes:""},es=()=>{const[c,w]=n.useState([]),[E,V]=n.useState(!0),[h,C]=n.useState(""),[j,d]=n.useState("all"),[I,k]=n.useState(!1),[t,U]=n.useState(null),[a,l]=n.useState(X),[S,R]=n.useState(null),[q,T]=n.useState(!1),A=n.useCallback(async()=>{const{data:s}=await y.from("saas_customers").select("*").order("created_at",{ascending:!1});w(s||[]),V(!1)},[]);n.useEffect(()=>{A()},[A]);const z=c.filter(s=>{const i=s.name.toLowerCase().includes(h.toLowerCase())||s.email.toLowerCase().includes(h.toLowerCase())||s.passport_number.toLowerCase().includes(h.toLowerCase()),te=j==="all"||s.visa_status===j;return i&&te}),$=()=>{l(X),R(null),k(!0)},ee=s=>
1{l({name:s.name,email:s.email,phone:s.phone,passport_number:s.passport_number,nid_number:s.nid_number,date_of_birth:s.date_of_birth||"",gender:s.gender,nationality:s.nationality,address:s.address,guardian_name:s.guardian_name,guardian_phone:s.guardian_phone,country:s.country,visa_type:s.visa_type,visa_status:s.visa_status,assigned_counselor:s.assigned_counselor,assigned_officer:s.assigned_officer,notes:s.notes}),R(s.id),k(!0)},se=async()=>{if(!a.name.trim()){b.error("Name is required");return}T(!0);const s={...a,date_of_birth:a.date_of_birth||null};if(S){const{error:i}=await y.from("saas_customers").update(s).eq("id",S);if(i){b.error(i.message),T(!1);return}}else{const{error:i}=await y.from("saas_customers").insert(s);if(i){b.error(i.message),T(!1);return}}b.success("Applicant saved!"),k(!1),T(!1),A()},ae=async s=>{await y.from("saas_customers").delete().eq("id",s),b.success("Applicant deleted"),A()},D=s=>B.find(i=>i.key===s);return e.jsxs(ce,{title:"Applicants",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[{label:"Total",count:c.length,cls:"text-foreground"},{label:"Processing",count:c.filter(s=>["processing","docs_submitted","embassy_submitted","interview_scheduled"].includes(s.visa_status)).length,cls:"text-blue-600 dark:text-blue-400"},{label:"Approved",count:c.filter(s=>s.visa_status==="approved").length,cls:"text-emerald-600 dark:text-emerald-400"},{label:"Rejected",count:c.filter(s=>s.visa_status==="rejected").length,cls:"text-red-600 dark:text-red-400"}].map(s=>e.jsx(L,{children:e.jsxs(F,{className:"p-4 text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:s.label}),e.jsx("p",{className:P("text-2xl font-heading font-bold mt-1",s.cls),children:s.count})]})},s.label))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative flex-1 sm:w-72",children:[e.jsx(le,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(r,{placeholder:"Search by name, email, passport...",value:h,onChange:s=>C(s.target.value),className:"pl-9"})]}),e.jsxs(g,{value:j,onValueChange:d,children:[e.jsx(f,{className:"w-44",children:e.jsx(v,{placeholder:"All Statuses"})}),e.jsxs(N,{children:[e.jsx(p,{value:"all",children:"All Statuses"}),B.map(s=>e.jsx(p,{value:s.key,children:s.label},s.key))]})]})]}),e.jsxs(_,{onClick:$,size:"sm",children:[e.jsx(ge,{className:"h-4 w-4 mr-1"}),"Add Applicant"]})]}),E?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(O,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(L,{children:e.jsx(F,{className:"p-0",children:e.jsxs(oe,{children:[e.jsx(me,{children:e.jsxs(G,{children:[e.jsx(m,{children:"Applicant"}),e.jsx(m,{children:"Country"}),e.jsx(m,{children:"Visa Type"}),e.jsx(m,{children:"Passport"}),e.jsx(m,{children:"Status"}),e.jsx(m,{children:"Counselor"}),e.jsx(m,{})]})}),e.jsx(xe,{children:z.length===0?e.jsx(G,{children:e.jsx(o,{colSpan:7,className:"text-center py-10 text-muted-foreground",children:"No applicants found."})}):z.map(s=>e.jsxs(G,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-semibold text-primary",children:s.name.charAt(0)})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.email})]})]})}),e.jsx(o,{className:"text-sm",children:s.country||"—"}),e.jsx(o,{className:"text-sm",children:s.visa_type||"—"}),e.jsx(o,{className:"text-xs font-mono",children:s.passport_number||"—"}),e.jsx(o,{children:e.jsx("span",{className:P("text-[11px] font-medium px-2 py-0.5 rounded-full",D(s.visa_status)?.class),children:D(s.visa_status)?.label||s.visa_status})}),e.jsx(o,{className:"text-sm",children:s.assigned_counselor||"—"}),e.jsx(o,{children:e.jsxs(ue,{children:[e.jsx(he,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(pe,{className:"h-4 w-4"})})}),e.jsxs(je,{align:"end",children:[e.jsxs(M,{onClick:()=>U(s),children:[e.jsx(fe,{className:"h-3.5 w-3.5 mr-1.5"}),"View Profile"]}),e.jsxs(M,{onClick:()=>ee(s),children:[e.jsx(ve,{className:"h-3.5 w-3.5 mr-1.5"}),"Edit"]}),e.jsxs(M,{className:"text-destructive",onClick:()=>ae(s.id),children:[e.jsx(Ne,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete"]})]})]})})]},s.id))})]})})})]}),e.jsx(H,{open:!!t,onOpenChange:()=>U(null),children:e.jsx(K,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:t&&e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsxs(W,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-bold text-primary",children:t.name.charAt(0)})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg",children:t.name}),e.jsx("span",{className:P("text-[11px] font-medium px-2 py-0.5 rounded-full",D(t.visa_status)?.class),children:D(t.visa_status)?.label})]})]})}),e.jsxs(Y,{defaultValue:"personal",children:[e.jsxs(Q,{className:"w-full",children:[e.jsxs(x,{value:"personal",className:"flex-1",children:[e.jsx(be,{className:"h-3.5 w-3.5 mr-1"}),"Personal"]}),e.jsxs(x,{value:"visa",className:"flex-1",children:[e.jsx(ne,{className:"h-3.5 w-3.5 mr-1"}),"Visa"]}),e.jsxs(x,{value:"academic",className:"flex-1",children:[e.jsx(re,{className:"h-3.5 w-3.5 mr-1"}),"Academic"]}),e.jsxs(x,{value:"docs",className:"flex-1",children:[e.jsx(Z,{className:"h-3.5 w-3.5 mr-1"}),"Docs"]})]}),e.jsx(u,{value:"personal",className:"mt-4 space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Email"}),e.jsx("p",{className:"font-medium",children:t.email||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Phone"}),e.jsx("p",{className:"font-medium",children:t.phone||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Passport"}),e.jsx("p",{className:"font-medium font-mono",children:t.passport_number||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"NID"}),e.jsx("p",{className:"font-medium font-mono",children:t.nid_number||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Date of Birth"}),e.jsx("p",{className:"font-medium",children:t.date_of_birth||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Gender"}),e.jsx("p",{className:"font-medium",children:t.gender||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Nationality"}),e.jsx("p",{className:"font-medium",children:t.nationality||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Address"}),e.jsx("p",{className:"font-medium",children:t.address||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Guardian"}),e.jsx("p",{className:"font-medium",children:t.guardian_name||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Guardian Phone"}),e.jsx("p",{className:"font-medium",children:t.guardian_phone||"—"})]})]})}),e.jsxs(u,{value:"visa",className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Country"}),e.jsx("p",{className:"font-medium",children:t.country||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Visa Type"}),e.jsx("p",{className:"font-medium",children:t.visa_type||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Counselor"}),e.jsx("p",{className:"font-medium",children:t.assigned_counselor||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Processing Officer"}),e.jsx("p",{className:"font-medium",children:t.assigned_officer||"—"})]})]}),t.notes&&e.jsxs("div",{className:"mt-3",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"Notes"}),e.jsx("p",{className:"text-sm mt-1 bg-muted p-3 rounded-lg whitespace-pre-wrap",children:t.notes})]})]}),e.jsx(u,{value:"academic",className:"mt-4",children:t.academic_history?.length>0?e.jsx("div",{className:"space-y-2",children:t.academic_history.map((s,i)=>e.jsx(L,{children:e.jsxs(F,{className:"p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:s.degree||s.title}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.institution," · ",s.year]})]})},i))}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No academic re
1cords added yet."})}),e.jsx(u,{value:"docs",className:"mt-4",children:e.jsx(Ce,{customerId:t.id})})]})]})})}),e.jsx(H,{open:I,onOpenChange:k,children:e.jsxs(K,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsx(J,{children:e.jsxs(W,{children:[S?"Edit":"Add"," Applicant"]})}),e.jsxs(Y,{defaultValue:"basic",children:[e.jsxs(Q,{className:"w-full",children:[e.jsx(x,{value:"basic",className:"flex-1",children:"Basic Info"}),e.jsx(x,{value:"identity",className:"flex-1",children:"Identity"}),e.jsx(x,{value:"visa",className:"flex-1",children:"Visa Details"})]}),e.jsx(u,{value:"basic",className:"mt-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Full Name *"}),e.jsx(r,{value:a.name,onChange:s=>l({...a,name:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Email"}),e.jsx(r,{type:"email",value:a.email,onChange:s=>l({...a,email:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Phone"}),e.jsx(r,{value:a.phone,onChange:s=>l({...a,phone:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Date of Birth"}),e.jsx(r,{type:"date",value:a.date_of_birth,onChange:s=>l({...a,date_of_birth:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Gender"}),e.jsxs(g,{value:a.gender,onValueChange:s=>l({...a,gender:s}),children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select"})}),e.jsx(N,{children:we.map(s=>e.jsx(p,{value:s,children:s},s))})]})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Address"}),e.jsx(r,{value:a.address,onChange:s=>l({...a,address:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Guardian Name"}),e.jsx(r,{value:a.guardian_name,onChange:s=>l({...a,guardian_name:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Guardian Phone"}),e.jsx(r,{value:a.guardian_phone,onChange:s=>l({...a,guardian_phone:s.target.value})})]})]})}),e.jsx(u,{value:"identity",className:"mt-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Passport Number"}),e.jsx(r,{value:a.passport_number,onChange:s=>l({...a,passport_number:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"NID Number"}),e.jsx(r,{value:a.nid_number,onChange:s=>l({...a,nid_number:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Nationality"}),e.jsx(r,{value:a.nationality,onChange:s=>l({...a,nationality:s.target.value})})]})]})}),e.jsx(u,{value:"visa",className:"mt-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Country"}),e.jsxs(g,{value:a.country,onValueChange:s=>l({...a,country:s}),children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select"})}),e.jsx(N,{children:ye.map(s=>e.jsx(p,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Visa Type"}),e.jsxs(g,{value:a.visa_type,onValueChange:s=>l({...a,visa_type:s}),children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select"})}),e.jsx(N,{children:_e.map(s=>e.jsx(p,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Status"}),e.jsxs(g,{value:a.visa_status,onValueChange:s=>l({...a,visa_status:s}),children:[e.jsx(f,{children:e.jsx(v,{})}),e.jsx(N,{children:B.map(s=>e.jsx(p,{value:s.key,children:s.label},s.key))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Counselor"}),e.jsx(r,{value:a.assigned_counselor,onChange:s=>l({...a,assigned_counselor:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Processing Officer"}),e.jsx(r,{value:a.assigned_officer,onChange:s=>l({...a,assigned_officer:s.target.value})})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Notes"}),e.jsx(ie,{value:a.notes,onChange:s=>l({...a,notes:s.target.value}),rows:3})]})]})})]}),e.jsxs(_,{onClick:se,disabled:q,className:"w-full mt-3",children:[q&&e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}),S?"Update":"Add"," Applicant"]})]})})]})},Ce=({customerId:c})=>{const[w,E]=n.useState([]),[V,h]=n.useState(!0),C=de();if(n.useEffect(()=>{(async()=>{const{data:I}=await y.from("saas_documents").select("*").eq("customer_id",c).order("created_at",{ascending:!1});E(I||[]),h(!1)})()},[c]),V)return e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})});const j={pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",uploaded:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",under_review:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400",verified:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",rejected:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",expired:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"};return w.length>0?e.jsxs("div",{className:"space-y-2",children:[w.map(d=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:d.doc_name||d.doc_type}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:d.doc_type})]})]}),e.jsx("span",{className:P("text-[11px] font-medium px-2 py-0.5 rounded-full",j[d.status]||""),children:d.status})]},d.id)),e.jsx(_,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>C("/saas/documents"),children:"Manage All Documents"})]}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No documents uploaded yet."}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>C("/saas/documents"),children:"Go to Documents"})]})};export{es 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.