import{i as v,d as m,T as b,p as y,c as k,w as r,u as e,o as l,a as t,b as i,g as n,t as s,n as w,e as p,f as u}from"./app-WJL2kJBE.js";import{_}from"./Button-Cw-sZQ7I.js";import{_ as C}from"./AppLayout-BWrI3d7K.js";import{_ as S}from"./FormSection-VZbtMXdy.js";import{L as $}from"./LoadingButton-H6RtHB1p.js";import"./Modal-B9NNWAdE.js";import"./SectionTitle-DsJypKOL.js";const B={class:"max-w-7xl mx-auto py-10 sm:px-6 lg:px-8"},I={class:"flex items-center gap-4 flex-wrap mt-4"},E={class:"w-full col-span-full"},N={for:"file-upload",class:"block font-medium"},V={class:"space-y-1 text-center"},F={class:"flex items-center justify-center py-2"},L={for:"file-upload",class:"relative cursor-pointer rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-gray-300"},T={key:0,class:"font-semibold"},j={key:1,class:"font-semibold"},z={class:"pl-1"},P={class:"text-xs"},R={key:0,class:"inline-block pt-4"},q={class:"px-3 py-1 rounded-md border font-bold text-lg"},D={key:1,class:"mt-4 pt-2 text-red-600 rounded-md"},W={__name:"Import",setup(O){const{t:o}=v({}),f=m([]),c=m(null),d=b({_method:"POST",excel:null}),x=a=>{c.value=a.target.files[0].name},h=()=>{f.value.files&&(d.excel=f.value.files[0]),d.post(route("categories.import.save"),{preserveScroll:!0})};return(a,A)=>{const g=y("icons");return l(),k(C,{title:e(o)("Import {x}",{x:e(o)("Categories")})},{default:r(()=>[t("div",B,[i(S,{onSubmitted:h},{title:r(()=>[n(s(e(o)("Import {x}",{x:e(o)("Categories")})),1)]),description:r(()=>[n(s(e(o)("Please upload the excel file to import records."))+" ",1),t("div",I,[i(_,{href:a.route("categories.index")},{default:r(()=>[n(s(e(o)("List Categories")),1)]),_:1},8,["href"]),i(_,{away:"",href:a.route("categories.export")},{default:r(()=>[n(s(e(o)("Export Categories")),1)]),_:1},8,["href"])])]),form:r(()=>[t("div",E,[t("label",N,s(e(o)("Excel File")),1),t("div",{class:w([a.$page.props.errors.excel?"border-red-500":"border-gray-300 dark:border-gray-700","mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-md"])},[t("div",V,[i(g,{name:"doc-text",size:"mx-auto h-12 w-12 text-gray-400"}),t("div",F,[t("label",L,[c.value?(l(),p("span",T,s(e(o)("Change file")),1)):(l(),p("span",j,s(e(o)("Select file")),1)),t("input",{type:"file",ref_key:"formRef",ref:f,class:"sr-only",id:"file-upload",name:"file-upload",onChange:x,accept:".xls,.xlsx,application/vnd.ms-excel"},null,544)]),t("p",z,s(e(o)("or drag and drop")),1)]),t("div",P,[t("div",null,s(e(o)("Excel file should have name and code columns both required.")),1)]),c.value?(l(),p("div",R,[t("div",q,s(e(o)("Selected File"))+": "+s(c.value),1)])):u("",!0),a.$page.props.errors.excel?(l(),p("div",D,s(a.$page.props.errors.excel),1)):u("",!0)])],2)])]),actions:r(()=>[i($,{loading:e(d).processing,disabled:e(d).processing},{default:r(()=>[n(s(e(o)("Import")),1)]),_:1},8,["loading","disabled"])]),_:1})])]),_:1},8,["title"])}}};export{W as default};
