import{d as b,r as p,a as v,b as y,lk as E,ll as S,lm as F,j as e,B as i,R as c,T as l,ln as L,z as C,a2 as D}from"./index-c5c88b67.js";import{b as R}from"./index.esm-0ad88c35.js";import{G as _}from"./GoBack-18f006a8.js";import{G as s}from"./Grid2-0ff60c92.js";import{L as w}from"./Menu-e7d2b2ee.js";import{L as B}from"./ListItem-7122806e.js";import{L as k}from"./ListItemText-86a40098.js";import{R as z,a as d}from"./RadioGroup-1ba0c7fd.js";import{F as x}from"./FormControlLabel-d6955dc8.js";import{S as G}from"./Select-4ed8db5d.js";import{M as u}from"./MenuItem-81e44793.js";import{C as M}from"./CircularProgress-13afa056.js";import"./LoadingButton-3a5d0643.js";import"./composeClasses-b42b2e69.js";import"./isMuiElement-b3c21f38.js";import"./Grow-7345f8ea.js";import"./index-e5978b8b.js";import"./listItemTextClasses-88792089.js";import"./dividerClasses-6bc0ca72.js";const se=()=>{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(B,{children:e.jsx(k,{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(z,{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(G,{fullWidth:!0,displayEmpty:!0,value:n.model_name||"",onChange:t=>r(L({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(R,{}),disabled:m,sx:{mt:2},children:m?e.jsx(M,{size:24}):`Export ${a===0?".csv":".xlsx"} file`})]})]})})})})})})})})};export{se as default};
