1import{r as q,_ as B}from"./AdminLayout.vue_vue_type_script_setup_true_lang-BxuW7XVf.js";import{o as c,a as _,m as o,n as I,c as F,K as D,A as y,F as V,B as $,C as x,I as p,b as f,E as C,J as A,D as L,G as j,z as P,bJ as z,s as N}from"./index.esm-C1d2N7E0.js";import{d as X}from"./vuedraggable.umd-Bju8iIVz.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{r as K}from"./TrashIcon-CdUo_9Vm.js";import{r as H}from"./PencilSquareIcon-D1n2YxQ9.js";import"./ExclamationCircleIcon-CEnuMk1c.js";import"./env-BTjPhoWI.js";import"./ChevronLeftIcon-cd2PAOsM.js";import"./vue.runtime.esm-bundler-Dt5tti2k.js";function J(a,i){return c(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})])}function R(a,i){return c(),_("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"})])}const G={components:{PlusIcon:R,XCircleIcon:q,PencilSquareIcon:J,TrashIcon:K,draggable:X},props:{list:{type:Object,required:!0},items:{type:Array,required:!0},id:{type:String,required:!0},form:{type:Object,required:!0}},setup(a,{emit:i}){const t={default:0,creating:1,editing:2},e=I(t.default),s=I(""),h=F(()=>{let n=g(!0);return n.length=n[Object.keys(n)[0]].length,n}),u=I(null);function g(n=!1){let w={};return a.items.forEach(k=>{w[`${a.id}_${k.id}`]=n?a.form[`${a.id}_${k.id}`]:null,k.type==="image"&&(w[`${a.id}_${k.id}_file`]=n?a.form[`${a.id}_${k.id}_file`]:null)}),w}const m=I(g());function U(){const n=Object.assign({},m.value);for(const w in n){const k=w.replace(`${a.id}_`,""),T=a.items.find(O=>O.id===k);if(T&&T.rules.includes("required")&&n[w]===null){if(T.type==="image"&&n[`${w}_file`]!==null)continue;return s.value=`${T.label} is required.`,!1}}return s.value="",!0}function S(n){u.value=n,a.items.forEach(w=>{const k=`${a.id}_${w.id}`;m.value[k]=a.form[k][n],w.type==="image"&&(m.value[`${k}_file`]=a.form[`${k}_file`][n])}),e.value=t.editing,P(()=>{document.getElementById(`${a.id}_editor`).scrollIntoView()})}function E(n){u.value=n,i("update-list",{action:"delete",form:m.value,selectedIndex:u.value}),e.value=t.default,u.value=null}function l(){U()&&(i("update-list",{action:e.value===t.creating?"create":"edit",form:m.value,selectedIndex:u.value}),m.value=g(),e.value=t.default,u.value=null)}function r(){e.value=t.default,m.value=g()}function v(n){i("update-list",{action:"reorder",form:m.value,order:n})}const d=F(()=>D().props.storage_url);function b(n){return n!==null&&n.startsWith("data:")?n:d.value+n}return{STATUSES:t,status:e,errors:s,listData:h,createForm:m,edit:S,remove:E,save:l,cancel:r,reorder:v,renderUrl:b}}},W={class:"overflow-x-auto w-full pb-4"},Q={class:"min-w-full divide-y divide-gray-200"},Y={class:"bg-gray-50"},Z={key:0,scope:"col",class:"px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider"},ee=o("th",{scope:"col",class:"relative px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider"}," Actions ",-1),te={key:0,class:"px-6 py-4 whitespace-nowrap"},oe={key:0,class:"text-sm text-center text-gray-900"},re=["src"],le={key:1},ae={class:"px-6 py-4 whitespace-nowrap text-center text-sm font-medium"},de=["onClick"],ne=["onClick"],ie={class:"text-center mt-4"},se=["id"],ce={class:"text-lg mb-4"},_e={key:0,class:"col-span-5 mb-4"},ue={class:"text-gray-400 text-sm mt-1"},me={key:1,class:"col-span-5 mb-4"},fe={class:"text-gray-400 text-sm mt-1"},he={key:2,class:"col-span-12"},be={class:"mt-0.5 text-gray-500"},ge={key:3,class:"col-span-5 mb-4"},pe={key:0,class:"text-center mt-4 text-red-400 text-sm"},ye={key:1,class:"text-center mt-4 space-x-2"};function xe(a,i,t,e,s,h){const u=y("PencilSquareIcon"),g=y("Tras
1hIcon"),m=y("draggable"),U=y("PlusIcon"),S=y("jet-button"),E=y("jet-input"),l=y("ck-editor"),r=y("dropzone"),v=y("XCircleIcon");return c(),_("div",W,[o("table",Q,[o("thead",Y,[o("tr",null,[(c(!0),_(V,null,$(t.items,d=>(c(),_(V,{key:d.id},[d.summary_field?(c(),_("th",Z,x(d.label),1)):p("",!0)],64))),128)),ee])]),f(m,{modelValue:[...Array(e.listData.length).keys()],"onUpdate:modelValue":i[0]||(i[0]=d=>e.reorder(d)),tag:"tbody","item-key":"name",class:"bg-white divide-y divide-gray-200"},{item:C(({element:d,index:b})=>[o("tr",null,[(c(!0),_(V,null,$(t.items,n=>(c(),_(V,{key:n.id},[n.summary_field?(c(),_("td",te,[n.type==="image"?(c(),_("div",oe,[o("img",{class:"m-auto object-contain",src:e.renderUrl(e.listData[`${t.id}_${n.id}`][b]),alt:"image",width:"120"},null,8,re)])):(c(),_("p",le,x(e.listData[`${t.id}_${n.id}`][b]),1))])):p("",!0)],64))),128)),o("td",ae,[o("button",{onClick:A(n=>e.edit(b),["prevent"]),class:"mx-1 inline-flex items-center p-1 border border-transparent rounded-full text-gray-600 hover:text-blue-400 focus:outline-none focus:ring-1 focus:ring-offset-1 focus:ring-blue-500"},[f(u,{class:"h-5 w-5","aria-hidden":"true"})],8,de),o("button",{onClick:A(n=>e.remove(b),["prevent"]),class:"mx-1 inline-flex items-center p-1 border border-transparent rounded-full text-gray-600 hover:text-red-400 focus:outline-none focus:ring-1 focus:ring-offset-1 focus:ring-red-500"},[f(g,{class:"h-5 w-5","aria-hidden":"true"})],8,ne)])])]),_:1},8,["modelValue"])]),o("div",ie,[e.status===e.STATUSES.default?(c(),L(S,{key:0,onClick:i[1]||(i[1]=d=>e.status=e.STATUSES.creating),type:"button"},{default:C(()=>[f(U,{class:"-ml-0.5 mr-2 h-4 w-4","aria-hidden":"true"}),j(" Add ")]),_:1})):p("",!0)]),e.status!==e.STATUSES.default?(c(),_("div",{key:0,id:`${t.id}_editor`},[o("p",ce,x(e.status===e.STATUSES.creating?"Add":"Edit")+" "+x(t.list.label),1),(c(!0),_(V,null,$(t.items,d=>(c(),_(V,{key:`${d.id}`},[d.type==="text"||d.type==="url"?(c(),_("div",_e,[f(E,{modelValue:e.createForm[`${t.id}_${d.id}`],"onUpdate:modelValue":b=>e.createForm[`${t.id}_${d.id}`]=b,label:d.label,id:`${d.id}`},null,8,["modelValue","onUpdate:modelValue","label","id"]),o("p",ue,x(d.description),1)])):p("",!0),d.type==="textarea"?(c(),_("div",me,[f(E,{textarea:!0,modelValue:e.createForm[`${t.id}_${d.id}`],"onUpdate:modelValue":b=>e.createForm[`${t.id}_${d.id}`]=b,label:d.label,id:`${d.id}`},null,8,["modelValue","onUpdate:modelValue","label","id"]),o("p",fe,x(d.description),1)])):p("",!0),d.type==="htmleditor"?(c(),_("div",he,[f(l,{modelValue:e.createForm[`${t.id}_${d.id}`],"onUpdate:modelValue":b=>e.createForm[`${t.id}_${d.id}`]=b,label:d.label,id:`${d.id}`},null,8,["modelValue","onUpdate:modelValue","label","id"]),o("small",be,x(d.description),1)])):p("",!0),d.type==="image"?(c(),_("div",ge,[f(r,{path:e.createForm[`${t.id}_${d.id}`],"onUpdate:path":b=>e.createForm[`${t.id}_${d.id}`]=b,file:e.createForm[`${t.id}_${d.id}_file`],"onUpdate:file":b=>e.createForm[`${t.id}_${d.id}_file`]=b,label:d.label,id:`${d.id}`,description:d.description,"overwrite-path":!0},null,8,["path","onUpdate:path","file","onUpdate:file","label","id","description"])])):p("",!0)],64))),128)),e.status!==e.STATUSES.default&&e.errors?(c(),_("p",pe,x(e.errors),1)):p("",!0),e.status!==e.STATUSES.default?(c(),_("div",ye,[f(S,{onClick:e.cancel,type:"button",outlined:""},{default:C(()=>[f(v,{class:"-ml-0.5 mr-2 h-4 w-4","aria-hidden":"true"}),j(" Cancel ")]),_:1},8,["onClick"]),f(S,{onClick:e.save,type:"button"},{default:C(()=>[f(u,{class:"-ml-0.5 mr-2 h-4 w-4","aria-hidden":"true"}),j(" Save ")]),_:1},8,["onClick"])])):p("",!0)],8,se)):p("",!0)])}const ve=M(G,[["render",xe]]);function ke(a){function i(t){const e=Object.keys(t.form);switch(t.action){case"create":e.forEach(s=>{a[s].push(t.form[s])});break;case"edit":e.forEach(s=>{a[s][t.selectedIndex]=t.form[s]});break;case"delete":e.forEach(s=>{a[s].splice(t.selectedIndex,1)});break;case"reorder":e.forEach(s=>{a[s]=t.order.map(h=>a[s][h])});break}}return{updateList:i}}function we(a,i,t){const e=Ve(a,i),s=z(e);N(()=>Object.keys(e).map(u=>s[u]),(u,g)=>{for(let m=0;m<u.length;m++)u[m]!==g[m]&&(s.errors[Object.keys(e)[m]]=null)},{deep:!0});function h(){s.post(t,{onError:u=>{document.getElementById(Object.keys(u)[0]).scrollIntoView()}})}return{form:s,submit:h}}function Ve(a,i){let t={title:a.title||null,description:a.description||null,keywords:a.keywords||null,og_image_path:a.og_image_path||null,robots_follow:a.robots_follow||!0,robots_index:a.robots_index||!0};
1return i.sections.forEach(e=>{e.items.forEach(s=>{const h=a.content;s.type==="list_table"?s.items.forEach(u=>{const g=`${e.id}_${s.id}`,m=`${g}_${u.id}`;t[m]=[],u.type==="image"&&(t[`${m}_file`]=[]),h&&h[g]&&h[g].length&&h[g].forEach(U=>{t[m].push(U[u.id]),u.type==="image"&&t[`${m}_file`].push(null)})}):t[`${e.id}_${s.id}`]=h&&h[`${e.id}_${s.id}`]||null,s.type==="image"&&(t[`${e.id}_${s.id}_file`]=null)})}),t}const Ue={components:{AdminLayout:B,PencilSquareIcon:H,ListTable:ve},props:["page","schema"],setup(a){const i=[{name:"CMS",href:route("admin.cms.index")},{name:"Edit",href:"#"}],t=route("admin.cms.edit",a.page.id),{form:e,submit:s}=we(a.page,a.schema,t),{updateList:h}=ke(e);return{breadcrumbs:i,form:e,submit:s,updateList:h}}},Se={class:"space-y-6"},Ee={class:"bg-white px-7 py-5 sm:rounded-lg sm:p-6"},Ce={class:"md:col-span-4"},$e={class:"text-sm font-bold text-gray-900"},Te={class:"mt-1 text-sm text-gray-500"},Ie={class:"mt-5 md:mt-0 md:col-span-8"},je={class:"grid grid-cols-12 gap-6"},Ae={key:0,class:"col-span-12"},Fe={class:"text-gray-400 text-sm mt-1"},Le={key:1,class:"col-span-12"},Me={class:"text-gray-400 text-sm mt-1"},Oe={key:2,class:"col-span-12"},qe={class:"mt-0.5 text-gray-500"},Be={key:3,class:"col-span-12"},De={key:4,class:"col-span-12"},Pe=["for"],ze=o("div",{class:"border-b border-gray-200 md:col-span-12 mt-6 mb-10"},null,-1),Ne={class:"md:grid md:grid-cols-12 md:gap-6"},Xe=o("div",{class:"md:col-span-4"},[o("p",{class:"text-sm font-bold text-gray-900"}," SEO Metadata "),o("p",{class:"mt-1 text-sm text-gray-500"}," Enter your SEO data such as title, description, and keywords data. ")],-1),Ke={class:"mt-5 md:mt-0 md:col-span-8"},He={class:"grid grid-cols-12 gap-6"},Je={class:"col-span-12"},Re=o("p",{class:"text-gray-400 text-sm mt-1"},"50-60 characters max",-1),Ge={class:"col-span-12"},We=o("p",{class:"text-gray-400 text-sm mt-1"},"160 characters max",-1),Qe={class:"col-span-12"},Ye=o("p",{class:"text-gray-400 text-sm mt-1"}," Comma-separated values ",-1),Ze={class:"col-span-12 mb-6"},et={class:"col-span-12 text-right"};function tt(a,i,t,e,s,h){const u=y("jet-input"),g=y("ck-editor"),m=y("dropzone"),U=y("list-table"),S=y("jet-button"),E=y("admin-layout");return c(),L(E,{title:`Edit ${t.page.label}`,"breadcrumb-pages":e.breadcrumbs,"show-back":!0,"back-url":a.route("admin.cms.index")},{default:C(()=>[o("div",Se,[o("div",Ee,[o("form",{onSubmit:i[5]||(i[5]=A((...l)=>e.submit&&e.submit(...l),["prevent"]))},[(c(!0),_(V,null,$(t.schema.sections,l=>(c(),_("div",{key:l.id,class:"md:grid md:grid-cols-12 md:gap-6"},[o("div",Ce,[o("p",$e,x(l.label),1),o("p",Te,x(l.description),1)]),o("div",Ie,[o("div",je,[(c(!0),_(V,null,$(l.items,r=>(c(),_(V,{key:`${l.id}_${r.id}`},[r.type==="text"||r.type==="url"?(c(),_("div",Ae,[f(u,{modelValue:e.form[l.id+"_"+r.id],"onUpdate:modelValue":v=>e.form[l.id+"_"+r.id]=v,label:r.label,id:`${l.id}_${r.id}`,error:e.form.errors[l.id+"_"+r.id]},null,8,["modelValue","onUpdate:modelValue","label","id","error"]),o("p",Fe,x(r.description),1)])):p("",!0),r.type==="textarea"?(c(),_("div",Le,[f(u,{textarea:!0,modelValue:e.form[l.id+"_"+r.id],"onUpdate:modelValue":v=>e.form[l.id+"_"+r.id]=v,label:r.label,id:`${l.id}_${r.id}`,error:e.form.errors[l.id+"_"+r.id]},null,8,["modelValue","onUpdate:modelValue","label","id","error"]),o("p",Me,x(r.description),1)])):p("",!0),r.type==="htmleditor"?(c(),_("div",Oe,[f(g,{modelValue:e.form[l.id+"_"+r.id],"onUpdate:modelValue":v=>e.form[l.id+"_"+r.id]=v,label:r.label,id:`${l.id}_${r.id}`,error:e.form.errors[l.id+"_"+r.id]},null,8,["modelValue","onUpdate:modelValue","label","id","error"]),o("small",qe,x(r.description),1)])):p("",!0),r.type==="image"?(c(),_("div",Be,[f(m,{path:e.form[l.id+"_"+r.id],"onUpdate:path":v=>e.form[l.id+"_"+r.id]=v,file:e.form[l.id+"_"+r.id+"_file"],"onUpdate:file":v=>e.form[l.id+"_"+r.id+"_file"]=v,label:r.label,id:`${l.id}_${r.id}`,description:r.description,error:e.form.errors[l.id+"_"+r.id+"_file"]},null,8,["path","onUpdate:path","file","onUpdate:file","label","id","description","error"])])):p("",!0),r.type==="list_table"?(c(),_("div",De,[o("label",{for:r.id,class:"block text-sm text-gray-900 mb-1"},x(r.label),9,Pe),f(U,{list:r,items:r.items,id:l.id+"_"+r.id,form:e.form,onUpdateList:e.updateList},null,8,["list","items","id","form","onUpdateList"])])):p("",!0)],64))),128))])]),ze]))),128)),o("div",Ne,[Xe,o("div",Ke,[o("div",He,[o("div",Je,[f(u,{modelValue:e.form.title,"onUpdate:modelValue":i[0]||(i[0]=l=>e.form.title=l),label:"Title",id:"seo_title",error:e.form.errors.title},null,8,["modelValue","error"]),Re]),o("div",Ge,[f(u,{modelValue:e.form.description,"onUpdate:modelValue":i[1]||(i[1]=l=>
1e.form.description=l),label:"Description",id:"seo_description",error:e.form.errors.description,textarea:""},null,8,["modelValue","error"]),We]),o("div",Qe,[f(u,{modelValue:e.form.keywords,"onUpdate:modelValue":i[2]||(i[2]=l=>e.form.keywords=l),label:"Keywords",id:"seo_keywords",error:e.form.errors.keywords},null,8,["modelValue","error"]),Ye]),o("div",Ze,[f(m,{path:e.form.og_image_path,"onUpdate:path":i[3]||(i[3]=l=>e.form.og_image_path=l),file:e.form.og_image_path,"onUpdate:file":i[4]||(i[4]=l=>e.form.og_image_path=l),label:"SEO Meta Image",id:"seo_image",description:"Max file size: 10MB | Dimension: 1200px x 627px",error:e.form.errors.og_image_path},null,8,["path","file","error"])])])])]),o("div",et,[f(S,{onClick:e.submit,type:"button"},{default:C(()=>[j(" Save Changes ")]),_:1},8,["onClick"])])],32)])])]),_:1},8,["title","breadcrumb-pages","back-url"])}const ut=M(Ue,[["render",tt]]);export{ut 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.