Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/talent.gosepakat.id/public/build/assets/
Upload File :
Current File : /home/aplikasiposinfo/public_html/talent.gosepakat.id/public/build/assets/Import-DTdlwEKu.js

import{X as S,r as t,G as w,j as e,S as C}from"./app-BmTP6guc.js";import{A as _}from"./AdminLayout-CjMXxslN.js";import{C as E,a as F,b as I,c as P}from"./card-C3x-ZG5W.js";import{S as D}from"./switch-DOYKz5eL.js";import{L as n}from"./label-BBvpekrf.js";import{I as f}from"./input-DyGHWNup.js";import{I as c}from"./InputError-CHi-rcQD.js";import{B as j}from"./button-BhHYkeOd.js";import{S as T,a as L,b as A,c as B,d as g}from"./select-CTwvNAAL.js";import{p as K}from"./excelUtils-DX2G9Acj.js";import{D as V}from"./download-E3r7pch_.js";import{L as O}from"./loader-circle-CgPpndr6.js";import"./utils-CytzSlOG.js";import"./dropdown-menu-DrXrYVxe.js";import"./index-BbEmxga1.js";import"./index-7efeotKz.js";import"./index-yBHduGbc.js";import"./toaster-BXPkgPoE.js";import"./x-CHODR9tn.js";import"./createLucideIcon-Clz6RkwZ.js";import"./Combination-Bxy8jxZP.js";import"./index-COLjj0g8.js";import"./chevron-right-3Fz0pDkz.js";import"./users-yydILNK1.js";import"./graduation-cap-BVe7kfFE.js";import"./index-SEQZ8Sgb.js";import"./xlsx-xCRnwQcp.js";function fe(){const b=S().props.auth.user,[m,d]=t.useState(null),[Q,p]=t.useState(!1),[W,u]=t.useState(null),[G,k]=t.useState(""),{data:l,setData:r,post:y,processing:h,errors:i}=w({file:null,tahun:"2025",buat_akun:0,password_kustom:null}),N=s=>{s.preventDefault(),y(route("admin.peserta.import"))},v=async s=>{var x;const a=(x=s.target.files)==null?void 0:x[0];if(a&&!a.name.endsWith(".xlsx")&&!a.name.endsWith(".xls")){r("file",null);return}if(a){r("file",a),p(!0),u(null),console.log("excel");try{const o=await K(a);console.log(o),d(o)}catch(o){console.error("Error parsing Excel file:",o),u("Failed to parse Excel file. Please ensure it is a valid Excel format.")}finally{p(!1)}}};return t.useCallback(s=>{m&&d({...m,activeSheet:s})},[m]),t.useCallback(s=>{k(s)},[]),t.useCallback(()=>{},[]),e.jsxs(_,{user:b,header:e.jsx("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:"Import Peserta"}),children:[e.jsx(C,{title:"Import Peserta"}),e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h1",{className:"text-lg font-bold md:text-2xl",children:"Import Peserta"}),e.jsx("a",{href:route("admin.peserta.download-template-import"),target:"_blank",children:e.jsxs(j,{children:[e.jsx(V,{})," Download Template"]})})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs(E,{className:"w-full mx-auto",children:[e.jsx(F,{children:e.jsx(I,{children:"Import Peserta"})}),e.jsx(P,{children:e.jsxs("form",{onSubmit:N,method:"POST",encType:"multipart/form-data",className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"tahun",children:"Tahun Data"}),e.jsxs(T,{onValueChange:()=>{r("tahun",l.tahun)},defaultValue:l.tahun,children:[e.jsx(L,{children:e.jsx(A,{placeholder:"Pilih Tahun Data"})}),e.jsxs(B,{children:[e.jsx(g,{value:"2025",children:"2025"}),e.jsx(g,{value:"2024",children:"2024"})]})]})]}),e.jsx(c,{message:i.tahun})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"file",children:"File Excel"}),e.jsx(f,{id:"file",type:"file",name:"file",accept:".xlsx, .xls",onChange:v,className:"mt-1 block w-full"})]}),e.jsx(c,{message:i.file})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{id:"buat_akun",checked:l.buat_akun===1,onCheckedChange:s=>r(a=>({...a,buat_akun:s?1:0}))}),e.jsx(n,{htmlFor:"buat_akun",children:"Buat Akun Otomatis"})]}),e.jsx(c,{message:i.buat_akun})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"file",children:"Password Kustom (Kosongkan jika ingin generate password otomatis untuk setiap akun peserta) "}),e.jsx(f,{disabled:l.buat_akun===0,id:"password_kustom",type:"password",name:"password_kustom",placeholder:"Password Kustom...",onChange:s=>r("password_kustom",s.target.value),className:"mt-1 block w-full"}),e.jsx(c,{message:i.file})]})]})}),e.jsx("div",{className:"mt-4",children:e.jsxs(j,{type:"submit",disabled:h,children:[h?e.jsx(O,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Import"]})})]})})]})})]})}export{fe as default};

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]