import{d as b,r as p,a as v,b as y,lI as E,lJ as S,lK as L,j as e,B as i,a2 as c,T as l,lL as F,R as C,ad as R}from"./index-858224db.js";import{b as D}from"./index.esm-20949d74.js";import{G as _}from"./GoBack-918e2157.js";import{G as r}from"./Grid2-274bb638.js";import{L as w,S as B}from"./Select-8b602eed.js";import{L as G}from"./ListItem-b47a5898.js";import{L as I}from"./ListItemText-16b22a4d.js";import{R as M}from"./RadioGroup-96e49713.js";import{F as d}from"./FormControlLabel-c742681c.js";import{R as x}from"./Radio-f2b1f7cf.js";import{M as u}from"./MenuItem-bf5218a0.js";import{C as k}from"./CircularProgress-5bd54bd6.js";import"./LoadingButton-4babbc5c.js";import"./composeClasses-b42b2e69.js";import"./isMuiElement-ec705bc2.js";import"./index-e5978b8b.js";import"./Grow-b7b43b3f.js";import"./listItemTextClasses-ac0d77df.js";import"./SwitchBase-959e94f2.js";import"./dividerClasses-3bf2d765.js";import"./listItemIconClasses-5ed9cb9d.js";const oe=()=>{const s=b(),[a,h]=p.useState(0),{importExport:{exportData:n,loading:m,exportModelList:j},system:{userAccessList:z}}=v(t=>({system:y(t),importExport:E(t)}));p.useEffect(()=>{s(S()),s(L())},[]);const f=["Reaching the targets and goals set for my area.","Servicing the needs of my existing customers.","Maintaining the relationships with existing customers for repeat business.","Reporting to top managers","Keeping up to date with the products."],g=()=>{const t={model_name:n.model_name,file_format:a};s(R({objData:t}))};return e.jsx(_,{is_goback:!0,title:"Export",showSaveButton:!1,loading:!1,go_back_url:"/dashboard",children:e.jsx(i,{sx:{my:2},children:e.jsx(c,{children:e.jsx(r,{container:!0,spacing:2,children:e.jsx(r,{size:{xs:12},children:e.jsx(c,{sx:{p:2},children:e.jsx("form",{onSubmit:t=>{t.preventDefault(),g()},children:e.jsxs(r,{container:!0,spacing:2,children:[e.jsxs(r,{size:{xs:12,md:6},children:[e.jsx(l,{variant:"h6",children:"Before Exporting Your File"}),e.jsx(w,{dense:!0,children:f.map((t,o)=>e.jsx(G,{children:e.jsx(I,{primary:`${o+1}. ${t}`})},o))})]}),e.jsxs(r,{size:{xs:12,md:6},children:[e.jsxs(i,{component:"div",sx:{mb:2},children:[e.jsx(l,{variant:"subtitle2",sx:{mb:.5},children:"File Format"}),e.jsxs(M,{row:!0,value:a,onChange:t=>h(Number(t.target.value)),children:[e.jsx(d,{value:0,control:e.jsx(x,{}),label:"CSV"}),e.jsx(d,{value:2,control:e.jsx(x,{}),label:"XLSX"})]})]}),e.jsxs(i,{component:"div",sx:{mb:2},children:[e.jsx(l,{variant:"subtitle1",children:"Select File Type"}),e.jsxs(B,{fullWidth:!0,displayEmpty:!0,value:n.model_name||"",onChange:t=>s(F({key:"model_name",value:t.target.value,type:"export"})),required:!0,children:[e.jsx(u,{value:"",disabled:!0,children:"Choose file"}),j.map((t,o)=>e.jsx(u,{value:t,children:t},o))]})]}),e.jsx(C,{type:"submit",variant:"contained",color:"primary",endIcon:e.jsx(D,{}),disabled:m,sx:{mt:2},children:m?e.jsx(k,{size:24}):`Export ${a===0?".csv":".xlsx"} file`})]})]})})})})})})})})};export{oe as default};
