1"use strict";(globalThis.webpackChunk_coreui_coreui_free_react_admin_template=globalThis.webpackChunk_coreui_coreui_free_react_admin_template||[]).push([[6937],{9272:(e,r,s)=>{s.d(r,{K:()=>a});const a=["512 512","<path fill='var(--ci-primary-color, currentColor)' d='M29.663,482.25l.087.087a24.847,24.847,0,0,0,17.612,7.342,25.178,25.178,0,0,0,8.1-1.345l142.006-48.172,272.5-272.5A88.832,88.832,0,0,0,344.334,42.039l-272.5,272.5L23.666,456.541A24.844,24.844,0,0,0,29.663,482.25Zm337.3-417.584a56.832,56.832,0,0,1,80.371,80.373L411.5,180.873,331.127,100.5ZM99.744,331.884,308.5,123.127,388.873,203.5,180.116,412.256,58.482,453.518Z' class='ci-primary'/>"]},80043:(e,r,s)=>{s.d(r,{Z:()=>a});const a=["512 512","<path fill='var(--ci-primary-color, currentColor)' d='M96,472a23.82,23.82,0,0,0,23.579,24H392.421A23.82,23.82,0,0,0,416,472V152H96Zm32-288H384V464H128Z' class='ci-primary'/><rect width='32' height='200' x='168' y='216' fill='var(--ci-primary-color, currentColor)' class='ci-primary'/><rect width='32' height='200' x='240' y='216' fill='var(--ci-primary-color, currentColor)' class='ci-primary'/><rect width='32' height='200' x='312' y='216' fill='var(--ci-primary-color, currentColor)' class='ci-primary'/><path fill='var(--ci-primary-color, currentColor)' d='M328,88V40c0-13.458-9.488-24-21.6-24H205.6C193.488,16,184,26.542,184,40V88H64v32H448V88ZM216,48h80V88H216Z' class='ci-primary'/>"]},96937:(e,r,s)=>{s.r(r),s.d(r,{default:()=>p});var a=s(71309),l=s(80214),c=s(18687),i=s(66351),t=s(86869),o=s(9272),n=s(80043),d=s(88944),h=s(40802),m=s(7398);const p=()=>{const[e,r]=(0,l.useState)({users:[],projects:[],formData:{project:""},file:null,loading:!1,error:"",success:""}),s=(0,l.useRef)(null);(0,l.useEffect)(()=>{u(),j()},[]);const p=e=>r(r=>({...r,...e})),u=async()=>{try{var r;const{data:s}=await c.A.get(`${a.A}/projects`);p({projects:s,formData:{...e.formData,project:e.formData.project||(null===(r=s[0])||void 0===r?void 0:r.name)||""}})}catch{p({error:"Error fetching projects"})}},j=async()=>{try{const{data:e}=await c.A.get(`${a.A}/user-slider-share`);p({users:e||[]})}catch{p({error:"Failed to fetch users."})}};return(0,m.jsx)(i.sK,{children:(0,m.jsxs)(i.UF,{xs:12,children:[(0,m.jsxs)(i.sK,{className:"mb-3",children:[(0,m.jsxs)(i.UF,{xs:6,children:[(0,m.jsx)("h1",{className:"module-main-heading",children:"User Slider Share"}),(0,m.jsx)(h.N_,{to:"/admin/user-slider-share/add",className:"mm-btn",children:"Add User"})]}),(0,m.jsxs)(i.UF,{xs:6,className:"text-end",children:[(0,m.jsx)("h1",{className:"module-main-heading",children:"Upload Users"}),(0,m.jsxs)(i.sK,{children:[(0,m.jsxs)(i.UF,{xs:10,children:[(0,m.jsx)(i.OG,{type:"file",accept:".xlsx,.csv",ref:s,onChange:e=>p({file:e.target.files[0]}),className:"mb-2"}),(0,m.jsxs)(i.MT,{name:"project",className:"keyBtn",value:e.formData.project,onChange:r=>p({formData:{...e.formData,project:r.target.value}}),children:[(0,m.jsx)("option",{value:"",children:"Select Project"}),e.projects.map(e=>(0,m.jsx)("option",{value:e.name,children:e.name},e.id))]})]}),(0,m.jsx)(i.UF,{xs:2,children:(0,m.jsx)(i.Q_,{color:"primary",onClick:async()=>{if(!e.file)return p({error:"Please select a file first."});if(!e.formData.project)return p({error:"Please select a project."});p({loading:!0,error:"",success:""});try{const r=new FormData;r.append("file",e.file),r.append("project",e.formData.project);const l=await c.A.post(`${a.A}/user-slider-share/import`,r,{headers:{"Content-Type":"multipart/form-data"}});p({success:`Inserted: ${l.data.inserted}, Skipped: ${l.data.skipped}`,file:null,formData:{project:""}}),s.current&&(s.current.value=""),j()}catch(i){var r,l;p({error:(null===(r=i.response)||void 0===r||null===(l=r.data)||void 0===l?void 0:l.msg)||"Upload failed. Please try again."})}finally{p({loading:!1})}},disabled:e.loading,children:e.loading?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.JT,{size:"sm",className:"me-2"})," Uploading..."]}):"Upload"})})]})]})]}),e.error&&(0,m.jsx)(i.kj,{color:"danger",children:e.error}),e.success&&(0,m.jsx)(i.kj,{color:"success",children:e.success}),(0,m.jsx)(i.E$,{className:"mb-4",children:(0,m.jsx)(i.W6,{children:(0,m.jsxs)(d.A,{singleLine:!0,className:"Table-spacing",children:[(0,m.jsx)(d.A.Header,{children:(0,m.jsxs)(d.A.Row,{children:[(0,m.jsx)(d.A.HeaderCell,{children:"Email"}),(0,m.jsx)(d.A.HeaderCell,{children:"Project"}),(0,m.jsx)(d.A.HeaderCell,{children:"Action"})]})}),(0,m.jsx)(d.A.Body,{children:e.users.map(e=>(0,m.jsxs)(d.A.Row,{children:[(0,m.jsx)(d.A.Cell,{children:e.email}),(0,m.jsx)(d.A.Cell,{children:e.project}),(0,m.jsxs)(d.A.Cell,{children:[(0,m.jsx)(t.Ay,{icon:n.Z,customClassName:"nav-icon me-2",height:25,onClick:()=>(async e=>{if(window.confirm("Are you sure you want to delete?"))try{await c.A.delete(`${a.A}/user-slider-share/delete/${e}`),j()}catch{p({error:"Failed to delete user."})}})(e.id)}),(0,m.jsx)(h.N_,{to:`/admin/user-slider-share/edit?id=${e.id}`,children:(0,m.jsx)(t.Ay,{icon:o.K,customClassName:"nav-icon",height:25})})]})]},e.id))})]})})})]})})}}}]); 2//# sourceMappingURL=6937.5ad3b43b.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.