import{i as g,d as u,T as b,p as y,c as k,w as r,u as e,o as a,a as o,b as i,g as n,t,n as w,e as p,f}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"},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({}),m=u([]),c=u(null),d=b({_method:"POST",excel:null}),x=l=>{c.value=l.target.files[0].name},h=()=>{m.value.files&&(d.excel=m.value.files[0]),d.post(route("customers.import.save"),{preserveScroll:!0})};return(l,A)=>{const v=y("icons");return a(),k(C,{title:e(s)("Import {x}",{x:e(s)("Customers")})},{default:r(()=>[o("div",B,[i(S,{onSubmitted:h},{title:r(()=>[n(t(e(s)("Import {x}",{x:e(s)("Customers")})),1)]),description:r(()=>[n(t(e(s)("Please upload the excel file to import records."))+" ",1),o("div",I,[i(_,{href:l.route("customers.index")},{default:r(()=>[n(t(e(s)("List Customers")),1)]),_:1},8,["href"]),i(_,{away:"",href:l.route("customers.export")},{default:r(()=>[n(t(e(s)("Export Customers")),1)]),_:1},8,["href"])])]),form:r(()=>[o("div",E,[o("label",N,t(e(s)("Excel File")),1),o("div",{class:w([l.$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,[c.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:m,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)]),c.value?(a(),p("div",R,[o("div",q,t(e(s)("Selected File"))+": "+t(c.value),1)])):f("",!0),l.$page.props.errors.excel?(a(),p("div",D,t(l.$page.props.errors.excel),1)):f("",!0)])],2)])]),actions:r(()=>[i($,{loading:e(d).processing,disabled:e(d).processing},{default:r(()=>[n(t(e(s)("Import")),1)]),_:1},8,["loading","disabled"])]),_:1})])]),_:1},8,["title"])}}};export{W as default};
