import{d as b,r as p,a as v,b as y,nA as E,nB as S,nC as C,j as e,B as i,a2 as c,T as n,nD as F,R as L,ah as D}from"./index-e79f7aad.js";import{b as R}from"./index.esm-05058101.js";import{G as _}from"./GoBack-fd6ecbf5.js";import{G as r}from"./Grid2-7786e458.js";import{L as B,S as w}from"./Select-8a61e5a6.js";import{L as G}from"./ListItem-b45414cf.js";import{L as M}from"./ListItemText-f54fc7e4.js";import{R as k}from"./RadioGroup-23ebb6a6.js";import{F as d}from"./FormControlLabel-bfeefc5c.js";import{R as x}from"./Radio-536258ca.js";import{M as u}from"./MenuItem-c14df0e9.js";import{C as z}from"./CircularProgress-8c35778c.js";import"./LoadingButton-2d3ef2e0.js";import"./composeClasses-b42b2e69.js";import"./isMuiElement-db2b7d4c.js";import"./index-e5978b8b.js";import"./listItemTextClasses-d3a968ad.js";import"./SwitchBase-e7cea42d.js";import"./dividerClasses-691b251c.js";import"./listItemIconClasses-03011ebf.js";const se=()=>{const s=b(),[a,h]=p.useState(0),{importExport:{exportData:l,loading:m,exportModelList:j},system:{userAccessList:A}}=v(t=>({system:y(t),importExport:E(t)}));p.useEffect(()=>{s(S()),s(C())},[]);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:l.model_name,file_format:a};s(D({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(n,{variant:"h6",children:"Before Exporting Your File"}),e.jsx(B,{dense:!0,children:f.map((t,o)=>e.jsx(G,{children:e.jsx(M,{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(n,{variant:"subtitle2",sx:{mb:.5},children:"File Format"}),e.jsxs(k,{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(n,{variant:"subtitle1",children:"Select File Type"}),e.jsxs(w,{fullWidth:!0,displayEmpty:!0,value:l.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(L,{type:"submit",variant:"contained",color:"primary",endIcon:e.jsx(R,{}),disabled:m,sx:{mt:2},children:m?e.jsx(z,{size:24}):`Export ${a===0?".csv":".xlsx"} file`})]})]})})})})})})})})};export{se as default};
