PageSourceSearch

https://etcweb.in/build/assets/demo-requests-FX7MsGTN.js

js etcweb.in collected 2026-09-25 03:44:18 UTC 12,753 bytes, 1 lines download raw bytes

1import{r as a,d as S,j as e,H as le}from"./app-7HBJ1Apf.js";import{S as ie}from"./super-admin-layout-CS6NPVk1.js";import{B as x}from"./button-x9iCiHwy.js";import{b as ne,C as oe,c as de,d as ce,a as me}from"./card-D8QYfN0a.js";import{D as V,a as B,b as F,c as L,d as M,e as H}from"./dialog-o65iHwZw.js";import{D as xe,a as pe,b as ue,c as y,C as he}from"./dropdown-menu-B1PUnwcf.js";import{I as je}from"./input-BKIYy12E.js";import{L as d}from"./label-UWbOryIJ.js";import{S as b,a as w,b as D,c as P,d as l}from"./select-k7kpKpKU.js";import{T as ge}from"./toast-BXJoIwj2.js";import{S as N}from"./stat-card-C9S91pSD.js";import{B as fe}from"./badge-DlBLFwO_.js";import{C as ve}from"./circle-play-BBpk1hrR.js";import{C as Ne}from"./clock-CPiHZyjf.js";import{C as U}from"./circle-check-big-oqKdYS3K.js";import{S as Ce}from"./search-DmizD6rg.js";import{E as Se}from"./ellipsis-vertical-Do4Jb0KP.js";import{E as ye}from"./eye-Bdy3tE7L.js";import{T as be}from"./trash-2-Bv8tA-25.js";import{C as we}from"./chevron-left-0KHFfh7L.js";/* empty css            */import"./nav-main-DAd6sXcd.js";import"./createLucideIcon-B-GenWB7.js";import"./sheet-DOKt16Rx.js";import"./index-5SrjSmjN.js";import"./check-DwUTHKzP.js";import"./index-C8WrhDd4.js";import"./index-D70aP5MW.js";import"./x-Vl-l8R5q.js";import"./index-BqjgvoQR.js";import"./use-mobile-navigation-Cs1LY7kG.js";import"./app-logo-icon-vD8jXHxq.js";import"./nav-footer-OztTASvz.js";import"./user-C11W5xqZ.js";import"./institute-admin-app-sidebar-layout-CDfA9CGh.js";import"./users-TfVkPDFO.js";import"./graduation-cap-BzAjWGD_.js";import"./book-open-CekbENE4.js";import"./ticket-WN-C8Icz.js";import"./theme-toggle-C2xQe2Ub.js";import"./sun-BOBLWgeB.js";import"./user-check-A5wfCfeC.js";import"./credit-card-BcqAkj9j.js";import"./file-text-CznOadTM.js";import"./school-CcsSJsKd.js";import"./video-BTh5zbtm.js";import"./circle-help-Bx96xs2_.js";import"./bell-Di2hbogt.js";import"./message-square-BXeYCRQ8.js";import"./chevron-down-DSrXABT6.js";import"./target-CV5Gf0K7.js";import"./sparkles-cElY-yTv.js";import"./settings-CNeQIGts.js";import"./shield-check-B-NQhW7f.js";import"./index-BIyNxQqj.js";import"./index-Cdjj24pt.js";import"./circle-alert-B7oQDflj.js";import"./arrow-right-Cq-Z79Ed.js";const De=[{title:"CRM",href:"#"},{title:"Demo Requests"}];function Et({stats:_,filters:k}){const[h,$]=a.useState(_),[R,G]=a.useState([]),[q,E]=a.useState(!1),[j,J]=a.useState(10),[r,K]=a.useState({currentPage:1,lastPage:1,total:0,from:0,to:0}),[g,Q]=a.useState(k.search||""),[f,W]=a.useState(k.status||""),[n,X]=a.useState("id"),[o,I]=a.useState("desc"),[Y,C]=a.useState(!1),[Z,v]=a.useState(!1),[i,T]=a.useState(null),[z,A]=a.useState(""),[ee,p]=a.useState(null),c=a.useCallback(async(t=1)=>{E(!0);try{const s=await S.get("/super-admin/demo-requests/data",{params:{page:t,per_page:j,search:g,status:f,sort_by:n,sort_order:o}});G(s.data.data),K({currentPage:s.data.meta.current_page,lastPage:s.data.meta.last_page,total:s.data.meta.total,from:s.data.meta.from,to:s.data.meta.to})}catch(s){console.error("Failed to fetch demo requests:",s)}finally{E(!1)}},[g,f,n,o,j]);a.useEffect(()=>{c(1)},[g,f,n,o,j,c]);const m=t=>{n===t?I(o==="asc"?"desc":"asc"):(X(t),I("desc"))},te=t=>{T(t),C(!0)},se=t=>{T(t),A(t.status),v(!0)},ae=async()=>{if(i)try{const t=await S.put(`/super-admin/demo-requests/${i.id}`,{status:z});t.data.type==="success"&&(p({type:"success",message:t.data.message}),v(!1),c(r.currentPage))}catch(t){p({type:"danger",message:t.response?.data?.message||"Failed to update status"})}},re=async t=>{if(confirm("Are you sure you want to delete this demo request?"))try{const s=await S.delete(`/super-admin/demo-requests/${t.id}`);s.data.type==="success"&&(p({type:"success",message:s.data.message}),c(r.currentPage),$(u=>({...u,total:u.total-1})))}catch(s){p({type:"danger",message:s.response?.data?.message||"Failed to delete demo request"})}},O=t=>{const s={pending:{variant:"outline",label:"Pending"},contacted:{variant:"secondary",label:"Contacted"},completed:{variant:"default",label:"Completed"},cancelled:{variant:"destructive",label:"Cancelled"}},u=s[t]||s.pending;return e.jsx(fe,{variant:u.variant,children:u.label})};return e.jsxs(ie,{breadcrumbs:De,children:[e.jsx(le,{title:"Demo Requests"}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-4",children:[e.jsx(ge,{toast:ee,onClose:()=>p(null)}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Demo Requests"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage demo requests from your website"})]})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(N,{title:"Total Requests",value:h?.total||0,description:"All demo requests",icon:ve,paletteIndex:0}),e.jsx(N,{title:"Pending",value:h?.pending||0,description:"Awaiting response",icon:Ne,paletteIndex:1}),e.jsx(N,{title:"Contacted",value:h?.contacted||0,description:"Already contacted",icon:U,paletteIndex:2}),e.jsx(N,{title:"Completed",value:h?.completed||0,description:"Successfully completed",icon:U,paletteIndex:3})]}),e.jsxs(ne,{children:[e.jsxs(oe,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(de,{children:"All Demo Requests"}),e.jsx(ce,{children:"A list of all demo requests from your website"})]})}),e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Ce,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{placeholder:"Search requests...",value:g,onChange:t=>Q(t.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{value:f||void 0,onValueChange:t=>W(t||""),children:[e.jsx(w,{className:"w-[140px]",children:e.jsx(D,{placeholder:"All Status"})}),e.jsxs(P,{children:[e.jsx(l,{value:"pending",children:"Pending"}),e.jsx(l,{value:"contacted",children:"Contacted"}),e.jsx(l,{value:"completed",children:"Completed"}),e.jsx(l,{value:"cancelled",children:"Cancelled"})]})]}),e.jsxs(b,{value:j.toString(),onValueChange:t=>J(parseInt(t)),children:[e.jsx(w,{className:"w-[100px]",children:e.jsx(D,{})}),e.jsxs(P,{children:[e.jsx(l,{value:"10",children:"10"}),e.jsx(l,{value:"25",children:"25"}),e.jsx(l,{value:"50",children:"50"}),e.jsx(l,{value:"100",children:"100"})]})]})]})]})]}),e.jsxs(me,{children:[e.jsx("div",{className:"rounded-md border",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"border-b bg-muted/50",children:e.jsxs("tr",{children:[e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>
1m("id"),children:["ID ",n==="id"&&(o==="asc"?"↑":"↓")]}),e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>m("name"),children:["Name ",n==="name"&&(o==="asc"?"↑":"↓")]}),e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>m("organization"),children:["Organization ",n==="organization"&&(o==="asc"?"↑":"↓")]}),e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>m("email"),children:["Email ",n==="email"&&(o==="asc"?"↑":"↓")]}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Phone"}),e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>m("status"),children:["Status ",n==="status"&&(o==="asc"?"↑":"↓")]}),e.jsxs("th",{className:"px-4 py-3 text-left text-sm font-medium cursor-pointer hover:bg-muted/70",onClick:()=>m("created_at"),children:["Date ",n==="created_at"&&(o==="asc"?"â
1†‘":"↓")]}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:q?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Loading..."})}):R.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No demo requests found."})}):R.map(t=>e.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[e.jsxs("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:["#",t.id]}),e.jsx("td",{className:"px-4 py-3 text-sm font-medium",children:t.name}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.organization}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.email}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.phone}),e.jsx("td",{className:"px-4 py-3 text-sm",children:O(t.status)}),e.jsx("td",{className:"px-4 py-3 text-sm",children:new Date(t.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs(xe,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"icon",children:e.jsx(Se,{className:"h-4 w-4"})})}),e.jsxs(ue,{align:"end",children:[e.jsxs(y,{onClick:()=>te(t),children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"View Details"]}),e.jsx(y,{onClick:()=>se(t),children:"Update Status"}),e.jsxs(y,{onClick:()=>re(t),className:"text-red-600",children:[e.jsx(be,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]},t.id))})]})})}),!q&&r.total>0&&e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",r.from," to ",r.to," of ",r.total," results"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>c(r.currentPage-1),disabled:r.currentPage===1,children:[e.jsx(we,{className:"h-4 w-4"}),"Previous"]}),e.jsxs("div",{className:"text-sm",children:["Page ",r.currentPage," of ",r.lastPage]}),e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>c(r.currentPage+1),disabled:r.currentPage===r.lastPage,children:["Next",e.jsx(he,{className:"h-4 w-4"})]})]})]})]})]})]}),e.jsx(V,{open:Y,onOpenChange:C,children:e.jsxs(B,{className:"max-w-2xl",children:[e.jsxs(F,{children:[e.jsx(L,{children:"Demo Request Details"}),e.jsx(M,{children:"Full details of the demo request"})]}),i&&e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Name"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.name})]}),e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Email"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.email})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Phone"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.phone})]}),e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Organization"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.organization})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Role"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.role})]}),e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Status"}),e.jsx("div",{className:"mt-1",children:O(i.status)})]})]}),e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Message"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:i.message})]}),e.jsxs("div",{children:[e.jsx(d,{className:"text-sm font-medium",children:"Submitted Date"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(i.created_at).toLocaleString()})]})]}),e.jsx(H,{children:e.jsx(x,{variant:"outline",onClick:()=>C(!1),children:"Close"})})]})}),e.jsx(V,{open:Z,onOpenChange:v,children:e.jsxs(B,{children:[e.jsxs(F,{children:[e.jsx(L,{children:"Update Status"}),e.jsx(M,{children:"Change the status of this demo request"})]}),e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"status",children:"Status"}),e.jsxs(b,{value:z,onValueChange:A,children:[e.jsx(w,{children:e.jsx(D,{placeholder:"Select status"})}),e.jsxs(P,{children:[e.jsx(l,{value:"pending",children:"Pending"}),e.jsx(l,{value:"contacted",children:"Contacted"}),e.jsx(l,{value:"completed",children:"Completed"}),e.jsx(l,{value:"cancelled",children:"Cancelled"})]})]})]})}
1),e.jsxs(H,{children:[e.jsx(x,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),e.jsx(x,{onClick:ae,children:"Update Status"})]})]})})]})}export{Et 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.