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-c3f592b2.js";import{b as _}from"./index.esm-1314deac.js";import{G as w}from"./GoBack-9a056fb7.js";import{G as s}from"./Grid2-9e718eb0.js";import{L as B,S as M}from"./Select-9d10c4ab.js";import{L as G}from"./ListItem-06b4e285.js";import{L as k}from"./ListItemText-f275f62e.js";import{R as z}from"./RadioGroup-e5fdfe21.js";import{F as d}from"./FormControlLabel-3f9f7a84.js";import{R as x}from"./Radio-0d4822c6.js";import{M as u}from"./MenuItem-e7a45c4b.js";import"./LoadingButton-69b28388.js";import"./isMuiElement-43203123.js";import"./Grow-f61cc5ca.js";import"./listItemTextClasses-3ff99335.js";import"./SwitchBase-38103115.js";import"./dividerClasses-03c42ea7.js";import"./listItemIconClasses-b60c7a41.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};
