import{F as b}from"./FileInput-f094e2ab.js";import{A as y}from"./AdminLayout-e87dd638.js";import{L as x}from"./LoadingButton-1a262643.js";import{T as v}from"./FormSection-07a3c25c.js";import{T as $}from"./SecondaryButton-7ef0b567.js";import{_ as k,r as n,o as r,d as S,e as s,g as d,h as c,t,a as o,n as C,c as l,b as m}from"./app-32ed258c.js";import"./Label-fda955a2.js";import"./Input-b786da58.js";import"./InputError-8d3cfe49.js";import"./v4-4a60fe23.js";import"./Modal-291f355a.js";import"./DropdownLink-b7a93580.js";import"./ApplicationLogo-67ce1691.js";import"./ApplicationMark-984b256c.js";import"./SectionTitle-8b846035.js";const F={props:["parents"],components:{FileInput:b,AdminLayout:y,LoadingButton:x,TecFormSection:v,TecSecondaryButton:$},data(){return{selected:null,form:this.$inertia.form({_method:"POST",excel:null})}},methods:{updateFile(e){this.selected=e.target.files[0].name},submit(){this.$refs.file&&(this.form.excel=this.$refs.file.files[0]),this.form.post(route("categories.import.save"),{preserveScroll:!0})}}},w={for:"file-upload",class:"block font-medium text-gray-700"},B={class:"space-y-1 text-center"},T={class:"flex items-center justify-center text-gray-600 py-2"},N={for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-gray-300"},V={key:0,class:"font-semibold"},E={key:1,class:"font-semibold"},I={class:"pl-1"},L={class:"text-xs text-gray-700"},j={key:0,class:"inline-block pt-4"},A={class:"px-3 py-1 rounded-md border font-bold text-lg"},P={key:1,class:"mt-4 pt-2 text-red-600 rounded-md"};function z(e,p,D,O,i,a){const f=n("icons"),u=n("loading-button"),h=n("tec-form-section"),g=n("admin-layout");return r(),S(g,{title:e.$t("import_x",{x:e.$t("Categories")})},{default:s(()=>[d(h,{onSubmitted:a.submit},{title:s(()=>[c(t(e.$t("import_x",{x:e.$t("Categories")})),1)]),description:s(()=>[c(t(e.$t("Please upload the excel file to import records.")),1)]),form:s(()=>[o("div",null,[o("label",w,t(e.$t("Excel File")),1),o("div",{class:C([e.$page.props.errors.excel?"border-red-500":"border-gray-300","mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-md"])},[o("div",B,[d(f,{name:"doc-text",class:"mx-auto h-12 w-12 text-gray-400"}),o("div",T,[o("label",N,[i.selected?(r(),l("span",V,t(e.$t("Change file")),1)):(r(),l("span",E,t(e.$t("Select file")),1)),o("input",{ref:"file",type:"file",class:"sr-only",id:"file-upload",name:"file-upload",onChange:p[0]||(p[0]=(..._)=>a.updateFile&&a.updateFile(..._)),accept:".xls,.xlsx,application/vnd.ms-excel"},null,544)]),o("p",I,t(e.$t("or drag and drop")),1)]),o("div",L,[o("div",null,t(e.$t("Excel file should have name, code & parent columns.")),1),o("div",null,t(e.$t("You must fill the name and code columns."))+" "+t(e.$t("parent is the code of the parent category.")),1)]),i.selected?(r(),l("div",j,[o("div",A,t(e.$t("Selected File"))+": "+t(i.selected),1)])):m("",!0),e.$page.props.errors.excel?(r(),l("div",P,t(e.$page.props.errors.excel),1)):m("",!0)])],2)])]),actions:s(()=>[d(u,{loading:i.form.processing,disabled:i.form.processing},{default:s(()=>[c(t(e.$t("Import")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["onSubmitted"])]),_:1},8,["title"])}const oe=k(F,[["render",z]]);export{oe as default};
