diff options
| author | gabrhr <[email protected]> | 2022-05-25 15:36:35 -0500 |
|---|---|---|
| committer | gabrhr <[email protected]> | 2022-05-25 15:36:35 -0500 |
| commit | 55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af (patch) | |
| tree | 316e157c2f167c595c4a8abc2c30932b3a0577e1 /front/odiparpack/app | |
| parent | f74cc2a27968533395b43334f606df63be4bb40f (diff) | |
| download | DP1_project-55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af.tar.gz DP1_project-55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af.tar.bz2 DP1_project-55c0f57d42d82f1f1f5809e9c7d6845b6e0b68af.zip | |
Add PedidoPage
- cambio de esqueleto segun figma
- componente de etiquetas
- tabla y form de Pedido
#TODO
- estetica de etiquetas
- redux y crear end points
Diffstat (limited to 'front/odiparpack/app')
24 files changed, 756 insertions, 471 deletions
diff --git a/front/odiparpack/app/api/brand.js b/front/odiparpack/app/api/brand.js index 883eed5..216e180 100644 --- a/front/odiparpack/app/api/brand.js +++ b/front/odiparpack/app/api/brand.js @@ -1,8 +1,8 @@ module.exports = { - name: 'Boss Ultimate', - desc: 'Boss Ultimate - Material Admin Dashboard', - prefix: 'boss', - footerText: 'Boss Ultimate All Rights Reserved 2018', - logoText: 'Boss Ultimate', + name: 'OdiparPack', + desc: 'OdiparPack - Planeamiento de rutas', + prefix: 'odipk', + footerText: 'OdiparPack All Rights Reserved 2022', + logoText: 'OdiparPack', needLogin: false }; diff --git a/front/odiparpack/app/api/dummyContents.js b/front/odiparpack/app/api/dummyContents.js index 104cdfd..2f839fb 100644 --- a/front/odiparpack/app/api/dummyContents.js +++ b/front/odiparpack/app/api/dummyContents.js @@ -1,7 +1,7 @@ import avatarApi from './avatars'; const dummyContent = { user: { - name: 'John Doe', + name: 'Mitsuo Tokumori', title: 'Administrator', avatar: avatarApi[6] }, diff --git a/front/odiparpack/app/api/menu.js b/front/odiparpack/app/api/menu.js index dce8f58..637424a 100644 --- a/front/odiparpack/app/api/menu.js +++ b/front/odiparpack/app/api/menu.js @@ -1,454 +1,51 @@ module.exports = [ { - key: 'dashboard', - name: 'Dashboard', - icon: 'dashboard', - child: [ - { - key: 'dashboard_v1', - name: 'Dashboard V1', - link: '/app' - }, - { - key: 'dashboard_v2', - name: 'Dashboard V2', - link: '/app/dashboard-v2' - }, - ] + key: 'seguimiento', + name: 'Seguimiento', + icon: 'near_me', + link: '/app/dashboard-v2', + child: [ ] }, { - key: 'layouts', - name: 'Layouts', - icon: 'view_column', - child: [ - { - key: 'grid', - name: 'Grid', - link: '/app/layouts/grid' - }, - { - key: 'application_layout', - name: 'App Layout', - link: '/app/layouts/app-layout' - }, - { - key: 'responsive', - name: 'Responsive', - link: '/app/layouts/responsive' - } - ] + key: 'pedidos', + name: 'Pedidos', + icon: 'inventory_2', + link: '/app/pedidos', + child: [ ] }, { - key: 'tables', - name: 'Tables', - icon: 'grid_on', - child: [ - { - key: 'basic_table', - name: 'Basic Table', - link: '/app/tables/basic-table' - }, - { - key: 'data_table', - name: 'Data Table', - link: '/app/tables/data-table' - }, - { - key: 'tree_table', - name: 'Tree Table', - link: '/app/tables/tree-table' - }, - { - key: 'crud_table', - name: 'CRUD Table', - link: '/app/tables/crud-table' - }, - { - key: 'table_playground', - name: 'Table Playgound', - link: '/app/tables/table-playground' - }, - ] + key: 'camiones', + name: 'Camiones', + icon: 'local_shipping', + link: '/app/layouts/grid', + child: [ ] }, { - key: 'forms', - name: 'Form Button', - icon: 'border_color', - child: [ - { - key: 'reduxform', - name: 'Redux Form', - link: '/app/forms/reduxform' - }, - { - key: 'datetimepicker', - name: 'Date Time Picker', - link: '/app/forms/date-time-picker' - }, - { - key: 'checkbox_radio', - name: 'Checkbox & Radio', - link: '/app/forms/checkbox-radio' - }, - { - key: 'switches', - name: 'Switches', - link: '/app/forms/switches' - }, - { - key: 'selectbox', - name: 'Select', - link: '/app/forms/selectbox' - }, - { - key: 'buttons', - name: 'Buttons', - link: '/app/forms/buttons' - }, - { - key: 'textfields', - name: 'Textfields', - link: '/app/forms/textfields' - }, - { - key: 'autocomplete', - name: 'Autocomplete & Tag', - link: '/app/forms/autocomplete' - }, - { - key: 'slider', - name: 'Slider Range', - link: '/app/forms/slider-range' - }, - { - key: 'upload', - name: 'Upload', - link: '/app/forms/upload' - }, - { - key: 'ratting', - name: 'Ratting', - link: '/app/forms/ratting' - }, - { - key: 'texteditor', - name: 'WYSIWYG Editor', - link: '/app/forms/wysiwyg-editor' - }, - ] + key: 'almacenes', + name: 'Almacenes', + icon: 'warehouse', + link: '/app/tables/crud-table', + child: [ ] }, { - key: 'ui', - name: 'UI Elements', - icon: 'flag', - child: [ - { - key: 'icons', - name: 'Icons', - link: '/app/ui/icons' - }, - { - key: 'avatars', - name: 'Avatars', - link: '/app/ui/avatars' - }, - { - key: 'badges', - name: 'Badges', - link: '/app/ui/badges' - }, - { - key: 'card_papper', - name: 'Card & Papper', - link: '/app/ui/card-papper' - }, - { - key: 'dialog_modal', - name: 'Dialog & Modal', - link: '/app/ui/dialog-modal' - }, - { - key: 'drawer_menu', - name: 'Drawer & Menu', - link: '/app/ui/drawer-menu' - }, - { - key: 'tab', - name: 'Tabs Navigation', - link: '/app/ui/tabs' - }, - { - key: 'accordion', - name: 'Accordion', - link: '/app/ui/accordion' - }, - { - key: 'image_gird', - name: 'Image Grid Gallery', - link: '/app/ui/image-grid' - }, - { - key: 'list_divider', - name: 'List & Divider', - link: '/app/ui/list' - }, - { - key: 'popover_tooltip', - name: 'Popover & Tooltip', - link: '/app/ui/popover-tooltip' - }, - { - key: 'progress', - name: 'Progress & Spinners', - link: '/app/ui/progress' - }, - { - key: 'tags', - name: 'Tags', - link: '/app/ui/tags' - }, - { - key: 'steppers', - name: 'Steppers', - link: '/app/ui/steppers' - }, - { - key: 'notification', - name: 'Notification', - link: '/app/ui/notification' - }, - { - key: 'breadcrumbs', - name: 'Breadcrumbs', - link: '/app/ui/breadcrumbs' - }, - { - key: 'dividers', - name: 'Dividers', - link: '/app/ui/dividers' - }, - { - key: 'typography', - name: 'Typography', - link: '/app/ui/typography' - }, - { - key: 'slider_carousel', - name: 'Slider & Carousel', - link: '/app/ui/slider-carousel' - }, - { - key: 'paginations', - name: 'Paginations', - link: '/app/ui/paginations' - }, - ] + key: 'red_tramos', + name: 'Red de Tramos', + icon: 'location_on', + link: '/app/forms/reduxform', + child: [ ] }, { - key: 'charts', - name: 'Charts', - icon: 'insert_chart', - child: [ - { - key: 'line_charts', - name: 'Line Charts', - link: '/app/charts/line-charts' - }, - { - key: 'bar_charts', - name: 'Bar Charts', - link: '/app/charts/bar-charts' - }, - { - key: 'area_charts', - name: 'Area Charts', - link: '/app/charts/area-charts' - }, - { - key: 'pie_charts', - name: 'Pie & Donuts Charts', - link: '/app/charts/pie-charts' - }, - { - key: 'radar_charts', - name: 'Radar Charts', - link: '/app/charts/radar-charts' - }, - { - key: 'scatter_charts', - name: 'Scatter Charts', - link: '/app/charts/scatter-charts' - }, - { - key: 'compossed_charts', - name: 'Compossed Charts', - link: '/app/charts/compossed-chart' - }, - { - key: 'responsive_charts', - name: 'Responsive Charts', - link: '/app/charts/responsive-chart' - }, - ] + key: 'otros', + name: 'Otros parámetros', + icon: 'settings', + link: '/app/ui/icons', + child: [ ] }, { - key: 'apps', - name: 'Apps', - icon: 'bubble_chart', - child: [ - { - key: 'social_media', - name: 'Social Media', - link: '/app/pages/social-media' - }, - { - key: 'ecommerce', - name: 'Ecommerce', - link: '/app/pages/ecommerce' - }, - { - key: 'contact', - name: 'Contact', - link: '/app/pages/contact' - }, - { - key: 'calendar', - name: 'Calendar', - link: '/app/pages/calendar' - }, - { - key: 'email', - name: 'Email', - link: '/app/pages/email' - }, - { - key: 'chat', - name: 'Chat', - link: '/app/pages/chat' - }, - ] - }, - { - key: 'pages', - name: 'Pages', - icon: 'library_books', - child: [ - { - key: 'user_profile', - name: 'User Profile', - link: '/app/pages/user-profile' - }, - { - key: 'gallery', - name: 'Photo Gallery', - link: '/app/pages/photo-gallery' - }, - { - key: 'not_found_page', - name: 'Not Found Page', - link: '/app/pages/not-found' - }, - { - key: 'error_page', - name: 'Error Page', - link: '/app/pages/error' - }, - { - key: 'maintenance', - name: 'Maintenance', - link: '/maintenance' - }, - { - key: 'login', - name: 'Login', - link: '/login' - }, - { - key: 'register', - name: 'Register', - link: '/register' - }, - { - key: 'reset', - name: 'Reset Password', - link: '/reset-password' - }, - { - key: 'lock', - name: 'Lock Screen', - link: '/lock-screen' - }, - { - key: 'blank', - name: 'Blank Page', - link: '/app/pages/blank-page' - }, - { - key: 'help_support', - name: 'Help & Support', - link: '/app/pages/help-support' - }, - ] - }, - { - key: 'maps', - name: 'Maps', - icon: 'maps', - child: [ - { - key: 'map_marker', - name: 'Map Marker', - link: '/app/maps/map-marker' - }, - { - key: 'map_direction', - name: 'Map Direction', - link: '/app/maps/map-direction' - }, - { - key: 'map_searchbox', - name: 'Map with Searchbox', - link: '/app/maps/map-searchbox' - }, - { - key: 'map_traffic', - name: 'Traffic Indicator', - link: '/app/maps/map-traffic' - }, - { - key: 'street_view', - name: 'Street View', - link: '/app/maps/street-view' - }, - ] - }, - { - key: 'menu_levels', - name: 'Menu Levels', - icon: 'sort', - child: [ - { - key: 'level_1', - name: 'Level 1', - link: '/#' - }, - { - key: 'level_2', - keyParent: 'menu_levels', - name: 'Level 2', - child: [ - { - key: 'sub_menu_1', - name: 'Sub Menu 1', - link: '/#' - }, - { - key: 'sub_menu_2', - name: 'Sub Menu 2', - link: '/#' - }, - ] - }, - ] + key: 'simulacion', + name: 'Simulación', + icon: 'fast_forward', + link: '/app/pages/calendar', + child: [ ] } -]; +];
\ No newline at end of file diff --git a/front/odiparpack/app/components/Forms/ReduxFormMUI.js b/front/odiparpack/app/components/Forms/ReduxFormMUI.js index 383a717..e3f5c33 100644 --- a/front/odiparpack/app/components/Forms/ReduxFormMUI.js +++ b/front/odiparpack/app/components/Forms/ReduxFormMUI.js @@ -4,6 +4,12 @@ import TextField from '@material-ui/core/TextField'; import Select from '@material-ui/core/Select'; import Checkbox from '@material-ui/core/Checkbox'; import Switch from '@material-ui/core/Switch'; +import { DateTimePicker, MuiPickersUtilsProvider } from '@material-ui/pickers'; + +import MomentUtils from '@date-io/moment'; +import moment from 'moment' +import 'moment/locale/es' +moment.locale('es'); /* Textfield */ export const TextFieldRedux = ({ meta: { touched, error }, input, ...rest }) => ( @@ -67,3 +73,18 @@ SwitchRedux.propTypes = { input: PropTypes.object.isRequired, }; /* End */ + +export const DatePickerRedux = ({ input, label, readonly}) => ( + + <MuiPickersUtilsProvider locale={'es'} utils={MomentUtils}> + <DateTimePicker + format="DD/MM/YYYY hh:mm A" + autoOk + onChange={date => input.onChange(moment(date).format("DD/MM/YYYY hh:mm A"))} + value={input.value ? moment(input.value,"DD/MM/YYYY hh:mm A"): null} + label={label} + readOnly = {readonly} + disabled = {readonly} + /> + </MuiPickersUtilsProvider> +); diff --git a/front/odiparpack/app/components/Header/Header.js b/front/odiparpack/app/components/Header/Header.js index e1d0bf5..2b86b41 100644 --- a/front/odiparpack/app/components/Header/Header.js +++ b/front/odiparpack/app/components/Header/Header.js @@ -36,7 +36,7 @@ function Header(props) { > <MenuIcon /> </IconButton> - <div className={classes.flex}> + {/* <div className={classes.flex}> <div className={classes.wrapper}> <div className={classes.search}> <SearchIcon /> @@ -46,8 +46,8 @@ function Header(props) { </div> <Hidden xsDown> <span className={classes.separatorV} /> - </Hidden> - <UserMenu /> + </Hidden> + <UserMenu />*/} </Toolbar> </AppBar> ); diff --git a/front/odiparpack/app/components/Odipar/EtiquetaData.js b/front/odiparpack/app/components/Odipar/EtiquetaData.js new file mode 100644 index 0000000..4a2a37c --- /dev/null +++ b/front/odiparpack/app/components/Odipar/EtiquetaData.js @@ -0,0 +1,73 @@ +//Pedido +export const pedido = { + entregado: { + text: "Entregado", + color: "#81C784", + icon: false + }, + pendiente:{ + text: "Pendiente", + color: "#FFB74D", + icon: false + }, + enCamino: { + text: "En Camino", + color: "#64B5F6", + icon: false + }, + cancelado: { + text: "Cancelado", + color: "#E57373", + icon: false + } + } + + //Camion + export const camion = { + entregado: { + text: "Entregado", + color: "#81C784", + icon: false + }, + pendiente:{ + text: "Pendiente", + color: "#FFB74D", + icon: false + }, + enCamino: { + text: "En Camino", + color: "#64B5F6", + icon: false + }, + cancelado: { + text: "Cancelado", + color: "#E57373", + icon: false + } + } + + export const bloqueo = { + desbloqueado: { + text: "Entregado", + color: "#81C784", + icon: false + }, + bloqueado:{ + text: "Pendiente", + color: "#FFB74D", + icon: false + } + } + + export const almacen = { + noPrincipal: { + text: "Pequeño", + color: "#81C784", + icon: false + }, + principal:{ + text: "Principal", + color: "#FFB74D", + icon: false + } + }
\ No newline at end of file diff --git a/front/odiparpack/app/components/Odipar/common.js b/front/odiparpack/app/components/Odipar/common.js new file mode 100644 index 0000000..c66b792 --- /dev/null +++ b/front/odiparpack/app/components/Odipar/common.js @@ -0,0 +1,38 @@ +import React from "react" +import { Chip } from "@material-ui/core"; +import {pedido, camion, bloqueo, almacen} from './EtiquetaData' + +const etiquetaStyle = color => ({ + fontWeight: 'bold', + color: '#FFF', + backgroundColor: color +}); + + +//Etiquetas +export function etiqueta(tipo , estado) { // eslint-disable-line + let {color, text} = "" + switch(tipo){ + case 'etiq_pedido': + text = pedido[Object.keys(pedido)[estado]].text + color = pedido[Object.keys(pedido)[estado]].color + break; + case 'etiq_camion': + text = camion[Object.keys(camion)[estado]].text + color = camion[Object.keys(camion)[estado]].color + break; + case 'etiq_bloqueo': + text = bloqueo[Object.keys(bloqueo)[estado]].text + color = bloqueo[Object.keys(bloqueo)[estado]].color + break; + case 'etiq_alma': + console.log("entre?") + text = almacen[Object.keys(almacen)[estado]].text + color = almacen[Object.keys(almacen)[estado]].color + break; + } + + return ( + <Chip label={text} style={etiquetaStyle(color)}/> + ) +}
\ No newline at end of file diff --git a/front/odiparpack/app/components/Panel/FloatingPanel.js b/front/odiparpack/app/components/Panel/FloatingPanel.js index 675166a..f0a0e6b 100644 --- a/front/odiparpack/app/components/Panel/FloatingPanel.js +++ b/front/odiparpack/app/components/Panel/FloatingPanel.js @@ -82,7 +82,7 @@ FloatingPanel.propTypes = { }; FloatingPanel.defaultProps = { - title: 'Add New Item', + title: 'Añadir nuevo', extraSize: false, }; diff --git a/front/odiparpack/app/components/Sidebar/MainMenuSimple.js b/front/odiparpack/app/components/Sidebar/MainMenuSimple.js new file mode 100644 index 0000000..f7634ca --- /dev/null +++ b/front/odiparpack/app/components/Sidebar/MainMenuSimple.js @@ -0,0 +1,98 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import classNames from 'classnames'; +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { NavLink } from 'react-router-dom'; +import ExpandLess from '@material-ui/icons/ExpandLess'; +import ExpandMore from '@material-ui/icons/ExpandMore'; +// Menu Object +import MenuContent from 'ba-api/menu'; +import { List, ListItem, ListItemIcon, ListItemText, Collapse, Icon } from '@material-ui/core'; +import styles from './sidebar-jss'; + +function sortByKey(array, key) { + return array.sort((a, b) => { + const x = a[key]; const y = b[key]; + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }); +} + +const LinkBtn = React.forwardRef(function LinkBtn(props, ref) { // eslint-disable-line + return <NavLink to={props.to} {...props} innerRef={ref} />; // eslint-disable-line +}); + +function MainMenuSimple(props) { + const { + classes, + toggleDrawerOpen, + loadTransition, + openSubMenu, + open, + } = props; + + const handleClick = () => { + //toggleDrawerOpen(); + loadTransition(false); + }; + + const getMenus = menuArray => menuArray.map((item, index) => { + return ( + <div key={index.toString()}> + <ListItem + button + exact + className={classNames(classes.head, open.indexOf(item.key) > -1 ? classes.opened : '')} + activeClassName={classes.active} + component={LinkBtn} + to={item.link} + onClick={handleClick} + timeout="auto" + unmountOnExit + > + {item.icon + && ( + <ListItemIcon className={classes.iconWrapper}> + <Icon className={classes.icon}>{item.icon}</Icon> + </ListItemIcon> + ) + } + <ListItemText classes={{ primary: classes.primary }} variant="inset" primary={item.name} /> + </ListItem> + </div> + ); + }); + return ( + <div> + {getMenus(MenuContent)} + </div> + ); +} + +MainMenuSimple.propTypes = { + classes: PropTypes.object.isRequired, + open: PropTypes.object.isRequired, + openSubMenu: PropTypes.func.isRequired, + toggleDrawerOpen: PropTypes.func.isRequired, + loadTransition: PropTypes.func.isRequired, +}; + +const openAction = (key, keyParent) => ({ type: 'OPEN_SUBMENU', key, keyParent }); +const reducer = 'ui'; + +const mapStateToProps = state => ({ + force: state, // force active class for sidebar menu + open: state.getIn([reducer, 'subMenuOpen']) +}); + +const mapDispatchToProps = dispatch => ({ + openSubMenu: bindActionCreators(openAction, dispatch) +}); + +const MainMenuMapped = connect( + mapStateToProps, + mapDispatchToProps +)(MainMenuSimple); + +export default withStyles(styles)(MainMenuMapped); diff --git a/front/odiparpack/app/components/Sidebar/Sidebar.js b/front/odiparpack/app/components/Sidebar/Sidebar.js index 01de4ec..b4f5626 100644 --- a/front/odiparpack/app/components/Sidebar/Sidebar.js +++ b/front/odiparpack/app/components/Sidebar/Sidebar.js @@ -4,10 +4,10 @@ import { withStyles } from '@material-ui/core/styles'; import classNames from 'classnames'; import brand from 'ba-api/brand'; import dummy from 'ba-api/dummyContents'; -import logo from 'ba-images/logo.svg'; -import { Hidden, Drawer, SwipeableDrawer, List, Divider, Avatar } from '@material-ui/core'; -import MainMenu from './MainMenu'; -import OtherMenu from './OtherMenu'; +import logo from 'ba-images/logo.png'; +import { Hidden, Drawer, SwipeableDrawer, Avatar } from '@material-ui/core'; +import MainMenuSimple from './MainMenuSimple'; +//import OtherMenu from './OtherMenu'; import styles from './sidebar-jss'; const MenuContent = props => { @@ -38,11 +38,11 @@ const MenuContent = props => { </div> </div> <div className={classes.menuContainer}> - <MainMenu loadTransition={loadTransition} toggleDrawerOpen={toggleDrawerOpen} /> - <Divider className={classes.divider} /> + <MainMenuSimple loadTransition={loadTransition} toggleDrawerOpen={toggleDrawerOpen} /> + {/* <Divider className={classes.divider} /> <List> <OtherMenu toggleDrawerOpen={toggleDrawerOpen} /> - </List> + </List> */} </div> </div> ); diff --git a/front/odiparpack/app/components/Sidebar/sidebar-jss.js b/front/odiparpack/app/components/Sidebar/sidebar-jss.js index e9bf4f6..95fb2b2 100644 --- a/front/odiparpack/app/components/Sidebar/sidebar-jss.js +++ b/front/odiparpack/app/components/Sidebar/sidebar-jss.js @@ -76,11 +76,14 @@ const styles = theme => ({ } }, avatar: { - margin: 10, + marginBottom: 10, + marginTop: 10, + marginLeft: 6, + marginRight: 10 }, bigAvatar: { - width: 80, - height: 80, + width: 55, + height: 55, }, brandBar: { transition: theme.transitions.create(['width', 'margin', 'background'], { @@ -168,16 +171,19 @@ const styles = theme => ({ fontSize: 14, padding: 10, alignItems: 'center', + justifyContent: 'flex-start', '& h4': { - fontSize: 18, + fontSize: 19, marginBottom: 0, textOverflow: 'ellipsis', + display: 'flex', overflow: 'hidden', whiteSpace: 'nowrap', - width: 110 + wordBreak:'break-all', + width: 180, }, '& span': { - fontSize: 12, + fontSize: 14, textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: 110, diff --git a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js index ccf0e4a..8869212 100644 --- a/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js +++ b/front/odiparpack/app/components/Tables/tableParts/MainTableForm.js @@ -61,7 +61,7 @@ class MainTableForm extends React.Component { <Tooltip title="Add Item"> <Button variant="contained" onClick={() => addNew(anchor, branch)} color="secondary" className={classes.button}> <AddIcon className={classNames(classes.leftIcon, classes.iconSmall)} /> - Add New + Añadir </Button> </Tooltip> </div> diff --git a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js index 7da655f..2f4a519 100644 --- a/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js +++ b/front/odiparpack/app/components/Tables/tableParts/RowReadOnly.js @@ -5,8 +5,9 @@ import classNames from 'classnames'; import css from 'ba-styles/Table.scss'; import DeleteIcon from '@material-ui/icons/Delete'; import EditIcon from '@material-ui/icons/BorderColor'; +import { etiqueta } from 'ba-components/Odipar/common'; -import { TableCell, IconButton } from '@material-ui/core'; +import { TableCell, IconButton, LinearProgress } from '@material-ui/core'; const styles = theme => ({ button: { @@ -32,11 +33,24 @@ class RowReadOnly extends React.Component { }; const renderCell = dataArray => dataArray.map((itemCell, index) => { if (itemCell.name !== 'action' && !itemCell.hidden) { - return ( - <TableCell padding="none" key={index.toString()}> - {item.get(itemCell.name) !== undefined ? item.get(itemCell.name).toString() : ''} - </TableCell> - ); + const inputType = anchor[index].type; + switch (inputType) { + case 'etiq_pedido': + case 'etiq_camion': + case 'etiq_bloqueo': + case 'etiq_alma': + return ( + <TableCell padding="none" key={index.toString()}> + {etiqueta(inputType, item.get(itemCell.name))} + </TableCell> + ); + case 'texto': + return ( + <TableCell padding="none" key={index.toString()}> + {item.get(itemCell.name) !== undefined ? item.get(itemCell.name).toString() : ''} + </TableCell> + ); + } } return false; }); diff --git a/front/odiparpack/app/components/index.js b/front/odiparpack/app/components/index.js index 9d7bdb3..123b48c 100644 --- a/front/odiparpack/app/components/index.js +++ b/front/odiparpack/app/components/index.js @@ -3,6 +3,8 @@ export Sidebar from './Sidebar/Sidebar'; export BreadCrumb from './BreadCrumb/BreadCrumb'; export SourceReader from './SourceReader/SourceReader'; export PapperBlock from './PapperBlock/PapperBlock'; +//Odipar + // Dashboard and Widget export CounterWidget from './Counter/CounterWidget'; export SliderWidget from './Widget/SliderWidget'; diff --git a/front/odiparpack/app/containers/App/Application.js b/front/odiparpack/app/containers/App/Application.js index 0a3ffc2..21c7a76 100644 --- a/front/odiparpack/app/containers/App/Application.js +++ b/front/odiparpack/app/containers/App/Application.js @@ -25,7 +25,8 @@ import { Profile, BlankPage, Photos, Error, Settings, HelpSupport, MapMarker, MapDirection, SearchMap, - TrafficIndicator, StreetViewMap, NotFound + TrafficIndicator, StreetViewMap, NotFound, + Pedidos } from '../pageListAsync'; function Application(props) { @@ -36,6 +37,8 @@ function Application(props) { <Switch> <Route exact path="/app" component={DashboardV1} /> <Route exact path="/app/dashboard-v2" component={DashboardV2} /> + {/* Pedidos */} + <Route exact path="/app/pedidos" component={Pedidos}/> { /* Layout */ } <Route exact path="/app/layouts" component={Parent} /> <Route path="/app/layouts/grid" component={Grid} /> diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js new file mode 100644 index 0000000..c1539e0 --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Pedidos/Pedidos.js @@ -0,0 +1,39 @@ +import React, { Component } from 'react'; +import { withStyles } from '@material-ui/core/styles'; +import PropTypes from 'prop-types'; +import { CrudPedido } from './table' +import { Paper, Typography } from '@material-ui/core'; +import { etiqueta } from 'ba-components/Odipar/common'; +const styles = ({ + root: { + flexGrow: 1, + marginTop: 30, + } + }); + +class Pedidos extends Component { + render() { + const { classes } = this.props; + return ( + <div> + <Typography variant="h4"> + {`Pedidos`} + </Typography> + <div> + {etiqueta("etiq_pedido", 1)} + </div> + <div> + <Paper className={classes.root}> + <CrudPedido title = "Historial de Pedidos"/> + </Paper> + </div> + </div> + ); + } +} + +Pedidos.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(Pedidos);
\ No newline at end of file diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js new file mode 100644 index 0000000..b11881f --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/CrudPedido.js @@ -0,0 +1,132 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import { + fetchAction, + addAction, + closeAction, + submitAction, + removeAction, + editAction, + closeNotifAction +} from 'ba-actions/CrudTbFrmActions'; +import { CrudTableForm, Notification } from 'ba-components'; +import { + Paper, + RadioGroup, +} from '@material-ui/core'; +import { anchorTable, dataApi } from './sampleData'; +import FormPedido from './FormPedido'; + + +const branch = 'crudPedido'; + +const renderRadioGroup = ({ input, ...rest }) => ( + <RadioGroup + {...input} + {...rest} + valueselected={input.value} + onChange={(event, value) => input.onChange(value)} + /> +); + + +const styles = ({ + root: { + flexGrow: 1, + } +}); + +class CrudPedido extends Component { + render() { + const { + classes, + fetchData, + addNew, + closeForm, + submit, + removeRow, + editRow, + dataTable, + openForm, + initValues, + closeNotif, + messageNotif, + title, + } = this.props; + return ( + <div> + <Notification close={() => closeNotif(branch)} message={messageNotif} /> + <Paper className={classes.root}> + <CrudTableForm + dataTable={dataTable} + openForm={openForm} + dataInit={dataApi} + anchor={anchorTable} + title={title} + fetchData={fetchData} + addNew={addNew} + closeForm={closeForm} + submit={submit} + removeRow={removeRow} + editRow={editRow} + branch={branch} + initValues={initValues} + > + {/* Create Your own form, then arrange or custom it as You like */} + <FormPedido/> + {/* No need create button or submit, because that already made in this component */} + </CrudTableForm> + </Paper> + </div> + ); + } +} + +renderRadioGroup.propTypes = { + input: PropTypes.object.isRequired, +}; + +CrudPedido.propTypes = { + dataTable: PropTypes.object.isRequired, + openForm: PropTypes.bool.isRequired, + classes: PropTypes.object.isRequired, + fetchData: PropTypes.func.isRequired, + addNew: PropTypes.func.isRequired, + closeForm: PropTypes.func.isRequired, + submit: PropTypes.func.isRequired, + removeRow: PropTypes.func.isRequired, + editRow: PropTypes.func.isRequired, + initValues: PropTypes.object.isRequired, + closeNotif: PropTypes.func.isRequired, + messageNotif: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, +}; + + +const mapStateToProps = state => ({ + force: state, // force state from reducer + initValues: state.getIn([branch, 'formValues']), + dataTable: state.getIn([branch, 'dataTable']), + openForm: state.getIn([branch, 'showFrm']), + messageNotif: state.getIn([branch, 'notifMsg']), +}); + +const mapDispatchToProps = dispatch => ({ + fetchData: bindActionCreators(fetchAction, dispatch), + addNew: bindActionCreators(addAction, dispatch), + closeForm: bindActionCreators(closeAction, dispatch), + submit: bindActionCreators(submitAction, dispatch), + removeRow: bindActionCreators(removeAction, dispatch), + editRow: bindActionCreators(editAction, dispatch), + closeNotif: bindActionCreators(closeNotifAction, dispatch), +}); + +const CrudPedidoMapped = connect( + mapStateToProps, + mapDispatchToProps +)(CrudPedido); + +export default withStyles(styles)(CrudPedidoMapped); diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js new file mode 100644 index 0000000..40bc801 --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/FormPedido.js @@ -0,0 +1,164 @@ +import React, { Component } from 'react'; +import { withStyles } from '@material-ui/core/styles'; +import PropTypes from 'prop-types'; +import { Field } from 'redux-form/immutable'; +import {required, integer} from 'ba-api/validation' +import { + SelectRedux, + TextFieldRedux, + DatePickerRedux +} from 'ba-components/Forms/ReduxFormMUI'; +import { + MenuItem, + InputLabel, + FormControl, + } from '@material-ui/core'; + +const styles = ({ + root: { + flexGrow: 1, + }, + field: { + width: '100%', + marginBottom: 20 + }, + fieldBasic: { + width: '100%', + marginBottom: 20, + marginTop: 10 + }, + inlineWrap: { + display: 'flex', + flexDirection: 'row' + } + }); + + +class FormPedido extends Component { + saveRef = ref => { + this.ref = ref; + return this.ref; + }; + + state = { + selectedDate: new Date(), + } + + handleDateChange = (date) => { + this.setState({ selectedDate: date }); + } + render() { + const { classes } = this.props; + const { selectedDate } = this.state; + const trueBool = true; + return ( + <> + <div> + <Field + name="cantidad" + component={TextFieldRedux} + placeholder="Cantidad paquetes A" + label="Cantidad de Paquetes A" + type = {'number'} + validate={[required, integer]} + required + ref={this.saveRef} + className={classes.field} + /> + </div> + <div> + <FormControl className={classes.field}> + <Field + name = "fecha" + component={DatePickerRedux} + label="Fecha de Registro" + readonly= {true} + /> + </FormControl> + </div> + <div> + <FormControl className={classes.field}> + <InputLabel htmlFor="selection">Lugar de Origen</InputLabel> + <Field + name="origen" + component={SelectRedux} + placeholder="Seleccionar" + autoWidth={trueBool} + > + <MenuItem value="Lima">Lima</MenuItem> + <MenuItem value="Arequipa">Arequipa</MenuItem> + <MenuItem value="Cuzco">Cuzco</MenuItem> + </Field> + </FormControl> + </div> + <div> + <FormControl className={classes.field}> + <InputLabel htmlFor="selection">Destino</InputLabel> + <Field + name="destino" + component={SelectRedux} + placeholder="Seleccionar" + autoWidth={trueBool} + > + <MenuItem value="Lima">Lima</MenuItem> + <MenuItem value="Arequipa">Arequipa</MenuItem> + <MenuItem value="Cuzco">Cuzco</MenuItem> + </Field> + </FormControl> + </div> + <div> + <Field + name="plazo_entrega" + component={TextFieldRedux} + placeholder="Plazo entrega" + label="Plazo de Entrega" + ref={this.saveRef} + className={classes.field} + /> + </div> + <div> + <Field + name="nombre" + component={TextFieldRedux} + placeholder="Ingrese el nombre" + label="Nombre del Cliente" + validate={required} + required + ref={this.saveRef} + className={classes.field} + /> + </div> + <div> + <Field + name="dni" + component={TextFieldRedux} + placeholder="Ingrese el dni" + label="DNI del Cliente" + validate={required} + required + ref={this.saveRef} + className={classes.field} + /> + </div> + <div> + <Field + name="correo" + component={TextFieldRedux} + placeholder="Ingrese el correo" + label="Correo del Cliente" + validate={required} + required + ref={this.saveRef} + className={classes.field} + /> + </div> + </> + ); + } +} + +FormPedido.propTypes = { + classes: PropTypes.object.isRequired, + }; + +export default withStyles(styles)(FormPedido);
\ No newline at end of file diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js new file mode 100644 index 0000000..48f7c9e --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/index.js @@ -0,0 +1 @@ +export CrudPedido from "./CrudPedido";
\ No newline at end of file diff --git a/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js new file mode 100644 index 0000000..2e2b003 --- /dev/null +++ b/front/odiparpack/app/containers/Odipar/Pedidos/table/sampleData.js @@ -0,0 +1,88 @@ +export const anchorTable = [ + { + name: 'id', + label: 'Id', + initialValue: '', + hidden: true, + type: 'texto' + }, { + name: 'cantidad', + label: 'Cantidad', + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'fecha', + label: 'Fecha de pedido', + initialValue: new Date(), + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'origen', + label: 'Origen', + initialValue: 'option1', + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'destino', + label: 'Destino', + initialValue: 'option1', + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'plazo_entrega', + label: 'Plazo de entrega', + initialValue: true, + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'nombre', + label: 'Cliente', + initialValue: true, + width: 'auto', + hidden: false, + type: 'texto' + }, { + name: 'estado', + label: 'Estado', + initialValue: 0, + width: 'auto', + hidden: false, + type: 'etiq_pedido' + }, { + name: 'action', + label: 'Action', + initialValue: '', + hidden: false + }, +]; + +export const dataApi = [ + { + id: '1', + cantidad: 30, + fecha: '24/05/2022 11:28 AM', + origen: 'Arequipa', + destino: 'Cuzco', + plazo_entrega: '24 horas', + nombre: 'Juan', + estado: 0, + correo: '[email protected]', + dni: '123456' + }, { + id: '2', + cantidad: 30, + fecha: '24/05/2022 10:28 AM', + origen: 'Lima', + destino: 'Cuzco', + plazo_entrega: '24 horas', + nombre: 'Juan', + estado: 1, + correo: '[email protected]', + dni: '123456' + } +]; diff --git a/front/odiparpack/app/containers/Templates/Dashboard.js b/front/odiparpack/app/containers/Templates/Dashboard.js index 5f24777..f82d16d 100644 --- a/front/odiparpack/app/containers/Templates/Dashboard.js +++ b/front/odiparpack/app/containers/Templates/Dashboard.js @@ -66,7 +66,7 @@ function Dashboard(props) { <main className={classNames(classes.content, !sidebarOpen && classes.contentPadding)} id="mainContent"> <div className={classes.bgbar} /> <section className={classes.mainWrap}> - <BreadCrumb separator=" › " theme="light" location={history.location} /> + <BreadCrumb separator=" › " theme="dark" location={history.location} /> <Fade in={pageLoaded} mountOnEnter diff --git a/front/odiparpack/app/containers/Templates/appStyles-jss.js b/front/odiparpack/app/containers/Templates/appStyles-jss.js index f9175eb..741bccf 100644 --- a/front/odiparpack/app/containers/Templates/appStyles-jss.js +++ b/front/odiparpack/app/containers/Templates/appStyles-jss.js @@ -52,6 +52,8 @@ const styles = theme => ({ }, mainWrap: { position: 'relative', + backgroundColor: '#F1EEEE', + padding: 20, marginTop: theme.spacing(6), marginLeft: theme.spacing(1.5), height: '100%', diff --git a/front/odiparpack/app/containers/pageListAsync.js b/front/odiparpack/app/containers/pageListAsync.js index feff750..102bb97 100644 --- a/front/odiparpack/app/containers/pageListAsync.js +++ b/front/odiparpack/app/containers/pageListAsync.js @@ -1,6 +1,12 @@ import Loadable from 'react-loadable'; import Loading from 'ba-components/Loading'; +// 2.Pedidos +export const Pedidos = Loadable({ + loader: () => import('./Odipar/Pedidos/Pedidos'), + loading: Loading, +}); + // Dashboard export const DashboardV1 = Loadable({ loader: () => import('./Dashboard/Dashboard'), diff --git a/front/odiparpack/app/redux/reducers.js b/front/odiparpack/app/redux/reducers.js index 902ab2b..7327c48 100644 --- a/front/odiparpack/app/redux/reducers.js +++ b/front/odiparpack/app/redux/reducers.js @@ -55,6 +55,7 @@ export default function createReducer(injectedReducers) { crudTableDemo: branchReducer(crudTable, 'crudTableDemo'), crudTableForm, crudTbFrmDemo: branchReducer(crudTableForm, 'crudTbFrmDemo'), + crudPedido: branchReducer(crudTableForm, 'crudPedido'), language: languageProviderReducer, router: connectRouter(history), ...injectedReducers, |
