1import{X as v,r as x,j as e,A as j}from"./app-C7IlInSe.js";import{R as y}from"./RichEditor-DP1DP5Ki.js";import{S as p}from"./sweetalert2.esm.all-Bj_ZQUAw.js";import"./Editor-ClgE2bCz.js";import"./index-DZq9ZGYf.js";import"./Combination-B2O05mu8.js";import"./InputBase-hn7HK4ER.js";import"./floating-ui.react-dom-C6CG5rhy.js";import"./clsx-B-dksMZM.js";function F(){const{csrf_token:m,getEventAgendaList:c,event_id:d}=v().props,[i,l]=x.useState(c&&c.length>0?c.map(t=>({id:t.id,event_id:t.event_id??d??"",title:t.title,content:t.content})):[{title:"",content:""}]),u=t=>{t.preventDefault();const s=t.target.querySelector("button[type='submit']"),n=s.innerHTML;s.disabled=!0,s.innerHTML='<i class="fa fa-spinner fa-spin"></i> Processing...';const o=new FormData;i.forEach((a,r)=>{o.append(`title_event_agenda[${r}]`,a.title||""),o.append(`content[${r}]`,a.content||"")}),o.append("event_id",d),o.append("_token",m),j.post("/system-content/events/agenda/list/save/",o,{preserveScroll:!0,forceFormData:!0,onSuccess:a=>{var r;p.fire({icon:"success",title:"Success!",text:((r=a==null?void 0:a.props)==null?void 0:r.message)||"Agenda Events has been saved successfully."}),l([{title:"",content:""}])},onError:a=>{const r=Object.values(a)[0];p.fire({icon:"error",title:"Validation Error",text:r||"Please check your input."}),console.error(a)},onFinish:()=>{s.disabled=!1,s.innerHTML=n}})},h=(t,s)=>{const n=[...i];n[t].content=s,l(n)},f=(t,s,n)=>{const o=[...i];o[t][s]=n,l(o)},b=()=>{l([...i,{title:"",content:""}])},g=t=>{l(i.filter((s,n)=>n!==t))};return e.jsxs("form",{onSubmit:u,children:[e.jsx("input",{type:"hidden",name:"event_id",value:d}),e.jsxs("section",{className:"card shadow mb-4",children:[e.jsx("header",{className:"card-header",children:e.jsx("h2",{className:"title pull-left",children:"Agenda Events"})}),e.jsxs("div",{style:{padding:15},children:[i.map((t,s)=>e.jsxs("div",{className:"pageAgenda",style:{position:"relative"},children:[e.jsx("button",{type:"button",className:"btn btn-danger btn-icon-split",style:{position:"absolute",right:10},onClick:()=>
1g(s),children:e.jsx("i",{className:"fa fa-trash-alt"})}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{className:"form-label",children:"Title"}),e.jsx("input",{type:"text",className:"form-control",value:t.title,placeholder:"Please input field for title",onChange:n=>f(s,"title",n.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{className:"form-label",children:"Content"}),e.jsx(y,{value:t.content,onChange:n=>h(s,n)})]}),e.jsx("hr",{style:{borderTop:"2px solid #333"}})]},s)),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:b,children:e.jsx("i",{className:"fa fa-plus"})})]}),e.jsx("div",{className:"form-group text-right",style:{padding:15},children:e.jsxs("button",{type:"submit",className:"btn btn-success",children:[e.jsx("i",{className:"bImg fa fa-save"})," Submit Agenda"]})})]})]})}export{F 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.