import{d as b,r as p,a as v,b as y,nL as E,nM as S,nN as L,j as e,B as i,a3 as c,T as n,nO as F,U as C,cH as D,ai as R}from"./index-60657852.js";import{b as _}from"./index.esm-5fae0aa9.js";import{G as w}from"./GoBack-bb4a2941.js";import{G as s}from"./Grid2-09163d35.js";import{L as B,S as M}from"./Select-7d2a5359.js";import{L as G}from"./ListItem-d3e4c009.js";import{L as k}from"./ListItemText-fdaa9509.js";import{R as z}from"./RadioGroup-1ebb1249.js";import{F as d}from"./FormControlLabel-95d4d7bb.js";import{R as x}from"./Radio-8a9e9740.js";import{M as u}from"./MenuItem-64348b57.js";import"./LoadingButton-c619bdb5.js";import"./isMuiElement-82a67859.js";import"./Grow-a21bdd26.js";import"./listItemTextClasses-81f8effc.js";import"./SwitchBase-3b306fc6.js";import"./dividerClasses-590294d7.js";import"./listItemIconClasses-39f47a05.js";const te=()=>{const r=b(),[a,h]=p.useState(0),{importExport:{exportData:l,loading:m,exportModelList:j},system:{userAccessList:I}}=v(t=>({system:y(t),importExport:E(t)}));p.useEffect(()=>{r(S()),r(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:l.model_name,file_format:a};r(R({objData:t}))};return e.jsx(w,{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(n,{variant:"h6",children:"Before Exporting Your File"}),e.jsx(B,{dense:!0,children:f.map((t,o)=>e.jsx(G,{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(n,{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(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(M,{fullWidth:!0,displayEmpty:!0,value:l.model_name||"",onChange:t=>r(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(_,{}),disabled:m,sx:{mt:2},children:m?e.jsx(D,{size:24}):`Export ${a===0?".csv":".xlsx"} file`})]})]})})})})})})})})};export{te as default};
