1import{g as H,r as o,B as M,c as l,o as a,a as b,b as t,w as S,T as G,e as F,M as B,H as E,f as P,i as N,t as i,F as y}from"./CU_8NFE3.js";const V={class:"section section--light"},q={class:"container max-w-xl"},R={class:"space-y-10"},W={class:"rounded-sm border border-stoneLight bg-ivory p-6"},O={class:"button-row button-row--left gap-3"},Z=["disabled"],z={key:0,class:"text-sm text-mutedInk mt-4"},Q={class:"text-sm text-mutedInk mb-4"},Y={key:0},j={key:2},J=["disabled"],K={class:"text-sm text-mutedInk mb-4"},X={key:0},ee={key:2},te=["disabled"],se={class:"text-sm text-mutedInk mb-4"},le={key:0},ae={key:2},ne=["disabled"],oe={key:0,class:"text-sm text-mutedInk mt-4"},ie={key:1,class:"text-sm text-mutedInk mt-4"},ue="https://docs.google.com/spreadsheets/d/181FrennvUUiBtvtrchE6dgqI9Ap5zIawtwi4VfvN6Ds/edit?gid=0#gid=0",pe=H({__name:"upload",setup(de){const _=o(null),x=o(null),k=o(null),p=o(!1),r=o(""),U=o({bulletin:{type:"bulletin",label:"Worship Leaflet",filename:null,uploadedAt:null,exists:!1},happenings:{type:"happenings",label:"Happenings",filename:null,uploadedAt:null,exists:!1},newsletter:{type:"newsletter",label:"Cathedral Times",filename:null,uploadedAt:null,exists:!1}}),c=o(!0),m=o(""),v=o(!1),f=o(""),A=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZone:"America/Denver",timeZoneName:"short"}),D=s=>{U.value[s.type]=s},T=async()=>{c.value=!0,m.value="";try{(await $fetch("/api/upload-status",{query:{refresh:Date.now()},timeout:1e4})).documents.forEach(D)}catch{m.value="Unable to load recent upload details. You can still select a PDF and try the upload."}finally{c.value=!1}},n=s=>U.value[s],w=s=>{if(!s)return"Not recorded";const e=new Date(s);return Number.isNaN(e.getTime())?"Not recorded":A.format(e)},$=async()=>{v.value=!0,f.value="";try{const s=await $fetch("/api/serve",{query:{refresh:Date.now()}}),e=Array.isArray(s)?s.length:0;f.value=`Gifts data refreshed. ${e} active opportunities found.`}catch{f.value="Unable to refresh gifts data."}finally{v.value=!1}},C=async s=>{const e=s==="bulletin"?_.value:s==="happenings"?x.value:k.value;if(!e){r.value="Please select a file.";return}const h=new FormData;h.append("file",e),p.value=!0,r.value="";try{const g=await $fetch(`/api/upload-${s}`,{method:"POST",body:h});g.document&&D(g.document),r.value=`${n(s).label} uploaded successfully.`,s==="bulletin"&&(_.value=null),s==="happenings"&&(x.value=null),s==="newsletter"&&(k.value=null)}catch{r.value="Upload failed."}finally{p.value=!1}};return M(T),(s,e)=>{const h=G,g=B,I=E,L=P;return a(),l(y,null,[b(I,null,{default:S(()=>[b(h,null,{default:S(()=>e[6]||(e[6]=[F("Upload Documents - St. Peter's Episcopal Cathedral | Helena, MT")])),_:1}),b(g,{name:"description",content:"Upload documents such as Happenings and Cathedral Times at St. Peter's Episcopal Cathedral."})]),_:1}),b(L,{page:"Documents",headline:"Upload Documents"}),t("main",V,[t("div",q,[t("div",R,[t("div",W,[e[8]||(e[8]=t("p",{class:"eyebrow mb-2"}," Quick Link ",-1)),e[9]||(e[9]=t("h2",{class:"font-serif text-xl mb-3"}," Gifts Spreadsheet ",-1)),t("div",O,[t("a",{href:ue,target:"_blank",rel:"noopener noreferrer",class:"btn-secondary inline-flex items-center gap-2"},e[7]||(e[7]=[F(" Open Gifts Sheet "),t("i",{class:"fa-solid fa-arrow-up-right-from-square","aria-hidden":"true"},null,-1)])),t("button",{type:"button",class:"btn-primary",disabled:v.value,onClick:$},i(v.value?"Refreshing...":"Refresh Gifts Data"),9,Z)]),f.value?(a(),l("p",z,i(f.value),1)):N("",!0)]),t("div",null,[e[10]||(e[10]=t("h2",{class:"font-serif text-xl mb-2"}," Worship Leaflet ",-1)),t("div",Q,[c.value?(a(),l("p",Y," Checking latest upload... ")):n("bulletin").exists?(a(),l(y,{key:1},[t("p",null,"Last uploaded: "+i(w(n("bulletin").uploadedAt)),1),t("p",null,"File: "+i(n("bulletin").filename||"Not recorded for previous upload"),1)],64)):(a(),l("p",j," No upload recorded yet. "))]),t("input",{type:"file",accept:"application/pdf",onChange:e[0]||(e[0]=u=>{var d;return _.value=((d=u.target.files)==null?void 0:d[0])||null})},null,32),t("button",{class:"btn-primary mt-4",disabled:p.value,onClick:e[1]||(e[1]=u=>C("bulletin"))}," Upload Worship Leaflet ",8,J)]),t("div",null,[e[11]||(e[11]=t("h2",{class:"font-serif text-xl mb-2"}," Happenings ",-1)),t("div",K,[c.value?(a(),l("p",X," Checking latest upload... ")):n("happenings").exists?(a(),l(y,{key:1},[t("p",null,"Last uploaded: "+i(w(n("happenings").uploadedAt)),1),t("p",null,"File: "+i(n("happenings").filename||"Not recorded for previous upload"),1)],64)):(a(),l("p",ee," No upload recorded yet. "))]),t("input",{type:"file",accept:"application/pdf",onChange:e[2]||(e[2]=u=>{var d;return x.value=((d=u.target.files)==null?void 0:d[0])||null})},null,32),t("button",{class:"btn-primary mt-4",disabled:p.value,onClick:e[3]||(e[3]=u=>C("happenings"))}," Upload Happenings ",8,te)]),t("div",null,[e[12]||(e[12]=t("h2",{class:"font-serif text-xl mb-2"}," Cathedral Times ",-1)),t("div",se,[c.value?(a(),l("p",le," Checking latest upload... ")):n("newsletter").exists?(a(),l(y,{key:1},[t("p",null,"Last uploaded: "+i(w(n("newsletter").uploadedAt)),1),t("p",null,"File: "+i(n("newsletter").filename||"Not recorded for previous upload"),1)],64)):(a(),l("p",ae," No upload recorded yet. "))]),t("input",{type:"file",accept:"application/pdf",onChange:e[4]||(e[4]=u=>{var d;return k.value=((d=u.target.files)==null?void 0:d[0])||null})},null,32),t("button",{class:"btn-primary mt-4",disabled:p.value,onClick:e[5]||(e[5]=u=>C("newsletter"))}," Upload Newsletter ",8,ne)]),r.value?(a(),l("p",oe,i(r.value),1)):N("",!0),m.value?(a(),l("p",ie,i(m.value),1)):N("",!0)])])])],64)}}});
1export{pe 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.