import{b as p,j as e,H as x}from"./app-vYFZLebK.js";import{A as u}from"./AuthenticatedLayout-dsnBHnD2.js";import{P as j}from"./ProBackground-HBykvu3f.js";import{A as v}from"./AnimatedGrid-Bf6AiAAC.js";import{T as o}from"./TextInput-BXnk3iOU.js";import{I as i}from"./InputLabel-B7-VnScM.js";import{P as b}from"./PrimaryButton-Byh_hOgr.js";import{T as h}from"./TipTapEditor-BqncdOQh.js";import{S as g}from"./save-Bzp-2mRa.js";import{M as f}from"./mail-CgMp0qFW.js";import"./ThemeSwitcher-C0dt0hQX.js";import"./NotificationDropdown-hhsBJy8C.js";import"./transition-6I0c9VKA.js";import"./x-5fjm0jEE.js";import"./zap-bQXiQpqs.js";import"./cpu-CnpbxAHg.js";import"./list-BXGFkwwy.js";import"./link-Cl8-yVed.js";function W({template:a}){const{data:r,setData:l,post:m,put:n,processing:c,errors:t}=p({name:a?.name||"",subject:a?.subject||"",content:a?.content||""}),d=s=>{s.preventDefault(),a?n(route("admin.email.update",a.id)):m(route("admin.email.store"))};return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)] transition-colors duration-300",children:[e.jsx(j,{}),e.jsxs(u,{header:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-2 bg-purple-500/10 border border-purple-500/30 rounded-lg text-purple-500",children:e.jsx(f,{size:20})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h2",{className:"text-lg font-black tracking-tighter uppercase italic leading-none",children:a?"Edit_Template":"New_Template"}),e.jsx("p",{className:"text-[8px] text-purple-500 uppercase tracking-[0.4em] font-bold mt-1",children:"Email Protocol"})]})]}),children:[e.jsx(x,{title:a?"Edit Template":"New Template"}),e.jsxs("div",{className:"relative min-h-full p-8 lg:p-12 overflow-y-auto",children:[e.jsx(v,{}),e.jsx("div",{className:"max-w-4xl mx-auto relative z-10",children:e.jsxs("form",{onSubmit:d,className:"space-y-8 bg-[var(--bg-surface)] border border-[var(--border)] rounded-[2rem] p-8 shadow-2xl",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{value:"Template Name (Internal)"}),e.jsx(o,{value:r.name,onChange:s=>l("name",s.target.value),className:"bg-[var(--bg-elevated)]",placeholder:"e.g. Welcome Email"}),t.name&&e.jsx("p",{className:"text-rose-500 text-xs",children:t.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{value:"Email Subject"}),e.jsx(o,{value:r.subject,onChange:s=>l("subject",s.target.value),className:"bg-[var(--bg-elevated)]",placeholder:"e.g. Welcome to HOACodeLab"}),t.subject&&e.jsx("p",{className:"text-rose-500 text-xs",children:t.subject})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(i,{value:"Content"}),e.jsxs("div",{className:"text-[9px] font-mono text-[var(--text-muted)]",children:["Variables: ","{{name}}",", ","{{email}}"]})]}),e.jsx(h,{value:r.content,onChange:s=>l("content",s)}),t.content&&e.jsx("p",{className:"text-rose-500 text-xs",children:t.content})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t border-[var(--border)]",children:e.jsxs(b,{className:"bg-purple-500 hover:bg-purple-600 border-purple-500 px-8 py-3",disabled:c,children:[e.jsx(g,{size:16,className:"mr-2"})," Save_Template"]})})]})})]})]})]})}export{W as default};
