import{d as b,r as p,a as v,b as y,lC as E,lD as S,lE as F,j as e,B as i,a2 as c,T as l,lF as C,R as L,ad as D}from"./index-dc933734.js";import{b as R}from"./index.esm-cd80da5b.js";import{G as _}from"./GoBack-2fddf049.js";import{G as s}from"./Grid2-9337452f.js";import{L as w,S as B}from"./Select-e75c6695.js";import{L as G}from"./ListItem-90181b8d.js";import{L as M}from"./ListItemText-c1aa0343.js";import{R as k,a as d}from"./RadioGroup-443b419e.js";import{F as x}from"./FormControlLabel-476fd96c.js";import{M as u}from"./MenuItem-03911a3a.js";import{C as z}from"./CircularProgress-b8ef250f.js";import"./LoadingButton-2e968ec8.js";import"./composeClasses-b42b2e69.js";import"./isMuiElement-f75ebb7c.js";import"./index-e5978b8b.js";import"./Grow-3459ea54.js";import"./listItemTextClasses-436d31bc.js";import"./dividerClasses-75377d2f.js";const te=()=>{const r=b(),[a,h]=p.useState(0),{importExport:{exportData:n,loading:m,exportModelList:j},system:{userAccessList:I}}=v(t=>({system:y(t),importExport:E(t)}));p.useEffect(()=>{r(S()),r(F())},[]);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};r(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(s,{container:!0,spacing:2,children:e.jsx(s,{size:{xs:12},children:e.jsx(c,{sx:{p:2},children:e.jsx("form",{onSubmit:t=>{t.preventDefault(),g()},children:e.jsxs(s,{container:!0,spacing:2,children:[e.jsxs(s,{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(M,{primary:`${o+1}. ${t}`})},o))})]}),e.jsxs(s,{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(k,{row:!0,value:a,onChange:t=>h(Number(t.target.value)),children:[e.jsx(x,{value:0,control:e.jsx(d,{}),label:"CSV"}),e.jsx(x,{value:2,control:e.jsx(d,{}),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=>r(C({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{te as default};
