1import{A as D}from"./AuthenticatedLayout-DcpqZk2r.js";import{Z as L,i as I,r as u,f as a,c as w,a as o,w as d,b as i,d as N,o as r,F as f,j as v,g as T,e as j,k as F,T as H}from"./app-B9KORyBa.js";import{T as Z,A as q}from"./Attachment-CDfGTxyk.js";import{_ as z}from"./InputLabel-C-zTQq7X.js";import{_ as G}from"./TextInput-C7OaZZNQ.js";import{_ as J}from"./InputError-BH5ciAU3.js";import{_ as K,T as Q}from"./TagInput-z-N_H-Oj.js";import{a as W}from"./TextOutline-CGLkonHp.js";import{_ as X,a as Y,C as $}from"./ContentManager-BeT97HXG.js";import{P as ee}from"./PrimaryButton-vaEit9c1.js";import{_ as te}from"./TextBlock-CnuGUd5s.js";import{S as oe}from"./Switch-CjgwlyRI.js";import{_ as ne}from"./RemoveCircleOutline-UYtqa7Mm.js";import{_ as le}from"./AddCircleOutline-Cx9F2hdC.js";import{_ as re}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-DrAX-EpC.js";import"./NavLink-BiVKPBr8.js";import"./DocumentTextOutline-B7A647Cs.js";import"./InformationCircleOutline-DCl6slX2.js";import"./ChevronDownOutline-DkbFw82G.js";import"./LinkOutline-D_8hjSSX.js";import"./LogoYoutube-C-1pvmVy.js";import"./ArrowUpOutline-BhcV9wP_.js";import"./ArrowDownOutline-DJK0Og38.js";const se={name:"ScholarshipsForm",components:{AddCircleOutline:le,RemoveCircleOutline:ne,ContentManager:$,Switch:oe,TagInput:Q,TextBlock:te,PrimaryButton:ee,AttachOutline:Y,ChatbubbleEllipsesOutline:X,TextOutline:W,CloseOutline:K,InputError:J,TextInput:G,InputLabel:z,Attachment:q,TextBuilder:Z,Link:I,AuthenticatedLayout:D,Head:L},props:{researcher:{type:Object,default:[]},categories:{type:Object,default:[]},forCategory:{type:Object,default:[]},tags:{type:Object,default:[]}},data(){return{form:H({name:this.researcher.name??{lv:"",en:""},excerpt:this.researcher.excerpt??{lv:"",en:""},published:this.researcher.published??!1,contents:this.researcher.contents??[{type:"text",content:{lv:"",en:""},title:{lv:"",en:""},order:1,submit:!0,photoPreview:null}],educations:this.researcher.educations??{lv:"",en:""},experiences:this.researcher.experiences??{lv:"",en:""},publications:this.researcher.publications??[{name:{lv:"",en:""},publications:[{name:{lv:"",en:""},link:""}]}],tags:this.researcher.tags??[],categories:this.researcher.categories??[],image:{image_title:this.researcher.image_title??{lv:null,en:null},image:this.researcher.image??null,photoPreview:null},author:this.researcher.author??{lv:"",en:""},_method:"post"})}},mounted(){this.form.contents.forEach(e=>{e.submit=!0,e.title=e.title??{lv:"",en:""}})},methods:{handleToggle(e){this.form.published=e},updatePhotoPreview(e){this.form.image.image=e.content,this.form.image.photoPreview=e.photoPreview},updatePhotoTitle(e){this.form.image.image_title=e.title},updateContentAttachmentTitle(e){this.form.contents[e.content.id].title[e.locale]=e.content.title},updateContent(e){const n=this.form.contents[e.content.id];if(n.type==="attachment"||n.type==="file"){this.form.contents[e.content.id].content.lv=e.content.content,this.form.contents[e.content.id].content.en=e.content.content,this.form.contents[e.content.id].photoPreview=e.content.photoPreview;return}this.form.contents[e.content.id].content[e.locale]=e.content.content},moveUp(e){const n=this.form.contents[e.index];this.form.contents[e.index].order=n.order-1,this.form.contents[e.index-1].order=n.order+1,this.reorderContentByOrderAsc()},moveDown(e){const n=this.form.contents[e.index];this.form.contents[e.index].order=n.order+1,this.form.contents[e.index+1].order=n.order-1,this.reorderContentByOrderAsc()},reorderContentByOrderAsc(){this.form.contents.sort((e,n)=>e.order-n.order)},updateCategories(e){this.form.categories=e},updateTags(e){this.form.tags=e},addContent(e){this.form.contents.push({type:e.type,content:{lv:null,en:null},title:{lv:null,en:null},order:this.form.contents.length+1,submit:!0,photoPreview:null})},addPublicationCategory(e){this.form.publications.splice(e+1,0,{name:{lv:"",en:""},publications:[{name:{lv:"",en:""},link:""}]})},removePublicationCategory(e){e>=0&&e<this.form.publications.length&&this.form.publications.splice(e,1)},addPublication(e,n){this.form.publications[e].publications.splice(n+1,0,{name:{lv:"",en:""},link:""})}
1,removePublication(e,n){n>=0&&n<this.form.publications[e].publications.length&&this.form.publications[e].publications.splice(n,1)},removeContentBlock(e){e.index>=0&&e.index<this.form.contents.length&&(this.form.contents[e.index].submit=!1)},submit(){var e;this.form.contents=this.form.contents.filter(n=>n.submit);for(let n=0;n<this.form.contents.length;n++)this.form.contents[n].order=n+1;(e=this.researcher)!=null&&e.id?(this.form._method="put",this.form.post(route("admin.researchers.update",{researcher:this.researcher.id}),{preserveState:"errors"})):this.form.post(route("admin.researchers.store"),{preserveState:"errors"})}}},ae={key:0,class:"font-semibold text-xl text-gray-800 leading-tight"},ie={key:1,class:"font-semibold text-xl text-gray-800 leading-tight"},me={class:"py-12"},ce={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg"},ue={class:"space-y-2"},pe={class:"w-full space-y-2"},de={class:"w-full flex"},he={class:"w-full"},fe={class:"w-full"},ve={class:"ml-3 my-auto flex"},_e={class:"space-y-4"},ge={class:"w-full pl-5"},Ce={class:"w-full flex"},be={class:"w-full"},Ue={class:"w-full"},we={class:"ml-3 my-auto flex"},ye={class:"flex items-center gap-4"},Te={key:0,class:"text-sm text-gray-600"};function ke(e,n,g,Pe,l,s){var B;const k=u("Head"),p=u("InputLabel"),O=u("Switch"),P=u("TagInput"),h=u("InputError"),b=u("TextInput"),y=u("TextBlock"),V=u("ContentManager"),A=u("RemoveCircleOutline"),x=u("AddCircleOutline"),E=u("Attachment"),M=u("PrimaryButton"),R=u("AuthenticatedLayout");return r(),a(f,null,[(B=g.researcher)!=null&&B.id?(r(),w(k,{key:0,title:"Edit Researcher"})):(r(),w(k,{key:1,title:"Add Researcher"})),o(R,null,{header:d(()=>{var c;return[(c=g.researcher)!=null&&c.id?(r(),a("h2",ae,"Edit Researcher")):(r(),a("h2",ie,"Add Researcher"))]}),default:d(()=>[i("div",me,[i("div",ce,[i("form",{class:"space-y-5 p-4",enctype:"multipart/form-data",onSubmit:n[0]||(n[0]=N(c=>s.submit(),["prevent"]))},[i("div",ue,[o(p,{for:"published",value:"Activate"}),o(O,{isOn:l.form.published,"onUpdate:isOn":s.handleToggle,id:"active"},null,8,["isOn","onUpdate:isOn"])]),i("div",null,[o(P,{onUpdateTags:s.updateCategories,"allow-creating-new-tags":!1,options:g.categories,selectedTags:g.researcher.categories??g.forCategory??[]},{label:d(()=>[...n[1]||(n[1]=[i("span",null,"Categories",-1)])]),placeholder:d(()=>[...n[2]||(n[2]=[i("h1",null,"Categories",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),o(h,{class:"mt-2",message:l.form.errors.categories},null,8,["message"])]),i("div",null,[o(P,{onUpdateTags:s.updateTags,"allow-creating-new-tags":!1,options:g.tags,selectedTags:g.researcher.tags??[]},{label:d(()=>[...n[3]||(n[3]=[i("span",null,"Display on landing",-1)])]),placeholder:d(()=>[...n[4]||(n[4]=[i("h1",null,"Display Tags",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),o(h,{class:"mt-2",message:l.form.errors.tags},null,8,["message"])]),(r(!0),a(f,null,v(l.form.name,(c,t)=>(r(),a("div",null,[o(p,{for:"name"+t.toUpperCase(),value:"Title "+t.toUpperCase()},null,8,["for","value"]),o(b,{id:"name"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:l.form.name[t],"onUpdate:modelValue":m=>l.form.name[t]=m,autofocus:"",autocomplete:"name"},null,8,["id","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["name."+t]},null,8,["message"])]))),256)),(r(!0),a(f,null,v(l.form.excerpt,(c,t)=>(r(),a("div",null,[o(p,{for:"excerpt"+t.toUpperCase(),value:"Excerpt "+t.toUpperCase()},null,8,["for","value"]),o(y,{id:"excerpt"+t.toUpperCase(),modelValue:l.form.excerpt[t],"onUpdate:modelValue":m=>l.form.excerpt[t]=m},null,8,["id","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["excerpt."+t]},null,8,["message"])]))),256)),o(V,{contents:l.form.contents,locale:"lv",onAddContent:s.addContent,onRemoveContentBlock:s.removeContentBlock,onMoveUp:s.moveUp,onMoveDown:s.moveDown,onUpdateContent:s.updateContent,onUpdateContentAttachmentTitle:s.updateContentAttachmentTitle},{default:d(()=>[o(p,{value:"Content LV"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),o(V,{contents:l.form.contents,locale:"en",onAddContent:s.addContent,onRemoveContentBlock:s.removeContentBlock,onMoveUp:s.moveUp,onMoveDown:s.moveDown,onUpdateContent:s.updateContent,onUpdateContentAttachmentTitle:s.updateContentAttachmentTitle},{default:d(()=>[o(p,{value:"Content EN"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),(r(!0),a(f,null,v(l.form.educations,
1(c,t)=>(r(),a("div",null,[o(p,{for:"education"+t.toUpperCase(),value:"Education "+t.toUpperCase()},null,8,["for","value"]),o(y,{id:"education"+t.toUpperCase(),modelValue:l.form.educations[t],"onUpdate:modelValue":m=>l.form.educations[t]=m},null,8,["id","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["education."+t]},null,8,["message"])]))),256)),(r(!0),a(f,null,v(l.form.experiences,(c,t)=>(r(),a("div",null,[o(p,{for:"experience"+t.toUpperCase(),value:"Experience "+t.toUpperCase()},null,8,["for","value"]),o(y,{id:"experience"+t.toUpperCase(),modelValue:l.form.experiences[t],"onUpdate:modelValue":m=>l.form.experiences[t]=m},null,8,["id","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["experience."+t]},null,8,["message"])]))),256)),i("div",pe,[o(p,{value:"Publications"}),(r(!0),a(f,null,v(l.form.publications,(c,t)=>(r(),a("div",null,[o(p,{value:"Category"}),i("div",de,[i("div",he,[(r(!0),a(f,null,v(c.name,(m,_)=>(r(),a("div",fe,[o(b,{type:"text",placeholder:"Category name "+_.toUpperCase(),class:"mt-1 block w-full",modelValue:c.name[_],"onUpdate:modelValue":C=>c.name[_]=C},null,8,["placeholder","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["publications."+t+".name."+_]},null,8,["message"])]))),256))]),i("div",ve,[l.form.publications.length>1?(r(),w(A,{key:0,class:"w-8 mt-auto mb-1 cursor-pointer text-red-600 fill-red-600",onClick:m=>s.removePublicationCategory(t)},null,8,["onClick"])):T("",!0),o(x,{class:"w-8 mt-auto mb-1 cursor-pointer text-green-600 fill-green-600",onClick:m=>s.addPublicationCategory(t)},null,8,["onClick"])])]),i("div",_e,[(r(!0),a(f,null,v(c.publications,(m,_)=>(r(),a("div",ge,[o(p,{value:"Publication"}),i("div",Ce,[i("div",be,[(r(!0),a(f,null,v(m.name,(C,U)=>(r(),a("div",Ue,[o(b,{type:"text",placeholder:"Publication name "+U.toUpperCase(),class:"mt-1 block w-full",modelValue:m.name[U],"onUpdate:modelValue":S=>m.name[U]=S},null,8,["placeholder","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["publications."+t+".publications."+_+".name."+U]},null,8,["message"])]))),256)),o(b,{type:"text",placeholder:"Publication link",class:"mt-1 block w-full",modelValue:m.link,"onUpdate:modelValue":C=>m.link=C},null,8,["modelValue","onUpdate:modelValue"])]),i("div",we,[c.publications.length>1?(r(),w(A,{key:0,class:"w-8 mt-auto mb-1 cursor-pointer text-red-600 fill-red-600",onClick:C=>s.removePublication(t,_)},null,8,["onClick"])):T("",!0),o(x,{class:"w-8 mt-auto mb-1 cursor-pointer text-green-600 fill-green-600",onClick:C=>s.addPublication(t,_)},null,8,["onClick"])])])]))),256))]),o(h,{class:"mt-2",message:l.form.errors.publications},null,8,["message"])]))),256))]),i("div",null,[o(E,{attachments:l.form.image.image,attachmentTitle:l.form.image.image_title,photoPreview:l.form.image.photoPreview,onUpdatePhotoPreview:s.updatePhotoPreview,onUpdatePhotoTitle:s.updatePhotoTitle},{title:d(()=>[...n[5]||(n[5]=[i("span",{class:"pl-2"},"Featured image",-1)])]),_:1},8,["attachments","attachmentTitle","photoPreview","onUpdatePhotoPreview","onUpdatePhotoTitle"])]),(r(!0),a(f,null,v(l.form.author,(c,t)=>(r(),a("div",null,[o(p,{for:"author"+t.toUpperCase(),value:"Author "+t.toUpperCase()},null,8,["for","value"]),o(b,{id:"author"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:l.form.author[t],"onUpdate:modelValue":m=>l.form.author[t]=m},null,8,["id","modelValue","onUpdate:modelValue"]),o(h,{class:"mt-2",message:l.form.errors["author."+t]},null,8,["message"])]))),256)),i("div",ye,[o(M,{disabled:l.form.processing},{default:d(()=>[...n[6]||(n[6]=[j("Save",-1)])]),_:1},8,["disabled"]),o(F,{"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:d(()=>[l.form.recentlySuccessful?(r(),a("p",Te,"Saved.")):T("",!0)]),_:1})])],32)])])]),_:1})],64)}const Xe=re(se,[["render",ke]]);export{Xe 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.