PageSourceSearch

https://admin.cartstack.com/build/assets/Index-DNWTcuKd.js

js cartstack.com collected 2026-09-24 17:44:59 UTC 8,853 bytes, 1 lines download raw bytes

1import{b as H,e as o,P as w,v as R,j as e,H as W,R as M,t as C}from"./app-D5Bf_dbH.js";import{U as O}from"./UserLayout-C9WnFx_O.js";import{B as q}from"./Breadcrumbs-DxtGVYP8.js";import{S as G}from"./spinner-CoXWKYJB.js";import{c as P}from"./site-api-DLyJnXUW.js";import{D as Q,a as V,b as J,c as K,d as X}from"./dialog-BgEHdzUT.js";import{I as l}from"./input-DqZbbFgj.js";import{L as m}from"./label-Cm1tsOLE.js";import{S as Y,a as Z,b as $,c as ee,d as se}from"./select-Ckvsxj-Q.js";import{B as u}from"./button-BooRjUAf.js";import{B as te}from"./badge-BdtyRZeW.js";import{C as p,a as re,b as ie,d as x}from"./card-CUwjT2hB.js";import{T as h,a as f,b as j,c as g}from"./tooltip-CMiJQMfJ.js";import ae from"./MacBrowserFrame-Cc0VL1By.js";import{t as oe,a as ne}from"./timezoneOptions-BouTqJ7V.js";import{S as le}from"./search-F-2nffFh.js";import{G as me}from"./globe-DJogESbI.js";import{U as de}from"./user-CODNnX9U.js";import{M as ce}from"./mail-Bw_TZjX-.js";import"./WistiaDialogContext-DEfy83sd.js";import"./index-eCYNzz1C.js";import"./separator-DsWrB1WR.js";import"./index-D4lci4mZ.js";import"./sheet-lU-qfqG8.js";import"./index-B02_DhYT.js";import"./react-icons.esm-CCm293eC.js";import"./useGlobalShortcuts-C3mPQ3zf.js";import"./react-BPWwdghM.js";import"./chevron-right-Ba0gC1l7.js";import"./createLucideIcon-CyKN5i_O.js";import"./index-Cn72dBP_.js";import"./scroll-area-CnV8vZPq.js";import"./index-D17hSi50.js";import"./rotate-ccw-hNqG30TC.js";import"./eye-jUg7xQoe.js";import"./CSLOGO_lghtbg-12-DL8MB5gQ.js";import"./index-DI8WOxmI.js";import"./index-rimmKLID.js";import"./popover-CBJwT1Kl.js";import"./shopping-cart-BYHhTvfT.js";import"./users-jvAb0Hsa.js";import"./lock-_lQojS3k.js";import"./settings-x0uW8CTG.js";import"./dropdown-menu-DXUwCH2H.js";import"./workflow-nfp-eV15.js";import"./circle-x-DJWwu-M6.js";import"./plus-C4zOu0jA.js";import"./avatar-CQYHhkys.js";import"./credit-card-BU_LCcMi.js";import"./life-buoy-CAWDIjwj.js";import"./log-out-Cqz61TM3.js";import"./bell-B-abMZvc.js";import"./circle-help-vR0qTlf_.js";import"./sonner-CJXwkPTZ.js";import"./x-JT2YrhZw.js";import"./alert-CGHGpkpD.js";import"./loader-circle-CNDCpqRX.js";import"./index-D2PwZ_9r.js";const js=({sites:F,isSuperAdmin:T})=>{const{auth:n,impersonation:a}=H().props,z=()=>a?.account?.id?a.account.id:n.account?.id??0,D=(a?a.account.business_type_signup:n.account?.business_type_signup)==="hotel",E=F.map(s=>({id:s.id.toString(),url:s.url,status:s.active?"active":"inactive",previewUrl:"/placeholder.svg?height=200&width=400",timezone:s.timezone,sendFromName:s.from_name,sendFromEmail:s.from_email})),[b,I]=o.useState(E),[v,B]=o.useState(""),[A,d]=o.useState(!1),[i,N]=o.useState(!1),[_,S]=o.useState(w()),k=b.filter(s=>s.url.toLowerCase().includes(v.toLowerCase()));o.useEffect(()=>{const s=n.user.id.toString(),t=a?.account?.id?a.account.id.toString():n.user.account_id.toString();R(s,t)},[n,a]),o.useEffect(()=>{window.location.search.includes("add_site=1")&&d(!0)},[]);const U=async s=>{s.preventDefault(),N(!0);const t=new FormData(s.currentTarget),c={website_address:t.get("website_address"),send_name:t.get("send_name"),send_from_email:t.get("send_from_email"),website_timezone:_,number_of_rooms:t.get("number_of_rooms")?parseInt(t.get("number_of_rooms")):void 0};try{const r=await P(c,z());if(r.success&&r.site){const L={id:r.site.id.toString(),url:r.site.url,status:r.site.active?"active":"inactive",previewUrl:"/placeholder.svg?height=200&width=400",timezone:r.site.timezone,sendFromName:r.site.from_name,sendFromEmail:r.site.from_email};I([...b,L]),d(!1),S(w()),window.dispatchEvent(new CustomEvent("site:created",{detail:{site:r.site}})),C.success("Site created successfully")}}catch(r){C.error(r instanceof Error?r.message:"Failed to create site")}finally{N(!1)}},y=s=>{const t=ne.find(c=>c.value===s);return t?t.label:s};return e.jsxs(O,{header:e.jsx(q,{items:[{name:"Dashboard",link:route("auth.dashboard"),
1current:!1},{name:"Sites",link:route("auth.settings.account.sites"),current:!0}]}),children:[e.jsx(W,{title:"Sites"}),e.jsxs(p,{className:"container mx-auto",children:[e.jsx(re,{children:e.jsx(ie,{children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h1",{className:"centra-bold text-page-heading",children:"Site Management"}),e.jsxs("div",{className:"relative w-72",children:[e.jsx(le,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(l,{placeholder:"Type to filter sites...",className:"pl-8 text-sm font-medium",value:v,onChange:s=>B(s.target.value)})]})]})})}),e.jsx(x,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[e.jsxs(Q,{open:A,onOpenChange:d,children:[e.jsx(V,{asChild:!0,children:e.jsx(p,{className:"cursor-pointer hover:opacity-90 transition-opacity bg-[#d4e8f7] border-0 h-[400px]",children:e.jsx(x,{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center space-y-6",children:[e.jsx("img",{src:"/images/svg/add-site.svg",alt:"Add Site",className:"w-28 h-auto mx-auto"}),e.jsx(u,{type:"button",variant:"default",className:"",children:"Add a Site"})]})})})}),e.jsxs(J,{children:[e.jsx(K,{children:e.jsx(X,{children:"Add New Site"})}),e.jsxs("form",{onSubmit:U,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"website_address",children:"Website Address"}),e.jsx(l,{id:"website_address",name:"website_address",placeholder:"eg: store.yourwebsite.com",required:!0,disabled:i})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"send_name",children:"Send Name"}),e.jsx(l,{id:"send_name",name:"send_name",placeholder:"eg: John Smith",required:!0,disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"send_from_email",children:"Send From Email"}),e.jsx(l,{id:"send_from_email",name:"send_from_email",type:"email",placeholder:"eg: [email protected]",required:!0,disabled:i})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"website_timezone",children:"Website Timezone"}),e.jsxs(Y,{value:_,onValueChange:S,disabled:i,children:[e.jsx(Z,{children:e.jsx($,{placeholder:"Select timezone"})}),e.jsx(ee,{children:oe.map(s=>e.jsxs(M.Fragment,{children:[e.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground",children:s.label}),s.options.map(t=>e.jsx(se,{value:t.value,children:t.label},t.value))]},s.label))})]})]}),D&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"number_of_rooms",children:"Number of Rooms"}),e.jsx(l,{id:"number_of_rooms",name:"number_of_rooms",type:"number",placeholder:"Enter Number of Rooms",disabled:i})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(u,{type:"button",variant:"outline",onClick:()=>d(!1),disabled:i,children:"Close"}),e.jsx(u,{type:"submit",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"mr-2"}),"Creating..."]}):"Add Site"})]})]})]})]}),k.map(s=>e.jsx(p,{className:"h-[400px] flex flex-col",children:e.jsxs(x,{className:"p-4 flex-1 flex flex-col",children:[e.jsx(ae,{url:s.url}),e.jsxs("div",{className:"flex-1 flex flex-col justify-between mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-medium break-all mb-3",children:s.url}),e.jsx(h,{children:e.jsxs(f,{children:[e.jsx(j,{asChild:!0,children:e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(me,{className:"h-4 w-4 mr-1 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:y(s.timezone)})]})}),e.jsx(g,{children:e.jsxs("p",{children:["Timezone: ",y(s.timezone)]})})]})}),e.jsx(h,{children:e.jsxs(f,{children:[e.jsx(j,{asChild:!0,children:e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(de,{className:"h-4 w-4 mr-1 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s.sendFromName})]})}),e.jsx(g,{children:e.jsxs("p",{children:["Send From Name: ",s.sendFromName]})})]})}),e.jsx(h,{children:e.jsxs(f,{children:[e.jsx(j,{asChild:!0,children:e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(ce,{className:"h-4 w-4 mr-1 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s.sendFromEmail})]})}),e.jsx(g,{children:e.jsxs("p",{children:["Send From Email: ",s.sendFromEmail]})})]})})]}),T&&e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsx(te,{variant:"secondary",className:s.status==="active"?"bg-green-500/10 text-green-600 hover:bg-green-500/20":"bg-red-500/10 text-red-600 hover:bg-red-500/20",children:s.status==="active"?"Active":"Inactive"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["ID: ",s.id]})]})]})]})},s.id))]})})]})]})};export{js 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.