import{i as g,d as f,T as b,p as y,c as k,w as l,u as e,o as a,a as o,b as i,g as n,t,n as w,e as p,f as m}from"./app-WJL2kJBE.js";import{_}from"./Button-Cw-sZQ7I.js";import{_ as S}from"./AppLayout-BWrI3d7K.js";import{_ as C}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"},T={class:"space-y-1 text-center"},V={class:"flex items-center justify-center py-2"},F={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"},L={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:s}=g({}),u=f([]),d=f(null),c=b({_method:"POST",excel:null}),x=r=>{d.value=r.target.files[0].name},h=()=>{u.value.files&&(c.excel=u.value.files[0]),c.post(route("suppliers.import.save"),{preserveScroll:!0})};return(r,A)=>{const v=y("icons");return a(),k(S,{title:e(s)("Import {x}",{x:e(s)("Suppliers")})},{default:l(()=>[o("div",B,[i(C,{onSubmitted:h},{title:l(()=>[n(t(e(s)("Import {x}",{x:e(s)("Suppliers")})),1)]),description:l(()=>[n(t(e(s)("Please upload the excel file to import records."))+" ",1),o("div",I,[i(_,{href:r.route("suppliers.index")},{default:l(()=>[n(t(e(s)("List Suppliers")),1)]),_:1},8,["href"]),i(_,{away:"",href:r.route("suppliers.export")},{default:l(()=>[n(t(e(s)("Export Suppliers")),1)]),_:1},8,["href"])])]),form:l(()=>[o("div",E,[o("label",N,t(e(s)("Excel File")),1),o("div",{class:w([r.$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"])},[o("div",T,[i(v,{name:"doc-text",size:"mx-auto h-12 w-12 text-gray-400"}),o("div",V,[o("label",F,[d.value?(a(),p("span",L,t(e(s)("Change file")),1)):(a(),p("span",j,t(e(s)("Select file")),1)),o("input",{type:"file",ref_key:"formRef",ref:u,class:"sr-only",id:"file-upload",name:"file-upload",onChange:x,accept:".xls,.xlsx,application/vnd.ms-excel"},null,544)]),o("p",z,t(e(s)("or drag and drop")),1)]),o("div",P,[o("div",null,t(e(s)("Excel file should have name, company, phone, email, cf1 and cf2 columns.")),1),o("div",null,t(e(s)("The name and phone or email are required.")),1)]),d.value?(a(),p("div",R,[o("div",q,t(e(s)("Selected File"))+": "+t(d.value),1)])):m("",!0),r.$page.props.errors.excel?(a(),p("div",D,t(r.$page.props.errors.excel),1)):m("",!0)])],2)])]),actions:l(()=>[i($,{loading:e(c).processing,disabled:e(c).processing},{default:l(()=>[n(t(e(s)("Import")),1)]),_:1},8,["loading","disabled"])]),_:1})])]),_:1},8,["title"])}}};export{W as default};
