PageSourceSearch

https://fonds.lv/build/assets/Form-BNHUShlY.js

js fonds.lv collected 2026-10-01 12:26:45 UTC 8,742 bytes, 1 lines download raw bytes

1import{A as V}from"./AuthenticatedLayout-BgPi6SK7.js";import{Z as M,i as L,r as i,f as a,c as C,a as o,w as c,b as l,d as E,o as m,F as h,j as v,g as T,e as D,k as R,T as N}from"./app-BFBm0Bhp.js";import{P as F}from"./PrimaryButton-DQRXstZk.js";import{_ as H}from"./TextInput-BleaLv5g.js";import{_ as j}from"./InputLabel-COeR7jGs.js";import{_ as W}from"./InputError-gS6WMAxM.js";import{_ as Z}from"./TextBlock-BLReQj5p.js";import{T as q,A as z}from"./Attachment-ui7ykot5.js";import{_ as G,T as J}from"./TagInput-B24tt8Te.js";import{a as K}from"./TextOutline-DJTNpM16.js";import{_ as Q,a as X,b as Y,C as $}from"./ContentManager-D8_wkhWp.js";import{_ as tt}from"./AddCircleOutline-DFv3S69M.js";import{_ as et}from"./RemoveCircleOutline-sQ5GsMCK.js";import{T as ot}from"./TagInputWithSections-ClLsNCgf.js";import{_ as nt}from"./DocumentTextOutline-CSPECrKp.js";import{S as st}from"./Switch-lcdVR_Lx.js";import{_ as rt}from"./LinkOutline-BCvp66tw.js";import{_ as lt}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-BDZZhcqx.js";import"./NavLink-XJ1F9B8R.js";import"./InformationCircleOutline-B09VKpeu.js";import"./ChevronDownOutline-I8s4miqi.js";import"./LogoYoutube-DPs_gR_f.js";import"./ArrowUpOutline-D4ILiFyi.js";import"./ArrowDownOutline-reU2X3OH.js";const mt={name:"PostForm",components:{ContentManager:$,LinkOutline:rt,ImageOutline:Y,Switch:st,DocumentTextOutline:nt,TagInputWithSections:ot,TagInput:J,Attachment:z,RemoveCircleOutline:et,AddCircleOutline:tt,AttachOutline:X,ChatbubbleEllipsesOutline:Q,TextOutline:K,CloseOutline:G,TextBuilder:q,TextBlock:Z,PrimaryButton:F,TextInput:H,InputLabel:j,InputError:W,Link:L,AuthenticatedLayout:V,Head:M},props:{postItem:{type:Object,default:[]},type:{type:String,default:""}},data(){return{form:N({name:this.postItem.name??{lv:"",en:""},excerpt:this.postItem.excerpt??{lv:"",en:""},contents:this.postItem.contents??[{type:"text",content:{lv:"",en:""},title:{lv:"",en:""},order:1,submit:!0,photoPreview:null}],published:this.postItem.published??!1,apply:this.postItem.apply??[{name:{lv:"",en:""}}],image:{image_title:this.postItem.image_title??{lv:null,en:null},image:this.postItem.image??null,photoPreview:null},_method:"post"})}},mounted(){this.form.contents.forEach(t=>{t.submit=!0})},methods:{updatePhotoPreview(t){this.form.image.image=t.content,this.form.image.photoPreview=t.photoPreview},updatePhotoTitle(t){this.form.image.image_title=t.title},handleToggle(t){this.form.published=t},updateContentAttachmentTitle(t){this.form.contents[t.content.id].title[t.locale]=t.content.title},updateContent(t){const e=this.form.contents[t.content.id];if(e.type==="attachment"||e.type==="file"){this.form.contents[t.content.id].content.lv=t.content.content,this.form.contents[t.content.id].content.en=t.content.content,this.form.contents[t.content.id].photoPreview=t.content.photoPreview;return}this.form.contents[t.content.id].content[t.locale]=t.content.content},moveUp(t){const e=this.form.contents[t.index];this.form.contents[t.index].order=e.order-1,this.form.contents[t.index-1].order=e.order+1,this.reorderContentByOrderAsc()},moveDown(t){const e=this.form.contents[t.index];this.form.contents[t.index].order=e.order+1,this.form.contents[t.index+1].order=e.order-1,this.reorderContentByOrderAsc()},reorderContentByOrderAsc(){this.form.contents.sort((t,e)=>t.order-e.order)},addContent(t){this.form.contents.push({type:t.type,content:{lv:null,en:null},title:{lv:null,en:null},order:this.form.contents.length+1,submit:!0,photoPreview:null})},removeContentBlock(t){t.index>=0&&t.index<this.form.contents.length&&(this.form.contents[t.index].submit=!1)},addStep(t){this.form.apply.splice(t+1,0,{name:{lv:"",en:""}})},removeStep(t){t>=0&&t<this.form.apply.length&&this.form.apply.splice(t,1)},submit(){var t;this.form.contents=this.form.contents.filter(e=>e.submit);for(let e=0;e<this.form.contents.length;e++)this.form.contents[e].order=e+1;(t=this.postItem)!=null&&t.id?(this.form._method="put",this.form.post(route("admin.posts.update",{type:this.t
1ype,post:this.postItem.id}),{preserveState:"errors"})):this.form.post(route("admin.posts.store",{type:this.type}),{preserveState:"errors"})}}},it={class:"py-12"},at={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg"},ct={class:"space-y-2"},pt={class:"w-full space-y-2"},ut={class:"w-full flex"},dt={class:"w-full"},ft={class:"w-full"},ht={class:"w-full"},_t={class:"ml-3 flex"},vt={class:"flex items-center gap-4"},Ct={key:0,class:"text-sm text-gray-600"};function gt(t,e,b,yt,n,r){var U;const g=i("Head"),p=i("InputLabel"),x=i("Switch"),y=i("TextInput"),_=i("InputError"),P=i("TextBlock"),w=i("ContentManager"),A=i("RemoveCircleOutline"),k=i("AddCircleOutline"),I=i("Attachment"),B=i("PrimaryButton"),O=i("AuthenticatedLayout");return m(),a(h,null,[(U=b.postItem)!=null&&U.id?(m(),C(g,{key:0,title:"Edit Post"})):(m(),C(g,{key:1,title:"Add Post"})),o(O,null,{header:c(()=>[...e[1]||(e[1]=[l("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Add Post",-1)])]),default:c(()=>[l("div",it,[l("div",at,[l("form",{class:"space-y-5 p-4",enctype:"multipart/form-data",onSubmit:e[0]||(e[0]=E(u=>r.submit(),["prevent"]))},[l("div",ct,[o(p,{for:"published",value:"Activate"}),o(x,{isOn:n.form.published,"onUpdate:isOn":r.handleToggle,id:"active"},null,8,["isOn","onUpdate:isOn"])]),(m(!0),a(h,null,v(n.form.name,(u,s)=>(m(),a("div",null,[o(p,{for:"name"+s.toUpperCase(),value:"Title "+s.toUpperCase()},null,8,["for","value"]),o(y,{id:"name"+s.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:n.form.name[s],"onUpdate:modelValue":d=>n.form.name[s]=d,autofocus:"",autocomplete:"name"},null,8,["id","modelValue","onUpdate:modelValue"]),o(_,{class:"mt-2",message:n.form.errors["name."+s]},null,8,["message"])]))),256)),(m(!0),a(h,null,v(n.form.excerpt,(u,s)=>(m(),a("div",null,[o(p,{for:"excerpt"+s.toUpperCase(),value:"Excerpt "+s.toUpperCase()},null,8,["for","value"]),o(P,{id:"excerpt"+s.toUpperCase(),modelValue:n.form.excerpt[s],"onUpdate:modelValue":d=>n.form.excerpt[s]=d},null,8,["id","modelValue","onUpdate:modelValue"]),o(_,{class:"mt-2",message:n.form.errors["excerpt".index]},null,8,["message"])]))),256)),o(w,{contents:n.form.contents,locale:"lv",onAddContent:r.addContent,onRemoveContentBlock:r.removeContentBlock,onMoveUp:r.moveUp,onMoveDown:r.moveDown,onUpdateContent:r.updateContent,onUpdateContentAttachmentTitle:r.updateContentAttachmentTitle},{default:c(()=>[o(p,{value:"Content LV"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),o(w,{contents:n.form.contents,locale:"en",onAddContent:r.addContent,onRemoveContentBlock:r.removeContentBlock,onMoveUp:r.moveUp,onMoveDown:r.moveDown,onUpdateContent:r.updateContent,onUpdateContentAttachmentTitle:r.updateContentAttachmentTitle},{default:c(()=>[o(p,{value:"Content EN"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),l("div",pt,[(m(!0),a(h,null,v(n.form.apply,(u,s)=>(m(),a("div",null,[o(p,{for:"step"+s,value:"Step "+(s+1)},null,8,["for","value"]),l("div",ut,[l("div",dt,[l("div",ft,[(m(!0),a(h,null,v(u.name,(d,f)=>(m(),a("div",ht,[o(y,{id:"step"+s+f,type:"text",placeholder:"Name "+f.toUpperCase(),class:"mt-1 block w-full",modelValue:u.name[f],"onUpdate:modelValue":S=>u.name[f]=S},null,8,["id","placeholder","modelValue","onUpdate:modelValue"]),o(_,{class:"mt-2",message:n.form.errors["apply."+s+".name."+f]},null,8,["message"])]))),256))])]),l("div",_t,[n.form.apply.length>1?(m(),C(A,{key:0,class:"w-8 mt-auto mb-1 cursor-pointer text-red-600 fill-red-600",onClick:d=>r.removeStep(s)},null,8,["onClick"])):T("",!0),o(k,{class:"w-8 mt-auto mb-1 cursor-pointer text-green-600 fill-green-600",onClick:d=>r.addStep(s)},null,8,["onClick"])])]),o(_,{class:"mt-2",message:n.form.errors.apply},null,8,["message"])]))),256))]),l("div",null,[o(I,{attachments:n.form.image.image,attachmentTitle:n.form.image.image_title,photoPreview:n.form.image.photoPreview,onUpdatePhotoPreview:r.updatePhotoPreview,onUpdatePhotoTitle:r.updatePhotoTitle},{title:c(()=>[...e[2]||(e[2]=[l("span",{class:"pl-2"},"Featured image",-1)])]),_:1},8,["attachments","attachmentTitle","photoPreview","onUpdatePhotoPreview","onUpdatePhotoTitle"])]),l("div",vt,[o(B,{disabled:n.form.processing},{default:c(()=>[...e[3]||(e[3]=[D("Save",-1)])]),_:1},8,["disabled"]),o(R,{"enter-active-class":"transition ease-in-out","enter-from-class":"opacity-0","leave-active-class":"transition ease-in-out","leave-to-class":"opacity-0"},{default:c(()=>[n.form.recentlySuccessful?(m(),a("p",Ct,"Saved.")):T("",!0)]),_:1})])],32)])])]),_:1})],64)}const zt=lt(mt,[["render",gt]]);export{zt 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.