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