1import{A}from"./AuthenticatedLayout-BgPi6SK7.js";import{r as l,f as a,b as o,s as w,g as S,n as P,t as h,a as i,l as L,v as j,F as y,j as b,o as n,e as I,Z as B,i as D,c as x,w as p,d as $,k as N,T as O}from"./app-BFBm0Bhp.js";import{T as E,A as F}from"./Attachment-ui7ykot5.js";import{_ as W,T as U}from"./TagInput-B24tt8Te.js";import{S as H}from"./Switch-lcdVR_Lx.js";import{C as M}from"./ContentManager-D8_wkhWp.js";import{P as z}from"./PrimaryButton-DQRXstZk.js";import{_ as Z}from"./InputError-gS6WMAxM.js";import{_ as q}from"./TextInput-BleaLv5g.js";import{_ as G}from"./InputLabel-COeR7jGs.js";import{_ as J}from"./TextBlock-BLReQj5p.js";import{T as K}from"./TagInputWithSections-ClLsNCgf.js";import{_ as Q}from"./ChevronDownOutline-I8s4miqi.js";import{_ as k}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-BDZZhcqx.js";import"./NavLink-XJ1F9B8R.js";import"./TextOutline-DJTNpM16.js";import"./DocumentTextOutline-CSPECrKp.js";import"./InformationCircleOutline-B09VKpeu.js";import"./LinkOutline-BCvp66tw.js";import"./LogoYoutube-DPs_gR_f.js";import"./ArrowUpOutline-D4ILiFyi.js";import"./ArrowDownOutline-reU2X3OH.js";const R={name:"SelectInputWithSections",components:{CloseOutline:W,ChevronDownOutline:Q},props:{selectedValue:{type:Number,default:null},options:{type:Array,default:[]}},data(){return{dropdown:!1,searchString:"",value:this.findItemName(this.selectedValue)}},methods:{findItemName(t){for(const e of this.options)for(const r of e.items)if(r.id===t)return r.name;return null},toggleDropdown(){this.dropdown=!this.dropdown},addTag(t){this.value=t.name,this.$emit("update-value",t.id),this.searchString="",this.toggleDropdown()}},computed:{items(){return this.options.map(t=>{const e=t.items.filter(r=>{let u;return typeof r.name=="object"&&r.name!==null?u=r.name.lv:u=r.name,u.toLowerCase().includes(this.searchString.toLowerCase())});return e.length>0?{...t,items:e}:null}).filter(t=>t!==null)}}},X={class:"space-y-3"},Y={class:"text-sm pl-1"},tt={class:"w-full relative"},et={key:1},ot={class:"flex-grow flex justify-end"},st={key:0,class:"absolute overflow-scroll z-10 w-full border-2 border-t-0 rounded-b-lg max-h-48"},nt={class:"bg-white"},rt={class:"border-b"},at={class:"p-3 text-gray-500 cursor-not-allowed"},it=["onClick"];function lt(t,e,r,u,s,d){const _=l("ChevronDownOutline");return n(),a("div",X,[o("div",Y,[w(t.$slots,"label")]),o("div",tt,[o("div",{class:P(["flex p-3 border-2",{"rounded-t-lg":s.dropdown,"rounded-lg":!s.dropdown}]),onClick:e[0]||(e[0]=m=>d.toggleDropdown())},[s.value?(n(),a("p",et,h(this.value.lv),1)):w(t.$slots,"placeholder",{key:0}),o("div",ot,[i(_,{styleClasses:"w-5"})])],2),s.dropdown?(n(),a("div",st,[o("div",nt,[o("div",rt,[L(o("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=m=>s.searchString=m),placeholder:"Search",class:"w-full border-none active:border-0 focus:outline-none"},null,512),[[j,s.searchString]])]),(n(!0),a(y,null,b(d.items,m=>(n(),a("div",at,[I(h(m.name.lv)+" ",1),(n(!0),a(y,null,b(m.items,c=>(n(),a("div",{class:"p-3 hover:bg-accent hover:text-white text-gray-900 cursor-pointer",onClick:v=>d.addTag(c)},h(c.name.lv),9,it))),256))]))),256))])])):S("",!0)])])}const mt=k(R,[["render",lt]]),dt={name:"ScholarshipsForm",components:{SelectInputWithSections:mt,TagInputWithSections:K,TextBlock:J,InputLabel:G,TextInput:q,InputError:Z,PrimaryButton:z,ContentManager:M,Switch:H,TagInput:U,Attachment:F,TextBuilder:E,Link:D,AuthenticatedLayout:A,Head:B},props:{payment:{type:Object,default:[]},patrons:{type:Object,default:[]},projectId:{type:String}},data(){return{form:O({project_id:this.payment.project_id??this.projectId,patron_id:this.payment.patron_id??null,amount:this.formatAmou
1nt(this.payment.amount)??"",_method:"post"})}},methods:{formatAmount(t){return(t/100).toFixed(2)},updatePatrons(t){console.log(t),this.form.patron_id=t},submit(){var t;(t=this.payment)!=null&&t.id?(this.form._method="put",this.form.post(route("admin.payments.update",{payment:this.payment.id}),{preserveState:"errors"})):this.form.post(route("admin.payments.store"),{preserveState:"errors"})}}},pt={key:0,class:"font-semibold text-xl text-gray-800 leading-tight"},ut={key:1,class:"font-semibold text-xl text-gray-800 leading-tight"},ct={class:"py-12"},ft={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg"},_t={class:"flex items-center gap-4"},ht={key:0,class:"text-sm text-gray-600"};function yt(t,e,r,u,s,d){var g;const _=l("Head"),m=l("SelectInputWithSections"),c=l("InputError"),v=l("InputLabel"),C=l("TextInput"),T=l("PrimaryButton"),V=l("AuthenticatedLayout");return n(),a(y,null,[(g=r.payment)!=null&&g.id?(n(),x(_,{key:0,title:"Edit Payment"})):(n(),x(_,{key:1,title:"Add Payment"})),i(V,null,{header:p(()=>{var f;return[(f=r.payment)!=null&&f.id?(n(),a("h2",pt,"Add Payment")):(n(),a("h2",ut,"Add Payment"))]}),default:p(()=>[o("div",ct,[o("div",ft,[o("form",{class:"space-y-5 p-4 h-80",enctype:"multipart/form-data",onSubmit:e[1]||(e[1]=$(f=>d.submit(),["prevent"]))},[o("div",null,[i(m,{onUpdateValue:d.updatePatrons,"allow-creating-new-tags":!1,options:r.patrons,selectedValue:this.form.patron_id??null},{label:p(()=>[...e[2]||(e[2]=[o("span",null,"Patrons",-1)])]),placeholder:p(()=>[...e[3]||(e[3]=[o("h1",null,"Select patron",-1)])]),_:1},8,["onUpdateValue","options","selectedValue"]),i(c,{class:"mt-2",message:s.form.errors.patron_id},null,8,["message"])]),o("div",null,[i(v,{for:"amount",value:"Amount"}),i(C,{id:"amount",type:"number",min:"0",step:"0.01",class:"mt-1 block w-full",modelValue:s.form.amount,"onUpdate:modelValue":e[0]||(e[0]=f=>s.form.amount=f)},null,8,["modelValue"]),i(c,{class:"mt-2",message:s.form.errors.amount},null,8,["message"])]),o("div",_t,[i(T,{disabled:s.form.processing},{default:p(()=>[...e[4]||(e[4]=[I("Save",-1)])]),_:1},8,["disabled"]),i(N,{"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:p(()=>[s.form.recentlySuccessful?(n(),a("p",ht,"Saved.")):S("",!0)]),_:1})])],32)])])]),_:1})],64)}const Ut=k(dt,[["render",yt]]);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.