PageSourceSearch

https://peaceweb.com/build/assets/Create-Cn5Al14F.js

js peaceweb.com collected 2026-10-10 00:07:02 UTC 5,105 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-react-B71pkc0u.js";import{u as A,H as L,L as p,r as B}from"./vendor-inertia-CCfyITfy.js";import{A as E}from"./AdminLayout-B6eaivXB.js";import{C as f,i as x,j,h,g as b,L as l,l as c,f as m}from"./onboarding-wizard-8d69wR1b.js";import{S as v,c as g,d as y,a as _,b as n}from"./select-DrWb2lM4.js";import{e as H,ca as T,aT as R}from"./vendor-icons-dO54kHSW.js";import"./dropdown-menu-BZa-QNLO.js";import"./vendor-radix-CNvn-D4_.js";import"./dialog-DAdEr7fa.js";import"./vendor-utils-CPRVqKOU.js";function Y({brands:N,approvalStatuses:C,filters:i,recipientCount:o}){const{data:a,setData:t,post:k,processing:u,errors:d}=A({subject:"",body:"",filters:{brand:i.brand??"",approval_status:i.approval_status??"",date_from:i.date_from??"",date_to:i.date_to??""}}),S=()=>{const s={};a.filters.brand&&(s["filters[brand]"]=a.filters.brand),a.filters.approval_status&&(s["filters[approval_status]"]=a.filters.approval_status),a.filters.date_from&&(s["filters[date_from]"]=a.filters.date_from),a.filters.date_to&&(s["filters[date_to]"]=a.filters.date_to),B.get("/admin/bulk-email/create",s,{preserveState:!0})},w=s=>{s.preventDefault();const r={};a.filters.brand&&(r.brand=a.filters.brand),a.filters.approval_status&&(r.approval_status=a.filters.approval_status),a.filters.date_from&&(r.date_from=a.filters.date_from),a.filters.date_to&&(r.date_to=a.filters.date_to),k("/admin/bulk-email",{subject:a.subject,body:a.body,filters:r})};return e.jsxs(E,{title:"Compose Bulk Email",description:"Send an email to filtered clients",breadcrumbs:[{label:"Bulk Email",href:"/admin/bulk-email"},{label:"Compose"}],children:[e.jsx(L,{title:"Admin · Compose Bulk Email"}),e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs(p,{href:"/admin/bulk-email",className:"inline-flex items-center text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(H,{className:"w-4 h-4 mr-1"}),"Back to list"]}),e.jsxs("form",{onSubmit:w,className:"space-y-6",children:[e.jsxs(f,{children:[e.jsxs(x,{children:[e.jsx(j,{children:"Recipient filters"}),e.jsx(h,{children:"Optionally limit who receives this email. Leave empty to send to all clients."})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Brand"}),e.jsxs(v,{value:a.filters.brand||"all",onValueChange:s=>t("filters",{...a.filters,brand:s==="all"?"":s}),children:[e.jsx(g,{children:e.jsx(y,{placeholder:"All brands"})}),e.jsxs(_,{children:[e.jsx(n,{value:"all",children:"All brands"}),N.map(s=>e.jsx(n,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Approval status"}),e.jsxs(v,{value:a.filters.approval_status||"all",onValueChange:s=>t("filters",{...a.filters,approval_status:s==="all"?"":s}),children:[e.jsx(g,{children:e.jsx(y,{placeholder:"All statuses"})}),e.jsxs(_,{children:[e.jsx(n,{value:"all",children:"All statuses"}),C.map(s=>e.jsx(n,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Registered from (date)"}),e.jsx(c,{type:"date",value:a.filters.date_from,onChange:s=>t("filters",{...a.filters,date_from:s.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Registered to (date)"}),e.jsx(c,{type:"date",value:a.filters.date_to,onChange:s=>t("filters",{...a.filters,date_to:s.target.value})})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(m,{type:"button",variant:"outline",onClick:S,children:"Update recipient count"}),e.jsxs("span",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(T,{className:"w-4 h-4"}),e.jsx("strong",{children:o})," recipient",o!==1?"s":""]})]})]})]}),e.jsxs(f,{children:[e.jsxs(x,{children:[e.jsx(j,{children:"Email content"}),e.jsx(h,{children:"Subject and body. You can use simple HTML in the body."})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"subject",children:"Subject"}),e.jsx(c,{id:"subject",value:a.subject,onChange:s=>t("subject",s.target.value),placeholder:"Email subject",required:!0}),d.subject&&e.jsx("p",{className:"text-sm text-destructive",children:d.subject})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"body",children:"Body"}),e.jsx("textarea",{id:"body",rows:12,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",value:a.body,onChange:s=>t("body",s.target.value),placeholder:"Email body (plain text or HTML)",required:!0}),d.body&&e.jsx("p",{className:"text-sm text-destructive",children:d.body})]})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(m,{type:"submit",disabled:u,children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),u?"Queueing...":"Send to "+o+" recipient(s)"]}),e.jsx(p,{href:"/admin/bulk-email",children:e.jsx(m,{type:"button",variant:"outline",children:"Cancel"})})]})]})]})]})}export{Y 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.