PageSourceSearch

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

js fonds.lv collected 2026-09-24 10:03:58 UTC 16,785 bytes, 1 lines download raw bytes

1import{A as L}from"./AuthenticatedLayout-DcpqZk2r.js";import{Z as j,i as N,r as p,f as a,c as y,a as l,w as f,b as n,d as H,o as r,F as g,j as _,g as w,l as W,t as q,p as Y,e as Z,k as z,T as G}from"./app-B9KORyBa.js";import{P as J}from"./PrimaryButton-vaEit9c1.js";import{_ as K}from"./TextInput-C7OaZZNQ.js";import{_ as Q}from"./InputLabel-C-zTQq7X.js";import{_ as X}from"./InputError-BH5ciAU3.js";import{_ as $}from"./TextBlock-CnuGUd5s.js";import{T as ee,A as B}from"./Attachment-CDfGTxyk.js";import{_ as te,T as oe}from"./TagInput-z-N_H-Oj.js";import{a as se}from"./TextOutline-CGLkonHp.js";import{_ as le,a as ne,C as re}from"./ContentManager-BeT97HXG.js";import{_ as ae}from"./AddCircleOutline-Cx9F2hdC.js";import{_ as me}from"./RemoveCircleOutline-UYtqa7Mm.js";import{T as ie}from"./TagInputWithSections-BBI1kWQZ.js";import{_ as ue}from"./DocumentTextOutline-B7A647Cs.js";import{S as ce}from"./Switch-CjgwlyRI.js";import{C as pe}from"./vue-select-C2MaT6ly.js";import{_ as fe}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-DrAX-EpC.js";import"./NavLink-BiVKPBr8.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 de={name:"ScholarshipsForm",computed:{attachment(){return B}},components:{vSelect:pe,ContentManager:re,Switch:ce,DocumentTextOutline:ue,TagInputWithSections:ie,TagInput:oe,Attachment:B,RemoveCircleOutline:me,AddCircleOutline:ae,AttachOutline:ne,ChatbubbleEllipsesOutline:le,TextOutline:se,CloseOutline:te,TextBuilder:ee,TextBlock:$,PrimaryButton:J,TextInput:K,InputLabel:Q,InputError:X,Link:N,AuthenticatedLayout:L,Head:j},props:{regforms_tmpl:{type:Array,required:!0},categories:{type:Object,default:null},students:{type:Object,default:null},patrons:{type:Object,default:null},forCategory:{type:Object,default:[]},scholarship:{type:Object,default:[]},tags:{type:Object,default:[]}},data(){return{form:G({regform_tmpl:this.scholarship.regform_tmpl??"",name:this.scholarship.name??{lv:"",en:""},excerpt:this.scholarship.excerpt??{lv:"",en:""},contents:this.scholarship.contents??[{type:"text",content:{lv:"",en:""},title:{lv:"",en:""},order:1,submit:!0,photoPreview:null}],positions:this.scholarship.positions??{lv:"",en:""},commission:this.scholarship.commission??[{name:{lv:"",en:""}}],apply:this.scholarship.apply??[{name:{lv:"",en:""}}],categories:this.scholarship.categories??[],students:this.scholarship.students??[],patrons:this.scholarship.patrons??[],tags:this.scholarship.tags??[],published:this.scholarship.published??!1,image:{image_title:this.scholarship.image_title??{lv:null,en:null},image:this.scholarship.image??null,photoPreview:null},submission_date:this.formatDate(this.scholarship.submission_date),amount:this.scholarship.amount??{lv:"",en:""},attachment:this.scholarship.attachment??{lv:null,en:null},regform:this.scholarship.regform??!1,author:this.scholarship.author??{lv:"",en:""},_method:"post"}),formPhotoPreview:null,newAttachment:{lv:!1,en:!1}}},mounted(){this.form.contents.forEach(e=>{e.submit=!0,e.title=e.title??{lv:"",en:""}})},methods:{handleToggle(e){this.form.published=e},handleToggleRf(e){this.form.regform=e},formatDate(e){if(e){const s=new Date(e),d=s.getFullYear(),U=String(s.getMonth()+1).padStart(2,"0"),o=String(s.getDate()).padStart(2,"0");return`${d}-${U}-${o}`}return null},updatePhotoPreview(e){this.form.image.image=e.content,this.form.image.photoPreview=e.photoPreview},updatePhotoTitle(e){this.form.image.image_title=e.title},updateAttachment(e,s){const d=e.target.files[0];d&&(this.form.attachment[s]=d,this.newAttachment[s]=!0)},updateCategories(e){this.form.categories=e},updateTags(e){this.form.tags=e},updateContentAttachmentTitle(e){this.form.contents[e.content.id].title[e.locale]=e.content.title},updateContent(e){const s=this.form.contents[e.content.id];if(s.type==="attachment"||s.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 s=this.form.contents[e.index];this.form.contents[e.index].order=s.order-1,this.form.contents[e.index-1].order=s.order+1,this.reorderContentByOrderAsc()},moveDown(e){const s=this.form.contents[e.index];this.form.contents[e.index].order=s.order+1,this.form.contents[e.index+1].order=s.order-1,this.reorderContentByOrderAsc()},reorderContentByOrderAsc(){this.form.contents.sort((e,s)=>e.order-s.order)},updateStudents(e){this.form.students=e},updatePatrons(e){this.form.patrons=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})},addParticipant(e){this.form.commission.splice(e+1,0,{name:{lv:"",en:""}})},addStep(e){this.form.apply.splice(e+1,0,{name:{lv:"",en:""}})},removeContentBlock(e){e.index>=0&&e.index<this.form.contents.length&&(this.form.contents[e.index].submit=!1)},removeParticipant(e){e>=0&&e<this.form.commission.length&&this.form.commission.splice(e,1)},removeStep(e){e>=0&&e<this.form.apply.length&&this.form.apply.splice(e,1)},submit(){var e;this.form.contents=this.form.contents.filter(s=>s.submit);for(let s=0;s<this.form.contents.length;s++)this.form.contents[s].order=s+1;(e=this.scholarship)!=null&&e.id?(this.form._method="put",this.form.post(route("admin.scholarships.update",{scholarship:this.scholarship.id}),{preserveState:"errors"})):this.form.post(route("admin.scholarships.store"),{preserveState:"errors"})}}},he={class:"py-12"},ge={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg"},ve={class:"space-y-2"},_e={class:"w-full space-y-2"},Ce={class:"w-full flex"},we={class:"w-full"},ye={class:"w-full"},be={class:"ml-3 my-auto flex"},Ue={class:"w-full space-y-2"},Te={class:"w-full flex"},ke={class:"w-full"},Ae={class:"w-full"},Pe={class:"ml-3 my-auto flex"},Ve={class:"space-y-2 pl-1"},Se=["onChange"],Oe={key:1,class:"relative w-fit"},Ie=["onClick"],Be=["href"],De={class:"space-y-2"},xe={class:"space-y-2"},Me=["value"],Re={class:"flex items-center gap-4"},Ee={key:0,class:"text-sm text-gray-600"};function Fe(e,s,d,U,o,m){var I;const T=p("Head"),h=p("InputLabel"),k=p("Switch"),A=p("TagInput"),c=p("InputError"),C=p("TextInput"),D=p("TextBlock"),P=p("ContentManager"),V=p("TagInputWithSections"),S=p("RemoveCircleOutline"),O=p("AddCircleOutline"),x=p("CloseOutline"),M=p("DocumentTextOutline"),R=p("Attachment"),E=p("PrimaryButton"),F=p("AuthenticatedLayout");return r(),a(g,null,[(I=d.scholarship)!=null&&I.id?(r(),y(T,{key:0,title:"Edit Scholarship"})):(r(),y(T,{key:1,title:"Add Scholarship"})),l(F,null,{header:f(()=>[...s[4]||(s[4]=[n("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Add Scholarship",-1)])]),default:f(()=>[n("div",he,[n("div",ge,[n("form",{class:"space-y-8 p-4",enctype:"multipart/form-data",onSubmit:s[3]||(s[3]=H(i=>m.submit(),["prevent"]))},[n("div",ve,[l(h,{for:"published",value:"Activate"}),l(k,{isOn:o.form.published,"onUpdate:isOn":m.handleToggle,id:"active"},null,8,["isOn","onUpdate:isOn"])]),n("div",null,[l(A,{onUpdateTags:m.updateCategories,"allow-creating-new-tags":!1,options:d.categories,selectedTags:d.scholarship.categories??d.forCategory??[]},{label:f(()=>[...s[5]||(s[5]=[n("span",null,"Categories",-1)])]),placeholder:f(()=>[...s[6]||(s[6]=[n("h1",null,"Categories",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),l(c,{class:"mt-2",message:o.form.errors.categories},null,8,["message"])]),n("div",null,[l(A,{onUpdateTags:m.updateTags,"allow-creating-new-tags":!1,options:d.tags,selectedTags:d.scholarship.tags??[]},{label:f(()=>[...s[7]||(s[7]=[n("span",null,"Display on landing",-1)])]),placeholder:f(()=>[...s[8]||(s[8]=[n("h1",null,"Display Tags",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),l(c,{class:"mt-2",message:o.form.errors.tags},null,8,["message"])]),(r(!0),a(g,null,_(o.form.name,(i,t)=>(r(),a("div",null,[l(h,{for:"name"+t.toUpperCase(),value:"Title "+t.toUpperCase()},null,8,["for","value"]),l(C,{id:"name"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:o.form.name[t],"onUpdate:modelValue":u=>o.form.name[t]=u,autofocus:"",autocomplete:"name"},null,8,["id","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["name."+t]},null,8,["message"])]))),256)),(r(!0),a(g,null,_(o.form.excerpt,(i,t)=>(r(),a("div",null,[l(h,{for:"excerpt"+t.toUpperCase(),value:"Excerpt "+t.toUpperCase()},null,8,["for","value"]),l(D,{id:"excerpt"+t.toUpperCase(),modelValue:o.form.excerpt[t],"onUpdate:modelValue":u=>o.form.excerpt[t]=u},null,8,["id","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["excerpt".index]},null,8,["message"])]))),256)),l(P,{contents:o.form.contents,locale:"lv",onAddContent:m.addContent,onRemoveContentBlock:m.removeContentBlock,onMoveUp:m.moveUp,onMoveDown:m.moveDown,onUpdateContent:m.updateContent,onUpdateContentAttachmentTitle:m.updateContentAttachmentTitle},{default:f(()=>[l(h,{value:"Content LV"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),l(P,{contents:o.form.contents,locale:"en",onAddContent:m.addContent,onRemoveContentBlock:m.removeContentBlock,onMoveUp:m.moveUp,onMoveDown:m.moveDown,onUpdateContent:m.updateContent,onUpdateContentAttachmentTitle:m.updateContentAttachmentTitle},{default:f(()=>[l(h,{value:"Content EN"})]),_:1},8,["contents","onAddContent","onRemoveContentBlock","onMoveUp","onMoveDown","onUpdateContent","onUpdateContentAttachmentTitle"]),n("div",null,[l(V,{onUpdateTags:m.updateStudents,"allow-creating-new-tags":!1,options:d.students,selectedTags:this.form.students??[]},{label:f(()=>[...s[9]||(s[9]=[n("span",null,"Students",-1)])]),placeholder:f(()=>[...s[10]||(s[10]=[n("h1",null,"Students",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),l(c,{class:"mt-2",message:o.form.errors.students},null,8,["message"])]),n("div",null,[l(V,{onUpdateTags:m.updatePatrons,"allow-creating-new-tags":!1,options:d.patrons,selectedTags:this.form.patrons??[]},{label:f(()=>[...s[11]||(s[11]=[n("span",null,"Patrons",-1)])]),placeholder:f(()=>[...s[12]||(s[12]=[n("h1",null,"Patrons",-1)])]),_:1},8,["onUpdateTags","options","selectedTags"]),l(c,{class:"mt-2",message:o.form.errors.patrons},null,8,["message"])]),(r(!0),a(g,null,_(o.form.positions,(i,t)=>(r(),a("div",null,[l(h,{for:"positions"+t.toUpperCase(),value:"Positions "+t.toUpperCase()},null,8,["for","value"]),l(C,{id:"positions"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:o.form.positions[t],"onUpdate:modelValue":u=>o.form.positions[t]=u},null,8,["id","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["positions."+t]},null,8,["message"])]))),256)),(r(!0),a(g,null,_(o.form.amount,(i,t)=>(r(),a("div",null,[l(h,{for:"amount"+t.toUpperCase(),value:"Amount "+t.toUpperCase()},null,8,["for","value"]),l(C,{id:"amount"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:o.form.amount[t],"onUpdate:modelValue":u=>o.form.amount[t]=u},null,8,["id","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["amount."+t]},null,8,["message"])]))),256)),n("div",null,[l(h,{for:"submission_date",value:"Submission date"}),l(C,{id:"submission_date",type:"date",class:"mt-1 block w-full",modelValue:o.form.submission_date,"onUpdate:modelValue":s[0]||(s[0]=i=>o.form.submission_date=i)},null,8,["modelValue"]),l(c,{class:"mt-2",message:o.form.errors.submission_date},null,8,["message"])]),n("div",_e,[(r(!0),a(g,null,_(o.form.commission,(i,t)=>(r(),a("div",null,[l(h,{for:"participant"+t,value:"Commission participant "+(t+1)},null,8,["for","value"]),n("div",Ce,[n("div",we,[(r(!0),a(g,null,_(i.name,(u,v)=>(r(),a("div",ye,[l(C,{id:"participant"+t+v,type:"text",placeholder:"Name "+v.toUpperCase(),class:"mt-1 block w-full",modelValue:i.name[v],"onUpdate:modelValue":b=>i.name[v]=b},null,8,["id","placeholder","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["commission."+t+".name."+v]},null,8,["message"])]))),256))]),n("div",be,[o.form.commission.length>1?(r(),y(S,{key:0,class:"w-8 mt-auto mb-1 cursor-pointer text-red-600 fill-red-600",onClick:u=>m.removeParticipant(t)}
1,null,8,["onClick"])):w("",!0),l(O,{class:"w-8 mt-auto mb-1 cursor-pointer text-green-600 fill-green-600",onClick:u=>m.addParticipant(t)},null,8,["onClick"])])]),l(c,{class:"mt-2",message:o.form.errors.commission},null,8,["message"])]))),256))]),n("div",Ue,[(r(!0),a(g,null,_(o.form.apply,(i,t)=>(r(),a("div",null,[l(h,{for:"step"+t,value:"Step "+(t+1)},null,8,["for","value"]),n("div",Te,[n("div",ke,[(r(!0),a(g,null,_(i.name,(u,v)=>(r(),a("div",Ae,[l(C,{id:"step"+t+v,type:"text",placeholder:"Name "+v.toUpperCase(),class:"mt-1 block w-full",modelValue:i.name[v],"onUpdate:modelValue":b=>i.name[v]=b},null,8,["id","placeholder","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["apply."+t+".name."+v]},null,8,["message"])]))),256))]),n("div",Pe,[o.form.apply.length>1?(r(),y(S,{key:0,class:"w-8 mt-auto mb-1 cursor-pointer text-red-600 fill-red-600",onClick:u=>m.removeStep(t)},null,8,["onClick"])):w("",!0),l(O,{class:"w-8 mt-auto mb-1 cursor-pointer text-green-600 fill-green-600",onClick:u=>m.addStep(t)},null,8,["onClick"])])]),l(c,{class:"mt-2",message:o.form.errors.apply},null,8,["message"])]))),256))]),(r(!0),a(g,null,_(o.form.attachment,(i,t)=>(r(),a("div",Ve,[l(h,{for:"attachment",value:"Regulation "+t.toUpperCase(),class:"pl-2"},null,8,["value"]),!o.form.attachment[t]||o.newAttachment[t]?(r(),a("input",{key:0,ref_for:!0,ref:`formAttachmentField_${t}`,onChange:u=>m.updateAttachment(u,t),type:"file",accept:".pdf, .doc, .docx",class:"block w-full rounded-lg text-sm text-blue-850 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-accent file:text-white hover:file:text-white hover:file:bg-accent file:cursor-pointer"},null,40,Se)):w("",!0),o.form.attachment[t]&&!o.newAttachment[t]?(r(),a("div",Oe,[n("div",{class:"absolute cursor-pointer rounded-full w-5 h-5 bg-white border-2 border-accent bg-white -right-1.5 -top-1.5 cursor-pointer",onClick:u=>{this.form.attachment[t]=null,this.newAttachment[t]=!1}},[l(x,{styleClasses:"w-4"})],8,Ie),n("a",{href:"/"+o.form.attachment[t],target:"_blank"},[l(M,{class:"w-20"})],8,Be)])):w("",!0),l(c,{class:"mt-2",message:o.form.errors["attachment."+t]},null,8,["message"])]))),256)),n("div",null,[l(R,{attachments:o.form.image.image,attachmentTitle:o.form.image.image_title,photoPreview:o.form.image.photoPreview,onUpdatePhotoPreview:m.updatePhotoPreview,onUpdatePhotoTitle:m.updatePhotoTitle},{title:f(()=>[...s[13]||(s[13]=[n("span",{class:"pl-2 text-sm"},"Featured image",-1)])]),_:1},8,["attachments","attachmentTitle","photoPreview","onUpdatePhotoPreview","onUpdatePhotoTitle"])]),n("div",De,[l(h,{for:"regform",value:"Enable Registration Form"}),l(k,{isOn:o.form.regform,"onUpdate:isOn":s[1]||(s[1]=i=>o.form.regform=i),id:"regform"},null,8,["isOn"]),l(c,{class:"mt-2",message:o.form.errors.regform},null,8,["message"])]),n("div",xe,[l(h,{for:"regform_tmpl",value:"Select Registration Form Template"}),W(n("select",{id:"regform_tmpl","onUpdate:modelValue":s[2]||(s[2]=i=>o.form.regform_tmpl=i),class:"mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"},[s[14]||(s[14]=n("option",{value:"",disabled:""},"Select a template",-1)),(r(!0),a(g,null,_(d.regforms_tmpl,i=>(r(),a("option",{key:i.id,value:i.id},q(i.title),9,Me))),128))],512),[[Y,o.form.regform_tmpl]]),l(c,{class:"mt-2",message:o.form.errors.regform_tmpl},null,8,["message"])]),(r(!0),a(g,null,_(o.form.author,(i,t)=>(r(),a("div",null,[l(h,{for:"author"+t.toUpperCase(),value:"Author "+t.toUpperCase()},null,8,["for","value"]),l(C,{id:"author"+t.toUpperCase(),type:"text",class:"mt-1 block w-full",modelValue:o.form.author[t],"onUpdate:modelValue":u=>o.form.author[t]=u},null,8,["id","modelValue","onUpdate:modelValue"]),l(c,{class:"mt-2",message:o.form.errors["author."+t]},null,8,["message"])]))),256)),n("div",Re,[l(E,{disabled:o.form.processing},{default:f(()=>[...s[15]||(s[15]=[Z("Save",-1)])]),_:1},8,["disabled"]),l(z,{"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:f(()=>[o.form.recentlySuccessful?(r(),a("p",Ee,"Saved.")):w("",!0)]),_:1})])],32)])])]),_:1})],64)}const ct=fe(de,[["render",Fe]]);export{ct 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.