(\n \n \n \n )}\n />\n );\n};\n\nRouteWithLayout.propTypes = {\n component: PropTypes.any.isRequired,\n layout: PropTypes.any.isRequired,\n path: PropTypes.string\n};\n\nexport default RouteWithLayout;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport { Typography, Link, colors } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background:colors.blueGrey[100],\n position: 'absolute',\n marginBottom: 0,\n marginTop:'15px',\n width: '100%',\n height: '200px' \n }\n}));\n\nconst Footer = props => {\n const { className } = props;\n\n const classes = useStyles();\n\n return (\n \n \n ©{' '}\n \n Larexir Decor\n \n .2019-2025\n \n \n Created and maintained by SoftDivision Company\n \n
\n );\n};\n\nFooter.propTypes = {\n className: PropTypes.string\n};\n\nexport default Footer;\n","import React from 'react';\nimport {connect} from 'react-redux';\nimport { Link as RouterLink } from 'react-router-dom';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { Typography, } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n minHeight: 'fit-content',\n \n },\n avatar: {\n width: 180,\n height: 180\n },\n name: {\n marginTop: theme.spacing(1)\n }\n}));\n\nconst Profile = props => {\n const { className,currentUser } = props;\n\n const classes = useStyles();\n\n const user = {\n name: '',\n avatar: '/images/logos/logoMediu.png',\n bio: ''\n };\n\n return (\n \n
\n
\n {currentUser?currentUser.idFirma.denumire:''}\n \n \n
\n );\n};\n\nProfile.propTypes = {\n className: PropTypes.string\n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser,\n \n})\n\nexport default connect(mapStateToProps)(Profile);\n","/* eslint-disable react/no-multi-comp */\n/* eslint-disable react/display-name */\nimport React, { forwardRef } from 'react';\nimport { NavLink as RouterLink } from 'react-router-dom';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { List, ListItem, Button, colors } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n root: {},\n item: {\n display: 'flex',\n paddingTop: 0,\n paddingBottom: 0\n },\n button: {\n color: colors.grey[200],\n padding: '10px 8px',\n justifyContent: 'flex-start',\n textTransform: 'none',\n letterSpacing: 0,\n width: '100%',\n fontWeight: theme.typography.fontWeightMedium\n },\n icon: {\n color:colors.grey[200],\n width: 24,\n height: 24,\n display: 'flex',\n alignItems: 'center',\n marginRight: theme.spacing(1)\n },\n active: {\n color: 'white',\n fontWeight: theme.typography.fontWeightMedium,\n '& $icon': {\n color: colors.red[900]\n }\n }\n}));\n\nconst CustomRouterLink = forwardRef((props, ref) => (\n \n \n
\n));\n\nconst SidebarNav = props => {\n const { pages, className } = props;\n \n const classes = useStyles();\n\n return (\n \n {pages.map(page => (\n \n \n {page.icon}
\n {page.title}\n \n \n \n ))}\n
\n );\n};\n\nSidebarNav.propTypes = {\n className: PropTypes.string,\n pages: PropTypes.array.isRequired\n};\n\n\nexport default SidebarNav;\n","import React from 'react';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { Typography, Button, colors } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n backgroundColor: colors.grey[50]\n },\n media: {\n paddingTop: theme.spacing(2),\n height: 80,\n textAlign: 'center',\n '& > img': {\n height: '100%',\n width: 'auto'\n }\n },\n content: {\n padding: theme.spacing(1, 2)\n },\n actions: {\n padding: theme.spacing(1, 2),\n display: 'flex',\n justifyContent: 'center'\n }\n}));\n\nconst UpgradePlan = props => {\n const { className } = props;\n\n const classes = useStyles();\n\n return (\n \n
\n
\n
\n
\n \n Upgrade to PRO\n \n \n Upgrade to Devias Kit PRO and get even more components\n \n
\n
\n \n Upgrade\n \n
\n
\n );\n};\n\nUpgradePlan.propTypes = {\n className: PropTypes.string\n};\n\nexport default UpgradePlan;\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { Divider, Drawer, colors } from '@material-ui/core';\nimport DashboardIcon from '@material-ui/icons/Dashboard';\nimport ShoppingBasketIcon from '@material-ui/icons/ShoppingBasket';\nimport AccountBoxIcon from '@material-ui/icons/AccountBox';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport LockOpenIcon from '@material-ui/icons/LockOpen';\nimport EmailIcon from '@material-ui/icons/Email';\nimport ExitToAppIcon from '@material-ui/icons/ExitToApp';\nimport Iframe from 'react-iframe'\n\nimport { Profile,SidebarNav } from './components';\n\nconst useStyles = makeStyles(theme => ({\n drawer: {\n width: 240,\n [theme.breakpoints.up('lg')]: {\n marginTop: 64,\n height: 'calc(100% - 64px)'\n }\n },\n root: {\n backgroundColor: colors.blueGrey[500],\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n padding: theme.spacing(2),\n paddingTop:0\n \n },\n divider: {\n margin: theme.spacing(2, 0)\n },\n nav: {\n marginBottom: theme.spacing(2),\n }\n}));\n\nconst Sidebar = props => {\n const { open, variant, onClose, className,currentUser, handleClick } = props;\n\n const classes = useStyles();\n\n const pagesConectat = [\n {\n title: 'Home',\n href: '/dashboard',\n icon: \n },\n {\n title: 'Produse',\n href: '/products',\n icon: \n },\n {\n title: 'Contul meu',\n href: '/account',\n icon: \n },\n {\n title: 'Contact',\n href: '/contact',\n icon: \n },\n {\n title: 'Setari',\n href: '/settings',\n icon: \n },\n {\n title: 'Deconectare',\n href: '/sign-out',\n icon: \n }\n ];\n\n const pagesDeconectat = [\n {\n title: 'Home',\n href: '/dashboard',\n icon: \n },\n \n {\n title: 'Autentificare',\n href: '/sign-in',\n icon: \n },\n ];\n\n return (\n \n \n
\n
\n
\n \n
\n
CURS BNR \n \n
\n \n
\n \n );\n};\n\nSidebar.propTypes = {\n className: PropTypes.string,\n onClose: PropTypes.func,\n open: PropTypes.bool.isRequired,\n variant: PropTypes.string.isRequired\n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser\n})\nexport default connect(mapStateToProps)(Sidebar);\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport { Link as RouterLink } from 'react-router-dom';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { AppBar, Toolbar, Badge, Hidden, IconButton, colors } from '@material-ui/core';\nimport MenuIcon from '@material-ui/icons/Menu';\nimport NotificationsIcon from '@material-ui/icons/NotificationsOutlined';\n// import InputIcon from '@material-ui/icons/Input';\n\n\nconst useStyles = makeStyles(theme => ({\n root: {\n boxShadow: 'none',\n background:colors.blueGrey[500]\n },\n flexGrow: {\n flexGrow: 1\n },\n signOutButton: {\n marginLeft: theme.spacing(1) \n },\n title:{\n marginLeft: theme.spacing(1)\n }, \n}));\n\nconst Topbar = props => {\n const { className, onSidebarOpen } = props;\n \n const classes = useStyles();\n\n const [notifications] = useState([]);\n\n return (\n \n \n \n \n \n
La rexir W ebSto re \n \n \n \n \n \n \n \n \n {/*\n \n \n */}\n \n \n \n \n \n \n \n \n );\n};\n\nTopbar.propTypes = {\n className: PropTypes.string,\n onSidebarOpen: PropTypes.func\n};\n\n\nexport default Topbar;\n","import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles, useTheme } from '@material-ui/styles';\nimport { useMediaQuery } from '@material-ui/core';\n\nimport { Sidebar, Topbar, Footer } from './components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n paddingTop: 56,\n height: '100%',\n [theme.breakpoints.up('sm')]: {\n paddingTop: 64,\n }\n },\n shiftContent: {\n paddingLeft: 240\n },\n content: {\n height: '100%',\n paddingBottom: '5rem',\n overflow:'auto'\n },\n footer: {\n position: 'absolute',\n paddingBottom: '1rem',\n bottom: 0,\n width: '100%',\n height: '5rem' /* Footer height */\n }\n\n}));\n\nconst Main = props => {\n const { children } = props;\n\n const classes = useStyles();\n const theme = useTheme();\n const isDesktop = useMediaQuery(theme.breakpoints.up('lg'), {\n defaultMatches: true\n });\n\n const [openSidebar, setOpenSidebar] = useState(false);\n\n const handleSidebarOpen = () => {\n setOpenSidebar(true);\n };\n\n const handleSidebarClose = () => {\n setOpenSidebar(false);\n };\n const handleClick=()=>{\n setOpenSidebar(false);\n }\n\n const shouldOpenSidebar = isDesktop ? true : openSidebar;\n\n return (\n \n \n \n \n {children}\n\n \n \n \n
\n );\n};\n\nMain.propTypes = {\n children: PropTypes.node\n};\n\nexport default Main;\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Link as RouterLink } from 'react-router-dom';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport { AppBar, Toolbar, colors } from '@material-ui/core';\n\nconst useStyles = makeStyles(() => ({\n root: {\n boxShadow: 'none',\n background:colors.blueGrey[500]\n },\n flexGrow: {\n flexGrow: 1\n },\n title:{\n color:'white'\n }\n \n}));\n\nconst Topbar = props => {\n const { className} = props;\n \n const classes = useStyles();\n\n return (\n \n \n \n \n
La rexir W ebSto re \n \n \n \n \n \n );\n};\n\nTopbar.propTypes = {\n className: PropTypes.string\n};\n\nexport default Topbar;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\n\nimport { Topbar } from './components';\n\nconst useStyles = makeStyles(() => ({\n root: {\n paddingTop: 64,\n height: '100%'\n },\n content: {\n height: '100%'\n }\n}));\n\nconst Minimal = props => {\n const { children } = props;\n\n const classes = useStyles();\n\n return (\n \n \n {children} \n
\n );\n};\n\nMinimal.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string\n};\n\nexport default Minimal;\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport {connect} from 'react-redux';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n colors \n} from '@material-ui/core';\nimport './accountdetails.css';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport {setCurrentUserSuccess} from '../../../../redux/user/user.actions';\nimport {setUser} from '../../../../strapi/strapi.utils';\n\nconst useStyles = makeStyles(() => ({\n root: {color:'white'},\n card:{\n marginTop:20\n },\n alignButton:{\n display:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n width:'35%',\n background:colors.blueGrey[500],\n },\n header:{\n background:colors.blueGrey[700],\n }\n}));\n\nconst AccountDetails = props => {\n const { className,currentUser,setCurrentUserSuccess, enqueueSnackbar} = props;\n const classes = useStyles();\n const [data, setdata] = useState({\n denumire: currentUser.idFirma.denumire,\n codFiscal: currentUser.idFirma.codFiscal,\n atributFiscal: currentUser.idFirma.atributFiscal,\n regCom: currentUser.idFirma.regCom,\n oras: currentUser.idFirma.oras,\n adresa: currentUser.idFirma.adresa,\n judet:currentUser.idFirma.judet,\n telefon:currentUser.idFirma.telefon,\n email:currentUser.idFirma.email,\n cont:currentUser.idFirma.cont,\n banca:currentUser.idFirma.banca,\n persoanaContact: currentUser.idFirma.persoanaContact,\n discountJV: currentUser.idFirma.discountJV,\n discountRO: currentUser.idFirma.discountRO,\n discountRE: currentUser.idFirma.discountRE,\n discountUG: currentUser.idFirma.discountUG,\n discountPI: currentUser.idFirma.discountPI,\n discountJO: currentUser.idFirma.discountJO,\n discountCO: currentUser.idFirma.discountCO,\n atentionare: currentUser.idFirma.atentionare,\n adaosJV: currentUser.idFirma.adaosJV,\n adaosRO: currentUser.idFirma.adaosRO,\n adaosRE: currentUser.idFirma.adaosRE,\n adaosUG: currentUser.idFirma.adaosUG,\n adaosPI: currentUser.idFirma.adaosPI,\n adaosJO: currentUser.idFirma.adaosJO,\n adaosCO: currentUser.idFirma.adaosCO,\n });\n //-------------------------------------------------------\n const handleChange = event => {\n setdata({\n ...data,\n [event.target.name]: event.target.value\n });\n };\n\n //-------------------------------------------------------\n const handleChangeAdaos = event => {\n setdata({\n ...data,\n [event.target.name]: event.target.value===''? 0 : event.target.value\n });\n // console.log (data.adaosJO)\n };\n //-------------------------------------------------------\n const handleSubmit = async e => {\n e.preventDefault()\n await strapi.updateEntry('firmas', currentUser.idFirma.id,data)\n .catch(e=>{\n enqueueSnackbar(`Eroare : nu am putut salva modificarile.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n })\n .then((res)=>{\n // console.log({...currentUser, idFirma:res,comandas:[]})\n setUser({...currentUser, idFirma:res,comandas:[]})\n setCurrentUserSuccess({...currentUser, idFirma:res,comandas:[]})\n enqueueSnackbar('Modificari salvate cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n })\n }; \n //-------------------------------------------------------\n \n return (\n \n
\n \n \n\n
\n \n \n\n\n\n
\n \n \n\n\n\n\n
\n );\n};\n\nAccountDetails.propTypes = {\n className: PropTypes.string,\n currentUser:PropTypes.object,\n enqueueSnackbar:PropTypes.func,\n setCurrentUserSuccess:PropTypes.func\n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser,\n})\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentUserSuccess:user=>dispatch(setCurrentUserSuccess(user)),\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withSnackbar(AccountDetails));\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport clsx from 'clsx';\nimport PerfectScrollbar from 'react-perfect-scrollbar';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n Button,\n Divider,\n Table,\n TableBody,\n TableCell,\n TableRow,\n colors\n} from '@material-ui/core';\nimport 'react-confirm-alert/src/react-confirm-alert.css';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport {setDeliveryAddressesStart} from '../../../../redux/user/user.actions';\n\n\nconst useStyles = makeStyles(() => ({\n root: {\n padding:'12px'\n },\n content: {\n padding: 0\n },\n inner: {\n width:'auto'\n },\n header:{\n background:colors.blueGrey[700],\n },\n buttonEditare:{\n color:colors.blueGrey[700],\n },\n buttonStergere:{\n color:colors.red[500],\n }\n\n}));\n\n\nconst AccountListaAdrese = props => {\n const { className,deliveryAddresses,setDeliveryAddressesStart,handleEdit, currentUser, enqueueSnackbar } = props;\n const classes = useStyles();\n //--------------------------------------------------------------------\n const handleDelete=async(id)=>{\n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sunteti sigur ca doriti stergerea acestei adrese de livrare din lista?',\n buttons: [\n {\n label: 'Da',\n onClick: async () => {\n await strapi.deleteEntry('adresaLivrares',id)\n .catch(e=>{\n enqueueSnackbar(`Eroare : nu am putut sterge adresa de livrare.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n })\n .then(()=>{\n enqueueSnackbar('Adresa de livrare a fost stearsa cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n })\n .then(()=>setDeliveryAddressesStart(currentUser.idFirma.id))\n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n }); \n }\n //--------------------------------------------------------------------\n return (\n \n \n \n \n \n \n
\n \n {deliveryAddresses.map(adresa => (\n \n {adresa.adresa} \n \n {handleEdit(adresa.id)}}>Editare \n {handleDelete(adresa.id)}}>Sterge \n \n \n ))}\n \n
\n
\n \n \n \n \n );\n};\n\nAccountListaAdrese.propTypes = {\n className: PropTypes.string,\n currentUser:PropTypes.object,\n deliveryAddresses:PropTypes.array,\n enqueueSnackbar:PropTypes.func,\n handleEdit:PropTypes.func,\n setDeliveryAddressesStart:PropTypes.func\n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser,\n deliveryAddresses:state.user.deliveryAddresses\n})\n\nconst mapDispatchToProps=dispatch=>({\n setDeliveryAddressesStart:idFirma=>dispatch(setDeliveryAddressesStart(idFirma))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withSnackbar(AccountListaAdrese));\n","/* eslint-disable linebreak-style */\nimport {createSelector} from 'reselect';\n\nconst selectUser=state=>state.user;\n\nexport const selectCurrentUser= createSelector(\n [selectUser],\n user=>user.currentUser\n);\n\nexport const selectDeliveryAddresses= createSelector(\n [selectUser],\n user=>user.deliveryAddresses\n);","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport {connect} from 'react-redux';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n colors\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport AccountListaAdrese from '../AccountListaAdrese/AccountListaAdrese'\nimport { setDeliveryAddressesStart} from '../../../../redux/user/user.actions';\nimport {selectCurrentUser, selectDeliveryAddresses} from '../../../../redux/user/user.selectors';\n\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton:{\n desplay:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n background:colors.blueGrey[500],\n },\n header:{\n background:colors.blueGrey[700],\n color:'white'\n },\n buttonSalvare:{\n \n color:'black'\n },\n buttonAbandon:{\n \n color:'red'\n }\n}));\n\nconst AccountAdrese = props => {\n const { className,currentUser,deliveryAddresses,setDeliveryAddressesStart, enqueueSnackbar} = props;\n const classes = useStyles();\n const [open, setOpen] = React.useState(false);\n const [add, setAdd] = React.useState(true);\n const [data, setdata] = useState({\n id:null,\n numeLocatie: '',\n oras: '',\n adresa: '',\n judet: '',\n codPostal: '',\n telefon: '',\n observatii: '',\n idFirma: currentUser.idFirma.id\n });\n //-------------------------------------------------------\n const handleClose = () => {\n setOpen(false);\n };\n //-------------------------------------------------------\n const handleChange = event => {\n setdata({\n ...data,\n [event.target.name]: event.target.value\n });\n };\n //-------------------------------------------------------\n const handleAdd = ()=>{\n setdata({\n id:'',\n numeLocatie: '',\n oras: '',\n adresa: '',\n judet: '',\n codPostal: '',\n telefon: '',\n observatii: '',\n idFirma: currentUser.idFirma.id\n });\n setOpen(true);\n setAdd(true)\n }\n //-------------------------------------------------------\n\n const handleEdit = (id)=>{\n setdata(deliveryAddresses.filter(a=>(a.id===id))[0].item)\n setOpen(true);\n setAdd(false)\n }\n //-------------------------------------------------------\n\n const handleSubmit = async e => {\n e.preventDefault()\n // eslint-disable-next-line no-unused-vars\n const {id,idFirma,created_at,updated_at, ...rest}=data\n if (!add){\n await strapi.updateEntry('adresaLivrares', data.id, rest)\n .catch(e=>{\n enqueueSnackbar(`Eroare : nu am putut salva modificarile.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n })\n .then(()=>{\n enqueueSnackbar('Modificarile la adresa de livrare au fost salvate cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n })\n .then(()=>setDeliveryAddressesStart(currentUser.idFirma.id))\n }else{\n await strapi.createEntry('adresaLivrares',{idFirma:currentUser.idFirma.id,...rest})\n .catch(e=>{\n enqueueSnackbar(`Eroare : nu am putut salva adresa de livrare.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n })\n .then(()=>\n enqueueSnackbar('Adresa de livrare a fost salvata cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n )\n .then(()=>setDeliveryAddressesStart(currentUser.idFirma.id))\n }\n setOpen(false);\n }; \n\n //-------------------------------------------------------\n return (\n \n \n \n \n \n \n \n \n Adauga adresa livrare\n \n \n \n );\n};\n\nAccountAdrese.propTypes = {\n className: PropTypes.string,\n currentUser:PropTypes.object,\n deliveryAddresses:PropTypes.array,\n enqueueSnackbar:PropTypes.func,\n setDeliveryAddressesStart:PropTypes.func\n};\n\nconst mapStateToProps=state=>({\n currentUser:selectCurrentUser(state),\n deliveryAddresses:selectDeliveryAddresses(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setDeliveryAddressesStart:idFirma=>dispatch(setDeliveryAddressesStart(idFirma))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withSnackbar(AccountAdrese));\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport { makeStyles } from '@material-ui/styles';\nimport { Grid } from '@material-ui/core';\nimport { AccountDetails } from './components';\nimport { AccountAdrese } from './components';\nimport {selectCurrentUser } from '../../redux/user/user.selectors';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background:'#CFD8DC', \n height:'100%',\n overflow: 'auto'\n }\n}));\n\nconst Account = (props) => {\n const classes = useStyles();\n const {currentUser}=props;\n\n const vanzatorVizibilitate=()=>{\n if(currentUser.role.name==='Vanzator'){\n return true;\n }else{\n return false;\n }\n }\n\n return (\n vanzatorVizibilitate()?\n Nu aveti drepturi de acces pentru modulul: Contul meu! \n\n :\n
\n \n \n \n \n \n \n \n
\n );\n};\n\nconst mapStateToProps=state=>({\n currentUser:selectCurrentUser(state),\n})\nexport default connect(mapStateToProps)(Account)\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Button,\n TextField,\n colors\n} from '@material-ui/core';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport { withSnackbar } from 'notistack';\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton:{\n desplay:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n width:'35%',\n background:colors.blueGrey[500],\n color:'white'\n },\n header:{\n background:colors.blueGrey[700],\n }\n}));\n\nconst Password = props => {\n const { className, enqueueSnackbar, codResetare } = props;\n const classes = useStyles();\n const [values, setValues] = useState({\n password: '',\n confirm: '',\n cod:codResetare\n });\n //--------------------------------------------------------------------------\n const handleChange = event => {\n setValues({\n ...values,\n [event.target.name]: event.target.value\n });\n };\n //--------------------------------------------------------------------------\n const handleSubmit = async e => {\n e.preventDefault()\n if (values.password===values.confirm){\n try{\n\n await strapi.resetPassword(values.cod, values.password, values.confirm)\n .then(()=>{\n enqueueSnackbar('Parola noua a fost setata cu succes.',{ \n variant: 'success',\n autoHideDuration:3000\n })\n setValues({\n password: '',\n confirm: '',\n cod:values.cod\n })\n })\n }catch(e){\n console.log(e)\n enqueueSnackbar(`Eroare : cod resetare invalid/expirat sau lipsa conexiune.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n }\n \n } else{\n enqueueSnackbar('Rubrica Parola nu este egal cu rubrica Confirmare parola!',{ \n variant: 'error',\n })\n }\n };\n //--------------------------------------------------------------------------\n return (\n \n \n \n );\n};\n\nPassword.propTypes = {\n className: PropTypes.string,\n enqueueSnackbar:PropTypes.func\n};\n\nexport default withSnackbar(Password);\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { useLocation } from \"react-router-dom\"\nimport { makeStyles } from '@material-ui/styles';\nimport Loader from 'react-loader-spinner'\nimport { connect } from 'react-redux';\nimport {\n colors,\n Card,\n CardHeader,\n CardContent,\n Divider,\n TextField,\n InputBase,\n Grid\n} from '@material-ui/core';\n\nimport { Password } from './components';\n\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background: colors.blueGrey[100],\n height: '100%',\n textAlign: 'center',\n overflow: 'auto'\n },\n spinner: {\n textAlign: 'center',\n padding: '200px'\n },\n gol: {\n height: '100%',\n }\n ,\n img: {\n maxWidth: '300px',\n maxHeight: '200px',\n padding: '20px'\n\n }\n}));\n\nconst Dashboard = (props) => {\n const { loading } = props\n const classes = useStyles();\n\n const location = useLocation()\n const queryParameters = new URLSearchParams(location.search)\n\n const codResetare = () => {\n console.log(queryParameters.get(\"code\"))\n if (queryParameters.get(\"code\") !== \"\" && queryParameters.get(\"code\") !== null) {\n return true;\n } else {\n\n return false;\n }\n }\n\n\n if (loading === true) {\n return (\n \n \n
\n )\n } else {\n\n return (\n \n { //
Larexir WebStore \n //
aplicatie comenzi retaileri \n }\n
\n
\n \n \n \n {props.informari ?\n props.informari.map((mesaj) => (\n \n \n {mesaj.Mesaj2 ? : null}\n {mesaj.Mesaj3 ? : null}\n {mesaj.Mesaj4 ? : null}\n {mesaj.Mesaj5 ?\n : null}\n
\n ))\n : null\n }\n {props.firma && props.firma[0] ?\n null\n :\n \n }\n\n\n \n \n\n {props.firma &&
\n \n \n \n {props.firma ?\n \n : null}\n \n\n \n {codResetare() ?\n \n
WebStore Larexir- resetare parola! \n
\n \n \n \n \n
\n :\n null}\n\n }\n\n {\n //
\n //
\n //
\n }\n\n
\n\n
\n );\n }\n\n};\n\nconst mapStateToProps = state => ({\n loading: state.order.currentProduct,\n errors: state.user.currentUser,\n warnings: state.order.currentOrder,\n currentUser: state.user.currentUser,\n firma: state.lookup.firma,\n informari: state.lookup.informari\n})\n\nexport default connect(mapStateToProps)(Dashboard);\n","import React from 'react';\nimport { makeStyles } from '@material-ui/styles';\nimport { Grid, Typography } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4)\n },\n content: {\n paddingTop: 150,\n textAlign: 'center'\n },\n image: {\n marginTop: 50,\n display: 'inline-block',\n maxWidth: '100%',\n width: 560\n }\n}));\n\nconst NotFound = () => {\n const classes = useStyles();\n\n return (\n \n
\n \n \n
\n 404: Pagina pe care incercati sa o accesati nu exista.\n \n
\n Oricare ar fi motivul, pentru a va intoarce in pagina principala a aplicatei, apasati iconita de logo din stanga sus.\n \n
\n
\n \n \n
\n );\n};\n\nexport default NotFound;\n","/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {setCurrentProduct} from '../../../../redux/order/order.actions'\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardContent,\n // CardActions,\n Typography,\n // Grid,\n Divider,\n colors\n} from '@material-ui/core';\n// import Link from '@material-ui/core/Link';\nimport Button from '@material-ui/core/Button';\nimport { setOrdersStart, setCurrentOrder, setCurrentItem, setUpdatedOrder} from '../../../../redux/order/order.actions';\nimport { setLoading, setErrors } from '../../../../redux/other/other.actions';\nimport { withSnackbar } from 'notistack';\nimport Loader from 'react-loader-spinner'\n\nconst useStyles = makeStyles(theme => ({\n root: {\n background:'#F0F5F4',\n },\n imageContainer: {\n height: 250,\n width: 200,\n margin: '0 auto',\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: '5px',\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n },\n image: {\n width: '100%',\n },\n icons:{\n with:30,\n height:30\n },\n statsItem: {\n display: 'flex',\n alignItems: 'center'\n },\n statsIcon: {\n color: theme.palette.icon,\n marginRight: theme.spacing(1),\n \n },\n button: {\n margin: theme.spacing(1),\n width: '150',\n height:'150',\n background:colors.blueGrey[400]\n },\n titlu:{\n color:colors.blueGrey[600]\n },\n input: {\n display: 'none',\n }\n}));\n\nconst ProductCard = props => {\n const { className, product, history, setCurrentProduct, setOrdersStart, currentUser} = props;\n const classes = useStyles();\n //--------------------------------------------------------------------------------------------\n const incarcaComenzi=()=>{\n setOrdersStart({idFirma:currentUser.idFirma.id,tipProdus:product.cod,subTip:product.subTip})\n }\n //--------------------------------------------------------------------------------------------\n const produsSelectat=()=>{\n return new Promise((resolve) => {\n setTimeout(async() => {\n setCurrentProduct(product)\n resolve('ok')\n },20) \n })\n }\n //--------------------------------------------------------------------------------------------\n const handleButComanda=async ()=>{\n document.body.style.cursor = 'wait';\n await produsSelectat().then(()=>incarcaComenzi()) ;\n document.body.style.cursor = 'pointer';\n history.push('/orders');\n }\n //--------------------------------------------------------------------------------------------\n if (props.loading===false){\n return (\n \n \n \n
\n \n \n
\n \n {product.title}\n \n \n {product.description}\n \n \n \n {/*\n \n \n \n \n \n \n \n Instructiuni montaj\n \n \n \n \n \n \n \n \n \n \n \n Comenzi {product.cod.toUpperCase()} \n \n \n \n \n */}\n \n );\n }else{\n return (\n \n \n
\n );\n }\n};\n\nProductCard.propTypes = {\n className: PropTypes.string,\n product: PropTypes.object.isRequired\n};\n\nconst mapStateToProps=state=>({\n currentProduct:state.order.currentProduct,\n currentUser:state.user.currentUser,\n loading:state.other.loading\n})\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentProduct:product=>dispatch(setCurrentProduct(product)),\n setOrdersStart:(idFirmaAndTipProdus)=>dispatch(setOrdersStart(idFirmaAndTipProdus)),\n setCurrentOrder:order=>dispatch(setCurrentOrder(order)),\n setLoading:boll=>dispatch(setLoading(boll)),\n setErrors:error=>dispatch(setErrors(error)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setUpdatedOrder:order=>dispatch(setUpdatedOrder(order))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(ProductCard)));\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport { Button } from '@material-ui/core';\n\nimport { SearchInput } from 'components';\n\nconst useStyles = makeStyles(theme => ({\n root: {},\n row: {\n height: '42px',\n display: 'flex',\n alignItems: 'center',\n marginTop: theme.spacing(1)\n },\n spacer: {\n flexGrow: 1\n },\n importButton: {\n marginRight: theme.spacing(1)\n },\n exportButton: {\n marginRight: theme.spacing(1)\n },\n searchInput: {\n marginRight: theme.spacing(1)\n }\n}));\n\nconst ProductsToolbar = props => {\n const { className } = props;\n\n const classes = useStyles();\n\n return (\n \n
\n \n Import \n Export \n \n Add product\n \n
\n
\n \n
\n
\n );\n};\n\nProductsToolbar.propTypes = {\n className: PropTypes.string\n};\n\nexport default ProductsToolbar;\n","import uuid from 'uuid/v1';\n\nexport default [\n {\n id: uuid(),\n title: 'Jaluzele verticale',\n description:\n '',\n imageUrl: '/images/products/jv.jpg',\n cod:'jv',\n instructiuniUrl:'http://larexir.ro/product/jaluzele-verticale-montaj/'\n },\n {\n id: uuid(),\n title: 'Rolete textile',\n description:\n '',\n imageUrl: '/images/products/ro.jpg',\n cod: 'ro',\n instructiuniUrl:'http://larexir.ro/product/day-night-caseta/',\n subTip:\"\"\n },\n {\n id: uuid(),\n title: 'Rulouri exterioare aplicate',\n description:'',\n imageUrl: '/images/products/aplicate.jpg',\n cod:'re',\n instructiuniUrl:'http://larexir.ro/product/rulouri-aplicate-montaj/',\n subTip:\"REA\"\n },\n {\n id: uuid(),\n title: 'Rulouri exterioare suprapuse',\n description:'',\n imageUrl: '/images/products/suprapuse.jpg',\n cod:'re',\n instructiuniUrl:'http://larexir.ro/product/rulouri-aplicate-montaj/',\n subTip:\"RES\"\n },\n {\n id: uuid(),\n title: 'Rulouri exterioare transparente',\n description:'',\n imageUrl: '/images/products/transparente.jpg',\n cod:'re',\n instructiuniUrl:'http://larexir.ro/product/rulouri-aplicate-montaj/',\n subTip:\"RET\",\n },\n {\n id: uuid(),\n title: 'Usi garaj',\n description:'',\n imageUrl: '/images/products/ug.jpg',\n cod:'ug',\n instructiuniUrl:'#',\n subTip:\"\"\n },\n {\n id: uuid(),\n title: 'Plase anti-insecte',\n description:'',\n imageUrl: '/images/products/pi.jpg',\n cod:'pi',\n instructiuniUrl:'#',\n subTip:\"\"\n },\n {\n id: uuid(),\n title: 'Jaluzele orizontale',\n description:'',\n imageUrl: '/images/products/jo.jpg',\n cod:'jo',\n instructiuniUrl:'http://larexir.ro/product/jaluzele-orizontale-montaj/',\n subTip:\"\"\n },\n {\n id: uuid(),\n title: 'Masuratori',\n description:'',\n imageUrl: '/images/products/masuratori.png',\n cod:'sv',\n instructiuniUrl:'http://larexir.ro/product/jaluzele-orizontale-montaj/',\n subTip:\"\"\n },\n // {\n // id: uuid(),\n // title: 'Rulouri exterioare',\n // description:'Modul vechi: se va folosi doar pentru comenzile vechi de rulouri exterioare netransmise inca.',\n // imageUrl: '/images/products/dezactivat.png',\n // cod:'re',\n // instructiuniUrl:'http://larexir.ro/product/rulouri-aplicate-montaj/',\n // subTip:\"\"\n // }\n];\n","import React, { useState } from 'react';\nimport { makeStyles } from '@material-ui/styles';\nimport { IconButton, Grid, Typography } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport { ProductCard } from './components';\nimport tipproduse from './data';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3),\n background:'#CFD8DC', \n height:'100%',\n overflow: 'auto'\n },\n content: {\n marginTop: theme.spacing(2)\n },\n pagination: {\n marginTop: theme.spacing(3),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end'\n }\n}));\n\nconst ProductList = () => {\n const classes = useStyles();\n const [products] = useState(tipproduse);\n\n return (\n \n
\n
\n {products.map(product => (\n \n \n \n ))}\n \n
\n
\n 1-6 of 20 \n \n \n \n \n \n \n
\n
\n );\n};\n\nexport default ProductList;\n","/* eslint-disable linebreak-style */\nimport React, {useState} from 'react';\nimport {connect} from 'react-redux';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardActions,\n Divider,\n Button,\n colors\n} from '@material-ui/core';\nimport {strapi, STRAPI_PASSWORD_RESET_URL} from '../../../../strapi/strapi.config';\nimport { withSnackbar } from 'notistack';\nimport { selectCurrentUser } from '../../../../redux/user/user.selectors'\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton:{\n desplay:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n width:'100%', \n background:colors.blueGrey[500],\n color:'white' \n },\n header:{\n background:colors.blueGrey[700],\n }\n}));\n\nconst Notifications = props => {\n const { className, enqueueSnackbar, currentUser } = props;\n const [enabled, setEnabled]=useState(true)\n const classes = useStyles();\n //----------------------------------------------------------------------------------------\n const handleSubmit= async (e)=>{\n e.preventDefault()\n setEnabled(false)\n await strapi.forgotPassword(currentUser.email, STRAPI_PASSWORD_RESET_URL)\n .catch(e=>(\n enqueueSnackbar(`Eroare : nu am putut trimite e-mailul cu codul de resetare.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n ))\n .then(()=>{\n enqueueSnackbar('Email-ul cu codul de resetare a fost trimis cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n })\n }\n //----------------------------------------------------------------------------------------\n\n return (\n \n \n \n );\n};\n\nNotifications.propTypes = {\n className: PropTypes.string,\n currentUser:PropTypes.object,\n enqueueSnackbar:PropTypes.func\n\n};\n\nconst mapStateToProps=state=>({\n currentUser:selectCurrentUser(state)\n})\n\nexport default connect(mapStateToProps)(withSnackbar(Notifications));\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Button,\n TextField,\n colors\n} from '@material-ui/core';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport { withSnackbar } from 'notistack';\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton:{\n desplay:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n width:'35%',\n background:colors.blueGrey[500],\n color:'white'\n },\n header:{\n background:colors.blueGrey[700],\n }\n}));\n\nconst Password = props => {\n const { className, enqueueSnackbar } = props;\n const classes = useStyles();\n const [values, setValues] = useState({\n password: '',\n confirm: '',\n cod:''\n });\n //--------------------------------------------------------------------------\n const handleChange = event => {\n setValues({\n ...values,\n [event.target.name]: event.target.value\n });\n };\n //--------------------------------------------------------------------------\n const handleSubmit = async e => {\n e.preventDefault()\n if (values.password===values.confirm){\n await strapi.resetPassword(values.cod, values.password, values.confirm)\n .catch(e=>(\n enqueueSnackbar(`Eroare : nu am putut trimite datele setarii noii parole.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n ))\n .then(()=>{\n enqueueSnackbar('Parola noua a fost setata cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n setValues({\n password: '',\n confirm: '',\n cod:''\n })\n })\n } else{\n enqueueSnackbar('Rubrica Parola nu este egal cu rubrica Confirmare parola!',{ \n variant: 'error',\n })\n }\n };\n //--------------------------------------------------------------------------\n return (\n \n \n \n );\n};\n\nPassword.propTypes = {\n className: PropTypes.string,\n enqueueSnackbar:PropTypes.func\n};\n\nexport default withSnackbar(Password);\n","import React from 'react';\nimport {connect} from 'react-redux';\nimport { makeStyles } from '@material-ui/styles';\nimport { Grid } from '@material-ui/core';\nimport { Notifications, Password } from './components';\nimport {selectCurrentUser } from '../../redux/user/user.selectors';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background:'#CFD8DC', \n height:'100%',\n overflow: 'auto'\n }\n}));\n\nconst Settings = (props) => {\n const classes = useStyles();\n const {currentUser}=props;\n\n const vanzatorVizibilitate=()=>{\n if(currentUser.role.name==='Vanzator'){\n return true;\n }else{\n return false;\n }\n }\n\n return (\n vanzatorVizibilitate()?\n Nu aveti drepturi de acces pentru modulul: Setari! \n\n :\n
\n \n \n \n {/* \n \n */}\n \n
\n );\n};\n\n\nconst mapStateToProps=state=>({\n currentUser:selectCurrentUser(state),\n})\nexport default connect(mapStateToProps)(Settings);\n\n\n\n","/* eslint-disable linebreak-style */\nimport React, { useState, useEffect } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport {connect} from 'react-redux';\nimport PropTypes from 'prop-types';\nimport validate from 'validate.js';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Grid,\n Button,\n IconButton,\n TextField,\n Typography\n} from '@material-ui/core';\nimport ArrowBackIcon from '@material-ui/icons/ArrowBack';\nimport {setCurrentUserStart, setDeliveryAddressesStart} from '../../redux/user/user.actions';\nimport Loader from 'react-loader-spinner'\nimport {setLoading} from '../../redux/other/other.actions';\nimport {strapi, STRAPI_PASSWORD_RESET_URL} from '../../strapi/strapi.config';\nimport { withSnackbar } from 'notistack';\nimport './signin.css';\n\nconst schema = {\n email: {\n presence: { allowEmpty: false, message: 'aceasta rubrica este obligatorie' },\n email: true,\n length: {\n maximum: 64\n }\n },\n password: {\n presence: { allowEmpty: false, message: 'aceasta rubrica este obligatorie' },\n length: {\n maximum: 128\n }\n }\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n backgroundColor: theme.palette.background.default,\n height: '100%'\n },\n grid: {\n height: '100%'\n },\n quoteContainer: {\n [theme.breakpoints.down('md')]: {\n display: 'none'\n }\n },\n quote: {\n backgroundColor: theme.palette.neutral,\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundImage: 'url(/images/auth.png)',\n backgroundSize: '800px',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center'\n },\n quoteInner: {\n textAlign: 'center',\n flexBasis: '600px'\n },\n quoteText: {\n color: theme.palette.white,\n fontWeight: 300\n },\n name: {\n marginTop: theme.spacing(3),\n color: theme.palette.white\n },\n bio: {\n color: theme.palette.white\n },\n content: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n contentHeader: {\n display: 'flex',\n alignItems: 'center',\n paddingTop: theme.spacing(5),\n paddingBototm: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2)\n },\n contentBody: {\n flexGrow: 1,\n display: 'flex',\n alignItems: 'center',\n [theme.breakpoints.down('md')]: {\n justifyContent: 'center'\n }\n },\n form: {\n paddingLeft: 100,\n paddingRight: 100,\n paddingBottom: 125,\n flexBasis: 700,\n [theme.breakpoints.down('sm')]: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2)\n }\n },\n title: {\n marginBottom: theme.spacing(3),\n textAlign: 'center',\n },\n textField: {\n marginTop: theme.spacing(2)\n },\n signInButton: {\n margin: theme.spacing(2, 0)\n },\n resetPaswordButton: {\n margin: theme.spacing(2, 0),\n fontSize: '12px'\n },\n resetPaswordDiv:{\n display: 'flex',\n flexDirection: 'row',\n textAlign: 'flex-end',\n margin: theme.spacing(2, 0),\n }\n\n}));\n\nconst SignIn = props => {\n const { history, loading, enqueueSnackbar } = props;\n const classes = useStyles();\n\n\n const [formState, setFormState] = useState({\n isValid: false,\n values: {},\n touched: {},\n errors: {}\n });\n\n useEffect(() => {\n const errors = validate(formState.values, schema);\n setFormState(formState => ({\n ...formState,\n isValid: errors ? false : true,\n errors: errors || {}\n }));\n }, [formState.values]);\n\n const handleBack = () => {\n history.goBack();\n };\n\n const handleChange = event => {\n event.persist();\n setFormState(formState => ({\n ...formState,\n values: {\n ...formState.values,\n [event.target.name]:\n event.target.type === 'checkbox'\n ? event.target.checked\n : event.target.value\n },\n touched: {\n ...formState.touched,\n [event.target.name]: true\n }\n }));\n };\n\n const handleSignIn = async e => {\n const {setCurrentUserStart,setDeliveryAddressesStart, currentUser}=props;\n e.preventDefault();\n \n setCurrentUserStart({email:formState.values.email, password:formState.values.password})\n //setDeliveryAddressesStart(currentUser?currentUser.idFirma.id:0)\n setLoading(true)\n setTimeout(()=>window.location.reload(),1000)\n // setLoading(false)\n };\n\n const handleResetPasword = async e => { \n \n if (!hasError('email') && formState.values.email){\n await strapi.forgotPassword(formState.values.email, STRAPI_PASSWORD_RESET_URL)\n .catch(e=>(\n enqueueSnackbar(`Eroare : nu am putut trimite e-mailul cu linkul de resetare a parolei.(${e})`,{ \n variant: 'error',\n autoHideDuration:3000 \n })\n ))\n .then(()=>{\n enqueueSnackbar('Email-ul cu link-ul de resetare a fost trimis cu succes.',{ \n variant: 'success',\n autoHideDuration:2000\n })\n })\n }else{\n enqueueSnackbar('Va rog completati adresa de email folosita la crearea contului!',{ \n variant: 'error',\n autoHideDuration:3000\n })\n }\n \n };\n\n const hasError = field =>\n formState.touched[field] && formState.errors[field] ? true : false;\n if (loading===false){\n return (\n \n
\n \n \n
\n
\n ....\n \n
\n \n .......\n \n \n .......\n \n
\n
\n
\n \n \n \n \n \n
\n )}else{\n return (\n \n
loading.... \n \n \n );\n };\n};\n\nSignIn.propTypes = {\n history: PropTypes.object,\n setCurrentUserStart:PropTypes.func\n};\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser,\n loading:state.other.loading,\n})\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentUserStart:(emailAndPassword)=>dispatch(setCurrentUserStart(emailAndPassword)),\n setDeliveryAddressesStart:idFirma=>dispatch(setDeliveryAddressesStart(idFirma)),\n setLoading:boll=>dispatch(setLoading(boll)),\n})\n\nexport default connect(mapStateToProps,mapDispatchToProps)(withRouter(withSnackbar(SignIn)));\n\n","import React, { useState, useEffect } from 'react';\nimport { Link as RouterLink, withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport validate from 'validate.js';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Grid,\n Button,\n IconButton,\n TextField,\n Link,\n FormHelperText,\n Checkbox,\n Typography\n} from '@material-ui/core';\nimport ArrowBackIcon from '@material-ui/icons/ArrowBack';\n\nconst schema = {\n firstName: {\n presence: { allowEmpty: false, message: 'is required' },\n length: {\n maximum: 32\n }\n },\n lastName: {\n presence: { allowEmpty: false, message: 'is required' },\n length: {\n maximum: 32\n }\n },\n email: {\n presence: { allowEmpty: false, message: 'is required' },\n email: true,\n length: {\n maximum: 64\n }\n },\n password: {\n presence: { allowEmpty: false, message: 'is required' },\n length: {\n maximum: 128\n }\n },\n policy: {\n presence: { allowEmpty: false, message: 'is required' },\n checked: true\n }\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n backgroundColor: theme.palette.background.default,\n height: '100%'\n },\n grid: {\n height: '100%'\n },\n quoteContainer: {\n [theme.breakpoints.down('md')]: {\n display: 'none'\n }\n },\n quote: {\n backgroundColor: theme.palette.neutral,\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundImage: 'url(/images/auth.jpg)',\n backgroundSize: 'cover',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center'\n },\n quoteInner: {\n textAlign: 'center',\n flexBasis: '600px'\n },\n quoteText: {\n color: theme.palette.white,\n fontWeight: 300\n },\n name: {\n marginTop: theme.spacing(3),\n color: theme.palette.white\n },\n bio: {\n color: theme.palette.white\n },\n contentContainer: {},\n content: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column'\n },\n contentHeader: {\n display: 'flex',\n alignItems: 'center',\n paddingTop: theme.spacing(5),\n paddingBototm: theme.spacing(2),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2)\n },\n logoImage: {\n marginLeft: theme.spacing(4)\n },\n contentBody: {\n flexGrow: 1,\n display: 'flex',\n alignItems: 'center',\n [theme.breakpoints.down('md')]: {\n justifyContent: 'center'\n }\n },\n form: {\n paddingLeft: 100,\n paddingRight: 100,\n paddingBottom: 125,\n flexBasis: 700,\n [theme.breakpoints.down('sm')]: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2)\n }\n },\n title: {\n marginTop: theme.spacing(3)\n },\n textField: {\n marginTop: theme.spacing(2)\n },\n policy: {\n marginTop: theme.spacing(1),\n display: 'flex',\n alignItems: 'center'\n },\n policyCheckbox: {\n marginLeft: '-14px'\n },\n signUpButton: {\n margin: theme.spacing(2, 0)\n }\n}));\n\nconst SignUp = props => {\n const { history } = props;\n\n const classes = useStyles();\n\n const [formState, setFormState] = useState({\n isValid: false,\n values: {},\n touched: {},\n errors: {}\n });\n\n useEffect(() => {\n const errors = validate(formState.values, schema);\n\n setFormState(formState => ({\n ...formState,\n isValid: errors ? false : true,\n errors: errors || {}\n }));\n }, [formState.values]);\n\n const handleChange = event => {\n event.persist();\n\n setFormState(formState => ({\n ...formState,\n values: {\n ...formState.values,\n [event.target.name]:\n event.target.type === 'checkbox'\n ? event.target.checked\n : event.target.value\n },\n touched: {\n ...formState.touched,\n [event.target.name]: true\n }\n }));\n };\n\n const handleBack = () => {\n history.goBack();\n };\n\n const handleSignUp = event => {\n event.preventDefault();\n history.push('/');\n };\n\n const hasError = field =>\n formState.touched[field] && formState.errors[field] ? true : false;\n\n return (\n \n
\n \n \n
\n
\n Hella narwhal Cosby sweater McSweeney's, salvia kitsch before\n they sold out High Life.\n \n
\n \n Takamaru Ayako\n \n \n Manager at inVision\n \n
\n
\n
\n \n \n \n \n \n
\n );\n};\n\nSignUp.propTypes = {\n history: PropTypes.object\n};\n\nexport default withRouter(SignUp);\n","/* eslint-disable linebreak-style */\nimport React from 'react'\nimport {Redirect } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport {connect} from 'react-redux';\nimport {setCurrentUserSuccess, setDeliveryAddressesSuccess} from '../../redux/user/user.actions'\nimport {loadCuloriSuccess,loadInformariSuccess, loadPreturiTabelareSuccess, loadFirmaSuccess, loadIndicatoriSuccess, loadProduseSuccess, loadMaterialeSuccess, loadOptionaleSuccess} from '../../redux/lookup/lookup.actions'\nimport {clearToken} from '../../strapi/strapi.utils.js';\n\nclass SignOut extends React.Component{\n \n renderRedirect = () => {\n const {setCurrentUserSuccess, setDeliveryAddressesSuccess, loadCuloriSuccess,loadInformariSuccess, loadPreturiTabelareSuccess, loadFirmaSuccess, loadIndicatoriSuccess, loadProduseSuccess, loadMaterialeSuccess, loadOptionaleSuccess}=this.props;\n clearToken();\n setCurrentUserSuccess(null)\n setDeliveryAddressesSuccess([])\n loadCuloriSuccess(null)\n loadInformariSuccess(null)\n loadPreturiTabelareSuccess(null)\n loadFirmaSuccess(null)\n loadIndicatoriSuccess(null)\n loadProduseSuccess(null)\n loadMaterialeSuccess(null)\n loadOptionaleSuccess(null)\n return( )\n \n }\n \n render () {\n return (\n \n {this.renderRedirect()}\n
\n )\n }\n}\n\nSignOut.propTypes = {\n setCurrentUserSuccess: PropTypes.func,\n setDeliveryAddressesSuccess:PropTypes.func\n};\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentUserSuccess:user=>dispatch(setCurrentUserSuccess(user)),\n loadIndicatoriSuccess:(indicatori)=>dispatch(loadIndicatoriSuccess(indicatori)),\n loadInformariSuccess:(informari)=>dispatch(loadInformariSuccess(informari)),\n loadCuloriSuccess:(culori)=>dispatch(loadCuloriSuccess(culori)),\n loadOptionaleSuccess:(optionale)=>dispatch(loadOptionaleSuccess(optionale)),\n loadFirmaSuccess:(firma)=>dispatch(loadFirmaSuccess(firma)),\n loadPreturiTabelareSuccess:(preturitabelare)=>dispatch(loadPreturiTabelareSuccess(preturitabelare)),\n loadMaterialeSuccess:(materiale)=>dispatch(loadMaterialeSuccess(materiale)),\n loadProduseSuccess:(produse)=>dispatch(loadProduseSuccess(produse)),\n setDeliveryAddressesSuccess:addresses=>dispatch(setDeliveryAddressesSuccess(addresses))\n})\nexport default connect(null,mapDispatchToProps)(SignOut);\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n Grid,\n Divider,\n Typography,\n colors\n} from '@material-ui/core';\n\nconst useStyles = makeStyles(() => ({\n root: {},\n item: {\n display: 'flex',\n flexDirection: 'column'\n },\n logo: {\n width: 200,\n height: 200,\n },\n info: {\n marginTop: 1,\n marginLeft:1,\n color:colors.grey[700],\n fontSize:15\n },\n header:{\n background:colors.blueGrey[700],\n }, \n body:{\n background:colors.blueGrey[100],\n \n }\n}));\n\nconst Informatii = props => {\n\n const { className } = props;\n\n const classes = useStyles();\n const inf = {\n logo: '/images/logos/logoMediu.ico',\n adresa: 'Bragadiru str.Soseaua Alexandriei, Nr.145A Ilfov',\n cui:' RO 24130091',\n regcom: 'J23/6264/2022',\n telefon:'0738 455 555',\n email:'office@larexir.ro',\n obs:'Raspundem cinci zile pe saptamana, in intervalul 09:00-17:30'\n };\n \n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n SC LAREXIR DECOR SRL\n \n \n \n \n \n \n {inf.adresa}\n \n \n \n \n {inf.cui}\n \n \n \n \n {inf.regcom}\n \n \n \n \n Telefon: {inf.telefon}\n \n \n \n \n Email: {inf.email}\n \n \n \n \n {inf.obs}\n \n \n \n \n \n \n \n \n \n );\n};\n\nInformatii.propTypes = {\n className: PropTypes.string\n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser\n})\n\nexport default connect(mapStateToProps)(Informatii);\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Button,\n TextField,\n colors\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\nimport {\n STRAPI_MAIL_POST_URL,\n LAREXIR_MAIL_FOR_CONTACT\n} from '../../../../strapi/strapi.config';\nimport LZString from 'lz-string';\nimport {strapi} from 'strapi/strapi.config';\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton: {\n desplay: 'flex',\n justifyContent: 'flex-end'\n },\n buton: {\n width: '20%',\n background: colors.blueGrey[500],\n color: 'white'\n },\n header: {\n background: colors.blueGrey[700]\n }\n}));\n\nconst Email = (props) => {\n const { className, currentUser, enqueueSnackbar } = props;\n const classes = useStyles();\n const [values, setValues] = useState({\n email: currentUser.email,\n subiect: '',\n continut: ''\n });\n //-----------------------------------------------------------------\n const handleChange = (event) => {\n setValues({\n ...values,\n [event.target.name]: event.target.value\n });\n };\n //-----------------------------------------------------------------\n const handleSubmit = async (e) => {\n e.preventDefault();\n const TOKEN = JSON.parse(localStorage.getItem('jwt'));\n await fetch(STRAPI_MAIL_POST_URL, {\n method: 'post',\n headers: {\n Authorization: `Bearer ${TOKEN}`,\n 'Content-type': 'application/json',\n Accept: 'application/json',\n },\n body: JSON.stringify({\n to: LAREXIR_MAIL_FOR_CONTACT,\n from:LAREXIR_MAIL_FOR_CONTACT,\n subject: \"Mesaj WebStore de la: \" + values.email + \" Subiect: \"+ values.subiect ,\n text: Mesaj formular contact WebStore de la : + {values.email}
{values.continut}
\n })\n })\n .catch((e) =>\n enqueueSnackbar(`Eroare : mesajul nu a putut fi trimis.(${e})`, {\n variant: 'error',\n persist: true\n })\n )\n .then((res) => {\n if (res.status === 200) {\n enqueueSnackbar('Mesaj trimis cu succes.', {\n variant: 'success',\n autoHideDuration: 1500\n });\n setValues({\n email: currentUser.email,\n subiect: '',\n continut: ''\n });\n }\n });\n\n \n };\n //-----------------------------------------------------------------\n return (\n \n \n \n );\n};\n\nEmail.propTypes = {\n className: PropTypes.string,\n currentUser: PropTypes.object,\n enqueueSnackbar: PropTypes.func\n};\n\nconst mapStateToProps = (state) => ({\n currentUser: state.user.currentUser\n});\nexport default connect(mapStateToProps)(withSnackbar(Email));\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { makeStyles } from '@material-ui/styles';\nimport { Grid } from '@material-ui/core';\nimport { Informatii, Email } from './components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background:'#CFD8DC', \n height:'100%',\n overflow: 'auto'\n }\n}));\n\nconst Settings = () => {\n const classes = useStyles();\n\n return (\n \n \n \n \n \n \n \n \n \n
\n );\n};\n\nexport default Settings;\n","/* eslint-disable linebreak-style */\nexport const dataFormatRO=(timestamp)=>{\n var data= new Date(Date.parse(timestamp)*1)\n return data.toLocaleString('ro-RO')\n}\n\nexport const dynamicSort=(property)=> {\n var sortOrder = 1;\n if(property[0] === '-') {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n /* next line works with strings and numbers, \n * and you may want to customize it to your needs\n */\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n}\n\nexport function dynamicMultipleSort() {\n /*\n * salvează obiectul arguments deoarece va fi suprascris\n * trebuie menționat că obiectul arguments este un obiect asemănător unui array\n * format din numele proprietăților după care se sortează\n */\n var props = arguments;\n return function (obj1, obj2) {\n var i = 0, result = 0, numberOfProperties = props.length;\n /* încearcă să obții un rezultat diferit de 0 (egal)\n * atâta timp cât avem proprietăți suplimentare de comparat\n */\n while(result === 0 && i < numberOfProperties) {\n result = dynamicSort(props[i])(obj1, obj2);\n i++;\n }\n return result;\n }\n}","/* eslint-disable linebreak-style */\nimport {createSelector} from 'reselect';\n\nconst selectOrder=state=>state.order;\n\nexport const selectOrderCurrentProduct= createSelector(\n [selectOrder],\n order=>order.currentProduct\n);\n\nexport const selectOrderOrders= createSelector(\n [selectOrder],\n order=>order.orders\n);\n\nexport const selectOrderCurrentOrder= createSelector(\n [selectOrder],\n order=>order.currentOrder\n);\n\nexport const selectOrderCurrentItem= createSelector(\n [selectOrder],\n order=>order.currentItem\n);\n\nexport const selectOrderUpdatedOrder= createSelector(\n [selectOrder],\n order=>order.updatedOrder\n);\n\nexport const selectOrderDeletedItems= createSelector(\n [selectOrder],\n order=>order.deletedItems\n);","/* eslint-disable linebreak-style */\nimport {createSelector} from 'reselect';\n\nconst selectOther=state=>state.other;\n\nexport const selectOtherLoading= createSelector(\n [selectOther],\n other=>other.loading\n);\n\nexport const selectOtherDone= createSelector(\n [selectOther],\n other=>other.done\n);\n\nexport const selectOtherErrors= createSelector(\n [selectOther],\n other=>other.errors\n);\n\nexport const selectOtherVariant= createSelector(\n [selectOther],\n other=>other.variant\n);\n\nexport const selectOtherOpenEditItem= createSelector(\n [selectOther],\n other=>other.openEditItem\n);\n\n\nexport const selectOtherConfirmation= createSelector(\n [selectOther],\n other=>other.confirmation\n);\n\nexport const selectOtherOverlaySpinner= createSelector(\n [selectOther],\n other=>other.overlaySpinner\n);","/* eslint-disable linebreak-style */\nimport React, {useRef} from 'react';\nimport {connect} from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport Loader from 'react-loader-spinner';\nimport {\n Card,\n} from '@material-ui/core';\n\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n Sort, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n Filter\n} from '@syncfusion/ej2-react-grids';\nimport { L10n, getValue, createElement} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\nimport 'react-confirm-alert/src/react-confirm-alert.css';\nimport './orderstable.css';\nimport { dataFormatRO } from '../../../../utils/functiiComune';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport { setOrdersSuccess, setCurrentOrder, setCurrentItem, setUpdatedOrder, setDeletedItems, setOrdersStart} from '../../../../redux/order/order.actions';\nimport { selectOrderCurrentProduct, selectOrderOrders }from '../../../../redux/order/order.selectors';\nimport { selectCurrentUser }from '../../../../redux/user/user.selectors';\nimport { selectOtherLoading}from '../../../../redux/other/other.selectors';\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'comanda',\n 'Items':'comenzi',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici o comanda!',\n 'DeleteOperationAlert':'Nu ati selectat nici o comanda!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea comenzii?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\nconst useStyles = makeStyles(() => ({\n gridContainer: {\n height: '100%', // Ocupă întreaga înălțime a containerului părinte\n display: 'flex',\n flexDirection: 'column'\n },\n spinner:{\n textAlign: 'center',\n padding:'200px'\n },\n netransmisa:{\n color:'orange'\n }\n}));\n\nconst OrdersTable = props => {\n const { currentUser,currentProduct,history,setOrdersSuccess,setCurrentOrder, loading, setCurrentItem, setUpdatedOrder, orders, setDeletedItems, enqueueSnackbar,} = props;\n const toolbarOptions =[\n { text: 'Adauga', tooltipText: 'Adauga comanda noua', prefixIcon: 'e-add', id: 'Adauga', disabled:false },\n { text: 'Modifica', tooltipText: 'Modifica comanda selectata', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge comanda selectata', prefixIcon: 'e-delete', id: 'Sterge' },\n ];\n const editSettings = { allowDeleting: false, mode: 'Dialog', allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n const sortingOptions = {columns: [{ field: 'id', direction: 'Descending' }]}\n const selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' };\n const classes = useStyles();\n const masterGrid = useRef(null)\n//----------------------------------------------------------------------------------------------------\n const filterOptions = {\n type: 'Menu',\n operators: {\n stringOperator: [\n { value: 'contains', text: 'Conține' },\n { value: 'startswith', text: 'Începe cu' },\n { value: 'endswith', text: 'Se termină cu' }\n ]\n },\n mode: 'Immediate'\n };\n\n //----------------------------------------------------------------------------------------------------\n \n //----------------------------------------------------------------------------------------------------\n const jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n const rowselect=(args)=>{\n let selRecord = args.data;\n vizualizareComandaSetCurentOrder(selRecord)\n vizualizareComandaSetUpdatedOrder(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n const rowdeselect=()=>{\n setCurrentOrder({});\n }\n //----------------------------------------------------------------------------------------------------\n const actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (masterGrid.pageSettings.currentPage !== 1 && masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (masterGrid.pageSettings.currentPage * masterGrid.pageSettings.pageSize) - masterGrid.pageSettings.pageSize;\n }\n else if (masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (masterGrid.pageSettings.currentPage * masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n const actionComplete=(args)=>{\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n\n const currencyFormatter=(field, data)=>{\n if (currentProduct.cod==='jv' || currentProduct.cod==='ro'|| currentProduct.cod==='jo'){\n return getValue(field, data) + ' Lei';\n }else{\n return getValue(field, data) + ' Euro';\n }\n\n }\n //----------------------------------------------------------------------------------------------------\n const dateFormatter=(field, data)=>{\n return dataFormatRO(getValue(field, data)).substring(0, 10);\n }\n //----------------------------------------------------------------------------------------------------\n const customizeCell=(args)=>{\n if((args.column).field === 'stadiu' && args.data && args.cell) {\n if (getValue('stadiu', args.data) ==='NETRANSMISA'){\n args.cell.classList.add('netransmisa');\n } \n }\n }\n //----------------------------------------------------------------------------------------------------\n const headerCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n } \n //----------------------------------------------------------------------------------------------------\n const clickHandlerMaster=async e=>{\n const { setCurrentOrder,setUpdatedOrder}=props;\n //.....................................\n if (e.item.properties.id==='Adauga'){\n switch(currentProduct.cod){\n case 'jv':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountJV, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountJV, id:0, comandarepers:[]})\n break;\n case 'ro':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountRO, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountRO, id:0, comandarepers:[]})\n break;\n case 're':\n setCurrentOrder({subTip:currentProduct.subTip,tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountRE, id:0, comandarepers:[]})\n setUpdatedOrder({subTip:currentProduct.subTip,tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountRE, id:0, comandarepers:[]})\n break;\n case 'ug':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountUG, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountUG, id:0, comandarepers:[]})\n break;\n case 'pi':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountPI, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountPI, id:0, comandarepers:[]})\n break;\n case 'jo':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountJO, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:currentUser.idFirma.discountJO, id:0, comandarepers:[]})\n break;\n case 'sv':\n setCurrentOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:0, id:0, comandarepers:[]})\n setUpdatedOrder({tipProdus:currentProduct.cod,idFirma:currentUser.idFirma.id,discount:0, id:0, comandarepers:[]})\n break;\n default:\n alert('Eroare. Nu am gasit nici un produs selectat!')\n }\n \n setDeletedItems([])\n let path = '/order';\n history.push(path);\n }\n //.....................................\n if (e.item.properties.id==='Modifica'){\n if (masterGrid.current.getSelectedRowIndexes().length){\n await vizualizareComandaSetCurentOrder(orders.filter(com=>(com.id===masterGrid.current.selectionModule.data.id))[0])\n await vizualizareComandaSetUpdatedOrder(orders.filter(com=>(com.id===masterGrid.current.selectionModule.data.id))[0])\n setDeletedItems([])\n setCurrentItem({}) \n history.push('/order')\n }else{\n enqueueSnackbar('Nu ati selectat nici o comanda.',{ \n variant: 'error',\n autoHideDuration:1500\n })\n } \n }\n //.....................................\n if (e.item.properties.id==='Sterge'){\n if(masterGrid.current.selectionModule.data.stadiu ==='NETRANSMISA'){\n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sunteti sigur ca doriti stergerea comenzii selectate?',\n buttons: [\n {\n label: 'Da',\n onClick: async () => {\n document.body.style.cursor = 'wait';\n await strapi.deleteEntry('comandas',masterGrid.current.selectionModule.data.id)\n .catch(e=>(\n props.enqueueSnackbar(`Eroare : nu am putut sterge comanda.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n ))\n .then(()=>{\n setOrdersSuccess(orders.filter(order=>(order.id!==masterGrid.current.selectionModule.data.id)))\n enqueueSnackbar('Comanda a fost stearsa cu succes.',{ \n variant: 'success',\n autoHideDuration:1500\n })\n document.body.style.cursor = 'pointer';\n masterGrid.current.refresh();\n })\n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n }else{\n enqueueSnackbar('Doar comenzile NETRANSMISE se pot sterge',{ \n variant: 'warning',\n })\n }\n } \n }\n //----------------------------------------------------------------------------------------------------\n const vizualizareComandaSetCurentOrder=(selectedRow)=>{\n return new Promise( (resolve) => { \n setTimeout(async() => {\n setCurrentOrder(jsonCopy(selectedRow))\n resolve('ok')\n },50)\n })\n }\n //----------------------------------------------------------------------------------------------------\n const vizualizareComandaSetUpdatedOrder=(selectedRow)=>{\n return new Promise( (resolve) => { \n setTimeout(async() => {\n setUpdatedOrder(jsonCopy(selectedRow))\n resolve('ok')\n },50)\n })\n }\n //----------------------------------------------------------------------------------------------------\n const vanzatorVizibilitate=()=>{\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n \n if (loading===false) {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n )\n } else {\n return (\n \n \n
\n );\n }\n}\n\nOrdersTable.propTypes = {\n className: PropTypes.string,\n currentProduct:PropTypes.object,\n currentUser:PropTypes.object,\n loading:PropTypes.bool,\n orders:PropTypes.array\n};\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n orders:selectOrderOrders(state),\n currentUser:selectCurrentUser(state),\n loading:selectOtherLoading(state),\n})\n\nconst mapDispatchToProps=dispatch=>({\n setOrdersSuccess:(orders)=>dispatch(setOrdersSuccess(orders)),\n setCurrentOrder:order=>dispatch(setCurrentOrder(order)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setUpdatedOrder:order=>dispatch(setUpdatedOrder(order)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n setOrdersStart:(idFirmaAndTipProdusAndTipProdus)=>dispatch(setOrdersStart(idFirmaAndTipProdusAndTipProdus)),\n})\n\nexport default connect(mapStateToProps,mapDispatchToProps)(withRouter(withSnackbar(OrdersTable)));\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { connect } from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardContent,\n Divider,\n} from '@material-ui/core';\nimport { selectOrderCurrentProduct } from '../../../../redux/order/order.selectors'\n\nconst useStyles = makeStyles(() => ({\n container: {\n width:'100%',\n textAlign:'center',\n color:'grey' \n },\n}));\n\nconst OrdersHeader = props => {\n const {currentProduct} = props;\n const classes = useStyles();\n return (\n \n
\n \n \n
{currentProduct.title.toUpperCase()} \n \n \n
\n );\n}\n\nOrdersHeader.propTypes = {\n className: PropTypes.string,\n currentProduct:PropTypes.object\n};\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n})\n\n\nexport default connect(mapStateToProps)(withRouter(OrdersHeader));\n","/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport { dataFormatRO } from '../../../../utils/functiiComune';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n margin: 10,\n padding: 10,\n display:'flex',\n flexDirection: 'column',\n },\n denumireFirma:{\n marginTop: 25,\n marginLeft:25,\n marginBottom:0,\n },\n linie:{\n marginTop:-15,\n marginLeft:25,\n padding:0,\n },\n dateFirma:{\n marginTop: 0,\n marginLeft:25,\n fontSize:10,\n },\n\n titlu:{\n marginTop: 25,\n marginLeft:25,\n marginBottom:25,\n textAlign:'center',\n fontWeight:'900'\n },\n dateComanda:{\n marginTop: 0,\n marginLeft:25,\n marginBottom:0,\n fontSize:12,\n \n }\n});\n\n// Create Document Component\nconst Header = (props) => {\n return(\n \n {props.currentUser.idFirma.denumire} \n ____________________________________________________________________________ \n {`Cod fiscal:${props.currentUser.idFirma.atributCodFiscal===null?'':props.currentUser.idFirma.atributCodFiscal}${props.currentUser.idFirma.codFiscal}`} \n {`Reg. com.:${props.currentUser.idFirma.regCom}`} \n {`Adresa:${props.currentUser.idFirma.oras}, ${props.currentUser.idFirma.adresa}`} \n {`Telefon:${props.currentUser.idFirma.telefon}`} \n {`Email:${props.currentUser.idFirma.email}`} \n\n {`OFERTA ${props.currentProduct.title.toUpperCase()}`} \n \n\n {`Numar: ${props.currentOrder.id} Data: ${dataFormatRO(props.currentOrder.dataComanda)}`} \n {`Client: ${props.currentOrder.clientClient}`} \n {`Observatii: ${props.currentOrder.observatii}`} \n\n \n )\n};\n\nexport default Header","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst Cell = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 10px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentJV = (props) => (\n \n \n Nr. crt | \n Lungime | \n Inaltime | \n Tip desc. | \n Material | \n Cod culoare | \n Lungime snur | \n Console | \n Cantitate | \n Pret(lei) | \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} | \n {item.lungime} | \n {item.inaltime} | \n {item.deschidere} | \n {item.denumireMaterial} | \n {item.codMaterial} | \n {item.lungimeSnur} | \n {item.console} | \n {item.buc} | \n {item.pretClientFinal} | \n \n )\n \n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareClientFinal} lei`} \n \n \n);\n\n\n\nexport default ContentJV","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop: 5,\n marginBottom: 5,\n },\n row: {\n display: 'flex',\n flexDirection: 'row',\n marginTop: 0,\n marginBottom: 0,\n marginLeft: 0,\n marginRight: 0,\n },\n // Stil pentru rândul de observații\n rowObservatii: {\n display: 'flex',\n flexDirection: 'row',\n marginTop: 0,\n marginBottom: 0,\n marginLeft: 0,\n marginRight: 0,\n width: '770px'\n },\n});\n\n// Definim componente reutilizabile pentru celule, cu dimensiuni fixe\nconst HeaderCell = styled.Text`\n padding: 5px;\n font-size: 8px;\n margin-left: -1px;\n margin-top: -1px;\n border: 1px solid;\n text-align: center;\n`;\n\nconst BodyCell = styled.Text`\n padding: 5px;\n font-size: 8px;\n margin-left: -1px;\n margin-top: -1px;\n border: 1px solid;\n text-align: center;\n`;\n\nconst CellNrCrt = styled(BodyCell)`\n display: flex;\n width: 30px; \n`;\n\nconst CellTipSubprodus = styled(BodyCell)`\n width: 80px;\n`;\n\nconst CellCod = styled(BodyCell)`\n width: 35px;\n`;\n\nconst CellMaterial = styled(BodyCell)`\n width: 55px;\n`;\n\nconst CellDimensiuni = styled(BodyCell)`\n width: 45px;\n`;\n\nconst CellActionare = styled(BodyCell)`\n width: 50px;\n`;\n\nconst CellAx = styled(BodyCell)`\n width: 35px;\n`;\n\nconst CellCuloareComp = styled(BodyCell)`\n width: 60px;\n`;\n\nconst CellOptional = styled(BodyCell)`\n width: 60px;\n`;\n\nconst CellCantitate = styled(BodyCell)`\n width: 40px;\n`;\n\nconst CellPret = styled(BodyCell)`\n width: 70px;\n`;\n\n// Stil pentru celula `CellTotal` fără border\nconst CellTotal = styled.Text`\n width: 100%;\n text-align: right;\n font-size: 15px;\n padding: 15px;\n margin-left: -1px;\n margin-top: -1px;\n /* Eliminăm border-ul */\n`;\n\nconst CellObservatii = styled(BodyCell)`\n width: 100%;\n text-align: left;\n border: 1px solid; /* Adăugăm border pentru observații */\n flex: 1; /* Permite celulei să ocupe tot spațiul pe înălțime */\n`;\n\n// Create Document Component\nconst ContentRO = (props) => (\n \n {/* Capul de tabel */}\n \n Nr. crt \n Tip roleta \n Cod \n Material \n Lungime PANZA \n Lungime FINALA \n Inaltime PANZA \n Inaltime FINALA \n Actionare \n Ax \n Culoare comp. \n Optional 1 \n Optional 2 \n Optional 3 \n Cant. \n Pret(lei) \n \n\n {/* Rândurile tabelului */}\n {props.currentOrder.comandarepers ?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare);\n }).map(item =>\n \n {/* Îmbinarea rândurilor într-un singur container */}\n \n {/* Celula NrCrt ocupă înălțimea ambelor rânduri */}\n {item.nrCrt} \n {/* Primul rând cu detalii produs */}\n \n \n {item.denumireSubProdus} \n {item.codMaterial} \n {item.denumireMaterial} \n {item.lungime} \n {item.lungimeFinala} \n {item.inaltime} \n {item.inaltimeFinala} \n {item.actionareStDr} \n {item.ax} \n {item.denumireCuloareLamela} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.buc} \n {item.pretClientFinal} \n \n\n {/* Al doilea rând pentru observații */}\n {item.observatii ?\n \n Obs.: {item.observatii} \n \n : null\n }\n \n \n \n )\n : Comanda nu are inregistrari \n }\n\n {/* Total fără border */}\n \n {`Total: ${props.currentOrder.valoareClientFinal} lei`} \n \n \n);\n\nexport default ContentRO;\n","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8.5%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:4%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\nconst CellTotalLei = styled.Text`\n padding:5px;\n font-size: 10px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n\n\n\n// Create Document Component\nconst ContentRE = (props) => {\n const valoareLei = ((props.curs * 101/100).toFixed(4)*props.currentOrder.valoareClientFinal).toFixed(2);\n var today = new Date();\n var dd = String(today.getDate()).padStart(2, '0');\n var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!\n var yyyy = today.getFullYear();\n today = dd + '.' + mm + '.' + yyyy;\n return(\n \n \n Nr. crt \n Tip rulou \n Culoare lamela \n Culoare caseta \n Lungime \n Inaltime \n Act. \n Tip actionare \n Optional 1 \n Optional 2 \n Optional 3 \n Optional 4 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareLamela} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.denumireOptional4} \n {item.observatii} \n {item.buc} \n {item.pretClientFinal} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareClientFinal} Euro`} \n {`Total in Lei la cursul BNR+1% din ${today} (1 Euro = ${(props.curs*101/100).toFixed(4)}) : ${valoareLei} Lei`} \n {`Atentie! Valoare in lei se va recalcula la data facturarii, in functie de cursul valutar valabil la data respectiva.`} \n \n \n \n )};\n\nexport default ContentRE","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:4%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\nconst CellTotalLei = styled.Text`\n padding:5px;\n font-size: 10px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentUG = (props) => {\n \n const valoareLei = ((props.curs * 101/100).toFixed(4)*props.currentOrder.valoareClientFinal).toFixed(2);\n var today = new Date();\n var dd = String(today.getDate()).padStart(2, '0');\n var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!\n var yyyy = today.getFullYear();\n today = dd + '.' + mm + '.' + yyyy;\n\n return(\n \n Nr. crt \n Tip rulou \n Culoare lamela \n Culoare caseta \n Lungime \n Inaltime \n Act. \n Tip actionare \n Optional 1 \n Optional 2 \n Optional 3 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareLamela} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.observatii} \n {item.buc} \n {item.pretClientFinal} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareClientFinal} Euro`} \n {`Total in Lei la cursul BNR+1% din ${today} (1 Euro = ${(props.curs*101/100).toFixed(4)}) : ${valoareLei} Lei`} \n {'Atentie! Valoare in lei se va recalcula la data facturarii, in functie de cursul valutar valabil la data respectiva.'} \n \n \n )};\n\nexport default ContentUG","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:17%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\nconst CellTotalLei = styled.Text`\n padding:5px;\n font-size: 10px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentPI = (props) => {\n\n const valoareLei = ((props.curs * 101/100).toFixed(4)*props.currentOrder.valoareClientFinal).toFixed(2);\n var today = new Date();\n var dd = String(today.getDate()).padStart(2, '0');\n var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!\n var yyyy = today.getFullYear();\n today = dd + '.' + mm + '.' + yyyy;\n\n return(\n \n Nr. crt \n Tip rulou \n Culoare \n Lungime \n Inaltime \n Cota \n Optional 1 \n Optional 2 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.observatii} \n {item.buc} \n {item.pretClientFinal} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareClientFinal} Euro`} \n {`Total in Lei la cursul BNR+1% din ${today} (1 Euro = ${(props.curs*101/100).toFixed(4)}) : ${valoareLei} Lei`} \n {`Atentie! Valoare in lei se va recalcula la data facturarii, in functie de cursul valutar valabil la data respectiva.`} \n \n \n )};\n\nexport default ContentPI","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentJO = (props) => (\n \n \n Nr. crt \n Lungime \n Inaltime \n Actionare \n Fixare \n Cod culoare \n Cod culoare 2 \n Lungime betisor actionare \n Cleme prindere metal \n Cant. \n Pret(Lei) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.map(item=>\n \n {item.nrCrt} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireOptional1} \n {item.denumireCuloareLamela} \n {item.culoareComponente} \n {item.lungimeSnur} \n {item.console} \n {item.buc} \n {item.pretClientFinal} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareClientFinal} Lei`} \n \n \n);\n\nexport default ContentJO","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n margin: 10,\n padding: 10,\n flexGrow: 1\n }\n});\n\n// Create Document Component\nconst Footer = () => (\n \n \n \n \n);\n\nexport default Footer","/* eslint-disable react/no-multi-comp */\n/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Page, Document, StyleSheet } from '@react-pdf/renderer';\nimport { Header } from './components';\nimport { ContentJV} from './components';\nimport { ContentRO} from './components';\nimport { ContentRE} from './components';\nimport { ContentUG} from './components';\nimport { ContentPI} from './components';\nimport { ContentJO} from './components';\nimport { Footer } from './components';\n\n// Create styles\nconst styles = StyleSheet.create({\n page: {\n display:'flex',\n flexDirection: 'column',\n justifyContent:'flex-start'\n },\n section: {\n margin: 5,\n padding: 5,\n \n }\n});\nconst ClientOffer = (props) => {\n const {currentProduct, currentOrder, curs}=props\n \n const product = () => {\n switch(currentProduct.cod) {\n case 'jv': \n return ;\n case 'ro': \n return ;\n case 're': \n return ;\n case 'ug': \n return ;\n case 'pi': \n return ;\n case 'jo': \n return ;\n case 'sv': \n return null;\n default: \n return Nici un tip de produs nu este setat \n }\n }\n \n return(\n \n \n \n {product()}\n \n \n \n \n ) \n};\n\n\nexport default ClientOffer\n","/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport { dataFormatRO } from '../../../../utils/functiiComune';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n margin: 10,\n padding: 10,\n display:'flex',\n flexDirection: 'column',\n },\n denumireFirma:{\n marginTop: 25,\n marginLeft:25,\n marginBottom:0,\n },\n linie:{\n marginTop:-15,\n marginLeft:25,\n padding:0,\n },\n dateFirma:{\n marginTop: 0,\n marginLeft:25,\n fontSize:10,\n },\n\n titlu:{\n marginTop: 25,\n marginLeft:25,\n marginBottom:25,\n textAlign:'center',\n fontWeight:'900'\n },\n dateComanda:{\n marginTop: 0,\n marginLeft:25,\n marginBottom:0,\n fontSize:12,\n \n }\n});\n\n// Create Document Component\nconst Header = (props) => {\n return(\n \n {props.currentUser.idFirma.denumire} \n ____________________________________________________________________________ \n {`Cod fiscal:${props.currentUser.idFirma.atributCodFiscal===null?'':props.currentUser.idFirma.atributCodFiscal}${props.currentUser.idFirma.codFiscal}`} \n {`Reg. com.:${props.currentUser.idFirma.regCom}`} \n {`Adresa:${props.currentUser.idFirma.oras}, ${props.currentUser.idFirma.adresa}`} \n {`Telefon:${props.currentUser.idFirma.telefon}`} \n {`Email:${props.currentUser.idFirma.email}`} \n\n {`COMANDA ${props.currentProduct.title.toUpperCase()}`} \n \n\n {`Numar: ${props.currentOrder.id} Data: ${dataFormatRO(props.currentOrder.dataComanda)} Stadiu: ${props.currentOrder.stadiu}`} \n {`Observatii: ${props.currentOrder.observatii}`} \n {`Adresa livrare: ${props.currentOrder.adresaLivrare}`} \n \n \n )\n};\n\nexport default Header","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst Cell = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 10px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentJV = (props) => (\n \n \n Nr. crt | \n Lungime | \n Inaltime | \n Tip desc. | \n Material | \n Cod culoare | \n Lungime snur | \n Console | \n Cantitate | \n Pret(lei) | \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} | \n {item.lungime} | \n {item.inaltime} | \n {item.deschidere} | \n {item.denumireMaterial} | \n {item.codMaterial} | \n {item.lungimeSnur} | \n {item.console} | \n {item.buc} | \n {item.pretCuDiscount} | \n \n )\n \n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareComanda} lei`} \n \n \n);\n\n\n\nexport default ContentJV","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop: 5,\n marginBottom: 5,\n },\n row: {\n display: 'flex',\n flexDirection: 'row',\n marginTop: 0,\n marginBottom: 0,\n marginLeft: 0,\n marginRight: 0,\n },\n // Stil pentru rândul de observații\n rowObservatii: {\n display: 'flex',\n flexDirection: 'row',\n marginTop: 0,\n marginBottom: 0,\n marginLeft: 0,\n marginRight: 0,\n width: '770px'\n },\n});\n\n// Definim componente reutilizabile pentru celule, cu dimensiuni fixe\nconst HeaderCell = styled.Text`\n padding: 5px;\n font-size: 8px;\n margin-left: -1px;\n margin-top: -1px;\n border: 1px solid;\n text-align: center;\n`;\n\nconst BodyCell = styled.Text`\n padding: 5px;\n font-size: 8px;\n margin-left: -1px;\n margin-top: -1px;\n border: 1px solid;\n text-align: center;\n`;\n\nconst CellNrCrt = styled(BodyCell)`\n display: flex;\n width: 30px; \n`;\n\nconst CellTipSubprodus = styled(BodyCell)`\n width: 80px;\n`;\n\nconst CellCod = styled(BodyCell)`\n width: 35px;\n`;\n\nconst CellMaterial = styled(BodyCell)`\n width: 55px;\n`;\n\nconst CellDimensiuni = styled(BodyCell)`\n width: 45px;\n`;\n\nconst CellActionare = styled(BodyCell)`\n width: 50px;\n`;\n\nconst CellAx = styled(BodyCell)`\n width: 35px;\n`;\n\nconst CellCuloareComp = styled(BodyCell)`\n width: 60px;\n`;\n\nconst CellOptional = styled(BodyCell)`\n width: 60px;\n`;\n\nconst CellCantitate = styled(BodyCell)`\n width: 40px;\n`;\n\nconst CellPret = styled(BodyCell)`\n width: 70px;\n`;\n\n// Stil pentru celula `CellTotal` fără border\nconst CellTotal = styled.Text`\n width: 100%;\n text-align: right;\n font-size: 15px;\n padding: 15px;\n margin-left: -1px;\n margin-top: -1px;\n /* Eliminăm border-ul */\n`;\n\nconst CellObservatii = styled(BodyCell)`\n width: 100%;\n text-align: left;\n border: 1px solid; /* Adăugăm border pentru observații */\n flex: 1; /* Permite celulei să ocupe tot spațiul pe înălțime */\n`;\n\n// Create Document Component\nconst ContentRO = (props) => (\n \n {/* Capul de tabel */}\n \n Nr. crt \n Tip roleta \n Cod \n Material \n Lungime PANZA \n Lungime FINALA \n Inaltime PANZA \n Inaltime FINALA \n Actionare \n Ax \n Culoare comp. \n Optional 1 \n Optional 2 \n Optional 3 \n Cant. \n Pret(lei) \n \n\n {/* Rândurile tabelului */}\n {props.currentOrder.comandarepers ?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare);\n }).map(item =>\n \n {/* Îmbinarea rândurilor într-un singur container */}\n \n {/* Celula NrCrt ocupă înălțimea ambelor rânduri */}\n {item.nrCrt} \n {/* Primul rând cu detalii produs */}\n \n \n {item.denumireSubProdus} \n {item.codMaterial} \n {item.denumireMaterial} \n {item.lungime} \n {item.lungimeFinala} \n {item.inaltime} \n {item.inaltimeFinala} \n {item.actionareStDr} \n {item.ax} \n {item.denumireCuloareLamela} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.buc} \n {item.pretCuDiscount} \n \n\n {/* Al doilea rând pentru observații */}\n {item.observatii ?\n \n Obs.: {item.observatii} \n \n : null\n }\n \n \n \n )\n : Comanda nu are inregistrari \n }\n\n {/* Total fără border */}\n \n {`Total: ${props.currentOrder.valoareComanda} lei`} \n \n \n);\n\n\n\nexport default ContentRO","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8.5%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:4%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentRE = (props) => (\n \n \n Nr. crt \n Tip rulou \n Culoare lamela \n Culoare caseta \n Lungime \n Inaltime \n Act. \n Tip actionare \n Optional 1 \n Optional 2 \n Optional 3 \n Optional 4 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareLamela} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.denumireOptional4} \n {item.observatii} \n {item.buc} \n {item.pretCuDiscount} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareComanda} Euro`} \n \n \n);\n\nexport default ContentRE","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:5%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:4%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentUG = (props) => (\n \n \n Nr. crt \n Tip rulou \n Culoare lamela \n Culoare caseta \n Lungime \n Inaltime \n Act. \n Tip actionare \n Optional 1 \n Optional 2 \n Optional 3 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareLamela} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.denumireOptional3} \n {item.observatii} \n {item.buc} \n {item.pretCuDiscount} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareComanda} Euro`} \n \n \n);\n\nexport default ContentUG","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\nconst CellTipSubprodus = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:7%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:9%;\n text-align: center;\n`;\nconst CellObservatii = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:17%;\n text-align: center;\n`;\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentPI = (props) => (\n \n \n Nr. crt \n Tip rulou \n Culoare \n Lungime \n Inaltime \n Cota \n Optional 1 \n Optional 2 \n Observatii \n Cant. \n Pret(euro) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.denumireSubProdus} \n {item.denumireCuloareCaseta} \n {item.lungime} \n {item.inaltime} \n {item.denumireTipActionare} \n {item.denumireOptional1} \n {item.denumireOptional2} \n {item.observatii} \n {item.buc} \n {item.pretCuDiscount} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareComanda} Euro`} \n \n \n);\n\nexport default ContentPI","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport styled from '@react-pdf/styled-components';\n\n\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n marginLeft: 25,\n marginTop:5,\n marginBottom:5\n },\n row: {\n display: 'flex',\n flexDirection:'row',\n marginTop:0,\n marginBottom:0,\n marginLeft: 5,\n marginRight: 5,\n },\n});\n\nconst CellNrCrt = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:3%;\n text-align: center; \n`;\n\nconst CellCulori = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:12%;\n text-align: center;\n`;\nconst CellDimensiuni = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:8%;\n text-align: center;\n`;\nconst CellActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellTipActionare = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellOptional = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\nconst CellCantitate = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:6%;\n text-align: center;\n`;\nconst CellPret = styled.Text`\n padding:5px;\n font-size: 8px;\n margin-left:-1px;\n margin-top:-1px;\n border:1px solid ;\n width:10%;\n text-align: center;\n`;\n\nconst CellTotal = styled.Text`\n padding:15px;\n font-size: 15px;\n margin-left:-1px;\n margin-top:-1px;\n text-align: right;\n width:100%;\n`;\n\n// Create Document Component\nconst ContentJO = (props) => (\n \n \n Nr. crt \n Lungime \n Inaltime \n Actionare \n Fixare \n Cod culoare \n Cod culoare 2 \n Lungime betisor actionare \n Cleme prindere metal \n Cant. \n Pret(Lei) \n \n \n {props.currentOrder.comandarepers?\n props.currentOrder.comandarepers.sort((a, b) => {\n return new Date(a.actionare) - new Date(b.actionare)}).map(item=>\n \n {item.nrCrt} \n {item.lungime} \n {item.inaltime} \n {item.actionareStDr} \n {item.denumireOptional1} \n {item.denumireCuloareLamela} \n {item.culoareComponente} \n {item.lungimeSnur} \n {item.console} \n {item.buc} \n {item.pretCuDiscount} \n \n )\n :Comanda nu are inregistrari \n }\n \n {`Total: ${props.currentOrder.valoareComanda} Lei`} \n \n \n);\n\nexport default ContentJO","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Text, View, StyleSheet } from '@react-pdf/renderer';\nimport { dataFormatRO } from '../../../../utils/functiiComune';\n// Create styles\nconst styles = StyleSheet.create({\n section: {\n margin: 10,\n padding: 10,\n flexGrow: 1\n },\n text:{\n color:'grey',\n marginLeft:25,\n fontSize:10\n }\n});\n\n// Create Document Component\nconst Footer = (props) => (\n \n {`Ultima modificare/transmitere: ${dataFormatRO(props.currentOrder.updated_at)}`} \n \n \n);\n\nexport default Footer","/* eslint-disable react/no-multi-comp */\n/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport { Page, Document, StyleSheet } from '@react-pdf/renderer';\nimport { Header } from './components';\nimport { ContentJV} from './components';\nimport { ContentRO} from './components';\nimport { ContentRE} from './components';\nimport { ContentUG} from './components';\nimport { ContentPI} from './components';\nimport { ContentJO} from './components';\nimport { Footer } from './components';\n\n// Create styles\nconst styles = StyleSheet.create({\n page: {\n display:'flex',\n flexDirection: 'column',\n justifyContent:'flex-start'\n },\n section: {\n margin: 5,\n padding: 5,\n \n }\n});\nconst OrderPrint = (props) => {\n const {currentProduct, currentOrder}=props\n const product = () => {\n switch(currentProduct.cod) {\n case 'jv': \n return ;\n case 'ro': \n return ;\n case 're': \n return ;\n case 'ug': \n return ;\n case 'pi': \n return ;\n case 'jo': \n return ;\n case 'sv': \n return null ;\n default: \n return Nici un tip de produs nu este setat \n }\n }\n \n return(\n \n \n \n \n ) \n};\n\n\nexport default OrderPrint\n","/* eslint-disable linebreak-style */\nimport {createSelector} from 'reselect';\n\nconst selectLookup=state=>state.lookup;\n\nexport const selectLookupProduse= createSelector(\n [selectLookup],\n lookup=>lookup.produse\n);\n\nexport const selectLookupMateriale= createSelector(\n [selectLookup],\n lookup=>lookup.materiale\n);\n\nexport const selectLookupPreturiTabelare= createSelector(\n [selectLookup],\n lookup=>lookup.preturitabelare\n);\n\nexport const selectLookupOptionale= createSelector(\n [selectLookup],\n lookup=>lookup.optionale\n);\n\nexport const selectLookupCulori= createSelector(\n [selectLookup],\n lookup=>lookup.culori\n);\n\nexport const selectLookupInformari= createSelector(\n [selectLookup],\n lookup=>lookup.informari\n);\n\nexport const selectLookupIndicatori= createSelector(\n [selectLookup],\n lookup=>lookup.indicatori\n);\n\nexport const selectLookupFirma= createSelector(\n [selectLookup],\n lookup=>lookup.firma\n);\n\nexport const selectLookupCurs= createSelector(\n [selectLookup],\n lookup=>lookup.curs\n);","/* eslint-disable linebreak-style */\n/* eslint-disable react/jsx-first-prop-new-line */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\n// import { useMediaQuery } from '@material-ui/core';\nimport {Card, Button, colors, Hidden} from '@material-ui/core';\nimport GetAppIcon from '@material-ui/icons/GetApp';\nimport ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';\nimport { withSnackbar } from 'notistack';\nimport { PDFDownloadLink } from '@react-pdf/renderer';\nimport './ordersfooter.css';\nimport ClientOffer from '../../../ClientOffer/ClientOffer'\nimport OrderPrint from '../../../OrderPrint/OrderPrint';\nimport { selectOrderCurrentOrder,selectOrderCurrentProduct} from '../../../../redux/order/order.selectors';\nimport { selectCurrentUser} from '../../../../redux/user/user.selectors';\nimport { selectLookupCurs } from 'redux/lookup/lookup.selectors';\n\n\nconst useStyles = makeStyles((theme) => ({\n root: {},\n alignButton:{\n display:'flex',\n justifyContent: 'flex-end' \n },\n container: {\n width:'100%',\n display:'flex',\n flexDirection: 'row',\n justifyContent: 'space-between', \n flexWrap:'wrap'\n },\n buton:{\n margin:'15px',\n background:colors.blueGrey[500],\n [theme.breakpoints.down('sm')]: {\n margin: '2px' ,\n width: '100px' ,\n height: '30px', \n fontSize:'7px'\n }\n \n },\n fab: {\n margin: theme.spacing(1),\n },\n extendedIcon: {\n marginRight: theme.spacing(1),\n },\n extendedIconGreen:{\n color:'yellow'\n },\n extendedIconRed:{\n color:'red'\n },\n extendedIconOrange:{\n color:'orange'\n }\n}));\n\nconst OrdersFooter = props => {\n const classes = useStyles();\n const { currentUser, currentProduct, currentOrder,history, enqueueSnackbar, curs} = props;\n const handleBack=()=>{\n let path = '/products';\n history.push(path);\n }\n \n const vanzatorVizibilitate=()=>{\n if(currentUser.role.name==='Vanzator'){\n return true;\n }else{\n return false;\n }\n }\n\n return (\n \n \n \n }\n variant=\"contained\"\n >\n Meniu produse\n \n
\n \n { currentOrder.id ?\n \n
}\n fileName=\"oferta.pdf\" \n >\n
}\n variant=\"contained\"\n >\n Oferta pdf\n \n \n
\n }\n fileName=\"comanda.pdf\" \n >\n }\n variant=\"contained\"\n >\n Comanda pdf\n \n \n \n
\n :\n \n \n enqueueSnackbar('Va rog selectati o comanda.',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n }\n size=\"small\"\n startIcon={}\n variant=\"contained\" \n >\n Oferta pdf\n \n \n enqueueSnackbar('Va rog selectati o comanda.',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n }\n size=\"small\"\n startIcon={}\n variant=\"contained\"\n >\n Comanda pdf\n \n
\n }\n \n \n );\n \n}\n\nOrdersFooter.propTypes = {\n className: PropTypes.string,\n currentOrder:PropTypes.object,\n currentProduct:PropTypes.object,\n currentUser:PropTypes.object,\n history:PropTypes.object\n};\n\nconst mapStateToProps=state=>({\n currentOrder:selectOrderCurrentOrder(state),\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n curs:selectLookupCurs(state)\n})\n\nexport default connect(mapStateToProps)(withRouter(withSnackbar(OrdersFooter)));\n","import React from 'react';\nimport { makeStyles } from '@material-ui/styles';\nimport { OrdersTable } from './components';\nimport { OrdersHeader } from './components';\nimport { OrdersFooter } from './components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n }\n}));\n\nconst OrdersList = () => {\n const classes = useStyles();\n return (\n \n
\n
\n
\n
\n
Atentie! Cursul valutar luat in calcul pentru produsele a caror pret este in Euro este cursul BNR+ 1% de la data in care preluam comanda.
\n
Preluarea comenzilor se face in timpul programului de lucru (Luni-Vineri intre orele 09:00-17:00, exceptie facand sarbatorile legale). Pentru comenzile transmise inafara programului de lucru, data preluarii este urmatoarea zi lucratoare.
\n
Din acest motiv, va rugam sa luati in calcul eventuala fluctuatie a cursului la momentul ofertarii catre clientul final.
\n
\n
\n \n );\n};\n\nexport default OrdersList;\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n if(currentItem.lungime>3000 && currentItem.lungime<=5900){\n mesajeEroare.m1m={mesaj:'Pot aparea probleme daca se trimite prin curier.', tip:'Atentionare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(currentItem.lungime>5900 ){\n mesajeEroare.m2m={mesaj:'Nu se poate executa garnisa/sina cu lungimea>5900mm). Se recomanda impartirea in doua bucati cu actionare T8.(Cod T8 care trebuie trecut la Observatii)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(currentItem.inaltime>2800 && currentItem.material===26){\n mesajeEroare.m3m={mesaj: 'Inaltime maxima admisa 2800mm pentru acest tip de material', tip:'Eroare'}\n }else{\n mesajeEroare.m3m={}\n }\n //--------------------------------------------------------------------------------------------\n if(currentItem.inaltime>5500){\n mesajeEroare.m4m={mesaj:'Nu se poate executa un produs cu inaltimea > 5500mm', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //--------------------------------------------------------------------------------------------\n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n//--------------------------------------------------------------------------------------------\nexport const mpJV=(vLungime=0, vInaltime=0,vDeschidere=0)=>{\n switch(vInaltime*1){\n case 0:\n return (vLungime / 1000).toFixed(2)\n default:\n if(vDeschidere==='L'){\n return ((vLungime * 116 * (vInaltime > 1500 ? vInaltime*1 : 1500) * 6 / 10) / 1000000).toFixed(2)\n }else{\n return (vLungime * (vInaltime > 1500 ? vInaltime*1 : 1500) / 1000000).toFixed(2)\n }\n }\n}\n//--------------------------------------------------------------------------------------------\nexport const actJV=(vInaltime=0)=>{\n switch(true){\n case (vInaltime <=0):\n return 1500\n case (vInaltime > 0 && vInaltime <= 800):\n return 800\n case (vInaltime > 800 && vInaltime <= 900) :\n return (vInaltime / 100).toFixed(0)\n case (vInaltime > 900 && vInaltime <= 1200) :\n return ((vInaltime - 100) / 100).toFixed(0) * 100\n case (vInaltime > 1200 && vInaltime <= 2000) :\n return ((vInaltime*1 - 200) / 100).toFixed(0) * 100\n case (vInaltime > 2000) :\n return ((vInaltime*1 - 300) / 100).toFixed(0) * 100\n default:\n return 0\n } \n}\n//--------------------------------------------------------------------------------------------\nexport const pretJV=(vMP=0,vPretMaterial=0,vConsole=0,vPretConsole=0,vBuc)=>{\n return ((vMP * vPretMaterial + vConsole * vPretConsole) * vBuc).toFixed(2)\n}\n//--------------------------------------------------------------------------------------------\n\nexport const carucioareJV = (vLungime=0, vDeschidere='0', vTipMaterial='0') => {\n let paritate;\n if (vTipMaterial==='89'){\n switch(vDeschidere){\n case '1':\n case '2':\n case 'DA':\n return round40( (vLungime*1 - 20) / 89 );\n case '3':\n paritate=round40( (vLungime*1 - 20) / 89 ) % 2 === 0 ? 0 : 1;\n if(paritate===0){\n return round40( (vLungime*1 - 20) / 89 );\n }else{\n return round40( (vLungime*1 - 20) / 89 ) + 1;\n }\n case '4':\n paritate=round49( (vLungime*1 - 20) / 89 ) % 2 === 0 ? 0 : 1;\n if(paritate===0){\n return round49( (vLungime*1 - 20) / 89 );\n }else{\n return round49( (vLungime*1 - 20) / 89 ) + 1;\n }\n case 'L':\n return round49(vLungime*1);\n default:\n return 0\n }\n \n }else{\n\n switch(vDeschidere){\n case '1':\n case '2':\n case 'DA':\n return round49( vLungime*1 / 116 )\n case '3':\n paritate=round40( (vLungime*1) / 116 ) % 2 === 0 ? 0 : 1\n if(paritate===0){\n return round40( (vLungime*1) / 116 )\n }else{\n return round40( (vLungime*1) / 116 ) + 1\n }\n case '4':\n paritate=round49( (vLungime*1) / 116 ) % 2 === 0 ? 0 : 1\n if(paritate===0){\n return round49( (vLungime*1) / 116 )\n }else{\n return round49( (vLungime*1) / 116 ) + 1\n }\n case 'L':\n return round49(vLungime*1)\n default:\n return 0\n }\n }\n}\n\n//----------------------------------------------------------------------------------------------\n\nexport const round49 = (n=0) => {\n let nr = n*1 - Math.floor(n)\n if(nr<=49/100){\n return Math.floor(n)\n }else{\n return Math.floor(n) + 1\n }\n}\n\n//----------------------------------------------------------------------------------------------\nexport const round40 = (n=0) => {\n let nr = n*1 - Math.floor(n);\n if(nr<=40/100){\n return Math.floor(n)\n }else{\n return Math.floor(n) + 1\n }\n}\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport {selectLookupOptionale, selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpJV, actJV, pretJV, carucioareJV} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.fieldsMaterial = { text: 'denumire', value: 'key' };\n this.fieldsDeschidere={ text: 'denumire', value: 'value' };\n this.deschideri=[\n {denumire:'1',key:'1', atentionare:'Ati selectat o actionare prin care lamelele se vor strange in partea cu snurul de actionare (stanga sau dreapta).'},\n {denumire:'2',key:'2', atentionare:'Ati selectat o actionare prin care lamelele se vor strange in partea opusa snurului de actionare (stanga sau dreapta).'},\n {denumire:'3',key:'3', atentionare:'Ati selectat o actionare prin care lamelele se vor strange stanga-dreapta, tip[ Cortina (jumatate stangasi cealata jumatate in dreapta).'}, \n {denumire:'4',key:'4', atentionare:'Ati selectat o actionare prin care lamelele se vor strange invers tip Cortina (toate pe mijlocul garnisei).'},\n {denumire:'L',key:'L', atentionare:'Doriti sa dati in executie doar lamelele de jaluzele, fara garnisa (trebuie sa introduceti la casuta Lungime numarul de lamele, ex.23).'}, \n {denumire:'DA',key:'DA', atentionare:'Doriti sa dati in executie o garnisa cu dubla actionare (snurul de actionare de ambele parti, care actioneaza independent lungimi diferite de garnisa).'}]\n \n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeMaterial= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem, materiale}=this.props;\n let key = 'material';\n let key2='denumireMaterial'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?materiale.filter(mat=>mat.denumire===e.target.value && mat.tipProdus.toUpperCase()==='JV')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareMaterial(e)\n }, 501);\n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeDeschidere= (e)=>{\n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'deschidere';\n let value = ''; \n if (currentItem){\n value=e.target.value\n }\n setCurrentItem({...currentItem, [key]: value})\n debounce(this.calculMp,500)()\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n this.handleAtentionareDeschidere(e)\n }, 501);\n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='console'){\n debounce(this.handleAtentionareConsole,500)()\n debounce(this.calculPretCatalog,500)()\n }\n\n if(key==='inaltime'){\n debounce(this.calculLungimeSnur,500)()\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n }\n if(key==='lungime'){\n debounce(this.calculLungimeSnur,500)()\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n }\n if(key==='buc'){\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n }\n\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n //-------------------------------------------------------------------------------------------------------------------\n calculLungimeSnur= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, lungimeSnur:actJV(currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpJV(currentItem.lungime, currentItem.inaltime,currentItem.deschidere)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{\n const pretConsole=this.props.optionale.filter(optional=>optional.key===1)[0].pret \n \n const {currentItem, setCurrentItem, materiale,currentUser}=this.props \n const pretMaterialSelectat=materiale.filter(mat=>(mat.key===currentItem.material && mat.tipProdus.toUpperCase()==='JV'))[0]?materiale.filter(mat=>(mat.key===currentItem.material && mat.tipProdus.toUpperCase()==='JV'))[0].pret:0\n const discount=currentUser.idFirma.discountJV\n const adaos=currentUser.idFirma.adaosJV\n const pretCatalog=pretJV(mpJV(currentItem.lungime, currentItem.inaltime, currentItem.deschidere),pretMaterialSelectat,currentItem.console,pretConsole,currentItem.buc)\n const pretCuDiscount=(pretJV(mpJV(currentItem.lungime, currentItem.inaltime, currentItem.deschidere),pretMaterialSelectat,currentItem.console,pretConsole,currentItem.buc)*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretJV(mpJV(currentItem.lungime, currentItem.inaltime, currentItem.deschidere),pretMaterialSelectat,currentItem.console,pretConsole,currentItem.buc)*(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n \n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareMaterial=(e)=>{\n const {currentItem, materiale, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=materiale.filter(mat=>mat.denumire===e.target.value && mat.tipProdus.toUpperCase()==='JV')[0].atentionare\n var denumireMaterial=materiale.filter(mat=>mat.denumire===e.target.value && mat.tipProdus.toUpperCase()==='JV')[0].denumire \n }\n if(mesaj){\n enqueueSnackbar(denumireMaterial+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n \n\n }\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareDeschidere=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.deschideri.filter(des=>des.denumire===e.target.value)[0].atentionare\n var denumireDeschidere=this.deschideri.filter(des=>des.denumire===e.target.value)[0].denumire \n }\n if(mesaj){\n enqueueSnackbar('Tip deschidere: ' + denumireDeschidere+' - '+ mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareConsole=(e)=>{\n const {enqueueSnackbar}=this.props\n enqueueSnackbar('Va rugam sa specificati la observatii ce tip de console se doresc: SIMPLE 10cm , REGLABILE 10-15cm, PRELUNGITOR 10-20cm.',{ \n variant: 'warning',\n },20000)\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleCarucioare=()=>{\n const {currentItem, materiale}=this.props\n let tipMaterial = materiale.filter(material=>material.key===currentItem.material && material.tipProdus.toUpperCase()==='JV')[0] ? materiale.filter(material=>material.key===currentItem.material && material.tipProdus.toUpperCase()==='JV')[0].tipMaterial:'0'\n return carucioareJV(currentItem.lungime, currentItem.deschidere, tipMaterial)\n }\n\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n render() { \n const {currentItem, openEditItem, materiale, errors}=this.props \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n optionale:selectLookupOptionale(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport {mpJV} from './functii';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentJV extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n //...........................\n this.deschideri=[{key:'1',value:'T1'}, {key:'2',value:'T2'}, {key:'3',value:'T3'}, {key:'4',value:'T4'}, {key:'L',value:'LAMELE'},{key:'D', value:'DUBLA DESCHIDERE'}]\n //........................... \n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Lei';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n\n if((args.column).field === 'lungime' && args.data && args.cell) {\n if (getValue('lungime', args.data) > 3000){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'lungime' && args.data && args.cell) {\n if (getValue('lungime', args.data) > 5900){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'inaltime' && args.data && args.cell) {\n if (getValue('inaltime', args.data) > 5500){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'inaltime' && args.data && args.cell) {\n if (getValue('inaltime', args.data) > 2800 && getValue('material', args.data)===26){\n args.cell.classList.add('error');\n } \n }\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Lei )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n //...........................\n calculatedMp=(data)=> {\n return mpJV(data.lungime, data.inaltime,data.deschidere)\n };\n //........................... \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n \n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \n\ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\n\nrender(){\n const {updatedOrder}=this.props;\n this.calculatedMp=this.calculatedMp.bind(this);\n return (\n \n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n );\n} \n}\n\nOrderContentJV.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentJV)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n if(currentItem.lungime===currentItem.lungimeFinala && currentItem.lungime && currentItem.lungimeFinala){\n mesajeEroare.m1m={mesaj:'Nu ati completat corect lungimea.(Lungime Panza nu are cum sa fie egala cu Lungime Finala).', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n\n if(currentItem.inaltime===currentItem.inaltimeFinala && currentItem.inaltime && currentItem.inaltimeFinala){\n mesajeEroare.m2m={mesaj:'Nu ati completat corect inaltimea.(Inaltime Panza nu are cum sa fie egala cu Inaltime Finala).', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,3].includes(currentItem.tipSubprodus) && currentItem.material===8 && currentItem.inaltime>2200){\n mesajeEroare.m3m={mesaj:'Materialul nu incape in caseta.(Inaltimea trebuie sa fie mai mica de 2200).', tip:'Eroare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([5,6].includes(currentItem.tipSubprodus) && currentItem.inaltime>1800){\n mesajeEroare.m4m={mesaj:'Materialul nu incape in caseta.(Inaltimea trebuie sa fie mai mica de 1800).', tip:'Atentionare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2].includes(currentItem.tipSubprodus) && currentItem.lungime>1500 && currentItem.ax==='MIC'){\n mesajeEroare.m5m={mesaj:'Recomandare ax MARE sau 32mm).', tip:'Atentionare'}\n }else{\n mesajeEroare.m5m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([2,3,5,6].includes(currentItem.tipSubprodus) && currentItem.lungime>1700){\n mesajeEroare.m6m={mesaj:'Lungime prea mare.(Inaltime maxima 1700).', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(currentItem.mp>2.4 && currentItem.ax==='MIC'){\n mesajeEroare.m7m={mesaj:'Pentru dimensiunile introduse, axul trebuie sa fie MARE sau 32mm.', tip:'Eroare'}\n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7,8,9].includes(currentItem.tipSubprodus) && currentItem.inaltime>2500){\n mesajeEroare.m8m={mesaj:'Inaltime prea mare.(Inaltime maxima 2500).', tip:'Eroare'}\n }else{\n mesajeEroare.m8m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([2,3,5,6].includes(currentItem.tipSubprodus) && (currentItem.lungimeFinala-currentItem.lungime)<35){\n mesajeEroare.m9m={mesaj:'Sub 35mm intre cota totala si cota panza, sunati!!', tip:'Atentionare'}\n }else{\n mesajeEroare.m9m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([2,3,5,6].includes(currentItem.tipSubprodus) && (currentItem.lungimeFinala-currentItem.lungime)>50){\n mesajeEroare.m10m={mesaj:'Peste 50mm intre cota totala si cota panza, sunati!!', tip:'Atentionare'}\n }else{\n mesajeEroare.m10m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([7,8].includes(currentItem.tipSubprodus) && currentItem.lungime<350){\n mesajeEroare.m11m={mesaj:'Lungime prea mica.(Lungime minima 350).', tip:'Eroare'}\n }else{\n mesajeEroare.m11m={}\n }\n //--------------------------------------------------------------------------------------------\n \n if([2,3,5,6,9].includes(currentItem.tipSubprodus) && (currentItem.ax==='MARE' || currentItem.ax==='32mm')){\n mesajeEroare.m12m={mesaj:'Pentru roleta selectata nu se accepta decat ax MIC).', tip:'Eroare'}\n }else{\n mesajeEroare.m12m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([1,4].includes(currentItem.tipSubprodus) && (currentItem.lungimeFinala-currentItem.lungime)!==35 && currentItem.ax==='MIC'){\n if(currentItem.lungimeFinala>0 && currentItem.lungime>0){\n mesajeEroare.m13m={mesaj:' In cazul acestui tip de roleta diferenta dintre LungimePanza si LungimeFinala trebuie sa fie = 35mm pentru Ax MIC!!', tip:'Atentionare'}\n }else{\n mesajeEroare.m13m={}\n }\n }else{\n mesajeEroare.m13m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n if([1,4].includes(currentItem.tipSubprodus) && (currentItem.lungimeFinala-currentItem.lungime)!==40 && (currentItem.ax==='MARE' || currentItem.ax==='32mm')){\n if(currentItem.lungimeFinala>0 && currentItem.lungime>0){\n mesajeEroare.m14m={mesaj:' In cazul acestui tip de roleta diferenta dintre LungimePanza si LungimeFinala trebuie sa fie = 40mm pentru Ax MARE sau 32mm!!', tip:'Atentionare'}\n }else{\n mesajeEroare.m13m={}\n }\n }else{\n mesajeEroare.m14m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,3,5,6].includes(currentItem.tipSubprodus) && currentItem.inaltimeFinala<=0){\n mesajeEroare.m15m={mesaj:'La acest tip de roleta, completarea inaltimii finale este obligatorie!', tip:'Eroare'}\n }else{\n mesajeEroare.m15m={}\n }\n //--------------------------------------------------------------------------------------------\n \n // if(currentItem.tipSubprodus===4 && currentItem.ax==='32mm'){\n // mesajeEroare.m16m={mesaj:'Pentru roleta selectata nu se accepta momentan ax de 32mm.', tip:'Eroare'}\n // }else{\n // mesajeEroare.m16m={}\n // }\n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n// var rutaPrincipala; setul de inregistari returnat de ruta : http://larexirwebstore.com/produses?tipProdus=RO&_limit=1000&_sort=denumire:ASC\n\nexport const mpRo = (lungime=0, lungimeFinala=0, inaltime=0, inaltimeFinala=0, tipSubprodus=0, ax='MIC')=> {// returneaza valoarea campului mp\n var cotaLungime;// lungime luata in calcul dupa anumite criterii\n var cotaInaltime;// inaltime luata in calcul dupa anumite crietii\n\n // stabilire valoare variabila cotaLungime\n switch(tipSubprodus) {\n case 7:\n case 8:\n case 9:\n cotaLungime=lungime*1; \n break;\n default :\n if (lungime >= lungimeFinala) {\n cotaLungime = lungime*1;\n } else {\n cotaLungime = lungimeFinala*1 - (ax==='MIC' ? 35 : 40);\n } \n } \n\n // stabilire valoare variabila cotaInaltime\n cotaInaltime = (inaltime >= inaltimeFinala ? inaltime*1 : inaltimeFinala*1);\n \n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 1:\n case 4:\n case 7:\n case 8:\n case 9:\n return (cotaLungime * cotaInaltime/1000000 > 0.7 ? cotaLungime * cotaInaltime / 1000000 : 0.7).toFixed(2)\n \n case 10:\n return ( cotaInaltime / 1000 > 1.5 ? cotaLungime * cotaInaltime / 1000000 : cotaLungime * 1500 / 1000000).toFixed(2);\n \n default:\n return (lungime * cotaInaltime / 1000000 > 0.7 ? lungime * cotaInaltime / 1000000 : 0.7).toFixed(2);\n } \n\n}\n\n//--------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretRo=(produse,tipSubprodus=0, material=0,lungime=0,lungimeFinala=0,inaltime=0,inaltimeFinala=0,ax='MIC', optional1=0, optional2=0, optional3=0, culoarecomp=0, vBuc=0)=>{ // returneaza pretul unitar pe metru patrat marit cu procentul suplimentar dat de optionalele selectate.\n var pretRoleta; // stocheaza pretul pe mp al roletei in functie de material\n var suplimentOptional1; // stocheaza procentul ce se aplica pretului roletei in functie de procentulSuplimentar setat la nivel de nomenclator optionale\n var suplimentOptional2; // -//-\n var suplimentOptional3; // -//-\n var suplimentAx32=5;// supliment procent pentru ax32mm // modificat aici 03.10.2022 15:00\n var suplimentCuloareComponente; // stocheaza procentul ce se aplica pretului roletei in functie de culoarea componentelor setat la nivel de nomenclator culori\n var vProdus= produse.find(produs => produs.key===tipSubprodus);\n var vOptional1= vProdus? vProdus.optionaleCompatibile.find(opt => opt.key === optional1) : {};\n var vOptional2=vProdus? vProdus.optionaleCompatibile.find(opt=> opt.key === optional2):{};\n var vOptional3=vProdus? vProdus.optionaleCompatibile.find(opt=> opt.key === optional3):{};\n var vCuloareComponente=vProdus? vProdus.culoriCompatibile.find(culoare=> culoare.key === culoarecomp):{};\n var vSuplimentAx32= (ax==='32mm'?suplimentAx32:0) // modificat aici 27.10.2022\n\n \n // pret material\n\n if (vProdus) { // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n pretRoleta = vProdus.materialeCompatibile.find(mat => mat.key === material) ? vProdus.materialeCompatibile.find(mat => mat.key === material).pret*1:0\n }else{ \n pretRoleta = 0\n }\n\n //precentSuplimentar datorat optionalului 1\n if (vProdus && vOptional1) { // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n suplimentOptional1 = vOptional1.procentSuplimentar*1 \n }else{ \n suplimentOptional1 = 0\n }\n\n //precentSuplimentar datorat optionalului 2\n if (vProdus && vOptional2) { // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n suplimentOptional2 = vOptional2.procentSuplimentar*1 \n }else{ \n suplimentOptional2 = 0\n }\n\n //precentSuplimentar datorat optionalului 3\n if (vProdus && vOptional3) { // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n suplimentOptional3 = vOptional3.procentSuplimentar*1 \n }else{ \n suplimentOptional3 = 0\n }\n\n //precentSuplimentar datorat culorii componentelor\n if (vProdus && vCuloareComponente) { // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n suplimentCuloareComponente = vCuloareComponente.procentSuplimentar*1 \n }else{ \n suplimentCuloareComponente = 0\n }\n //preturi optionale\n\n var pretOptional1=pretOptional(produse,optional1, lungime, inaltime, lungimeFinala, inaltimeFinala, tipSubprodus, ax)*1\n var pretOptional2=pretOptional(produse,optional2, lungime, inaltime, lungimeFinala, inaltimeFinala, tipSubprodus, ax)*1\n var pretOptional3=pretOptional(produse,optional3, lungime, inaltime, lungimeFinala, inaltimeFinala, tipSubprodus, ax)*1\n \n return (pretRoleta * (1 + (suplimentOptional1 + suplimentOptional2 + suplimentOptional3 + suplimentCuloareComponente + vSuplimentAx32) / 100)* mpRo (lungime, lungimeFinala, inaltime, inaltimeFinala, tipSubprodus, ax) + pretOptional1 + pretOptional2 + pretOptional3).toFixed(2) * vBuc;\n// modificat aici 27.10.2022^ adaugat vSuplimentAx32 in formula\n}\n\n//--------------------------------------------------------------------------------------------------------------------------------------\nexport const pretOptional=(produse,optional=0, lungime=0, inaltime=0, lungimeFinala=0, inaltimeFinala=0, tipSubprodus=0, ax='MIC')=>{\n var cotaInaltime = (inaltime>=inaltimeFinala ? inaltime : inaltimeFinala - 40);\n var cotaLungime = cotaPanza(lungime,lungimeFinala,tipSubprodus,ax) + 20;\n var vProdus= produse.find(produs => produs.key===tipSubprodus);\n var vOptional= vProdus? vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax):{}\n\n if (vProdus && vOptional){\n\n switch(optional) { \n case 7:\n case 8:\n case 9:\n case 28: \n case 29: \n case 30:\n case 34: \n return vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax).pret * (lungime===0 || lungime===''? cotaLungime : lungime*1 + 20) / 1000;\n case 27: \n return vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax).pret * (lungime===0 || lungime===''? cotaLungime-15 : lungime*1 + 5) / 1000;\n case 10:\n case 35:\n case 36: \n case 37:\n case 38:\n case 15:\n case 39:\n case 40:\n case 41:\n case 42: \n return vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax).pret * (inaltime===0 || inaltime===''? 2 * cotaInaltime : 2 * inaltime) / 1000; \n case 11:\n return vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax).pret * (lungime===0 || lungime==='' ? lungimeFinala*1 - 10 : lungime*1 + 30) / 1000;\n \n default :\n \n return vProdus.optionaleCompatibile.find(opt => opt.key === optional && opt.ax=== ax).pret*1; \n }\n }else{\n return 0;\n }\n}\n\n//--------------------------------------------------------------------------------------------------------------------------------------\nexport const cotaPanza=(lungime=0, lungimeFinala=0, tipSubprodus=0, ax='MIC')=>{\n switch(tipSubprodus) {\n case 1:\n case 4:\n if (lungime >= lungimeFinala){\n return lungimeFinala*1; \n } else {\n return lungimeFinala*1 - (ax==='MIC' ? 35 : 40);\n }\n case 7:\n return lungime*1 + 15;\n case 8 :\n return lungime*1 - 30;\n case 9 :\n return lungime*1 + 20;\n default :\n return lungime*1;\n } \n} \n\n\n\n\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicSort, dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport {selectLookupProduse, selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpRo, pretRo} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props);\n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='RO'):[]; \n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n if(currentItem.material || currentItem.denumireMaterial || currentItem.optional1 || currentItem.denumireOptional1 || currentItem.optional2 || currentItem.denumireOptional2 || currentItem.optional3 || currentItem.denumireOptional3 || currentItem.culoareLamela || currentItem.denumireCuloareLamela || currentItem.actionareStDr || currentItem.ax || currentItem.lungime || currentItem.lungimeFinala || currentItem.inaltime || currentItem.inaltimeFinala || currentItem.codMaterial) {\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, material:0, denumireMaterial:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:'', culoareLamela:0, denumireCuloareLamela:'', actionareStDr:'', ax:'', lungime:'',lungimeFinala:'',inaltime:'', inaltimeFinala:'', codMaterial:''})\n } else{\n setCurrentItem({...currentItem, [key]: value, [key2]:value2});\n }\n\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n resetErrors();\n this.handleAtentionareTipSubprodus(e)\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeMaterial= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'material';\n let key2='denumireMaterial'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].materialeCompatibile.filter(material=>material.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, codMaterial:''})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareMaterial(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCod= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'codMaterial';\n let value = e.target.value;\n setCurrentItem({...currentItem, [key]: value});\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCod(e)\n }, 501);\n }\n \n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeAx= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'ax';\n let value = e.target.value;\n \n setCurrentItem({...currentItem, [key]: value, optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:''}) \n debounce(this.calculPretCatalog,500)()\n \n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n\n\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='COMPONENTA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='lungimeFinala' || key==='inaltime' || key==='inaltimeFinala' || key==='ax' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpRo(currentItem.lungime,currentItem.lungimeFinala, currentItem.inaltime, currentItem.inaltimeFinala,currentItem.tipSubprodus, currentItem.ax)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountRO\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n \n const adaos=currentUser.idFirma.adaosRO\n const pretCatalog=(pretRo(this.produse, currentItem.tipSubprodus, currentItem.material, currentItem.lungime, currentItem.lungimeFinala, currentItem.inaltime, currentItem.inaltimeFinala, currentItem.ax, currentItem.optional1, currentItem.optional2, currentItem.optional3,currentItem.culoareLamela, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n \n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n \n handleAtentionareMaterial=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].materialeCompatibile.filter(material=>material.key===currentItem.material)[0].atentionare:''\n var denumireMaterial=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].materialeCompatibile.filter(material=>material.key===currentItem.material)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireMaterial+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n handleAtentionareCod=(e)=>{\n const {currentItem, materiale, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=materiale.filter(mat=>mat.key===currentItem.material && mat.tipProdus.toUpperCase()==='RO')[0].coduris.filter(cod=>cod.denumire===currentItem.codMaterial)[0]?materiale.filter(mat=>mat.key===currentItem.material && mat.tipProdus.toUpperCase()==='RO')[0].coduris.filter(cod=>cod.denumire===currentItem.codMaterial)[0].atentionare:''\n var denumireCod=currentItem.codMaterial\n }\n if(mesaj){\n enqueueSnackbar(denumireCod+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n }\n }\n \n\n //-------------------------------------------------------------------------------------------------------------------\n\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='COMPONENTA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='COMPONENTA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, produse, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.ax===currentItem.ax)[0].atentionare:''\n var denumireOptional1=produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.ax===currentItem.ax)[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.ax===currentItem.ax)[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.ax===currentItem.ax)[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.ax===currentItem.ax)[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.ax===currentItem.ax)[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },15000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleCotePanza=()=>{\n const {currentItem, produse}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let cotePanza=produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].cotePanza:'DA'\n return cotePanza==='NU'? true:false\n }\n return false\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleCoteFinale=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let coteFinale=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].coteFinale:'NU'\n return coteFinale==='NU'? true:false\n }\n return true\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleActionare=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareActionare=[7,8].includes(currentItem.tipSubprodus)?true:false\n return dezactivareActionare\n }\n return false\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAx=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareAx=[7,8].includes(currentItem.tipSubprodus)?true:false\n return dezactivareAx\n }\n return false\n }\n }\n\n handleLungimeRequired=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let require=[1,4].includes(currentItem.tipSubprodus)?false:true\n return require\n }\n return true\n }\n }\n\n handleInaltimeRequired=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let require=[1,4].includes(currentItem.tipSubprodus)?false:true\n return require\n }\n return true\n }\n }\n\n handleInaltimeFinalaRequired=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let require=[2,3,5,6].includes(currentItem.tipSubprodus)?true:false\n return require\n }\n return false\n }\n }\n\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n \n\n render() { \n const {currentItem, openEditItem, materiale, errors}=this.props \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n materiale:selectLookupMateriale(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport {mpRo} from './functii';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentRO extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Lei';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'ax' && args.data && args.cell) {\n if ([1,2].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 1500 && getValue('ax', args.data)==='MIC' ){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'lungimeFinala' && args.data && args.cell) {\n if ([2,3,5,6].includes(getValue('tipSubprodus', args.data)) && (getValue('lungimeFinala', args.data) - getValue('lungime', args.data))<35 ){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'lungimeFinala' && args.data && args.cell) {\n if ([2,3,5,6].includes(getValue('tipSubprodus', args.data)) && (getValue('lungimeFinala', args.data) - getValue('lungime', args.data))>50 ){\n args.cell.classList.add('error');\n } \n }\n\n }\n //........................... \n\n\n\n\n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Lei )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n //...........................\n calculatedMp=(data)=> {\n return mpRo(data.lungime, data.lungimeFinala,data.inaltime,data.inaltimeFinala,data.tipSubprodus,data.ax)\n };\n //........................... \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica' ){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n this.calculatedMp=this.calculatedMp.bind(this);\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
*)rubrica CULOARE COMP. VECHI nu se mai foloseste, s-a adaugat o rubrica noua cu selectie dintr-o lista de culori prestabilita ce va influenta pretul.(ex. ANTRACIT +5%)
\n
\n \n \n );\n} \n}\n\nOrderContentRO.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentRO)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>6){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>6)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.lungime>2500){\n mesajeEroare.m3m={mesaj:'Latime mare, recomandare lamela 45mm(L>2000)', tip:'Atentionare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,6].includes(currentItem.tipSubprodus) && currentItem.lungime>2000){\n mesajeEroare.m4m={mesaj:'Latime prea mare,probleme de functionare', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>5){\n mesajeEroare.m5m={mesaj:'Recomandare lamela de 45mm!(mp>5)', tip:'Atentionare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([1,3].includes(currentItem.optional1) || [1,3].includes(currentItem.optional2)|| [1,3].includes(currentItem.optional3) || [1,3].includes(currentItem.optional4)) && currentItem.tipSubprodus===2){\n mesajeEroare.m6m={mesaj:'La ruloul cu plasa este incompatibil optionalul ZAVOR SIMPLU si INCUIETOARE CU CHEIE.', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2,3].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m7m={mesaj:'Se recomanda TABACHERA CU MANIVELA MARE SAU MOTOR! (mp>3)', tip:'Atentionare'}\n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([4,11,12].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m8m={mesaj:'Trebuie selectat MOTOR MARE pentru rulourile cu peste 3mp!', tip:'Eroare'}\n }else{\n mesajeEroare.m8m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m9m={mesaj:'Latime prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m9m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.mp>2.7){\n mesajeEroare.m10m={mesaj:'Suprafata prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m10m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.lungime>4800) || ([9].includes(currentItem.tipSubprodus) && currentItem.lungime>3800)){\n mesajeEroare.m11m={mesaj:'Latimea prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m11m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.inaltime>3500) || ([9].includes(currentItem.tipSubprodus) && currentItem.inaltime>3000)){\n mesajeEroare.m12m={mesaj:'Inaltime prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m12m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru RE sunt in acest moment 2348.\n//rutaPretTabelar va returna deci 2348 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=RE&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=RE&_limit=100000 \n\n\n\nexport const mpRe=(tipSubprodus=0,lungime=0, inaltime=0)=> { // returneaza valoarea campului mp\n \n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 3: // cazul PLASA IN RULOU LATERALA\n case 4: // cazul PLASA IN RULOU CENTRAL\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7\n default:\n return ((lungime * inaltime) / 1000000).toFixed(2);\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretRe=(produse,tipSubprodus=0, lungime=0, inaltime=0, culoareLamela=0, culoareCaseta=0, tipActionare=0, optional1=0, optional2=0, optional3=0, optional4, preturitabelare, buc=0)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n \n var pretTabel;\n var pretFix;\n var procentCuloareLamele;\n var procentCuloareCaseta;\n var pretActionare;\n var pretOptional1;\n var pretOptional2;\n var pretOptional3;\n var pretOptional4;\n var cotaLungime;\n var cotaInaltime;\n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100===0 ){\n cotaLungime=(lungime>500 ? lungime : 500) *1 \n }else{\n cotaLungime=((Math.floor(lungime / 100)*100 +100)>500 ? (Math.floor(lungime/100)*100 +100) : 500) *1\n }\n \n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100===0 ){\n cotaInaltime=(inaltime>500 ? inaltime : 500)*1 || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100) * 100 + 100) > 500 ? (Math.floor(inaltime / 100) * 100 + 100) : 500)*1 \n }\n \n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= preturitabelare.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus===tipSubprodus) \n // var vProdus=preturitabelare.find(produs => produs.key===tipSubprodus)\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentCuloareLamela= produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareLamela && culoare.componenta==='LAMELA')\n \n var vProcentculoareCaseta=produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n \n }else{ \n \n vProcentCuloareLamela = undefined\n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret\n \n }else{ \n pretTabel=0 \n \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul ruloului se calculeaza pe metru patrat )\n \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA\n case 4: // PLASA IN RULOU CENTRAL\n case 10: //TRANSPARENT CU CAPSE \n if(vProdus){\n pretFix = vProdus.pretMP * mpRe(tipSubprodus,lungime,inaltime) ; \n }else{\n pretFix=0\n } \n break; \n default:\n pretFix = 0; \n } \n \n // extragere variabila procentCuloareLamele procent suplimentar datorat culorii lamelelor\n if(vProcentCuloareLamela){\n procentCuloareLamele =vProcentCuloareLamela.procentSuplimentar;\n }else{\n procentCuloareLamele=0\n }\n \n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar;\n }else{\n procentCuloareCaseta=0;\n } \n \n //extragere variabila pretActionare pret actionare\n pretActionare =functiePretActionare(produse,tipSubprodus,tipActionare) ;\n switch(tipActionare) {\n case 4: //MOTOR MIC + INTRERUPATOR (INACTIVAT INLOCUIT DE 22)\n case 11: // MOTOR MIC + TELECOMANDA(INACTIVAT INLOCUIT DE 20)\n case 12: // MOTOR MARE + RECEPTOR(INACTIVAT)\n case 22: // MOTOR MIC PT INTRERUPATOR\n case 20: // MOTOR MIC PT TELECOMANDA\n if(lungime <= 650) {\n pretActionare = pretActionare+3\n }\n break;\n case 10: // MOTOR MARE+INTRERUPATOR (INACTIVAT INLOCUIT DE 23)\n case 23: //MOTOR MARE PT INTRERUPATOR\n if (((lungime * inaltime) / 1000000)> 65/100) {\n pretActionare = pretActionare+5\n }\n break;\n case 21: // MOTOR MARE + TELECOMANDA\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 16\n }\n break;\n case 23: // MOTOR MARE PT INTRERUPATOR\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59 ){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 14\n }\n break;\n default:\n pretActionare = pretActionare\n break;\n }\n // preturi optionale\n pretOptional1=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional1);\n \n pretOptional2=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional2);\n \n pretOptional3=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional3);\n\n pretOptional4=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional4);\n\n // stabilire rezultat functie \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA - pret pe mp\n case 4: // PLASA IN RULOU CENTRAL - pret pe mp \n case 10: //TRANSPARENT CU CAPSE - pret pe mp \n if(pretFix === 0){\n console.log('Eroare: Nu exista pret pentru aceste produse!!!');\n return 0; // trebuie sa genereze un mesaj de atentionare \"Eroare: Nu exista pret pentru aceste produse!!!\"\n }else{\n //Atentie se ia in calcul doar procentul suplimentar de la culoare caseta\n return (pretFix * (100 + procentCuloareCaseta*1) / 100 + pretActionare*1 + pretOptional1*1 + pretOptional2*1 + pretOptional3*1 + pretOptional4*1).toFixed(2) * buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n\n default:\n if(pretTabel+ pretFix === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n\n }else{\n return ((pretFix+pretTabel) * (100 + procentCuloareLamele*1 + procentCuloareCaseta*1)/100 + pretActionare*1 + pretOptional1*1+ pretOptional2*1+ pretOptional3*1 + pretOptional4*1).toFixed(2)* buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n } \n \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse,tipSubprodus=0,lungime=0, inaltime=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretRe \n var dimensiuneOptional;\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n var nrClemeAntiefractie;\n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional=produse.find(produs => produs.key===tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ //..........................\n // stabilire valoare variabila nrClemeAntiefractie, ce intra in calculul anumitor optionale\n switch(true) { \n case (lungime<=1300):\n nrClemeAntiefractie = 2;\n break; \n case (lungime<=1600):\n nrClemeAntiefractie = 3;\n break; \n case (lungime<=2300):\n nrClemeAntiefractie = 4;\n break; \n case (lungime<=2800):\n nrClemeAntiefractie = 5;\n break;\n default:\n nrClemeAntiefractie = 6;\n } \n\n // exista optionale care au dimensiuni in functie de lungime si inaltime \n switch(optionalX) { \n case 28: // PROFIL INCHIDERE GHIDAJ*\n dimensiuneOptional= (lungime*1 - 106) / 1000;\n break;\n case 29: // CORNIER INCHIDERE20X20*\n dimensiuneOptional= lungime / 1000;\n break;\n case 30: // PROFIL SUB TENCUIALA*\n dimensiuneOptional= lungime * 2 / 1000;\n break;\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n dimensiuneOptional= (lungime*1 + 2 * inaltime) / 1000\n break;\n case 55 : // GHIDAJE DUBLE APLICATE\n dimensiuneOptional= (2 * inaltime) / 1000\n break;\n case 56 : // CORNIER INCHIDERE 20X40\n dimensiuneOptional= lungime / 1000;\n break;\n default:\n dimensiuneOptional=1;\n } \n\n //stabilire valoare rezultat functie \n\n switch(optionalX) { \n case 27: // CLEME ANTIEFRACTIE*\n return Number(vPretOptional.pret * nrClemeAntiefractie);\n case 28: // PROFIL INCHIDERE GHIDAJ*\n case 29: // CORNIER INCHIDERE*\n case 30: // PROFIL SUB TENCUIALA*\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n case 55 : // GHIDAJE DUBLE APLICATE\n case 56 : // CORNIER INCHIDERE 20X40\n return vPretOptional.pret * dimensiuneOptional ; \n \n default:\n return vPretOptional.pret * 1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n } \n }else{ //..........................\n return 0\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nconst functiePretActionare=(produse,tipSubprodus=0,tipActionare=0)=>{ // functie folosita in cadrul functiei pretRe \n \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretActionare=produse.find(produs => produs.key===tipSubprodus).actionariCompatibile.find(actionare => actionare.key === tipActionare)\n }else{ \n return 0;\n }\n\n if(vPretActionare){\n return vPretActionare.pret*1\n }else{\n return 0\n }\n}","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicSort, dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport { selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpRe, pretRe} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='RE'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='RE'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareLamela:0, culoareCaseta:0, denumireCuloareLamela:'',denumireCuloareCaseta:'',tipActionare:0, denumireTipActionare:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', optional3:0, denumireOptional3:'', optional4:0, denumireOptional4:'', actionareStDr:''})\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n this.handleAtentionareTipSubprodus(e);\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='LAMELA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, optional1:0,denumireOptional1:'',optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:'',optional4:0, denumireOptional4:''})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional4= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional4';\n let key2='denumireOptional4'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional4(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpRe(currentItem.tipSubprodus,currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountRE\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const adaos=currentUser.idFirma.adaosRE\n\n const pretCatalog=(pretRe(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.culoareCaseta,currentItem.tipActionare, currentItem.optional1, currentItem.optional2,currentItem.optional3,currentItem.optional4,this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional4=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional4=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional4+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleActionare=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareActionare=[4].includes(currentItem.tipSubprodus)?true:false\n return dezactivareActionare\n }\n return false\n }\n }\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n render() { \n const {currentItem, openEditItem, errors}=this.props \n \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentRE extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'lungime' && args.data && args.cell) {\n if ([1,2,6].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 2500 ){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([8,9,10].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 5 ){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([1,2,3].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 3 ){\n args.cell.classList.add('atention');\n } \n }\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentRE.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentRE)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>6){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>6)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.lungime>2500){\n mesajeEroare.m3m={mesaj:'Latime mare, recomandare lamela 45mm(L>2000)', tip:'Atentionare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,6].includes(currentItem.tipSubprodus) && currentItem.lungime>2000){\n mesajeEroare.m4m={mesaj:'Latime prea mare,probleme de functionare', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>5){\n mesajeEroare.m5m={mesaj:'Recomandare lamela de 45mm!(mp>5)', tip:'Atentionare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([1,3].includes(currentItem.optional1) || [1,3].includes(currentItem.optional2)|| [1,3].includes(currentItem.optional3) || [1,3].includes(currentItem.optional4)) && currentItem.tipSubprodus===2){\n mesajeEroare.m6m={mesaj:'La ruloul cu plasa este incompatibil optionalul ZAVOR SIMPLU si INCUIETOARE CU CHEIE.', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2,3].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m7m={mesaj:'Se recomanda TABACHERA CU MANIVELA MARE SAU MOTOR! (mp>3)', tip:'Atentionare'}\n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([4,11,12].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m8m={mesaj:'Trebuie selectat MOTOR MARE pentru rulourile cu peste 3mp!', tip:'Eroare'}\n }else{\n mesajeEroare.m8m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m9m={mesaj:'Latime prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m9m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.mp>2.7){\n mesajeEroare.m10m={mesaj:'Suprafata prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m10m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.lungime>4800) || ([9].includes(currentItem.tipSubprodus) && currentItem.lungime>3800)){\n mesajeEroare.m11m={mesaj:'Latimea prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m11m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.inaltime>3500) || ([9].includes(currentItem.tipSubprodus) && currentItem.inaltime>3000)){\n mesajeEroare.m12m={mesaj:'Inaltime prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m12m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru RE sunt in acest moment 2348.\n//rutaPretTabelar va returna deci 2348 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=RE&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=RE&_limit=100000 \n\n\n\nexport const mpRe=(tipSubprodus=0,lungime=0, inaltime=0)=> { // returneaza valoarea campului mp\n \n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 3: // cazul PLASA IN RULOU LATERALA\n case 4: // cazul PLASA IN RULOU CENTRAL\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7\n default:\n return ((lungime * inaltime) / 1000000).toFixed(2);\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretRe=(produse,tipSubprodus=0, lungime=0, inaltime=0, culoareLamela=0, culoareCaseta=0, tipActionare=0, optional1=0, optional2=0, optional3=0, optional4, preturitabelare, buc=0)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n \n var pretTabel;\n var pretFix;\n var procentCuloareLamele;\n var procentCuloareCaseta;\n var pretActionare;\n var pretOptional1;\n var pretOptional2;\n var pretOptional3;\n var pretOptional4;\n var cotaLungime;\n var cotaInaltime;\n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100===0 ){\n cotaLungime=(lungime>500 ? lungime : 500) *1 \n }else{\n cotaLungime=((Math.floor(lungime / 100)*100 +100)>500 ? (Math.floor(lungime/100)*100 +100) : 500) *1\n }\n \n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100===0 ){\n cotaInaltime=(inaltime>500 ? inaltime : 500)*1 || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100) * 100 + 100) > 500 ? (Math.floor(inaltime / 100) * 100 + 100) : 500)*1 \n }\n \n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= preturitabelare.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus===tipSubprodus) \n // var vProdus=preturitabelare.find(produs => produs.key===tipSubprodus)\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentCuloareLamela= produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareLamela && culoare.componenta==='LAMELA')\n \n var vProcentculoareCaseta=produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n \n }else{ \n \n vProcentCuloareLamela = undefined\n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret\n \n }else{ \n pretTabel=0 \n \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul ruloului se calculeaza pe metru patrat )\n \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA\n case 4: // PLASA IN RULOU CENTRAL\n case 10: //TRANSPARENT CU CAPSE \n if(vProdus){\n pretFix = vProdus.pretMP * mpRe(tipSubprodus,lungime,inaltime) ; \n }else{\n pretFix=0\n } \n break; \n default:\n pretFix = 0; \n } \n \n // extragere variabila procentCuloareLamele procent suplimentar datorat culorii lamelelor\n if(vProcentCuloareLamela){\n procentCuloareLamele =vProcentCuloareLamela.procentSuplimentar;\n }else{\n procentCuloareLamele=0\n }\n \n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar;\n }else{\n procentCuloareCaseta=0;\n } \n \n //extragere variabila pretActionare pret actionare\n pretActionare =functiePretActionare(produse,tipSubprodus,tipActionare) ;\n switch(tipActionare) {\n case 4: //MOTOR MIC + INTRERUPATOR (INACTIVAT INLOCUIT DE 22)\n case 11: // MOTOR MIC + TELECOMANDA(INACTIVAT INLOCUIT DE 20)\n case 12: // MOTOR MARE + RECEPTOR(INACTIVAT)\n case 22: // MOTOR MIC PT INTRERUPATOR\n case 20: // MOTOR MIC PT TELECOMANDA\n if(lungime <= 650) {\n pretActionare = pretActionare+3\n }\n break;\n case 10: // MOTOR MARE+INTRERUPATOR (INACTIVAT INLOCUIT DE 23)\n case 23: //MOTOR MARE PT INTRERUPATOR\n if (((lungime * inaltime) / 1000000)> 65/100) {\n pretActionare = pretActionare+5\n }\n break;\n case 21: // MOTOR MARE + TELECOMANDA\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 16\n }\n break;\n case 23: // MOTOR MARE PT INTRERUPATOR\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59 ){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 14\n }\n break;\n default:\n pretActionare = pretActionare\n break;\n }\n // preturi optionale\n pretOptional1=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional1);\n \n pretOptional2=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional2);\n \n pretOptional3=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional3);\n\n pretOptional4=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional4);\n\n // stabilire rezultat functie \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA - pret pe mp\n case 4: // PLASA IN RULOU CENTRAL - pret pe mp \n case 10: //TRANSPARENT CU CAPSE - pret pe mp \n if(pretFix === 0){\n console.log('Eroare: Nu exista pret pentru aceste produse!!!');\n return 0; // trebuie sa genereze un mesaj de atentionare \"Eroare: Nu exista pret pentru aceste produse!!!\"\n }else{\n //Atentie se ia in calcul doar procentul suplimentar de la culoare caseta\n return (pretFix * (100 + procentCuloareCaseta*1) / 100 + pretActionare*1 + pretOptional1*1 + pretOptional2*1 + pretOptional3*1 + pretOptional4*1).toFixed(2) * buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n\n default:\n if(pretTabel+ pretFix === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n\n }else{\n return ((pretFix+pretTabel) * (100 + procentCuloareLamele*1 + procentCuloareCaseta*1)/100 + pretActionare*1 + pretOptional1*1+ pretOptional2*1+ pretOptional3*1 + pretOptional4*1).toFixed(2)* buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n } \n \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse,tipSubprodus=0,lungime=0, inaltime=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretRe \n var dimensiuneOptional;\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n var nrClemeAntiefractie;\n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional=produse.find(produs => produs.key===tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ //..........................\n // stabilire valoare variabila nrClemeAntiefractie, ce intra in calculul anumitor optionale\n switch(true) { \n case (lungime<=1300):\n nrClemeAntiefractie = 2;\n break; \n case (lungime<=1600):\n nrClemeAntiefractie = 3;\n break; \n case (lungime<=2300):\n nrClemeAntiefractie = 4;\n break; \n case (lungime<=2800):\n nrClemeAntiefractie = 5;\n break;\n default:\n nrClemeAntiefractie = 6;\n } \n\n // exista optionale care au dimensiuni in functie de lungime si inaltime \n switch(optionalX) { \n case 28: // PROFIL INCHIDERE GHIDAJ*\n dimensiuneOptional= (lungime*1 - 106) / 1000;\n break;\n case 29: // CORNIER INCHIDERE20X20*\n dimensiuneOptional= lungime / 1000;\n break;\n case 30: // PROFIL SUB TENCUIALA*\n dimensiuneOptional= lungime * 2 / 1000;\n break;\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n dimensiuneOptional= (lungime*1 + 2 * inaltime) / 1000\n break;\n case 55 : // GHIDAJE DUBLE APLICATE\n dimensiuneOptional= (2 * inaltime) / 1000\n break;\n case 56 : // CORNIER INCHIDERE 20X40\n dimensiuneOptional= lungime / 1000;\n break;\n default:\n dimensiuneOptional=1;\n } \n\n //stabilire valoare rezultat functie \n\n switch(optionalX) { \n case 27: // CLEME ANTIEFRACTIE*\n return Number(vPretOptional.pret * nrClemeAntiefractie);\n case 28: // PROFIL INCHIDERE GHIDAJ*\n case 29: // CORNIER INCHIDERE*\n case 30: // PROFIL SUB TENCUIALA*\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n case 55 : // GHIDAJE DUBLE APLICATE\n case 56 : // CORNIER INCHIDERE 20X40\n return vPretOptional.pret * dimensiuneOptional ; \n \n default:\n return vPretOptional.pret * 1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n } \n }else{ //..........................\n return 0\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nconst functiePretActionare=(produse,tipSubprodus=0,tipActionare=0)=>{ // functie folosita in cadrul functiei pretRe \n \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretActionare=produse.find(produs => produs.key===tipSubprodus).actionariCompatibile.find(actionare => actionare.key === tipActionare)\n }else{ \n return 0;\n }\n\n if(vPretActionare){\n return vPretActionare.pret*1\n }else{\n return 0\n }\n}","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport { selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpRe, pretRe} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='RE'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='RE'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareLamela:0, culoareCaseta:0, denumireCuloareLamela:'',denumireCuloareCaseta:'',tipActionare:0, denumireTipActionare:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', optional3:0, denumireOptional3:'', optional4:0, denumireOptional4:'', actionareStDr:''})\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n this.handleAtentionareTipSubprodus(e);\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='LAMELA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, optional1:0,denumireOptional1:'',optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:'',optional4:0, denumireOptional4:''})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional4= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional4';\n let key2='denumireOptional4'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional4(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpRe(currentItem.tipSubprodus,currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountRE\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const adaos=currentUser.idFirma.adaosRE\n\n const pretCatalog=(pretRe(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.culoareCaseta,currentItem.tipActionare, currentItem.optional1, currentItem.optional2,currentItem.optional3,currentItem.optional4,this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional4=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional4=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional4+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleActionare=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareActionare=[4].includes(currentItem.tipSubprodus)?true:false\n return dezactivareActionare\n }\n return false\n }\n }\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n render() { \n const {currentItem, openEditItem, errors}=this.props \n \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentREA extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'lungime' && args.data && args.cell) {\n if ([1,2,6].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 2500 ){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([8,9,10].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 5 ){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([1,2,3].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 3 ){\n args.cell.classList.add('atention');\n } \n }\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentREA.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentREA)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>6){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>6)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.lungime>2500){\n mesajeEroare.m3m={mesaj:'Latime mare, recomandare lamela 45mm(L>2000)', tip:'Atentionare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,6].includes(currentItem.tipSubprodus) && currentItem.lungime>2000){\n mesajeEroare.m4m={mesaj:'Latime prea mare,probleme de functionare', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>5){\n mesajeEroare.m5m={mesaj:'Recomandare lamela de 45mm!(mp>5)', tip:'Atentionare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([1,3].includes(currentItem.optional1) || [1,3].includes(currentItem.optional2)|| [1,3].includes(currentItem.optional3) || [1,3].includes(currentItem.optional4)) && currentItem.tipSubprodus===2){\n mesajeEroare.m6m={mesaj:'La ruloul cu plasa este incompatibil optionalul ZAVOR SIMPLU si INCUIETOARE CU CHEIE.', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2,3].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m7m={mesaj:'Se recomanda TABACHERA CU MANIVELA MARE SAU MOTOR! (mp>3)', tip:'Atentionare'}\n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([4,11,12].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m8m={mesaj:'Trebuie selectat MOTOR MARE pentru rulourile cu peste 3mp!', tip:'Eroare'}\n }else{\n mesajeEroare.m8m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m9m={mesaj:'Latime prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m9m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.mp>2.7){\n mesajeEroare.m10m={mesaj:'Suprafata prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m10m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.lungime>4800) || ([9].includes(currentItem.tipSubprodus) && currentItem.lungime>3800)){\n mesajeEroare.m11m={mesaj:'Latimea prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m11m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.inaltime>3500) || ([9].includes(currentItem.tipSubprodus) && currentItem.inaltime>3000)){\n mesajeEroare.m12m={mesaj:'Inaltime prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m12m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru RE sunt in acest moment 2348.\n//rutaPretTabelar va returna deci 2348 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=RE&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=RE&_limit=100000 \n\n\n\nexport const mpRe=(tipSubprodus=0,lungime=0, inaltime=0)=> { // returneaza valoarea campului mp\n \n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 3: // cazul PLASA IN RULOU LATERALA\n case 4: // cazul PLASA IN RULOU CENTRAL\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7\n default:\n return ((lungime * inaltime) / 1000000).toFixed(2);\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretRe=(produse,tipSubprodus=0, lungime=0, inaltime=0, culoareLamela=0, culoareCaseta=0, tipActionare=0, optional1=0, optional2=0, optional3=0, optional4, preturitabelare, buc=0)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n \n var pretTabel;\n var pretFix;\n var procentCuloareLamele;\n var procentCuloareCaseta;\n var pretActionare;\n var pretOptional1;\n var pretOptional2;\n var pretOptional3;\n var pretOptional4;\n var cotaLungime;\n var cotaInaltime;\n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100===0 ){\n cotaLungime=(lungime>500 ? lungime : 500) *1 \n }else{\n cotaLungime=((Math.floor(lungime / 100)*100 +100)>500 ? (Math.floor(lungime/100)*100 +100) : 500) *1\n }\n \n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100===0 ){\n cotaInaltime=(inaltime>500 ? inaltime : 500)*1 || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100) * 100 + 100) > 500 ? (Math.floor(inaltime / 100) * 100 + 100) : 500)*1 \n }\n \n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= preturitabelare.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus===tipSubprodus) \n // var vProdus=preturitabelare.find(produs => produs.key===tipSubprodus)\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentCuloareLamela= produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareLamela && culoare.componenta==='LAMELA')\n \n var vProcentculoareCaseta=produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n \n }else{ \n \n vProcentCuloareLamela = undefined\n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret\n \n }else{ \n pretTabel=0 \n \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul ruloului se calculeaza pe metru patrat )\n \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA\n case 4: // PLASA IN RULOU CENTRAL\n case 10: //TRANSPARENT CU CAPSE \n if(vProdus){\n pretFix = vProdus.pretMP * mpRe(tipSubprodus,lungime,inaltime) ; \n }else{\n pretFix=0\n } \n break; \n default:\n pretFix = 0; \n } \n \n // extragere variabila procentCuloareLamele procent suplimentar datorat culorii lamelelor\n if(vProcentCuloareLamela){\n procentCuloareLamele =vProcentCuloareLamela.procentSuplimentar;\n }else{\n procentCuloareLamele=0\n }\n \n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar;\n }else{\n procentCuloareCaseta=0;\n } \n \n //extragere variabila pretActionare pret actionare\n pretActionare =functiePretActionare(produse,tipSubprodus,tipActionare) ;\n switch(tipActionare) {\n case 4: //MOTOR MIC + INTRERUPATOR (INACTIVAT INLOCUIT DE 22)\n case 11: // MOTOR MIC + TELECOMANDA(INACTIVAT INLOCUIT DE 20)\n case 12: // MOTOR MARE + RECEPTOR(INACTIVAT)\n case 22: // MOTOR MIC PT INTRERUPATOR\n case 20: // MOTOR MIC PT TELECOMANDA\n if(lungime <= 650) {\n pretActionare = pretActionare+3\n }\n break;\n case 10: // MOTOR MARE+INTRERUPATOR (INACTIVAT INLOCUIT DE 23)\n case 23: //MOTOR MARE PT INTRERUPATOR\n if (((lungime * inaltime) / 1000000)> 65/100) {\n pretActionare = pretActionare+5\n }\n break;\n case 21: // MOTOR MARE + TELECOMANDA\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 16\n }\n break;\n case 23: // MOTOR MARE PT INTRERUPATOR\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59 ){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 14\n }\n break;\n default:\n pretActionare = pretActionare\n break;\n }\n // preturi optionale\n pretOptional1=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional1);\n \n pretOptional2=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional2);\n \n pretOptional3=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional3);\n\n pretOptional4=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional4);\n\n // stabilire rezultat functie \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA - pret pe mp\n case 4: // PLASA IN RULOU CENTRAL - pret pe mp \n case 10: //TRANSPARENT CU CAPSE - pret pe mp \n if(pretFix === 0){\n console.log('Eroare: Nu exista pret pentru aceste produse!!!');\n return 0; // trebuie sa genereze un mesaj de atentionare \"Eroare: Nu exista pret pentru aceste produse!!!\"\n }else{\n //Atentie se ia in calcul doar procentul suplimentar de la culoare caseta\n return (pretFix * (100 + procentCuloareCaseta*1) / 100 + pretActionare*1 + pretOptional1*1 + pretOptional2*1 + pretOptional3*1 + pretOptional4*1).toFixed(2) * buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n\n default:\n if(pretTabel+ pretFix === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n\n }else{\n return ((pretFix+pretTabel) * (100 + procentCuloareLamele*1 + procentCuloareCaseta*1)/100 + pretActionare*1 + pretOptional1*1+ pretOptional2*1+ pretOptional3*1 + pretOptional4*1).toFixed(2)* buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n } \n \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse,tipSubprodus=0,lungime=0, inaltime=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretRe \n var dimensiuneOptional;\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n var nrClemeAntiefractie;\n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional=produse.find(produs => produs.key===tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ //..........................\n // stabilire valoare variabila nrClemeAntiefractie, ce intra in calculul anumitor optionale\n switch(true) { \n case (lungime<=1300):\n nrClemeAntiefractie = 2;\n break; \n case (lungime<=1600):\n nrClemeAntiefractie = 3;\n break; \n case (lungime<=2300):\n nrClemeAntiefractie = 4;\n break; \n case (lungime<=2800):\n nrClemeAntiefractie = 5;\n break;\n default:\n nrClemeAntiefractie = 6;\n } \n\n // exista optionale care au dimensiuni in functie de lungime si inaltime \n switch(optionalX) { \n case 28: // PROFIL INCHIDERE GHIDAJ*\n dimensiuneOptional= (lungime*1 - 106) / 1000;\n break;\n case 29: // CORNIER INCHIDERE20X20*\n dimensiuneOptional= lungime / 1000;\n break;\n case 30: // PROFIL SUB TENCUIALA*\n dimensiuneOptional= lungime * 2 / 1000;\n break;\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n dimensiuneOptional= (lungime*1 + 2 * inaltime) / 1000\n break;\n case 55 : // GHIDAJE DUBLE APLICATE\n dimensiuneOptional= (2 * inaltime) / 1000\n break;\n case 56 : // CORNIER INCHIDERE 20X40\n dimensiuneOptional= lungime / 1000;\n break;\n default:\n dimensiuneOptional=1;\n } \n\n //stabilire valoare rezultat functie \n\n switch(optionalX) { \n case 27: // CLEME ANTIEFRACTIE*\n return Number(vPretOptional.pret * nrClemeAntiefractie);\n case 28: // PROFIL INCHIDERE GHIDAJ*\n case 29: // CORNIER INCHIDERE*\n case 30: // PROFIL SUB TENCUIALA*\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n case 55 : // GHIDAJE DUBLE APLICATE\n case 56 : // CORNIER INCHIDERE 20X40\n return vPretOptional.pret * dimensiuneOptional ; \n \n default:\n return vPretOptional.pret * 1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n } \n }else{ //..........................\n return 0\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nconst functiePretActionare=(produse,tipSubprodus=0,tipActionare=0)=>{ // functie folosita in cadrul functiei pretRe \n \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretActionare=produse.find(produs => produs.key===tipSubprodus).actionariCompatibile.find(actionare => actionare.key === tipActionare)\n }else{ \n return 0;\n }\n\n if(vPretActionare){\n return vPretActionare.pret*1\n }else{\n return 0\n }\n}","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport { selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpRe, pretRe} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='RE'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='RE'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareLamela:0, culoareCaseta:0, denumireCuloareLamela:'',denumireCuloareCaseta:'',tipActionare:0, denumireTipActionare:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', optional3:0, denumireOptional3:'', optional4:0, denumireOptional4:'', actionareStDr:''})\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n this.handleAtentionareTipSubprodus(e);\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='LAMELA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, optional1:0,denumireOptional1:'',optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:'',optional4:0, denumireOptional4:''})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional4= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional4';\n let key2='denumireOptional4'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional4(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpRe(currentItem.tipSubprodus,currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountRE\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const adaos=currentUser.idFirma.adaosRE\n\n const pretCatalog=(pretRe(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.culoareCaseta,currentItem.tipActionare, currentItem.optional1, currentItem.optional2,currentItem.optional3,currentItem.optional4,this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional4=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional4=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional4+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleActionare=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareActionare=[4].includes(currentItem.tipSubprodus)?true:false\n return dezactivareActionare\n }\n return false\n }\n }\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n render() { \n const {currentItem, openEditItem, errors}=this.props \n \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentRES extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'lungime' && args.data && args.cell) {\n if ([1,2,6].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 2500 ){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([8,9,10].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 5 ){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([1,2,3].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 3 ){\n args.cell.classList.add('atention');\n } \n }\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentRES.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentRES)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>6){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>6)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.lungime>2500){\n mesajeEroare.m3m={mesaj:'Latime mare, recomandare lamela 45mm(L>2000)', tip:'Atentionare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2,6].includes(currentItem.tipSubprodus) && currentItem.lungime>2000){\n mesajeEroare.m4m={mesaj:'Latime prea mare,probleme de functionare', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([8,9,10].includes(currentItem.tipSubprodus) && currentItem.mp>5){\n mesajeEroare.m5m={mesaj:'Recomandare lamela de 45mm!(mp>5)', tip:'Atentionare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([1,3].includes(currentItem.optional1) || [1,3].includes(currentItem.optional2)|| [1,3].includes(currentItem.optional3) || [1,3].includes(currentItem.optional4)) && currentItem.tipSubprodus===2){\n mesajeEroare.m6m={mesaj:'La ruloul cu plasa este incompatibil optionalul ZAVOR SIMPLU si INCUIETOARE CU CHEIE.', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2,3].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m7m={mesaj:'Se recomanda TABACHERA CU MANIVELA MARE SAU MOTOR! (mp>3)', tip:'Atentionare'}\n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([4,11,12].includes(currentItem.tipActionare) && currentItem.mp>3){\n mesajeEroare.m8m={mesaj:'Trebuie selectat MOTOR MARE pentru rulourile cu peste 3mp!', tip:'Eroare'}\n }else{\n mesajeEroare.m8m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m9m={mesaj:'Latime prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m9m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.mp>2.7){\n mesajeEroare.m10m={mesaj:'Suprafata prea mare pentru produsul selectat, recomandare RULOU DE ALUMINIU!', tip:'Eroare'}\n }else{\n mesajeEroare.m10m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.lungime>4800) || ([9].includes(currentItem.tipSubprodus) && currentItem.lungime>3800)){\n mesajeEroare.m11m={mesaj:'Latimea prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m11m={}\n }\n //-------------------------------------------------------------------------------------------- \n if(([8].includes(currentItem.tipSubprodus) && currentItem.inaltime>3500) || ([9].includes(currentItem.tipSubprodus) && currentItem.inaltime>3000)){\n mesajeEroare.m12m={mesaj:'Inaltime prea mare, incercati sa divizati ruloul!', tip:'Eroare'}\n }else{\n mesajeEroare.m12m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru RE sunt in acest moment 2348.\n//rutaPretTabelar va returna deci 2348 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=RE&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=RE&_limit=100000 \n\n\n\nexport const mpRe=(tipSubprodus=0,lungime=0, inaltime=0)=> { // returneaza valoarea campului mp\n \n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 3: // cazul PLASA IN RULOU LATERALA\n case 4: // cazul PLASA IN RULOU CENTRAL\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7\n default:\n return ((lungime * inaltime) / 1000000).toFixed(2);\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretRe=(produse,tipSubprodus=0, lungime=0, inaltime=0, culoareLamela=0, culoareCaseta=0, tipActionare=0, optional1=0, optional2=0, optional3=0, optional4, preturitabelare, buc=0)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n \n var pretTabel;\n var pretFix;\n var procentCuloareLamele;\n var procentCuloareCaseta;\n var pretActionare;\n var pretOptional1;\n var pretOptional2;\n var pretOptional3;\n var pretOptional4;\n var cotaLungime;\n var cotaInaltime;\n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100===0 ){\n cotaLungime=(lungime>500 ? lungime : 500) *1 \n }else{\n cotaLungime=((Math.floor(lungime / 100)*100 +100)>500 ? (Math.floor(lungime/100)*100 +100) : 500) *1\n }\n \n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100===0 ){\n cotaInaltime=(inaltime>500 ? inaltime : 500)*1 || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100) * 100 + 100) > 500 ? (Math.floor(inaltime / 100) * 100 + 100) : 500)*1 \n }\n \n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= preturitabelare.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus===tipSubprodus) \n // var vProdus=preturitabelare.find(produs => produs.key===tipSubprodus)\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentCuloareLamela= produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareLamela && culoare.componenta==='LAMELA')\n \n var vProcentculoareCaseta=produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n \n }else{ \n \n vProcentCuloareLamela = undefined\n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret\n \n }else{ \n pretTabel=0 \n \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul ruloului se calculeaza pe metru patrat )\n \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA\n case 4: // PLASA IN RULOU CENTRAL\n case 10: //TRANSPARENT CU CAPSE \n if(vProdus){\n pretFix = vProdus.pretMP * mpRe(tipSubprodus,lungime,inaltime) ; \n }else{\n pretFix=0\n } \n break; \n default:\n pretFix = 0; \n } \n \n // extragere variabila procentCuloareLamele procent suplimentar datorat culorii lamelelor\n if(vProcentCuloareLamela){\n procentCuloareLamele =vProcentCuloareLamela.procentSuplimentar;\n }else{\n procentCuloareLamele=0\n }\n \n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar;\n }else{\n procentCuloareCaseta=0;\n } \n \n //extragere variabila pretActionare pret actionare\n pretActionare =functiePretActionare(produse,tipSubprodus,tipActionare) ;\n switch(tipActionare) {\n case 4: //MOTOR MIC + INTRERUPATOR (INACTIVAT INLOCUIT DE 22)\n case 11: // MOTOR MIC + TELECOMANDA(INACTIVAT INLOCUIT DE 20)\n case 12: // MOTOR MARE + RECEPTOR(INACTIVAT)\n case 22: // MOTOR MIC PT INTRERUPATOR\n case 20: // MOTOR MIC PT TELECOMANDA\n if(lungime <= 650) {\n pretActionare = pretActionare+3\n }\n break;\n case 10: // MOTOR MARE+INTRERUPATOR (INACTIVAT INLOCUIT DE 23)\n case 23: //MOTOR MARE PT INTRERUPATOR\n if (((lungime * inaltime) / 1000000)> 65/100) {\n pretActionare = pretActionare+5\n }\n break;\n case 21: // MOTOR MARE + TELECOMANDA\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 16\n }\n break;\n case 23: // MOTOR MARE PT INTRERUPATOR\n if( optional1 !== 48 && optional2 !== 48 && optional3!== 48 && optional4!== 48 && optional1 !== 59 && optional2 !== 59 && optional3!== 59 && optional4!== 59 ){ //' daca optionalul este diferit de LegaturaCardanicaPtCon + Manivela sau LegaturaCardanicaPtCon\n pretActionare = pretActionare\n }else{\n pretActionare = pretActionare + 14\n }\n break;\n default:\n pretActionare = pretActionare\n break;\n }\n // preturi optionale\n pretOptional1=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional1);\n \n pretOptional2=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional2);\n \n pretOptional3=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional3);\n\n pretOptional4=functiePretOptional(produse,tipSubprodus,lungime, inaltime, optional4);\n\n // stabilire rezultat functie \n switch(tipSubprodus) { \n case 3: // PLASA IN RULOU LATERALA - pret pe mp\n case 4: // PLASA IN RULOU CENTRAL - pret pe mp \n case 10: //TRANSPARENT CU CAPSE - pret pe mp \n if(pretFix === 0){\n console.log('Eroare: Nu exista pret pentru aceste produse!!!');\n return 0; // trebuie sa genereze un mesaj de atentionare \"Eroare: Nu exista pret pentru aceste produse!!!\"\n }else{\n //Atentie se ia in calcul doar procentul suplimentar de la culoare caseta\n return (pretFix * (100 + procentCuloareCaseta*1) / 100 + pretActionare*1 + pretOptional1*1 + pretOptional2*1 + pretOptional3*1 + pretOptional4*1).toFixed(2) * buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n\n default:\n if(pretTabel+ pretFix === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n\n }else{\n return ((pretFix+pretTabel) * (100 + procentCuloareLamele*1 + procentCuloareCaseta*1)/100 + pretActionare*1 + pretOptional1*1+ pretOptional2*1+ pretOptional3*1 + pretOptional4*1).toFixed(2)* buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }\n } \n \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse,tipSubprodus=0,lungime=0, inaltime=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretRe \n var dimensiuneOptional;\n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n var nrClemeAntiefractie;\n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional=produse.find(produs => produs.key===tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ //..........................\n // stabilire valoare variabila nrClemeAntiefractie, ce intra in calculul anumitor optionale\n switch(true) { \n case (lungime<=1300):\n nrClemeAntiefractie = 2;\n break; \n case (lungime<=1600):\n nrClemeAntiefractie = 3;\n break; \n case (lungime<=2300):\n nrClemeAntiefractie = 4;\n break; \n case (lungime<=2800):\n nrClemeAntiefractie = 5;\n break;\n default:\n nrClemeAntiefractie = 6;\n } \n\n // exista optionale care au dimensiuni in functie de lungime si inaltime \n switch(optionalX) { \n case 28: // PROFIL INCHIDERE GHIDAJ*\n dimensiuneOptional= (lungime*1 - 106) / 1000;\n break;\n case 29: // CORNIER INCHIDERE20X20*\n dimensiuneOptional= lungime / 1000;\n break;\n case 30: // PROFIL SUB TENCUIALA*\n dimensiuneOptional= lungime * 2 / 1000;\n break;\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n dimensiuneOptional= (lungime*1 + 2 * inaltime) / 1000\n break;\n case 55 : // GHIDAJE DUBLE APLICATE\n dimensiuneOptional= (2 * inaltime) / 1000\n break;\n case 56 : // CORNIER INCHIDERE 20X40\n dimensiuneOptional= lungime / 1000;\n break;\n default:\n dimensiuneOptional=1;\n } \n\n //stabilire valoare rezultat functie \n\n switch(optionalX) { \n case 27: // CLEME ANTIEFRACTIE*\n return Number(vPretOptional.pret * nrClemeAntiefractie);\n case 28: // PROFIL INCHIDERE GHIDAJ*\n case 29: // CORNIER INCHIDERE*\n case 30: // PROFIL SUB TENCUIALA*\n case 31: // COMPENSARE 40X20*\n case 32: // COMPENSARE 50X20*\n case 33: // COMPENSARE 40X40*\n case 55 : // GHIDAJE DUBLE APLICATE\n case 56 : // CORNIER INCHIDERE 20X40\n return vPretOptional.pret * dimensiuneOptional ; \n \n default:\n return vPretOptional.pret * 1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n } \n }else{ //..........................\n return 0\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nconst functiePretActionare=(produse,tipSubprodus=0,tipActionare=0)=>{ // functie folosita in cadrul functiei pretRe \n \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretActionare=produse.find(produs => produs.key===tipSubprodus).actionariCompatibile.find(actionare => actionare.key === tipActionare)\n }else{ \n return 0;\n }\n\n if(vPretActionare){\n return vPretActionare.pret*1\n }else{\n return 0\n }\n}","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport { selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpRe, pretRe} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='RE'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='RE'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareLamela:0, culoareCaseta:0, denumireCuloareLamela:'',denumireCuloareCaseta:'',tipActionare:0, denumireTipActionare:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', optional3:0, denumireOptional3:'', optional4:0, denumireOptional4:'', actionareStDr:''})\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n this.handleAtentionareTipSubprodus(e);\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='LAMELA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, optional1:0,denumireOptional1:'',optional2:0, denumireOptional2:'',optional3:0, denumireOptional3:'',optional4:0, denumireOptional4:''})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional4= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional4';\n let key2='denumireOptional4'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value && optional.tipActionare===currentItem.tipActionare)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional4(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpRe(currentItem.tipSubprodus,currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountRE\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const adaos=currentUser.idFirma.adaosRE\n\n const pretCatalog=(pretRe(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.culoareCaseta,currentItem.tipActionare, currentItem.optional1, currentItem.optional2,currentItem.optional3,currentItem.optional4,this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional4=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].atentionare:''\n var denumireOptional4=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional4 && optional.tipActionare===currentItem.tipActionare && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional4+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleActionare=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareActionare=[4].includes(currentItem.tipSubprodus)?true:false\n return dezactivareActionare\n }\n return false\n }\n }\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n render() { \n const {currentItem, openEditItem, errors}=this.props \n \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentRET extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'lungime' && args.data && args.cell) {\n if ([1,2,6].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 2500 ){\n args.cell.classList.add('error');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([8,9,10].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 5 ){\n args.cell.classList.add('atention');\n } \n }\n\n if((args.column).field === 'mp' && args.data && args.cell) {\n if ([1,2,3].includes(getValue('tipSubprodus', args.data)) && getValue('mp', args.data) > 3 ){\n args.cell.classList.add('atention');\n } \n }\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'optional4':currentItem.optional4?currentItem.optional4:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n 'denumireOptional4':currentItem.denumireOptional4?currentItem.denumireOptional4:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentRET.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentRET)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.mp>9){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>9)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2].includes(currentItem.tipSubprodus) && currentItem.mp>15){\n mesajeEroare.m3m={mesaj:'Dimensiunbi prea mari!(mp>15)', tip:'Eroare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1].includes(currentItem.tipSubprodus) && currentItem.lungime>3200){\n mesajeEroare.m4m={mesaj:'Recomandare lamela de 77mm!(L>3200)', tip:'Atentionare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2].includes(currentItem.tipSubprodus) && currentItem.tipActionare===8){\n mesajeEroare.m5m={mesaj:'Usile de garaj cu lamela de 77mm NU accepta actionarea Motor cu Receptor', tip:'Eroare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru UG sunt in acest moment 1209.\n//rutaPretTabelar va returna deci 1209 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=UG&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=UG&_limit=100000 \n\nexport const mpUg=(lungime=0, inaltime=0)=>{ // returneaza valoarea campului mp\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7 \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nexport const pretUg=(produse,tipSubprodus=0, lungime=0, inaltime=0, culoareLamela=0, culoareCaseta=0, tipActionare=0, optional1=0, optional2=0, optional3=0, prettabelar, buc)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n var pretTabel;\n var pretFix;\n var procentCuloareLamele;\n var procentCuloareCaseta;\n var pretActionare;\n var pretOptional1;\n var pretOptional2;\n var pretOptional3;\n var cotaLungime;\n var cotaInaltime;\n \n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100===0 ){\n cotaLungime=(lungime>500 ? lungime : 500)*1 \n }else{\n cotaLungime=((Math.floor(lungime / 100)*100 +100)>500 ? (Math.floor(lungime / 100) * 100 + 100) : 500) \n }\n\n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100===0 ){\n cotaInaltime=(inaltime>500 ? inaltime : 500)*1 || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100)*100 + 100)>500 ? (Math.floor(inaltime / 100) * 100 +100) : 500) \n }\n\n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= prettabelar.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus===tipSubprodus) \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentCuloareLamela= produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareLamela && culoare.componenta==='LAMELA')\n var vProcentculoareCaseta=produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n }else{ \n vProcentCuloareLamela = undefined\n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret*1\n }else{ \n pretTabel=0 \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul ruloului se calculeaza pe metru patrat )\n \n if(vProdus){\n pretFix = vProdus.pretMP * mpUg(lungime,inaltime) ; \n }else{\n pretFix=0\n } \n \n // extragere variabila procentCuloareLamele procent suplimentar datorat culorii lamelelor\n if(vProcentCuloareLamela){\n procentCuloareLamele =vProcentCuloareLamela.procentSuplimentar*1;\n }else{\n procentCuloareLamele = 0\n }\n\n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar*1;\n }else{\n procentCuloareCaseta = 0;\n } \n\n //extragere variabila pretActionare pret actionare\n pretActionare =functiePretActionare(produse,tipSubprodus,tipActionare) ;\n \n // preturi optionale\n pretOptional1 = functiePretOptional(produse,tipSubprodus, optional1);\n pretOptional2 = functiePretOptional(produse,tipSubprodus, optional2);\n pretOptional3 = functiePretOptional(produse,tipSubprodus, optional3);\n \n // stabilire rezultat functie \n \n if(pretTabel*1 + pretFix*1 === 0){\n console.log('Eroare: Dimensiuni prea mari sau prea mici (UG55mm: L>700 si H>1500!)(UG77mm: L>1800 si H>1800!)');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n\n }else{\n return ((pretFix+pretTabel) * (100 + procentCuloareLamele*1 + procentCuloareCaseta*1)/100 + pretActionare*1 + pretOptional1*1 + pretOptional2*1 + pretOptional3*1).toFixed(2)* buc; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n } \n}\n\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse,tipSubprodus=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretUg \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional=produse.find(produs => produs.key===tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ \n return vPretOptional.pret*1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string;\n }else{ \n return 0\n } \n\n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretActionare=(produse,tipSubprodus=0,tipActionare=0)=>{ // functie folosita in cadrul functiei pretUg \n \n var vProdus=produse.find(produs => produs.key===tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretActionare=produse.find(produs => produs.key===tipSubprodus).actionariCompatibile.find(actionare => actionare.key === tipActionare)\n }else{ \n return 0;\n }\n\n if(vPretActionare){\n return vPretActionare.pret*1; // inmultit cu 1 ptr a forta functia sa returneze un numar si nu un string\n }else{\n return 0\n }\n}\n\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport {selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpUg, pretUg} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='UG'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='UG'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareLamela:0, culoareCaseta:0, denumireCuloareLamela:'',denumireCuloareCaseta:'',tipActionare:0, denumireTipActionare:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', optional3:0, denumireOptional3:''})\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors);\n this.handleAtentionareTipSubprodus(e);\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareLamela= (e)=>{ \n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='LAMELA' )[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional2= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional3= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional3';\n let key2='denumireOptional3'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional3(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpUg(currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountUG\n const adaos=currentUser.idFirma.adaosUG\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const pretCatalog=(pretUg(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.culoareCaseta,currentItem.tipActionare, currentItem.optional1, currentItem.optional2, currentItem.optional3,this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareLamela=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareLamela && culoare.componenta==='LAMELA' && culoare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareLamela+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional3=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional3=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional3 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional3+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n \n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n \n render() { \n const {currentItem, openEditItem, errors}=this.props \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentUG extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n if((args.column).field === 'lungime' && args.data && args.cell) {\n if ([1].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 3200 ){\n args.cell.classList.add('error');\n } \n }\n\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n const val = args.result.map(item => item.mp*item.buc)\n return val\n}\n\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentUG.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentUG)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.tipSubprodus && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([1,2,3,4].includes(currentItem.tipSubprodus) && currentItem.mp>2.9){\n mesajeEroare.m2m={mesaj:'Dimensiunbi prea mari!(mp>2,9)', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([2].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m3m={mesaj:'Lungime prea mare, recomandare plasa TIP USA IN 2 CANATE.', tip:'Eroare'}\n }else{\n mesajeEroare.m3m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([6].includes(currentItem.tipSubprodus) && currentItem.lungime>1500){\n mesajeEroare.m4m={mesaj:'Lungime prea mare, recomandare plasa TIP USA IN 2 CANATE.', tip:'Eroare'}\n }else{\n mesajeEroare.m4m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([7].includes(currentItem.tipSubprodus) && currentItem.lungime>2600){\n mesajeEroare.m5m={mesaj:'Lungime prea mare, pentru produsul selectat.', tip:'Eroare'}\n }else{\n mesajeEroare.m5m={}\n }\n //-------------------------------------------------------------------------------------------- \n if([6,7].includes(currentItem.tipSubprodus) && currentItem.inaltime>2600){\n mesajeEroare.m6m={mesaj:'Inaltime prea mare, pentru produsul selectat.', tip:'Eroare'}\n }else{\n mesajeEroare.m6m={}\n }\n\n //-------------------------------------------------------------------------------------------- \n // regula hardcode eroare la alegerea culorii negru pentru plase cu codul 1,2,3,4\n if([1,2,3,4].includes(currentItem.tipSubprodus) && currentItem.culoareCaseta===12){ \n mesajeEroare.m7m={mesaj:'Culoarea Negru nu este valabila pentru acest tip de plasa', tip:'Eroare'}\n \n }else{\n mesajeEroare.m7m={}\n }\n //-------------------------------------------------------------------------------------------- \n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n//Tebelul prettabelars contine in acest moment 4997 inregistrari din care pentru UG sunt in acest moment 1420.\n//rutaPretTabelar va returna deci 1420 de inregistrari.\n//Pe scurt ideea este ca trebuie stabilita o limita foarte mare in continutul requestului(_limit=100000) pentru a fi sigur ca se raspunde cu toate inregistrarile. \n\n// var rutaPrincipala; // setul de inregistari returnat de ruta principala : http://5.189.183.44:1337/produses?tipProdus=PI&_limit=1000&_sort=denumire:ASC\n// var rutaPretTabelar // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/prettabelars?tipProdus=PI&_limit=100000 \n\n\n\nexport const mpPi=( tipSubprodus=0,lungime=0, inaltime=0)=>{ // returneaza valoarea campului mp\n // rezultat functie tinand cont de tipul de produs\n switch(tipSubprodus) { \n case 4: // PLASA BALAMALE- are pret pe mp\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7\n default:\n return ((lungime * inaltime) / 1000000).toFixed(2);\n } \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nexport const pretPi=(produse=[], tipSubprodus=0, lungime=0, inaltime=0, culoareCaseta=0, optional1=0, optional2=0, prettabelar=0, buc=0)=>{ // returneaza pretul intregului rulou, inclusiv actionare si optionale.\n var pretTabel;\n var pretFix;\n var procentCuloareCaseta;\n var pretOptional1;\n var pretOptional2;\n var cotaLungime;\n var cotaInaltime;\n \n // stabilire valoare variabila cotaLungime astfel incat sa se determine lungimea luata in calcul pentru pret (pret stabilit pe lungimi din 100 in 100 mm)\n if(lungime % 100 === 0 ){\n cotaLungime=(lungime>500 ? lungime*1 : 500) \n }else{\n cotaLungime=((Math.floor(lungime/100)*100 +100)>500 ? (Math.floor(lungime / 100)*100 + 100) : 500) \n }\n\n\n // stabilire valoare variabila cotaInaltime astfel incat sa se determine inaltimea luata in calcul pentru pret (pret stabilit pe inaltimi din 100 in 100 mm)\n if(inaltime % 100 === 0 ){\n cotaInaltime=(inaltime > 500 ? inaltime*1 : 500) || 0\n }else{\n cotaInaltime=((Math.floor(inaltime / 100) * 100 +100)>500 ? (Math.floor(inaltime / 100) * 100 + 100) : 500) \n }\n\n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaPrincipala si rutaPretTabelar \n var vPretTabel= prettabelar.find(produs => produs.lungime === cotaLungime && produs.inaltime === cotaInaltime && produs.idProdus === tipSubprodus) \n var vProdus=produse.find(produs => produs.key === tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vProcentculoareCaseta = produse.find(produs => produs.key===tipSubprodus).culoriCompatibile.find(culoare => culoare.key === culoareCaseta && culoare.componenta==='CASETA')\n }else{ \n vProcentculoareCaseta = undefined \n }\n\n // extragere pret rulou din tabel preturi(prettabelars)\n if (vPretTabel){\n pretTabel = vPretTabel.pret*1\n }else{ \n pretTabel = 0 \n }\n\n // extragere variabila pretFix (pret pe mp) acolo unde pretul plasei se calculeaza pe metru patrat )\n if(vProdus){\n pretFix = vProdus.pretMP * mpPi(tipSubprodus,lungime,inaltime) ; \n }else{\n pretFix = 0\n } \n \n // extragere variabila procentCuloareCaseta procent suplimentar datorat culorii casetei\n if(vProcentculoareCaseta){\n procentCuloareCaseta = vProcentculoareCaseta.procentSuplimentar;\n }else{\n procentCuloareCaseta = 0;\n } \n\n // preturi optionale\n pretOptional1=functiePretOptional(produse, tipSubprodus, optional1);\n pretOptional2=functiePretOptional(produse, tipSubprodus, optional2);\n \n // stabilire rezultat functie \n switch(tipSubprodus) { \n case 4: // PLASA BALAMALE- are pret pe mp\n if(pretFix === 0){\n console.log('Eroare: Nu exista pret pentru acest produs!!!');\n return 0; \n }else{\n return (pretFix * (100 + procentCuloareCaseta) / 100 + pretOptional1*1 + pretOptional2*1).toFixed(2) * buc; \n }\n // -----------------------------promotie temporara 10%\n case 5:\n case 6:\n case 7:\n if((pretTabel*1 + pretFix*1) === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n }else{\n return ((pretFix*1 + pretTabel*1) * (100 + procentCuloareCaseta*1) / 100 + pretOptional1*1 + pretOptional2*1).toFixed(2) * buc; \n }\n // --------------------------------------------\n default:\n if((pretTabel*1 + pretFix*1) === 0){\n console.log('Eroare: Dimensiuni prea mari!');\n return 0; // trebuie sa genereze un mesaj de atentionare : \"Pentru aceste dimensiuni pretul este zero, dimensiuni prea mari\"\n }else{\n return ((pretFix*1 + pretTabel*1) * (100 + procentCuloareCaseta*1) / 100 + pretOptional1*1 + pretOptional2*1).toFixed(2) * buc; \n }\n } \n \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nexport const functiePretOptional=(produse, tipSubprodus=0, optionalX=0)=>{ // functie folosita in cadrul functiei pretUg \n var vProdus=produse.find(produs => produs.key === tipSubprodus)\n \n if (vProdus){ // se verifica daca exista produsul, altfel nu se poate cauta in subcategorii ale lui.\n var vPretOptional = produse.find(produs => produs.key === tipSubprodus).optionaleCompatibile.find(optional => optional.key === optionalX)\n }else{ \n return 0;\n }\n\n if(vPretOptional){ \n return vPretOptional.pret*1 ;\n }else{ \n return 0\n } \n}\n\n\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicMultipleSort} from '../../../../utils/functiiComune';\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport {selectLookupProduse, selectLookupPreturiTabelare} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpPi, pretPi} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment, \n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar } from 'notistack';\n\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.produse=props.produse?props.produse.filter(produs=>produs.tipProdus==='PI'):[];\n this.preturitabelare=props.preturitabelare?props.preturitabelare.filter(pret=>pret.tipProdus==='PI'):[]\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n onChangeTipSubprodus= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipSubprodus';\n let key2='denumireSubProdus'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n \n if ([5,6,7].includes(value)){ // plisse 5 6 7\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareCaseta:0,denumireCuloareCaseta:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', tipActionare:1, denumireTipActionare:'FINALA'})\n }else{\n setCurrentItem({...currentItem, [key]: value, [key2]:value2, culoareCaseta:0,denumireCuloareCaseta:'', optional1:0, denumireOptional1:'', optional2:0, denumireOptional2:'', tipActionare:0, denumireTipActionare:''})\n }\n debounce(this.calculPretCatalog,500)()\n debounce(this.calculMp,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipSubprodus(e)\n }, 501);\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeCuloareCaseta= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareCaseta';\n let key2='denumireCuloareCaseta'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.denumire===e.target.value && culoare.componenta==='CASETA')[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareCaseta(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeTipActionare= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'tipActionare';\n let key2='denumireTipActionare'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareTipActionare(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional1= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChangeOptional2= (e)=>{ \n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional2';\n let key2='denumireOptional2'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional2(e)\n this.handleAtentionareOptional2(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='culoareCaseta' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpPi(currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountPI\n const discountSuplimentar= this.produse.filter(produs=>produs.key===currentItem?.tipSubprodus)[0].discountSuplimentar || 0 // AICIIIII\n const adaos=currentUser.idFirma.adaosPI\n const pretCatalog=(pretPi(this.produse, currentItem.tipSubprodus, currentItem.lungime, currentItem.inaltime, currentItem.culoareCaseta, currentItem.optional1, currentItem.optional2, this.preturitabelare, currentItem.buc).toFixed(2)*(1-(discountSuplimentar?discountSuplimentar/100:0))).toFixed(2) //aiciiii\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipSubprodus=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].atentionare:''\n var denumireTipSubprodus=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireTipSubprodus+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareCaseta=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].atentionare:''\n var denumireCuloareCaseta=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].culoriCompatibile.filter(culoare=>culoare.key===currentItem.culoareCaseta && culoare.componenta==='CASETA' && culoare.activ==='DA')[0].denumire :''\n }\n if(mesaj){\n enqueueSnackbar(denumireCuloareCaseta+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareTipActionare=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].atentionare:''\n var denumireActionare=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].actionariCompatibile.filter(actionare=>actionare.key===currentItem.tipActionare && actionare.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireActionare+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional2=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional2=this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0]?this.produse.filter(produs=>produs.denumire===currentItem.denumireSubProdus)[0].optionaleCompatibile.filter(optional=>optional.key===currentItem.optional2 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional2+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n handleCotaEnabled=()=>{\n const {currentItem}=this.props;\n if (currentItem){\n if(currentItem.tipSubprodus){\n let dezactivareCota=[5,6,7].includes(currentItem.tipSubprodus)?true:false\n return dezactivareCota\n }\n return false\n }\n }\n\n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n render() { \n const {currentItem, openEditItem, errors}=this.props \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n produse:selectLookupProduse(state),\n preturitabelare:selectLookupPreturiTabelare(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentPI extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + ' Euro';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n // if((args.column).field === 'lungime' && args.data && args.cell) {\n // if ([1].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 3200 ){\n // args.cell.classList.add('error');\n // } \n // }\n\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Euro )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentPI.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentPI)));\n\n\n","/* eslint-disable linebreak-style */\nimport debounce from 'lodash.debounce'\nexport const validation=debounce(async (currentItem,errors,setErrors)=>{\n var mesajeEroare={}\n //--------------------------------------------------------------------------------------------\n if (currentItem){\n //-------------------------------------------------------------------------------------------- \n if(currentItem.pretCatalog==='0.00' && currentItem.culoareLamela && currentItem.lungime && currentItem.inaltime ){\n mesajeEroare.m1m={mesaj:'Pret 0 pentru dimensiunile introduse.Dimensiuni prea mari pentru produsul selectat!!', tip:'Eroare'}\n }else{\n mesajeEroare.m1m={}\n } \n //-------------------------------------------------------------------------------------------- \n if(currentItem.lungime>3000){\n mesajeEroare.m2m={mesaj:'Lungime prea mare(lungime maxima 3000mm).', tip:'Eroare'}\n }else{\n mesajeEroare.m2m={}\n }\n //-------------------------------------------------------------------------------------------- \n }\n setErrors({...errors,...mesajeEroare})\n return !JSON.stringify(mesajeEroare).includes('Eroare')\n}\n,500)\n ","/* eslint-disable linebreak-style */\n// VARIABILA GLOBALA \n//Atentie! Particularitate server strapi: rutele daca nu se mentioneaza \"_limit=xxx\" vor returna doar primele 100 de rezultate. \n\n// var rutaOptionale; // setul de inregistari returnat de ruta : http://5.189.183.44:1337/optionals?tipProdus=JO&_limit=1000&_sort=denumire:ASC\n// var rutaCulori // setul de inregistrari returnat de ruta : http://5.189.183.44:1337/culoares?tipProdus=JO&_limit=1000&_sort=denumire:ASC \n// var rutaClema // setul de inregistari returnat de ruta : http://5.189.183.44:1337/optionals?tipProdus=JV&denumire=CLEME%20METAL\n//Atentie rutaClema are la tipProdus=\"JV\" asta pentru ca daca ar avea JO, ar aparea aceste cleme in lista din care se alege Ghid/Fix si nu trebuie, asa ca i-am pus tipProdus=JV\n\n\n\nexport const mpJo = (lungime=0, inaltime=0) => { // returneaza valoarea campului mp\n return ((lungime * inaltime) / 1000000 > 0.7 ? (lungime * inaltime) / 1000000 : 0.7).toFixed(2) ; // in cazul in care mp<0.7 se ia 0.7 \n}\n\n//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nexport const pretJo = (optionale, culori, clema, lungime=0, inaltime=0, culoareLamela=0, optional1=0, buc=0,cleme=0) => { // returneaza pretul intregului produs, inclusiv optional.\n \n var vOptionale;\n var vCulori;\n var pretMP;\n var pretOptional;\n var pretClema;\n \n // extragerea in variabile a datelor necesare calcularii pretului din setul de date returnat de rutele: rutaOptionale si rutaCulori \n vOptionale= optionale.find(optional => optional.key===optional1) \n vCulori=culori.find(culoare => culoare.key===culoareLamela)// atentie in programul meu in rubrica Cod Culoare apare ceva ce poate fi confundat cu id-ul(key-ul) dar nu e. De ex. Cod culoare 18 are key=3\n \n // pretMP (pret pe mp) \n if(vCulori){\n pretMP = vCulori.pret*1; \n }else{\n pretMP = 0\n } \n\n // pretOptional(Ghid/Fix)\n if(vOptionale){ \n pretOptional = vOptionale.pret*1; \n }else{\n pretOptional = 0\n } \n \n // pretCleme\n if(clema){ \n pretClema = clema.pret*1; \n }else{\n pretClema = 0\n } \n \n // stabilire rezultat functie \n return ((pretMP * mpJo(lungime, inaltime)) + pretOptional*1 + (pretClema*cleme)).toFixed(2)* buc; \n //atentie fata de varianta devco si clienti, aici numarul de cleme este per bucata si pentru toata cantitatea / de stabilit o concordanta intre ele \n}\n\n\n\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React from 'react';\nimport Popup from 'reactjs-popup'\nimport {connect} from 'react-redux';\nimport {dynamicSort,dynamicMultipleSort } from '../../../../utils/functiiComune'\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder, selectOrderCurrentItem} from '../../../../redux/order/order.selectors'\nimport {selectLookupOptionale, selectLookupCulori} from '../../../../redux/lookup/lookup.selectors'\nimport {selectOtherLoading,selectOtherOpenEditItem, selectOtherErrors} from '../../../../redux/other/other.selectors'\nimport {selectCurrentUser} from '../../../../redux/user/user.selectors'\nimport {setLoading,setOpenEditItem, setErrors, resetErrors, setErrorsAsync} from '../../../../redux/other/other.actions'\nimport {setCurrentItem} from '../../../../redux/order/order.actions'\nimport {mpJo, pretJo} from './functii';\nimport './reperedit.css';\nimport debounce from 'lodash.debounce'\nimport {validation} from './validation'\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Grid,\n Button,\n TextField,\n InputAdornment,\n colors,\n Hidden\n} from '@material-ui/core';\nimport { withSnackbar, useSnackbar } from 'notistack';\n\n\nclass ReperEdit extends React.Component {\n constructor(props) {\n super(props); \n this.optionale=props.optionale?props.optionale.filter(optional=>optional.tipProdus==='JO').sort(dynamicMultipleSort('pozitieLista','denumire')):[];\n this.culori=props.culori?props.culori.sort(dynamicMultipleSort('pozitieLista','denumire')):[]\n this.clema=props.optionale?props.optionale.filter(optional=>optional.tipProdus==='JV' && optional.key===2)[0]:[];\n \n }\n \n //-------------------------------------------------------------------------------------------------------------------\n\n \n onChangeCuloareLamela= (e)=>{\n e.persist() \n const {setCurrentItem, currentItem}=this.props;\n let key = 'culoareLamela';\n let key2='denumireCuloareLamela'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.culori.filter(culoare=>culoare.codCuloare===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareCuloareLamela(e)\n }, 501);\n \n }\n //-------------------------------------------------------------------------------------------------------------------\n \n onChangeOptional1= (e)=>{ // FIXAREA\n e.persist()\n const {setCurrentItem, currentItem}=this.props;\n let key = 'optional1';\n let key2='denumireOptional1'\n let value=null;\n let value2='';\n if (currentItem){\n value = e.target.value?this.optionale.filter(optional=>optional.denumire===e.target.value)[0].key:0\n value2=e.target.value?e.target.value:''\n }\n setCurrentItem({...currentItem, [key]: value, [key2]:value2})\n debounce(this.calculPretCatalog,500)()\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n this.handleAtentionareOptional1(e)\n }, 501);\n \n }\n\n //-------------------------------------------------------------------------------------------------------------------\n onChange= (e)=> {\n let key = e.target.name;\n let value = e.target.value;\n this.props.setCurrentItem({...this.props.currentItem, [key]: value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')}) \n if(key==='lungime' || key==='inaltime' || key==='culoareLamela' || key==='console' || key==='buc'){\n debounce(this.calculPretCatalog,500)()\n }\n if(key==='lungime' || key==='inaltime'){\n debounce(this.calculMp,500)()\n }\n setTimeout(() => {\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n }, 50);\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n calculMp= async ()=>{\n const {setCurrentItem,currentItem}=this.props;\n setCurrentItem({...currentItem, mp:mpJo( currentItem.lungime, currentItem.inaltime)}) \n }\n //-------------------------------------------------------------------------------------------------------------------\n calculPretCatalog= async()=>{ \n const {currentItem, setCurrentItem,currentUser}=this.props \n const discount=currentUser.idFirma.discountJO\n const adaos=currentUser.idFirma.adaosJO\n const pretCatalog=pretJo(this.optionale, this.culori, this.clema, currentItem.lungime, currentItem.inaltime, currentItem.culoareLamela, currentItem.optional1, currentItem.buc, currentItem.console).toFixed(2);\n const pretCuDiscount=(pretCatalog*(1-(discount?discount/100:0))).toFixed(2)\n const pretClientFinal=(pretCatalog *(1+(adaos?adaos/100:0))).toFixed(2)\n setCurrentItem({...currentItem, pretCatalog:pretCatalog,pretCuDiscount:pretCuDiscount,pretClientFinal:pretClientFinal})\n }\n //------------------------------------------------------------------------------------------------------------------- \n closeModal=()=> {\n const {setOpenEditItem}=this.props;\n setOpenEditItem({open:false, title:'',add:true});\n } \n //-------------------------------------------------------------------------------------------------------------------\n handlerSumbit=async (e)=>{\n e.preventDefault()\n const {openEditItem, adaugaItem, modificaItem, enqueueSnackbar}=this.props;\n const validare=await validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n \n if (validare===false){\n enqueueSnackbar('Datele introduse nu respecta regulile de validare. Nu se poate salva inregistrarea.',{ \n variant: 'error',\n })\n return \n }\n\n if(openEditItem.add===true){\n return adaugaItem()\n }else{\n return modificaItem()\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handlerKeyDown=(e)=>{\n if(e.keyCode === 13) {\n e.preventDefault();\n return false;\n }\n }\n \n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareCuloareLamela=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.culori.filter(culoare=>culoare.key===currentItem.culoareLamela)[0]?this.culori.filter(culoare=>culoare.key===currentItem.culoareLamela)[0].atentionare:''\n var denumireCuloareLamela=this.culori.filter(culoare=>culoare.key===currentItem.culoareLamela)[0]?this.culori.filter(culoare=>culoare.key===currentItem.culoareLamela)[0].codCuloare:''\n }\n if(mesaj){\n enqueueSnackbar('Mesaj pentru codul:'+ denumireCuloareLamela+': '+mesaj,{ \n variant: 'warning',\n autoHideDuration: 9000\n },20000)\n }\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n handleAtentionareOptional1=(e)=>{\n const {currentItem, enqueueSnackbar}=this.props;\n if (currentItem){\n if(e.target.value){\n var mesaj=this.optionale.filter(optional=>optional.denumire===currentItem.denumireOptional1)[0]?this.optionale.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].atentionare:''\n var denumireOptional1=this.optionale.filter(optional=>optional.denumire===currentItem.denumireOptional1)[0]?this.optionale.filter(optional=>optional.key===currentItem.optional1 && optional.activ==='DA')[0].denumire:''\n }\n if(mesaj){\n enqueueSnackbar(denumireOptional1+':'+mesaj,{ \n variant: 'warning',\n },20000)\n }\n }\n }\n \n //----------------------------------------------------------------------------------------------------\n vanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n //-------------------------------------------------------------------------------------------------------------------\n \n render() { \n const {currentItem, openEditItem, errors}=this.props \n return (\n \n \n \n \n \n );\n }\n\n}\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n optionale:selectLookupOptionale(state),\n culori:selectLookupCulori(state),\n openEditItem:selectOtherOpenEditItem(state),\n errors:selectOtherErrors(state)\n})\n \nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setErrors:error=>dispatch(setErrors(error)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrorsAsync:()=>dispatch(setErrorsAsync()),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(ReperEdit));","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport {\n Card,\n} from '@material-ui/core';\nimport { \n GridComponent, \n ColumnsDirective, \n ColumnDirective, \n Selection,\n Page, \n Inject,\n Toolbar, \n CommandColumn, \n Resize, \n ColumnMenu,\n Edit,\n ForeignKey,\n AggregateColumnDirective,\n AggregateColumnsDirective, \n AggregateDirective, \n AggregatesDirective,\n Aggregate\n} from '@syncfusion/ej2-react-grids'; \nimport { L10n, getValue} from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\n\nimport 'react-confirm-alert/src/react-confirm-alert.css'\nimport './ordercontent.css';\nimport {validation} from './validation';\nimport ReperEdit from './ReperEdit';\nimport {setLoading,setErrors } from '../../../../redux/other/other.actions';\nimport {selectOtherLoading, selectOtherErrors} from '../../../../redux/other/other.selectors';\nimport {selectOrderCurrentProduct,selectOrderOrders, selectOrderCurrentOrder,selectOrderCurrentItem, selectOrderUpdatedOrder, selectOrderDeletedItems} from '../../../../redux/order/order.selectors';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\nimport { selectLookupMateriale} from '../../../../redux/lookup/lookup.selectors';\nimport {setCurrentItem, setUpdatedOrder, setDeletedItems} from '../../../../redux/order/order.actions';\nimport {setOpenEditItem, resetErrors} from '../../../../redux/other/other.actions';\n\n//---------------------------------------------------------------------------------------------------------------------------------\n\nL10n.load({\n 'ro-RO': {\n 'grid': {\n 'Add':'Adauga',\n 'Edit':'Modifica',\n 'Delete':'Sterge',\n 'Update':'Actualizare',\n 'Cancel': 'Abandon',\n 'Save':'Salveaza',\n 'Item':'reper',\n 'Items':'repere',\n 'EmptyRecord':'Nu exista inregistrari',\n 'EditOperationAlert':'Nu ati selectat nici un reper!',\n 'DeleteOperationAlert':'Nu ati selectat nici un reper!',\n 'SaveButton':'Salvare',\n 'CancelButton':'Abandon',\n 'ConfirmDelete':'Sunteti sigur ca doriti stergerea reperului?',\n 'CancelEdit':'Sunteti sigur ca doriti sa abandonati modificarile facute ?'\n },\n 'pager':{\n 'currentPageInfo': '{0} din {1} pagini',\n 'firstPageTooltip': 'prima pagina',\n 'lastPageTooltip': 'ultima pagina',\n 'nextPageTooltip': 'urmatoarea pagina',\n 'nextPagerTooltip': 'urmatoarea pagina',\n 'previousPageTooltip': 'pagina anterioara',\n 'previousPagerTooltip': 'pagina anterioara',\n 'totalItemsInfo': '({0} inregistrari)'\n }\n }\n}); \n\n// documentatie la link-ul: https://ej2.syncfusion.com/react/documentation/grid/global-local/\n//---------------------------------------------------------------------------------------------------------------------------\n\nclass OrderContentJO extends React.Component{\n\n constructor() {\n super(...arguments);\n this.editparams={params:{popupHeight:'300px'}};\n this.validationRule={required:true};\n this.toolbarOptions = this.props.updatedOrder.stadiu !=='TRANSMISA'?[\n { text: 'Adauga', tooltipText: 'Adauga reper noua', prefixIcon: 'e-add', id: 'Adauga' },\n { text: 'Modifica', tooltipText: 'Modifica reperul selectat', prefixIcon: 'e-edit', id: 'Modifica' },\n { text: 'Sterge', tooltipText: 'Sterge reperul selectat', prefixIcon: 'e-delete', id: 'Sterge' }\n ]:[{text:'Comanda transmisa - nu se pot face modificari', id:'Transmisa'}];\n this.editSettings = { allowEditing: false, allowAdding: false, allowDeleting: false, mode: 'Dialog', template: this.dialogTemplate , allowEditOnDblClick: false, showDeleteConfirmDialog: true };\n this.sortingOptions = {columns: [{ field: 'actionare', direction: 'Ascending' }]}\n this.selectionsettings = {checkboxMode: 'ResetOnRowClick',type: 'Single' }; \n }\n \n //----------------------------------------------------------------------------------------------------\n jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //----------------------------------------------------------------------------------------------------\n rowselect=(args)=>{\n const {setCurrentItem}=this.props\n let selRecord = args.data;\n setCurrentItem(selRecord)\n }\n //----------------------------------------------------------------------------------------------------\n rowdeselect=()=>{\n const {setCurrentItem}=this.props\n setCurrentItem({});\n }\n //----------------------------------------------------------------------------------------------------\n actionBegin=(args)=> {\n if (args.requestType === 'save') {\n if (this.masterGrid.pageSettings.currentPage !== 1 && this.masterGrid.editSettings.newRowPosition === 'Top') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - this.masterGrid.pageSettings.pageSize;\n }\n else if (this.masterGrid.editSettings.newRowPosition === 'Bottom') {\n args.index = (this.masterGrid.pageSettings.currentPage * this.masterGrid.pageSettings.pageSize) - 1;\n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n actionComplete(args) {\n if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {\n if (Browser.isDevice) {\n args.dialog.height = window.innerHeight - 90 + 'px';\n args.dialog.dataBind(); \n }\n }\n }\n //----------------------------------------------------------------------------------------------------\n currencyFormatter=(field, data)=>{\n return getValue(field, data) + 'Lei';\n }\n //----------------------------------------------------------------------------------------------------\n mpTotal=(field, data)=>{\n return getValue('mp', data) * getValue('buc', data) ;\n }\n //----------------------------------------------------------------------------------------------------\n //...........................\n customizeCell=(args)=>{\n \n // if((args.column).field === 'lungime' && args.data && args.cell) {\n // if ([1].includes(getValue('tipSubprodus', args.data)) && getValue('lungime', args.data) > 3200 ){\n // args.cell.classList.add('error');\n // } \n // }\n\n }\n //........................... \n\n //----------------------------------------------------------------------------------------------------\n //...........................\n footerTotal=(props)=>{\n return ({props.Sum.toFixed(2)} Lei )\n }\n //----------------------------------------------------------------------------------------------------\n footerTotalMp=(props)=>{\n return ( {(props.Custom*1).toFixed(2)} mp )\n }\n //........................... \n //----------------------------------------------------------------------------------------------------\n \n //---------------------------------------------------------------------------------------------------- \n clickHandlerMaster=async e=>{\n const { setCurrentItem, setOpenEditItem,updatedOrder, resetErrors, enqueueSnackbar}=this.props;\n if (e.item.properties.id==='Adauga'){\n if(!updatedOrder.clientClient){\n enqueueSnackbar('Nu se pot adauga repere pana nu se completeaza Clientul!',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n return \n }\n setCurrentItem({buc:1});\n resetErrors();\n setOpenEditItem({open:true, title:'Adauga reper nou',add:true});\n }\n if (e.item.properties.id==='Modifica'){\n if (this.masterGrid.getSelectedRowIndexes().length){\n validation(this.props.currentItem,this.props.errors,this.props.setErrors)\n setOpenEditItem({open:true, title:'Modifica reper',add:false})\n }else{\n enqueueSnackbar('Va rog selectati un reper',{ \n variant: 'warning',\n autoHideDuration:1500\n })\n } \n }\n if (e.item.properties.id==='Sterge'){\n \n confirmAlert({\n title: 'Confirmare stergere',\n message: 'Sigur doriti stergerea reperului?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n resetErrors()\n this.stergeItem()\n this.masterGrid.refresh() \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de stergere a fost abandonata.',{ \n variant: 'warning',\n autoHideDuration:1500\n }) \n }\n }\n ]\n });\n } \n }\n //----------------------------------------------------------------------------------------------------\nadaugaItem=()=>{\n const {currentItem,setOpenEditItem, updatedOrder, enqueueSnackbar, currentProduct}=this.props;\n const newItem={\n 'id':updatedOrder.comandarepers?(updatedOrder.comandarepers.length+1)*-1:-1,\n 'idComanda':updatedOrder.id,\n 'nrCrt':updatedOrder.comandarepers?updatedOrder.comandarepers.length+1:1,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':new Date().toISOString().slice(0, 19).replace('T', ' '),\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n }\n\n if (this.masterGrid) {\n updatedOrder.comandarepers.push(newItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper adaugat cu succes',{ variant: 'success',autoHideDuration:1500}) \n }\n}; \n//----------------------------------------------------------------------------------------------------\nmodificaItem=()=>{\n const {currentItem, setOpenEditItem, updatedOrder, setUpdatedOrder, enqueueSnackbar, currentProduct}=this.props;\n if (this.masterGrid) { \n var foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === currentItem.id); \n const updatedItem= { \n 'id':currentItem.id,\n 'idComanda':currentItem.idComanda,\n 'nrCrt':currentItem.nrCrt,\n 'tipSubprodus':currentItem.tipSubprodus?currentItem.tipSubprodus:0,\n 'lungime':Number(currentItem.lungime?currentItem.lungime:0) ,\n 'lungimeFinala':Number(currentItem.lungimeFinala?currentItem.lungimeFinala:0) ,\n 'inaltime':Number(currentItem.inaltime?currentItem.inaltime:0),\n 'inaltimeFinala':Number(currentItem.inaltimeFinala?currentItem.inaltimeFinala:0),\n 'deschidere':currentItem.deschidere?currentItem.deschidere:'',\n 'culoareLamela':currentItem.culoareLamela?currentItem.culoareLamela:0,\n 'culoareCaseta':currentItem.culoareCaseta?currentItem.culoareCaseta:0,\n 'material':currentItem.material?currentItem.material:0,\n 'codMaterial':currentItem.codMaterial?currentItem.codMaterial:'',\n 'lungimeSnur':Number(currentItem.lungimeSnur?currentItem.lungimeSnur:0),\n 'actionare':currentItem.actionare?currentItem.actionare:'',\n 'tipActionare':currentItem.tipActionare?currentItem.tipActionare:0,\n 'actionareStDr':currentItem.actionareStDr?currentItem.actionareStDr:'',\n 'ax':currentItem.ax?currentItem.ax:'',\n 'culoareComponente':currentItem.culoareComponente?currentItem.culoareComponente:'',\n 'optional1':currentItem.optional1?currentItem.optional1:0,\n 'optional2':currentItem.optional2?currentItem.optional2:0,\n 'optional3':currentItem.optional3?currentItem.optional3:0,\n 'console':Number(currentItem.console?currentItem.console:0),\n 'buc':Number(currentItem.buc?currentItem.buc:0),\n 'mp':Number(currentItem.mp?currentItem.mp:0),\n 'pretCatalog':Number(currentItem.pretCatalog?currentItem.pretCatalog:0),\n 'pretCuDiscount':Number(currentItem.pretCuDiscount?currentItem.pretCuDiscount:0),\n 'pretClientFinal':Number(currentItem.pretClientFinal?currentItem.pretClientFinal:0),\n 'observatii':currentItem.observatii?currentItem.observatii:'',\n 'tipProdus':currentItem.tipProdus?currentItem.tipProdus:currentProduct.cod,\n 'denumireProdus':currentItem.denumireProdus?currentItem.denumireProdus:currentProduct.title.toUpperCase(),\n 'denumireSubProdus':currentItem.denumireSubProdus?currentItem.denumireSubProdus:currentProduct.title.toUpperCase(),\n 'denumireCuloareLamela':currentItem.denumireCuloareLamela?currentItem.denumireCuloareLamela:'',\n 'denumireCuloareCaseta':currentItem.denumireCuloareCaseta?currentItem.denumireCuloareCaseta:'',\n 'denumireMaterial':currentItem.denumireMaterial?currentItem.denumireMaterial:'',\n 'denumireTipActionare':currentItem.denumireTipActionare?currentItem.denumireTipActionare:'',\n 'denumireOptional1':currentItem.denumireOptional1?currentItem.denumireOptional1:'',\n 'denumireOptional2':currentItem.denumireOptional2?currentItem.denumireOptional2:'',\n 'denumireOptional3':currentItem.denumireOptional3?currentItem.denumireOptional3:'',\n } \n updatedOrder.comandarepers.splice(foundReperUpdatedOrder,1,updatedItem)\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n setUpdatedOrder({...updatedOrder,'valoareCatalog':TotalValoareCatalog,'valoareComanda':TotalValoareComanda,'valoareClientFinal':TotalValoareClientFinal})\n setOpenEditItem({open:false, title:'',add:true});\n this.masterGrid.refresh()\n enqueueSnackbar('Reper modificat cu succes',{ variant: 'success', autoHideDuration:1500}) \n }\n};\n//----------------------------------------------------------------------------------------------------\nstergeItem=()=>{\n const {currentItem, updatedOrder, setDeletedItems, deletedItems, enqueueSnackbar}=this.props;\n if (this.masterGrid) {\n const selectedRow = this.masterGrid.dataSource.findIndex(reper=>(reper.id===currentItem.id));\n if (this.masterGrid.getSelectedRowIndexes().length){\n deletedItems.push(currentItem);\n setDeletedItems(deletedItems);\n this.masterGrid.dataSource.splice(selectedRow, 1);\n setUpdatedOrder(updatedOrder);\n enqueueSnackbar('Reper sters cu succes',{variant: 'success', autoHideDuration:1500}); \n } else {\n enqueueSnackbar('Va rog selectati un reper',{ variant: 'warning', autoHideDuration:1500}) ; \n }\n }\n}\n//----------------------------------------------------------------------------------------------------\nheaderCellInfo=(args)=>{ \n args.node.getElementsByClassName('e-checkbox-wrapper')[0] && args.node.getElementsByClassName('e-checkbox-wrapper')[0].remove(); \n} \n//----------------------------------------------------------------------------------------------------\ncloseVizualizareRepere=()=>{\n const {setOpenEditItem}=this.props;\n setOpenEditItem(false)\n} \n//---------------------------------------------------------------------------------------------------- \ncustomAggregateMp=(args)=>{\n var val = args.result.reduce((acc,item) => (acc+(item.mp*item.buc)),0)\n return val\n}\n\n//----------------------------------------------------------------------------------------------------\nvanzatorVizibilitate=()=>{\n const { currentUser}=this.props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n}\n\n\nrender(){\n const {updatedOrder}=this.props;\n return (\n \n \n
this.masterGrid = grid}\n rowDeselected={this.rowdeselect.bind(this)}\n rowSelected={this.rowselect.bind(this)} \n selectedRowIndex={-1}\n selectionSettings={this.selectionsettings}\n sortSettings={this.sortingOptions}\n textWrapSettings={{wrapMode: 'Both'}}\n toolbar={this.toolbarOptions}\n toolbarClick={this.clickHandlerMaster}\n >\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n );\n} \n}\n\nOrderContentJO.propTypes = {\n className: PropTypes.string,\n currentItem:PropTypes.object, \n currentProduct:PropTypes.object, \n currentUser:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func, \n resetErrors:PropTypes.func, \n setCurrentItem:PropTypes.func,\n setDeletedItems:PropTypes.func,\n setOpenEditItem:PropTypes.func,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n currentItem:selectOrderCurrentItem(state),\n loading:selectOtherLoading(state),\n materiale:selectLookupMateriale(state),\n orders:selectOrderOrders(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n deletedItems:selectOrderDeletedItems(state),\n errors:selectOtherErrors(state)\n})\n\nconst mapDispatchToProps=dispatch=>({\n setLoading:boll=>dispatch(setLoading(boll)),\n setCurrentItem:item=>dispatch(setCurrentItem(item)),\n setOpenEditItem:bool=>dispatch(setOpenEditItem(bool)),\n setUpdatedOrder:orderUp=>dispatch(setUpdatedOrder(orderUp)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n resetErrors:()=>dispatch(resetErrors()),\n setErrors:(eroare)=>dispatch(setErrors(eroare))\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(withRouter(withSnackbar(OrderContentJO)));\n\n\n","/* eslint-disable linebreak-style */\nimport React, {useState} from 'react';\nimport {connect} from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport { makeStyles } from '@material-ui/styles';\nimport './orderheader.css'\nimport {\n Card,\n CardHeader,\n CardContent,\n Divider,\n Grid,\n TextField,\n Tooltip,\n colors\n} from '@material-ui/core';\nimport { dataFormatRO } from '../../../../utils/functiiComune';\nimport {setUpdatedOrder} from '../../../../redux/order/order.actions'\nimport {selectOrderCurrentProduct, selectOrderCurrentOrder,selectOrderUpdatedOrder } from '../../../../redux/order/order.selectors'\nimport {selectDeliveryAddresses } from '../../../../redux/user/user.selectors'\n\n\nconst useStyles = makeStyles(() => ({\n header:{\n background:colors.blueGrey[700],\n textAlign:'center',\n color:'grey'\n },\n menu: {\n width: 200,\n },\n centerGrid:{\n alignContent: 'center'\n }\n}));\n\nconst OrderHeader = props => {\n const { className,currentProduct, deliveryAddresses, setUpdatedOrder, updatedOrder} = props;\n const classes = useStyles();\n //----------------------------------------------------------------\n const [values, setValues] = useState({\n id: updatedOrder.id,\n dataComanda: updatedOrder.dataComanda,\n clientClient:updatedOrder.clientClient,\n observatii:updatedOrder.observatii,\n adresaLivrare:updatedOrder.adresaLivrare,\n discount:updatedOrder.discount,\n subTip:updatedOrder.subTip\n });\n\n //----------------------------------------------------------------\n const handleChange = event => {\n setValues({\n ...values,\n [event.target.name]: event.target.value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')\n });\n setUpdatedOrder({...updatedOrder,[event.target.name]: event.target.value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '')})\n };\n //----------------------------------------------------------------\n\n return (\n \n \n \n );\n}\n\nOrderHeader.propTypes = {\n className: PropTypes.string,\n currentProduct:PropTypes.object,\n deliveryAddresses:PropTypes.array,\n setUpdatedOrder:PropTypes.func,\n updatedOrder:PropTypes.object,\n};\n\n\nconst mapStateToProps=state=>({\n currentProduct:selectOrderCurrentProduct(state),\n currentOrder:selectOrderCurrentOrder(state),\n deliveryAddresses:selectDeliveryAddresses(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n})\n\nconst mapDispatchToProps=dispatch=>({\n setUpdatedOrder:order=>dispatch(setUpdatedOrder(order)),\n})\n\nexport default connect(mapStateToProps,mapDispatchToProps)(withRouter(OrderHeader));\n","/* eslint-disable react/no-multi-comp */\n/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\nimport React, {useState} from 'react';\nimport {connect} from 'react-redux';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash.isequal';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardContent,\n Divider,\n Fab\n} from '@material-ui/core';\nimport SaveIcon from '@material-ui/icons/Save';\nimport CancelIcon from '@material-ui/icons/Cancel';\nimport SendIcon from '@material-ui/icons/Send';\nimport { withSnackbar } from 'notistack';\nimport { confirmAlert } from 'react-confirm-alert';\nimport 'react-confirm-alert/src/react-confirm-alert.css';\nimport './orderfooter.css';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport { selectOrderCurrentOrder, selectOrderUpdatedOrder, selectOrderOrders, selectOrderDeletedItems } from '../../../../redux/order/order.selectors'\nimport { setOverlaySpinner } from '../../../../redux/other/other.actions';\nimport { setCurrentOrder, setUpdatedOrder, setOrdersSuccess, setDeletedItems } from '../../../../redux/order/order.actions'\nimport {setLoading } from '../../../../redux/other/other.actions';\nimport {selectCurrentUser } from '../../../../redux/user/user.selectors';\n\n\nconst useStyles = makeStyles((theme) => ({\n alignButton:{\n display:'flex',\n justifyContent: 'flex-end' \n },\n container: {\n width:'100%',\n display:'flex',\n flexDirection: 'row',\n justifyContent: 'space-between', \n flexWrap:'wrap'\n },\n fab: {\n margin: theme.spacing(1),\n },\n extendedIconGreen:{\n color:'green'\n },\n extendedIconRed:{\n color:'red'\n },\n extendedIconOrange:{\n color:'orange'\n }\n}));\n\nconst OrderFooter = props => {\n \n const [buttonDisabled, setButtonDisabled]=useState(false);\n const { currentOrder,updatedOrder, setOrdersSuccess,orders,deletedItems,setDeletedItems, history, enqueueSnackbar, setOverlaySpinner, setCurrentOrder} = props;\n const classes = useStyles();\n //-------------------------------------------------------------------------------------------------------\n const jsonCopy=(src)=>{\n return JSON.parse(JSON.stringify(src));\n }\n //-------------------------------------------------------------------------------------------------------\n\n\n //-------------------------------------------------------------------------------------------------------\n\n const handleCancel=()=>{\n if (isEqual(currentOrder,updatedOrder)){\n let path = '/orders';\n setCurrentOrder({})\n history.push(path);\n \n }else{\n confirmAlert({\n title: 'Comanda are modificari',\n message: 'Sunteti sigur ca doriti sa abandonati aceste modificari?',\n buttons: [\n {\n label: 'Da',\n onClick: () => {\n let path = '/orders';\n setCurrentOrder({})\n history.push(path);\n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de abandon a fost anulata.',{ \n variant: 'warning',\n autoHideDuration:3000\n }) \n }\n }\n ]\n });\n }\n }\n //-------------------------------------------------------------------------------------------------------\n const salvareComandaNouaRepereNoi=async ()=>{\n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n var comandaSalvata\n await strapi.createEntry('comandas',\n {\n 'clientClient': updatedOrder.clientClient? updatedOrder.clientClient : '',\n 'valoareCatalog': updatedOrder.comandarepers? TotalValoareCatalog: 0, \n 'discount': updatedOrder.discount? updatedOrder.discount : 0,\n 'cursValutar': updatedOrder.cursValutar? updatedOrder.cursValutar:0,\n 'valoareComanda': updatedOrder.comandarepers? TotalValoareComanda: 0, \n 'valoareClientFinal': updatedOrder.comandarepers? TotalValoareClientFinal: 0, \n 'observatii': updatedOrder.observatii? updatedOrder.observatii :'',\n 'adresaLivrare': updatedOrder.adresaLivrare? updatedOrder.adresaLivrare:'',\n 'stadiu': updatedOrder.stadiu?updatedOrder.stadiu:'NETRANSMISA',\n 'idFirma': updatedOrder.idFirma? updatedOrder.idFirma : 0,\n 'tipProdus': updatedOrder.tipProdus? updatedOrder.tipProdus :'Z',\n 'subTip':updatedOrder.subTip? updatedOrder.subTip :''\n })\n .then(async (res)=>{\n comandaSalvata=res\n let comenzi= jsonCopy(props.orders) \n comenzi.unshift(res) \n setOrdersSuccess(comenzi)\n \n if(updatedOrder.comandarepers && updatedOrder.comandarepers.length>0){\n updatedOrder.comandarepers.map( async (reper,index)=>{\n if(reper.id<0 && reper.denumireProdus !=='STERGE'){\n await strapi.createEntry('comandarepers',\n {\n 'idComanda': res.id,\n 'nrCrt': index+1,\n 'tipSubprodus': reper.tipSubprodus,\n 'lungime': reper.lungime,\n 'lungimeFinala': reper.lungimeFinala,\n 'inaltime': reper.inaltime,\n 'inaltimeFinala': reper.inaltimeFinala,\n 'deschidere': reper.deschidere,\n 'culoareLamela': reper.culoareLamela,\n 'culoareCaseta': reper.culoareCaseta,\n 'material': reper.material,\n 'codMaterial': reper.codMaterial,\n 'lungimeSnur': reper.lungimeSnur,\n 'actionare': reper.actionare, // camp folosit pentru data creearii necesar la ordonare in Devco\n 'tipActionare': reper.tipActionare,\n 'actionareStDr': reper.actionareStDr,\n 'ax': reper.ax,\n 'culoareComponente': reper.culoareComponente,\n 'optional1': reper.optional1,\n 'optional2': reper.optional2,\n 'optional3': reper.optional3,\n 'optional4': reper.optional4,\n 'console': reper.console,\n 'buc': reper.buc,\n 'mp': reper.mp,\n 'pretCatalog': reper.pretCatalog,\n 'pretCuDiscount': reper.pretCuDiscount,\n 'pretClientFinal': reper.pretClientFinal,\n 'observatii': reper.observatii,\n 'tipProdus': reper.tipProdus,\n 'denumireProdus': reper.denumireProdus,\n 'denumireSubProdus': reper.denumireSubProdus,\n 'denumireCuloareLamela': reper.denumireCuloareLamela,\n 'denumireCuloareCaseta': reper.denumireCuloareCaseta,\n 'denumireMaterial': reper.denumireMaterial,\n 'denumireTipActionare': reper.denumireTipActionare,\n 'denumireOptional1': reper.denumireOptional1,\n 'denumireOptional2': reper.denumireOptional2,\n 'denumireOptional3': reper.denumireOptional3,\n 'denumireOptional4': reper.denumireOptional4\n })\n .then((response)=>{ \n let foundComanda = comenzi.findIndex(com => com.id === response.idComanda.id); \n comenzi[foundComanda].comandarepers.push(response)\n setOrdersSuccess(comenzi)\n })\n .catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva reperele de pe comanda.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n setLoading(false)\n }); \n }\n \n })\n } \n })\n .then(()=>{\n props.enqueueSnackbar('Salvare cu success',{ \n variant: 'success',\n autoHideDuration:3000\n })\n \n })\n .catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva comanda.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n setLoading(false)\n });\n \n return comandaSalvata\n }\n //-------------------------------------------------------------------------------------------------------\n const salvareComandaModificata=async ()=>{\n return new Promise( (resolve, reject) => { \n const TotalValoareCatalog=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCatalog;},0)\n const TotalValoareComanda=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretCuDiscount;},0)\n const TotalValoareClientFinal=updatedOrder.comandarepers.reduce((accumulator, currentValue)=> {return accumulator + currentValue.pretClientFinal;},0)\n \n setTimeout(async() => {\n await strapi.updateEntry('comandas',updatedOrder.id,\n {\n 'clientClient': updatedOrder.clientClient? updatedOrder.clientClient : '',\n 'valoareCatalog': updatedOrder.comandarepers? TotalValoareCatalog: 0, \n 'discount': updatedOrder.discount? updatedOrder.discount : 0,\n 'cursValutar': updatedOrder.cursValutar? updatedOrder.cursValutar:0,\n 'valoareComanda': updatedOrder.comandarepers? TotalValoareComanda: 0, \n 'valoareClientFinal': updatedOrder.comandarepers? TotalValoareClientFinal: 0, \n 'observatii': updatedOrder.observatii? updatedOrder.observatii :'',\n 'adresaLivrare': updatedOrder.adresaLivrare? updatedOrder.adresaLivrare:'',\n 'stadiu': updatedOrder.stadiu?updatedOrder.stadiu:'NETRANSMISA',\n 'idFirma': updatedOrder.idFirma? updatedOrder.idFirma : 0,\n 'tipProdus': updatedOrder.tipProdus? updatedOrder.tipProdus :'Z',\n 'subTip':updatedOrder.subTip? updatedOrder.subTip :''\n }\n )\n .then((res)=>{ \n let comenzi= jsonCopy(props.orders)\n let foundComanda = comenzi.findIndex(com => com.id === res.id); \n comenzi[foundComanda]=res\n return {res, comenzi}\n }) \n .then(({comenzi, res})=>{\n setOrdersSuccess(comenzi)\n props.enqueueSnackbar('Salvare cu success',{ \n variant: 'success',\n autoHideDuration:3000\n })\n resolve(res)\n }).catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva modificarile.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n reject('Error')\n });\n },2000)\n })\n }\n\n //-------------------------------------------------------------------------------------------------------\n const salvareReperNou=(reper, index)=>{\n return new Promise( (resolve, reject) => {\n setTimeout(async() => {\n await strapi.createEntry('comandarepers',\n {\n 'idComanda': updatedOrder.id,\n 'nrCrt': index+1,\n 'tipSubprodus': reper.tipSubprodus,\n 'lungime': reper.lungime,\n 'lungimeFinala': reper.lungimeFinala,\n 'inaltime': reper.inaltime,\n 'inaltimeFinala': reper.inaltimeFinala,\n 'deschidere': reper.deschidere,\n 'culoareLamela': reper.culoareLamela,\n 'culoareCaseta': reper.culoareCaseta,\n 'material': reper.material,\n 'codMaterial': reper.codMaterial,\n 'lungimeSnur': reper.lungimeSnur,\n 'actionare': reper.actionare,// camp folosit pentru data creearii necesar la ordonare in Devco\n 'tipActionare': reper.tipActionare,\n 'actionareStDr': reper.actionareStDr,\n 'ax': reper.ax,\n 'culoareComponente': reper.culoareComponente,\n 'optional1': reper.optional1,\n 'optional2': reper.optional2,\n 'optional3': reper.optional3,\n 'optional4': reper.optional4,\n 'console': reper.console,\n 'buc': reper.buc,\n 'mp': reper.mp,\n 'pretCatalog': reper.pretCatalog,\n 'pretCuDiscount': reper.pretCuDiscount,\n 'pretClientFinal': reper.pretClientFinal,\n 'observatii': reper.observatii,\n 'tipProdus': reper.tipProdus,\n 'denumireProdus': reper.denumireProdus,\n 'denumireSubProdus': reper.denumireSubProdus,\n 'denumireCuloareLamela': reper.denumireCuloareLamela,\n 'denumireCuloareCaseta': reper.denumireCuloareCaseta,\n 'denumireMaterial': reper.denumireMaterial,\n 'denumireTipActionare': reper.denumireTipActionare,\n 'denumireOptional1': reper.denumireOptional1,\n 'denumireOptional2': reper.denumireOptional2,\n 'denumireOptional3': reper.denumireOptional3,\n 'denumireOptional4': reper.denumireOptional4\n }).then(()=>{ \n resolve('ok')\n }).catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva reperele de pe comanda.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n reject('Error')\n });\n },1000) \n }) \n }\n //-------------------------------------------------------------------------------------------------------\n const salvareReperModificat=async (reper, index)=>{\n if (typeof reper.idComanda==='object'){\n var foundComanda = orders.findIndex(com => com.id === reper.idComanda.id);\n }else{\n foundComanda = orders.findIndex(com => com.id === reper.idComanda);\n }\n \n let foundReperOrders = orders[foundComanda].comandarepers.findIndex(rep => rep.id === reper.id); \n let foundReperUpdatedOrder = updatedOrder.comandarepers.findIndex(rep => rep.id === reper.id); \n\n if(isEqual(orders[foundComanda].comandarepers[foundReperOrders], updatedOrder.comandarepers[foundReperUpdatedOrder])===false){\n return new Promise((resolve, reject) => {\n setTimeout(async() => {\n await strapi.updateEntry('comandarepers', reper.id,\n {\n 'idComanda': updatedOrder.id,\n 'nrCrt': index+1,\n 'tipSubprodus': reper.tipSubprodus,\n 'lungime': reper.lungime,\n 'lungimeFinala': reper.lungimeFinala,\n 'inaltime': reper.inaltime,\n 'inaltimeFinala': reper.inaltimeFinala,\n 'deschidere': reper.deschidere,\n 'culoareLamela': reper.culoareLamela,\n 'culoareCaseta': reper.culoareCaseta,\n 'material': reper.material,\n 'codMaterial': reper.codMaterial,\n 'lungimeSnur': reper.lungimeSnur,\n 'tipActionare': reper.tipActionare,\n 'actionareStDr': reper.actionareStDr,\n 'ax': reper.ax,\n 'culoareComponente': reper.culoareComponente,\n 'optional1': reper.optional1,\n 'optional2': reper.optional2,\n 'optional3': reper.optional3,\n 'optional4': reper.optional4,\n 'console': reper.console,\n 'buc': reper.buc,\n 'mp': reper.mp,\n 'pretCatalog': reper.pretCatalog,\n 'pretCuDiscount': reper.pretCuDiscount,\n 'pretClientFinal': reper.pretClientFinal,\n 'observatii': reper.observatii,\n 'tipProdus': reper.tipProdus,\n 'denumireProdus': reper.denumireProdus,\n 'denumireSubProdus': reper.denumireSubProdus,\n 'denumireCuloareLamela': reper.denumireCuloareLamela,\n 'denumireCuloareCaseta': reper.denumireCuloareCaseta,\n 'denumireMaterial': reper.denumireMaterial,\n 'denumireTipActionare': reper.denumireTipActionare,\n 'denumireOptional1': reper.denumireOptional1,\n 'denumireOptional2': reper.denumireOptional2,\n 'denumireOptional3': reper.denumireOptional3,\n 'denumireOptional4': reper.denumireOptional4,\n }).then(()=>{ \n resolve('ok')\n }).catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva modificarile la reperele de pe comanda.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n reject('Error')\n });\n },1000)\n }) \n } \n }\n //-------------------------------------------------------------------------------------------------------\n const stergereReper=async (reper)=>{\n if (typeof reper.idComanda==='object'){\n var foundComanda = orders.findIndex(com => com.id === reper.idComanda.id);\n }else{\n // eslint-disable-next-line no-redeclare\n foundComanda = orders.findIndex(com => com.id === reper.idComanda);\n }\n let foundReperOrders = orders[foundComanda].comandarepers.findIndex(rep => rep.id === reper.id); \n \n if(foundReperOrders !==-1){\n return new Promise((resolve, reject) => {\n setTimeout(async() => {\n await strapi.deleteEntry('comandarepers', reper.id)\n .then(()=>{\n resolve('ok')\n }).catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut salva modificarile la reperele de pe comanda.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n reject('Error')\n });\n },1000)\n }) \n } \n }\n //-------------------------------------------------------------------------------------------------------\n const handleSave= async ()=>{\n\n if (!updatedOrder.clientClient){\n props.enqueueSnackbar('Nu ati completat clientul!',{ \n variant: 'error',\n })\n return\n }\n // if (!updatedOrder.adresaLivrare){\n // props.enqueueSnackbar('Nu ati completat adresa de livrare!',{ \n // variant: 'error',\n // })\n // return\n // }\n\n setOverlaySpinner(true)\n setButtonDisabled(true)\n //-----salvare comanda noua-----------------\n if (!isEqual(currentOrder,updatedOrder)){\n if(updatedOrder.id===0){\n await salvareComandaNouaRepereNoi()\n } \n //-----salvare repere comanda-----------------\n if(updatedOrder.comandarepers && updatedOrder.comandarepers.length>0){\n updatedOrder.comandarepers.map( async (reper,index)=>{\n if(reper.id<0 && reper.denumireProdus !=='STERGE' && reper.idComanda !==0){\n await salvareReperNou(reper,index)\n }\n if(reper.id>0){\n await salvareReperModificat(reper,index)\n }\n })\n }\n //-----stergere repere comanda----------------- (acolo unde denumireProdus='STERGE' && id>0)\n if(deletedItems && deletedItems.filter((item=>(item.id>0))).length>0){\n deletedItems.filter((item=>(item.id>0))).map(async (rep)=>{\n await stergereReper(rep) \n })\n }\n //-----salvare comanda modificata-----------------\n if(updatedOrder.id>0 && isEqual(updatedOrder,currentOrder)===false){\n await salvareComandaModificata()\n }\n setDeletedItems([])\n \n }\n // props.closeSnackbar()\n \n setCurrentOrder({})\n setTimeout(()=>{\n setButtonDisabled(false)\n setOverlaySpinner(false)\n history.push('/orders')\n },1000)\n \n }\n\n //-------------------------------------------------------------------------------------------------------\n const handleTrimite= async ()=>{\n var comandaSal\n var idComanda\n if (!updatedOrder.clientClient){\n props.enqueueSnackbar('Nu ati completat clientul!',{ \n variant: 'error',\n })\n return\n }\n // if (!updatedOrder.adresaLivrare){\n // props.enqueueSnackbar('Nu ati completat adresa de livrare!',{ \n // variant: 'error',\n // })\n // return\n // }\n setOverlaySpinner(true)\n setButtonDisabled(true)\n //-----salvare comanda noua-----------------\n if (!isEqual(currentOrder,updatedOrder)){\n if(updatedOrder.id===0){\n comandaSal= await salvareComandaNouaRepereNoi()\n } \n //-----salvare repere comanda-----------------\n if(updatedOrder.comandarepers && updatedOrder.comandarepers.length>0){\n updatedOrder.comandarepers.map( async (reper,index)=>{\n if(reper.id<0 && reper.denumireProdus !=='STERGE' && reper.idComanda !==0){\n await salvareReperNou(reper,index)\n }\n if(reper.id>0){\n await salvareReperModificat(reper,index)\n }\n })\n }\n //-----stergere repere comanda----------------- (acolo unde denumireProdus='STERGE' && id>0)\n if(deletedItems && deletedItems.filter((item=>(item.id>0))).length>0){\n deletedItems.filter((item=>(item.id>0))).map(async (rep)=>{\n await stergereReper(rep) \n })\n }\n //-----salvare comanda modificata-----------------\n if(updatedOrder.id>0 && isEqual(updatedOrder,currentOrder)===false){\n await salvareComandaModificata()\n }\n setDeletedItems([]) \n }\n\n //------update stadiu comanda la 'TRANSMISA'\n // let idComanda = comandaSal?comandaSal.id:updatedOrder.id -schimbata de vazut daca are efect mutarea intr-un then dupa salvare\n\n async function alocare(){\n idComanda = comandaSal?comandaSal.id:updatedOrder.id\n }\n await alocare();\n\n await strapi.updateEntry('comandas',idComanda,{'stadiu': 'TRANSMISA',})\n .catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut trimite comanda.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n })\n .then((res)=>{ \n let comenzi= jsonCopy(props.orders)\n let foundComanda = comenzi.findIndex(com => com.id === res.id); \n if (foundComanda !==-1){\n comenzi[foundComanda]=res\n }else{\n comenzi.unshift(res) \n }\n return comenzi\n })\n .then((comenzi)=>{\n setOrdersSuccess(comenzi)\n props.enqueueSnackbar('Trimitere cu succes',{ \n variant: 'success',\n autoHideDuration:3000\n })\n })\n //-----update indicator comenzi noi la 1\n await strapi.updateEntry('indicators',1,{\n 'Valoare': 1,\n } )\n .catch(e=>{\n props.enqueueSnackbar(`Eroare : nu am putut reseta indicatorul de comenzi noi.(${e})`,{ \n variant: 'error',\n persist:true,\n })\n setLoading(false)\n })\n .then(()=>{\n props.enqueueSnackbar('Trimitere cu success',{ \n variant: 'success',\n autoHideDuration:1500\n })\n })\n\n // props.closeSnackbar()\n \n setCurrentOrder({})\n setTimeout(()=>{\n setButtonDisabled(false)\n setOverlaySpinner(false)\n history.push('/orders')\n },1000)\n }\n\n //-------------------------------------------------------------------------------------------------------\n const trimiteComanda=async ()=>{\n confirmAlert({\n title: 'Confirmare trimitere comanda',\n message: 'Odata transmisa, o comanda nu mai poate suferi modificari si va fi considerata o comanda ferma. Sunteti sigur ca doriti sa trimiteti aceasta comanda?',\n buttons: [\n {\n label: 'Da',\n onClick: async() => {\n setButtonDisabled(true)\n handleTrimite() \n \n \n }\n },\n {\n label: 'Nu',\n onClick: () => {\n enqueueSnackbar('Operatia de transmitere a fost anulata.',{ \n variant: 'warning',\n autoHideDuration:3000\n }) \n }\n }\n ]\n });\n setButtonDisabled(false)\n }\n //----------------------------------------------------------------------------------------------------\n const vanzatorVizibilitate=()=>{\n const {currentUser}=props;\n if(currentUser.role.name==='Vanzator'){\n return false;\n }else{\n return true;\n }\n }\n\n\n return ( \n \n \n \n \n \n \n Trimite\n \n
\n \n \n \n Salvare\n \n \n \n Abandon\n \n
\n \n \n \n );\n \n}\n\nOrderFooter.propTypes = {\n className: PropTypes.string,\n currentOrder:PropTypes.object,\n deletedItems:PropTypes.array, \n enqueueSnackbar:PropTypes.func,\n history:PropTypes.object,\n orders:PropTypes.array,\n setDeletedItems:PropTypes.func, \n setOrdersSuccess:PropTypes.func, \n updatedOrder:PropTypes.object\n};\n\n\nconst mapStateToProps=state=>({\n currentUser:selectCurrentUser(state),\n currentOrder:selectOrderCurrentOrder(state),\n updatedOrder:selectOrderUpdatedOrder(state),\n orders:selectOrderOrders(state),\n deletedItems:selectOrderDeletedItems(state),\n})\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentOrder:order=>dispatch(setCurrentOrder(order)),\n setUpdatedOrder:order=>dispatch(setUpdatedOrder(order)),\n setOrdersSuccess:orders=>dispatch(setOrdersSuccess(orders)),\n setDeletedItems:items=>dispatch(setDeletedItems(items)),\n setOverlaySpinner:bool=>dispatch(setOverlaySpinner(bool)),\n setLoading:boll=>dispatch(setLoading(boll)),\n})\n\nexport default connect(mapStateToProps,mapDispatchToProps)(withRouter(withSnackbar(OrderFooter)));\n","/* eslint-disable react/no-multi-comp */\n/* eslint-disable react/jsx-no-undef */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport LoadingOverlay from 'react-loading-overlay';\nimport { makeStyles } from '@material-ui/styles';\nimport { OrderHeader } from './components';\nimport { OrderContentJV} from './components';\nimport { OrderContentRO} from './components';\nimport { OrderContentRE} from './components';\nimport { OrderContentREA} from './components';\nimport { OrderContentRES} from './components';\nimport { OrderContentRET} from './components';\nimport { OrderContentUG} from './components';\nimport { OrderContentPI} from './components';\nimport { OrderContentJO} from './components';\nimport { OrderContentSV} from './components';\nimport { OrderFooter } from './components';\nimport { selectOtherOverlaySpinner } from '../../redux/other/other.selectors'\nimport { selectOrderCurrentProduct } from '../../redux/order/order.selectors';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(3)\n },\n content: {\n marginTop: theme.spacing(2)\n },\n pagination: {\n marginTop: theme.spacing(3),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end'\n }\n}));\n\nconst Order = (props) => {\n const classes = useStyles();\n const {overlaySpinner, currentProduct}=props\n const product = () => {\n switch(currentProduct.cod) {\n case 'jv': \n return ;\n case 'ro': \n return ;\n case 're': \n switch(currentProduct.subTip) {\n case 'REA':\n return ;\n case 'RES':\n return ;\n case 'RET':\n return ;\n case '':\n return ;\n }\n case 'ug': \n return ;\n case 'pi': \n return ;\n case 'jo': \n return ;\n case 'sv':\n return null;\n default: \n return Nici un tip de produs nu este setat \n }\n }\n\n return (\n \n \n \n \n {product()}\n \n
\n \n \n );\n};\n\nconst mapStateToProps=state=>({\n overlaySpinner:selectOtherOverlaySpinner(state),\n currentProduct:selectOrderCurrentProduct(state)\n\n})\n\n\nexport default connect(mapStateToProps)(Order) ;\n","/* eslint-disable linebreak-style */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { makeStyles } from '@material-ui/styles';\nimport {\n Card,\n CardHeader,\n CardContent,\n CardActions,\n Divider,\n Button,\n TextField,\n colors\n} from '@material-ui/core';\nimport {strapi} from '../../../../strapi/strapi.config';\nimport { withSnackbar } from 'notistack';\n\nconst useStyles = makeStyles(() => ({\n root: {},\n alignButton:{\n desplay:'flex',\n justifyContent: 'flex-end' \n },\n buton:{\n width:'35%',\n background:colors.blueGrey[500],\n color:'white'\n },\n header:{\n background:colors.blueGrey[700],\n }\n}));\n\nconst Password = props => {\n const { className, enqueueSnackbar, codResetare } = props;\n const classes = useStyles();\n const [values, setValues] = useState({\n password: '',\n confirm: '',\n cod:codResetare\n });\n //--------------------------------------------------------------------------\n const handleChange = event => {\n setValues({\n ...values,\n [event.target.name]: event.target.value\n });\n };\n //--------------------------------------------------------------------------\n const handleSubmit = async e => {\n e.preventDefault()\n if (values.password===values.confirm){\n try{\n\n await strapi.resetPassword(values.cod, values.password, values.confirm)\n .then(()=>{\n enqueueSnackbar('Parola noua a fost setata cu succes.',{ \n variant: 'success',\n autoHideDuration:3000\n })\n setValues({\n password: '',\n confirm: '',\n cod:values.cod\n })\n })\n }catch(e){\n console.log(e)\n enqueueSnackbar(`Eroare : cod resetare invalid/expirat sau lipsa conexiune.(${e})`,{ \n variant: 'error',\n persist:true, \n })\n }\n \n } else{\n enqueueSnackbar('Rubrica Parola nu este egal cu rubrica Confirmare parola!',{ \n variant: 'error',\n })\n }\n };\n //--------------------------------------------------------------------------\n return (\n \n \n \n );\n};\n\nPassword.propTypes = {\n className: PropTypes.string,\n enqueueSnackbar:PropTypes.func\n};\n\nexport default withSnackbar(Password);\n","// de sters tot folderul ResetPassword , a fost inclus direct in dashboard\n\n\nimport React from 'react';\nimport {\n\n useLocation\n\n} from \"react-router-dom\"\n// import {connect} from 'react-redux';\nimport { makeStyles } from '@material-ui/styles';\nimport { Grid } from '@material-ui/core';\nimport { Password } from './components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n padding: theme.spacing(4),\n background: '#CFD8DC',\n height: '100%',\n overflow: 'auto'\n }\n}));\n\nconst ResetPassword = (props) => {\n const classes = useStyles();\n const location = useLocation()\n const queryParameters = new URLSearchParams(location.search)\n\n const codResetare = () => {\nconsole.log (queryParameters.get(\"code\"))\n if (queryParameters.get(\"code\") !== \"\" && queryParameters.get(\"code\") !== null) {\n return true;\n } else {\n\n return false;\n }\n }\n\n return (\n codResetare() ?\n\n \n
WebStore Larexir- resetare parola! \n
\n \n \n \n \n
\n :\n WebStore Larexir- cod resetare invalid! \n );\n};\n\n\n// const mapStateToProps=state=>({\n// currentUser:selectCurrentUser(state),\n// })\n// export default connect(mapStateToProps)(Settings);\nexport default ResetPassword;","/* eslint-disable linebreak-style */\nimport React from 'react';\nimport {connect} from 'react-redux';\nimport { Switch, Redirect } from 'react-router-dom';\nimport {getCookie} from './strapi/strapi.utils'\nimport { RouteWithLayout } from './components';\nimport { Main as MainLayout, Minimal as MinimalLayout } from './layouts';\nimport {\n Dashboard as DashboardView,\n ProductList as ProductListView,\n Account as AccountView,\n Settings as SettingsView,\n ResetPassword as ResetPasswordView,\n SignUp as SignUpView,\n SignIn as SignInView,\n NotFound as NotFoundView,\n SignOut as SignOutView,\n Contact as ContactView,\n OrdersList as OrdersListView,\n Order as OrderView,\n ClientOffer as ClientOfferView\n} from './views';\n\nconst Routes = ({currentUser}) => {\n \n if(currentUser && getCookie('jwt')){\n return (\n \n \n {/* \n */}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n }else{\n return(\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n }\n \n};\n\nconst mapStateToProps=state=>({\n currentUser:state.user.currentUser\n})\n\nexport default connect(mapStateToProps)(Routes);\n","/* eslint-disable linebreak-style */\n/* eslint-disable react/prop-types */\nimport { Component } from 'react';\nimport { bindActionCreators } from 'redux';\nimport { connect } from 'react-redux';\nimport { withSnackbar } from 'notistack';\nimport { removeSnackbar } from '../../redux/other/other.actions';\n\nclass Notifier extends Component {\n displayed = [];\n\n storeDisplayed = (id) => {\n this.displayed = [...this.displayed, id];\n };\n\n\n removeDisplayed = (id) => {\n this.displayed = this.displayed.filter(key => id !== key)\n }\n\n componentDidUpdate() {\n const { notifications = [] } = this.props;\n\n notifications.forEach(({ key, message, options = {}, dismissed = false }) => {\n if (dismissed) {\n this.props.closeSnackbar(key)\n return\n }\n // Do nothing if snackbar is already displayed\n if (this.displayed.includes(key)) return;\n // Display snackbar using notistack\n this.props.enqueueSnackbar(message, {\n key,\n ...options,\n onClose: (event, reason, key) => {\n if (options.onClose) {\n options.onClose(event, reason, key);\n }\n },\n onExited: (event, key) => {\n this.props.removeSnackbar(key);\n this.removeDisplayed(key)\n }\n });\n // Keep track of snackbars that we've displayed\n this.storeDisplayed(key);\n });\n }\n\n render() {\n return null;\n }\n}\n\nconst mapStateToProps = store => ({\n notifications: store.other.notifications,\n});\n\nconst mapDispatchToProps = dispatch => bindActionCreators({ removeSnackbar }, dispatch);\n\nexport default withSnackbar(connect(mapStateToProps,mapDispatchToProps)(Notifier));\n","/* eslint-disable react/prop-types */\n/* eslint-disable linebreak-style */\nimport React, { Component, Fragment } from 'react';\nimport { Router } from 'react-router-dom';\nimport { createBrowserHistory } from 'history';\nimport { ThemeProvider } from '@material-ui/styles';\nimport validate from 'validate.js';\n\nimport theme from './theme';\nimport 'react-perfect-scrollbar/dist/css/styles.css';\nimport './assets/scss/index.scss';\nimport validators from './common/validators';\nimport Routes from './Routes';\n\nimport {connect} from 'react-redux';\nimport {setLoading} from './redux/other/other.actions'\nimport './App.css'\n\n\nimport {getUser,setUser, clearToken, getFirmaX} from './strapi/strapi.utils.js';\nimport { withSnackbar } from 'notistack';\n\nimport Notifier from './components/Notifier/Notifier';\n\nimport {loadProduseStart,loadMaterialeStart, loadOptionaleStart, loadCuloriStart, loadPreturiTabelareStart, loadInformariStart, loadIndicatoriStart, loadFirmaStart, loadCursStart} from './redux/lookup/lookup.actions';\nimport {setCurrentUserSuccess, setDeliveryAddressesStart} from './redux/user/user.actions';\nimport { selectCurrentUser }from './redux/user/user.selectors'\n\n\nimport {strapi} from 'strapi/strapi.config';\n\n\nimport FadeIn from 'react-fade-in';\nimport Lottie from 'react-lottie';\nimport 'bootstrap/dist/css/bootstrap.css';\n\nimport * as legoData from './views/Loading/legoloader.json';\nimport * as doneData from './views/Loading/doneloading.json';\n\n\nconst defaultOptions = {\n loop: true,\n autoplay: true,\n animationData: legoData.default,\n rendererSettings: {\n preserveAspectRatio: 'xMidYMid slice'\n }\n}\n\n\nconst defaultOptions2 = {\n loop: false,\n autoplay: true,\n animationData: doneData.default,\n rendererSettings: {\n preserveAspectRatio: 'xMidYMid slice'\n }\n};\n\n\nconst browserHistory = createBrowserHistory();\n\n\n\nvalidate.validators = {\n ...validate.validators,\n ...validators\n};\n\n\nclass App extends Component {\n\n componentDidMount(){\n const {currentUser, setCurrentUserSuccess, loadProduseStart, loadMaterialeStart,loadOptionaleStart, loadCuloriStart, loadPreturiTabelareStart, loadInformariStart, loadIndicatoriStart, loadFirmaStart, loadCursStart }=this.props \n console.log(currentUser, \"currentUser\")\n if(this.verificareLocalStorage()<10){ \n localStorage.removeItem('indicatori');\n }\n \n this.setCurrentUserUpdate()\n \n if (currentUser && this.verificareUtilizator()){\n loadFirmaStart(currentUser?currentUser.idFirma.id:0)\n loadProduseStart()\n loadMaterialeStart()\n loadOptionaleStart()\n loadCuloriStart()\n loadInformariStart()\n loadPreturiTabelareStart()\n loadCursStart() \n setDeliveryAddressesStart(currentUser?currentUser.idFirma.id:0)\n \n \n if (this.verificareLocalStorage()>=11){\n loadIndicatoriStart()\n }else{\n setTimeout(function() {\n loadIndicatoriStart() \n }, 2000);\n }\n }\n\n }\n\n async verificareUtilizator(){\n await strapi.getEntries('indicators',{indicator:'InregistrariNoi'})\n .then(()=>true)\n .catch(()=> {\n clearToken()\n this.props.setCurrentUserSuccess(null)\n setTimeout(()=>window.location.reload(),500)\n return false\n })\n \n }\n\n verificareLocalStorage(){\n var nrNomenclatoare=Object.keys(localStorage)\n return nrNomenclatoare.length\n }\n\n\n async setCurrentUserUpdate() {\n const currentUtilizator= getUser()\n await strapi.getEntries('firmas',{id:(currentUtilizator?.idFirma?.id) || 0})\n .then((res)=>{\n setUser({...currentUtilizator, idFirma:res[0],comandas:[]});\n this.props.setCurrentUserSuccess({...currentUtilizator, idFirma:res[0],comandas:[]});\n }).catch(e=>{\n console.log(\"nu exista date precendete despre utilizator\")\n }); \n\n }; \n\n\n render() {\n const {loading, done}=this.props\n if (loading===false){\n return (\n \n \n \n \n \n \n \n \n\n // Aplicatie in mentenanta in intervalul 16:00-24:00 \n\n );\n }else{\n return (\n \n
\n loading...
\n \n {done ? (\n \n ) : (\n \n )}\n
\n \n
\n
\n );\n }\n }\n}\n\nconst mapStateToProps=state=>({\n loading:state.other.loading,\n done:state.other.done,\n // currentUser:state.user.currentUser,\n currentUser:selectCurrentUser(state),\n \n})\n\nconst mapDispatchToProps=dispatch=>({\n setCurrentUserSuccess:user=>dispatch(setCurrentUserSuccess(user)),\n loadProduseStart:()=>dispatch(loadProduseStart()),\n loadMaterialeStart:()=>dispatch(loadMaterialeStart()),\n loadOptionaleStart:()=>dispatch(loadOptionaleStart()),\n loadCuloriStart:()=>dispatch(loadCuloriStart()),\n loadPreturiTabelareStart:()=>dispatch(loadPreturiTabelareStart()),\n loadInformariStart:()=>dispatch(loadInformariStart()),\n loadIndicatoriStart:()=>dispatch(loadIndicatoriStart()),\n loadFirmaStart:(id)=>dispatch(loadFirmaStart(id)),\n loadCursStart:()=>dispatch(loadCursStart()),\n setLoading:boll=>dispatch(setLoading(boll)),\n setDeliveryAddressesStart:idFirma=>dispatch(setDeliveryAddressesStart(idFirma)),\n})\nexport default connect(mapStateToProps,mapDispatchToProps)(withSnackbar(App));","import React from 'react';\nimport HighlightOffIcon from '@material-ui/icons/HighlightOff';\nimport ReactDOM from 'react-dom';\nimport {BrowserRouter} from 'react-router-dom';\nimport {Provider} from 'react-redux';\nimport {PersistGate} from 'redux-persist/integration/react';\nimport {store, persistor} from './redux/store';\nimport * as serviceWorker from './serviceWorker';\nimport App from './App';\nimport { SnackbarProvider } from 'notistack';\n\nconst notistackRef = React.createRef();\nconst onClickDismiss = key => () => { \n notistackRef.current.closeSnackbar(key);\n}\n\n\nReactDOM.render(\n \n \n \n (\n \n )}\n maxSnack={1}\n ref={notistackRef} \n >\n \n \n \n \n \n , document.getElementById('root'));\n\nserviceWorker.unregister();\n"],"sourceRoot":""}