1import{G as S,j as e,S as D}from"./app-Ha4X7SlF.js";import{A as T}from"./AuthenticatedLayout-BZKUhDrh.js";import{I as o}from"./InputError-Do4kQPnM.js";import{I as a}from"./InputLabel-D410np7F.js";import{P as q}from"./PrimaryButton-Bjn3n3t2.js";import{T as n}from"./TextInput-YH4SiJD7.js";import{Q as u}from"./index-C9bVzuNG.js";/* empty css */import"./transition-DszwGdUG.js";import"./Sidebar-BmBFQuN7.js";import"./SvgSwitcher-DH9r9e5c.js";import"./ToastNotification-BhTNdAie.js";import"./_baseIsEqual-CXvocJ9U.js";function U({auth:m,news:i}){const{data:t,setData:l,patch:p,processing:x,errors:r,setError:d}=S({title:i.title||"",slug:i.slug||"",description:i.description||"",short_description:i.short_description||"",status:i.status||1,published_at:new Date(i.published_at).toISOString().slice(0,10)||new Date().toISOString().slice(0,10),title_hi:i.title_hi||"",short_description_hi:i.short_description_hi||"",description_hi:i.description_hi||""}),g=s=>l("title",s),j=s=>l("slug",s),f=s=>l("short_description",s),b=s=>l("description",s),v=s=>l("status",s),_=s=>l("published_at",s),N=s=>l("title_hi",s),C=s=>l("short_description_hi",s),w=s=>l("description_hi",s),k=()=>{let s=!0;return t.title||(d("title","The title field is required."),s=!1),t.slug||(d("slug","The slug field is required."),s=!1),t.short_description||(d("short_description","The short description field is required."),s=!1),t.description||(d("description","The description field is required."),s=!1),t.published_at||(d("published_at","The published date is required."),s=!1),s},y=s=>{s.preventDefault(),k()&&p(route("news.update",i.id),{data:t})},c={toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],["link","image","video","formula"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"},{list:"check"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},h=["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"];return e.jsxs(T,{user:m.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 leading-tight",children:"Edit News"}),children:[e.jsx(D,{title:"Edit News"}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"max-w-12xl mx-auto px-6 lg:px-8",children:[e.jsx("div",{className:"py-1",children:e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("h3",{className:"text-lg font-semibold",children:"Edit News"})})}),e.jsx("form",{onSubmit:y,className:"space-y-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:space-x-6 space-y-6 md:space-y-0",children:[e.jsxs("div",{className:"md:w-4/12 w-full bg-white shadow sm:rounded-lg p-8 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"English Content"}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"title",value:"Title"}),e.jsx(n,{id:"title",name:"title",value:t.title,className:"mt-1 block w-full",autoComplete:"title",onChange:s=>g(s.target.value),required:!0}),e.jsx(o,{message:r.title,className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"slug",value:"Slug"}),e.jsx(n,{id:"slug",name:"slug",value:t.slug,className:"mt-1 block w-full",autoComplete:"slug",onChange:s=>j(s.target.value),required:!0}),e.jsx(o,{message:r.slug,className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"short_description",value:"Short Description"}),e.jsx(n,{id:"short_description",name:"short_description",value:t.short_description,className:"mt-1 block w-full",onChange:s=>f(s.target.value),required:!0}),e.jsx(o,{message:r.short_description,className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"description",value:"Description"}),e.jsx(u,{value:t.description,onChange:b,modules:c,formats:h,theme:"snow",placeholder:"Compose your description here..."}),e.jsx(o,{message:r.description,className:"mt-2"})]})]}),e.jsxs("div",{className:"md:w-4/12 w-full bg-white shadow sm:rounded-lg p-8 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Hindi Content"}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"title_hi",value:"Title (Hindi)"}),e.jsx(n,{id:"title_hi",name:"title_hi",value:t.title_hi,className:"mt-1 block w-full",onCh
1ange:s=>N(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"short_description_hi",value:"Short Description (Hindi)"}),e.jsx(n,{id:"short_description_hi",name:"short_description_hi",value:t.short_description_hi,className:"mt-1 block w-full",onChange:s=>C(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"description_hi",value:"Description (Hindi)"}),e.jsx(u,{value:t.description_hi,onChange:w,modules:c,formats:h,theme:"snow",placeholder:"Compose your description here (Hindi)..."})]})]}),e.jsx("div",{className:"md:w-4/12 w-full bg-white shadow sm:rounded-lg p-8 space-y-6 flex flex-col justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Publication Settings"}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"status",value:"Status"}),e.jsxs("select",{id:"status",name:"status",className:"mt-1 block w-full",value:t.status,onChange:s=>v(Number(s.target.value)),children:[e.jsx("option",{value:0,children:"Draft"}),e.jsx("option",{value:1,children:"Publish"})]}),e.jsx(o,{message:r.status,className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"published_at",value:"Publish Date"}),e.jsx("input",{type:"date",id:"published_at",name:"published_at",className:"mt-1 block w-full",value:t.published_at,onChange:s=>_(s.target.value),required:!0}),e.jsx(o,{message:r.published_at,className:"mt-2"})]}),e.jsx("div",{className:"flex items-center justify-end mt-4",children:e.jsx(q,{className:"ms-4 bgTheme",disabled:x,children:"Update"})})]})})]})})]})})]})}export{U 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.