import{r as u,o as _,c as f,a as e,z as y,w as g,e as w,g as t,i as a,B as F,C}from"./app-91dba96b.js";import{i as E}from"./index-0653e21c.js";import{u as I}from"./urlGenerator-87d92adb.js";import{_ as B}from"./_plugin-vue_export-helper-c27b6911.js";import"./appFunction-1b5b1f43.js";const l=n=>(F("data-v-bba90d99"),n=n(),C(),n),D={class:"content py-5"},S={class:"container p-4 shadow-sm rounded bg-white"},z=l(()=>e("h1",{class:"mb-4 text-center"},"Prayer Time Import",-1)),T={class:"instruction-box mb-4 p-3 rounded"},Y=l(()=>e("strong",null,"Instructions for the Excel File:",-1)),k={class:"mb-0"},M=l(()=>e("li",null,[t("Date format should be "),e("code",null,"DD/MM/YYYY"),t(" (e.g., 01/01/2025).")],-1)),N=l(()=>e("li",null,[t("Ensure the "),e("b",null,"Column"),t(" names are correct: "),e("b",null,'"Time"'),t(", "),e("b",null,'"City"'),t(", and other necessary columns.")],-1)),V=l(()=>e("li",null,"File size should not exceed 150 KB.",-1)),K={class:"form-text mt-2"},P=["href"],U={class:"mb-3"},G=l(()=>e("label",{for:"file",class:"form-label fw-bold"},"Upload File",-1)),L={class:"text-center"},O=["disabled"],j={key:0,class:"spinner-border spinner-border-sm me-2"},q={__name:"import",setup(n){const s=u(!1),o=u(null),m=u(null),x=r=>{m.value=r,o.value=r.target.files[0]},h=r=>{if(s.value=!0,!o.value){a.error("Please select a file"),s.value=!1;return}const i=["xlsx","xls","csv"],c=o.value.name.split(".").pop().toLowerCase();if(!i.includes(c)){a.error("Only .xlsx, .xls, or .csv files are allowed"),s.value=!1;return}const v=150*1024;if(o.value.size>v){a.error("File size must not exceed 150 KB"),s.value=!1;return}const p=new FormData;p.append("file",o.value),E.post("prayertime-import",p,{headers:{"Content-Type":"multipart/form-data"}}).then(d=>{a.success(d.data.message),o.value=null,m.value.target.value=null}).catch(({response:d})=>{a.error(d.data.message)}).finally(()=>s.value=!1)},b=I("assets/prayer_times_example.xlsx");return(r,i)=>(_(),f("main",D,[e("div",S,[z,e("div",T,[Y,e("ul",k,[M,N,V,e("li",null,[e("span",K,[e("a",{href:y(b),download:"prayer_times_example.xlsx",class:"text-primary text-decoration-underline"}," Download Example File ",8,P)])])])]),e("form",{enctype:"multipart/form-data",onSubmit:g(h,["prevent"]),class:"needs-validation"},[e("div",U,[G,e("input",{id:"file",class:"form-control form-control-lg",type:"file",onChange:i[0]||(i[0]=c=>x(c)),accept:".xlsx, .xls, .csv"},null,32)]),e("div",L,[e("button",{disabled:s.value,type:"submit",class:"btn btn-primary btn-lg w-100"},[s.value?(_(),f("span",j)):w("",!0),t(" Submit ")],8,O)])],32)])]))}},W=B(q,[["__scopeId","data-v-bba90d99"]]);export{W as default};
