Merge branch 'develop' of https://github.com/kfnawaz/plaidware-wms-web into feature/wms-55_develop
This commit is contained in:
@@ -8,6 +8,10 @@ module.exports = {
|
||||
extends: ['eslint:recommended', 'plugin:react/recommended'],
|
||||
parser: '@babel/eslint-parser',
|
||||
parserOptions: {
|
||||
requireConfigFile: false,
|
||||
babelOptions: {
|
||||
presets: ['@babel/preset-react']
|
||||
},
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
modules: true,
|
||||
@@ -23,7 +27,7 @@ module.exports = {
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
quotes: ['warn', 'single'],
|
||||
semi: ['warn', 'always'],
|
||||
'no-unused-vars' : 'warn',
|
||||
'no-unused-vars': 'warn',
|
||||
'comma-dangle': [
|
||||
'warn',
|
||||
{
|
||||
|
||||
@@ -100,7 +100,9 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.5",
|
||||
"@babel/eslint-parser": "^7.17.0",
|
||||
"@babel/preset-react": "^7.16.7",
|
||||
"eslint": "^8.2.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import PropTypes from 'prop-types';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
@@ -14,22 +14,8 @@ const useStyles = makeStyles({
|
||||
}
|
||||
});
|
||||
|
||||
export default function Dropdown({ dropdownData, label, dropdownChange = null }) {
|
||||
export default function Dropdown({ dropdownData, label, onChange, value }) {
|
||||
const classes = useStyles();
|
||||
const [age, setAge] = useState('');
|
||||
|
||||
const handleChange = (event) => {
|
||||
if (dropdownChange !== null) {
|
||||
dropdownChange(event);
|
||||
}
|
||||
const {
|
||||
target: { value }
|
||||
} = event;
|
||||
setAge(
|
||||
// On autofill we get a stringified value.
|
||||
typeof value === 'string' ? value.split(',') : value
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -40,22 +26,16 @@ export default function Dropdown({ dropdownData, label, dropdownChange = null })
|
||||
<FormControl sx={{ width: '100%' }}>
|
||||
<Select
|
||||
displayEmpty
|
||||
value={age}
|
||||
renderValue={(selected) => {
|
||||
if (selected.length === 0) {
|
||||
return <span>{/* {dropDownValue?.placeholder} */}</span>;
|
||||
}
|
||||
return selected;
|
||||
}}
|
||||
value={value}
|
||||
inputProps={{ 'aria-label': 'Without label' }}
|
||||
onChange={handleChange}
|
||||
onChange={onChange}
|
||||
>
|
||||
<MenuItem disabled value="">
|
||||
{/* <span>{dropDownValue?.label}</span> */}
|
||||
None selected
|
||||
</MenuItem>
|
||||
{dropdownData &&
|
||||
dropdownData.map((data) => (
|
||||
<MenuItem value={data.name} key={data._id}>
|
||||
<MenuItem value={data._id} key={data._id}>
|
||||
{data.name}
|
||||
</MenuItem>
|
||||
))}
|
||||
@@ -66,7 +46,8 @@ export default function Dropdown({ dropdownData, label, dropdownChange = null })
|
||||
);
|
||||
}
|
||||
Dropdown.propTypes = {
|
||||
dropdownData: PropTypes.object.isRequired,
|
||||
dropdownChange: PropTypes.object,
|
||||
label: PropTypes.string
|
||||
dropdownData: PropTypes.array,
|
||||
onChange: PropTypes.any,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.any
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ function NestedDataTable({ data, selected, setSelected, populateChildren }) {
|
||||
selected?.id === data.id
|
||||
? 'linear-gradient(135deg, ' +
|
||||
getColorOfLocationType(data.location) +
|
||||
' 0%, #f9f9f9 20%)'
|
||||
' 0%, #f9f9f9 100%)'
|
||||
: '#f9f9f9'
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -4,8 +4,7 @@ import { makeStyles } from '@mui/styles';
|
||||
import Search from 'assets/images/SearchIcon';
|
||||
|
||||
function SearchBar(props) {
|
||||
|
||||
const {onChange} = props;
|
||||
const { onChange } = props;
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
textField: {
|
||||
@@ -41,5 +40,5 @@ function SearchBar(props) {
|
||||
|
||||
SearchBar.propTypes = {
|
||||
onChange: PropTypes.func
|
||||
}
|
||||
};
|
||||
export default SearchBar;
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function TileBasic({ tiles }) {
|
||||
<Grid container spacing={2}>
|
||||
{tiles &&
|
||||
tiles.map((item) => (
|
||||
<Grid item key={item.name} xs={12} sm={6} md={tiles.length > 4 ? 4 : 6}>
|
||||
<Grid item key={item._id} xs={12} sm={6} md={tiles.length > 4 ? 4 : 6}>
|
||||
{item.disabled ? (
|
||||
<MDBox
|
||||
key={item.name + item.path}
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function Tile({ data, children }) {
|
||||
Update {data.name} <ArrowRightIcon />
|
||||
</Box>
|
||||
</Link>
|
||||
<Link to={`/setup/inventory/new-item/${data.widgetname}/${data.id}`}>
|
||||
<Link to={`/setup/inventory/new-item/${data.name}/${data.widgetname}/${data.id}`}>
|
||||
<Box className={`${classes.box} ${classes.boxEven}`}>
|
||||
Add New {data.widgetname} <ArrowRightIcon />
|
||||
</Box>
|
||||
@@ -49,7 +49,7 @@ export default function Tile({ data, children }) {
|
||||
Cycle Count <ArrowRightIcon />
|
||||
</Box>
|
||||
</Link>
|
||||
<Link to={`/setup/inventory/browse/${data.widgetname}/${data.id}`}>
|
||||
<Link to={`/setup/inventory/browse/${data.name}/${data.widgetname}/${data.id}`}>
|
||||
<Box className={`${classes.box} ${classes.boxEven}`}>
|
||||
{data.widgetname} List <ArrowRightIcon />
|
||||
</Box>
|
||||
|
||||
@@ -51,7 +51,7 @@ const useStyles = makeStyles({
|
||||
|
||||
function AddNewItem() {
|
||||
const classes = useStyles();
|
||||
const { widgetName, inventoryId, itemId } = useParams();
|
||||
const { widgetName, inventoryName, inventoryId, itemId } = useParams();
|
||||
const getInitialFormValues = (data) => {
|
||||
return data && data._id === itemId
|
||||
? {
|
||||
@@ -228,8 +228,8 @@ function AddNewItem() {
|
||||
{ name: 'Home', path: '/home' },
|
||||
{ name: 'Setup', path: '/setup' },
|
||||
{ name: 'Inventory', path: '/setup/inventory' },
|
||||
{ name: `${widgetName || 'Item'}` },
|
||||
{ name: `Add New ${widgetName || 'Item'}` }
|
||||
{ name: `${inventoryName || 'Inventory'}` },
|
||||
{ name: `${itemId ? 'Edit' : 'Add'} ${widgetName || 'Item'}` }
|
||||
]}
|
||||
/>
|
||||
<Box mx={3} my={3}>
|
||||
@@ -248,7 +248,12 @@ function AddNewItem() {
|
||||
variant="outlined"
|
||||
value={formik.values.commonName}
|
||||
error={formik.touched.commonName && Boolean(formik.errors.commonName)}
|
||||
helperText={formik.touched.commonName && formik.errors.commonName}
|
||||
helperText={
|
||||
formik.touched.commonName &&
|
||||
formik.errors.commonName && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.commonName}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -343,7 +348,12 @@ function AddNewItem() {
|
||||
variant="outlined"
|
||||
value={formik.values.formalName}
|
||||
error={formik.touched.formalName && Boolean(formik.errors.formalName)}
|
||||
helperText={formik.touched.formalName && formik.errors.formalName}
|
||||
helperText={
|
||||
formik.touched.formalName &&
|
||||
formik.errors.formalName && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.formalName}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -40,6 +40,7 @@ import { WarehouseSelectors } from 'redux/WarehouseRedux';
|
||||
import { InventorySelectors } from 'redux/InventoryRedux';
|
||||
import InventoryActions from 'redux/InventoryRedux';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import schema from 'services/ValidationServices';
|
||||
|
||||
const bottomButtonStyling = {
|
||||
width: '100%',
|
||||
@@ -354,11 +355,11 @@ function EditWarehouseDetails() {
|
||||
initialValues: {
|
||||
warehousename: warehouseData.name,
|
||||
address: warehouseData.address || '',
|
||||
preferredInventories: warehouseData.preferredInventories || [],
|
||||
preferredInventories: [...warehouseData.preferredInventories] || [],
|
||||
specs: warehouseData.specs || '',
|
||||
image: warehouseData.image_url ? [{ src: warehouseData.image_url }] : []
|
||||
},
|
||||
// validationSchema: schema.warehouseForm,
|
||||
validationSchema: schema.warehouseForm,
|
||||
onSubmit: (values) => {
|
||||
dispatch(
|
||||
WarehouseActions.editWarehouseAction({
|
||||
@@ -422,7 +423,12 @@ function EditWarehouseDetails() {
|
||||
variant="outlined"
|
||||
value={formik.values.warehousename}
|
||||
error={formik.touched.warehousename && Boolean(formik.errors.warehousename)}
|
||||
helperText={formik.touched.warehousename && formik.errors.warehousename}
|
||||
helperText={
|
||||
formik.touched.warehousename &&
|
||||
formik.errors.warehousename && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.warehousename}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -445,7 +451,12 @@ function EditWarehouseDetails() {
|
||||
variant="outlined"
|
||||
value={formik.values.address}
|
||||
error={formik.touched.address && Boolean(formik.errors.address)}
|
||||
helperText={formik.touched.address && formik.errors.address}
|
||||
helperText={
|
||||
formik.touched.address &&
|
||||
formik.errors.address && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.address}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -464,7 +475,6 @@ function EditWarehouseDetails() {
|
||||
<Select
|
||||
multiple
|
||||
select
|
||||
disabled
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
name="preferredInventories"
|
||||
@@ -497,6 +507,9 @@ function EditWarehouseDetails() {
|
||||
);
|
||||
}}
|
||||
>
|
||||
<MenuItem disabled key={'none'} value={''}>
|
||||
None Selected
|
||||
</MenuItem>
|
||||
{inventoryTypes &&
|
||||
inventoryTypes.map((inventory) => (
|
||||
<MenuItem key={inventory._id} value={inventory._id}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import DashboardNavbar from 'components/DashboardNavbar';
|
||||
import DashboardLayout from 'layouts/DashboardLayout';
|
||||
@@ -37,6 +37,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import WidgetNestedDataTable from 'components/WidgetNestedDataTable';
|
||||
import { GetIconFromSlug } from 'utils/inventorySlugTools';
|
||||
import { iconSlugs } from 'utils/inventorySlugTools';
|
||||
import AddCircleIcon from '@mui/icons-material/AddCircle';
|
||||
|
||||
const customStyles = {
|
||||
labelSize: {
|
||||
@@ -120,18 +121,16 @@ function InventoryScreen() {
|
||||
};
|
||||
|
||||
const currentInventoryData = useSelector(InventorySelectors.getInventoryDetailById(inventoryId));
|
||||
// LOGGER.log({ currentInventoryData });
|
||||
// const [inventoryAllData, setInventoryAllData] = useState([]);
|
||||
// const initialInventoryName='';
|
||||
const [iconSelect, setIconSelect] = React.useState('');
|
||||
|
||||
// useEffect(() => {
|
||||
// const filterData = inventoryData.filter((item) => item._id === inventoryId);
|
||||
// console.log('filterData', filterData);
|
||||
// setInitialInventoryName(filterData[0].name)
|
||||
// setInventoryAllData(filterData[0].widgetName);
|
||||
// }, []);
|
||||
|
||||
// LOGGER.log('initialInventoryName', initialInventoryName);
|
||||
useEffect(() => {
|
||||
if (inventoryId) {
|
||||
const iconFilter = iconSlugs.filter(
|
||||
(iconSlug) => iconSlug === currentInventoryData.icon_slug
|
||||
);
|
||||
setIconSelect(GetIconFromSlug(iconFilter[0]));
|
||||
}
|
||||
}, [inventoryId]);
|
||||
|
||||
/* eslint-disable indent */
|
||||
const formik = useFormik({
|
||||
@@ -199,6 +198,19 @@ function InventoryScreen() {
|
||||
setDeleteAlertOpen(true);
|
||||
};
|
||||
|
||||
const [iconSlugOpen, setIconSlugOpen] = React.useState(null);
|
||||
const handleIconSlugClose = () => {
|
||||
setIconSlugOpen(false);
|
||||
};
|
||||
const handleIconSlugOpen = () => {
|
||||
setIconSlugOpen(true);
|
||||
};
|
||||
|
||||
const handleIconSlug = (value) => {
|
||||
const iconFilter = iconSlugs.filter((iconSlug) => iconSlug === value);
|
||||
setIconSelect(GetIconFromSlug(iconFilter[0]));
|
||||
setIconSlugOpen(false);
|
||||
};
|
||||
return (
|
||||
<DashboardLayout>
|
||||
<DashboardNavbar />
|
||||
@@ -236,7 +248,10 @@ function InventoryScreen() {
|
||||
variant="outlined"
|
||||
value={formik.values.name}
|
||||
error={formik.touched.name && Boolean(formik.errors.name)}
|
||||
helpertText={formik.touched.name && formik.errors.name}
|
||||
helperText={
|
||||
formik.touched.name &&
|
||||
formik.errors.name && <div style={{ color: 'red' }}>{formik.errors.name}</div>
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -252,7 +267,12 @@ function InventoryScreen() {
|
||||
variant="outlined"
|
||||
value={formik.values.widgetName}
|
||||
error={formik.touched.widgetName && Boolean(formik.errors.widgetName)}
|
||||
helpertext={formik.touched.widgetName && formik.errors.widgetName}
|
||||
helperText={
|
||||
formik.touched.widgetName &&
|
||||
formik.errors.widgetName && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.widgetName}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Grid>
|
||||
@@ -367,25 +387,46 @@ function InventoryScreen() {
|
||||
Choose the icon to represent the inventory
|
||||
</MDTypography>
|
||||
</MDBox>
|
||||
<RadioGroup
|
||||
row
|
||||
sx={{
|
||||
marginTop: '15px'
|
||||
}}
|
||||
aria-labelledby="demo-error-radios"
|
||||
name="icon_slug"
|
||||
value={formik.values.icon_slug}
|
||||
onChange={formik.handleChange}
|
||||
|
||||
<AddCircleIcon fontSize="large" onClick={handleIconSlugOpen} />
|
||||
{iconSelect}
|
||||
<Dialog
|
||||
open={iconSlugOpen}
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
onClose={handleIconSlugClose}
|
||||
>
|
||||
{iconSlugs.map((iconSlug) => (
|
||||
<MyFormControlLabel
|
||||
key={iconSlug}
|
||||
value={iconSlug}
|
||||
control={<Radio style={{ display: 'none' }} />}
|
||||
label={GetIconFromSlug(iconSlug)}
|
||||
/>
|
||||
))}
|
||||
</RadioGroup>
|
||||
<DialogTitle id="alert-dialog-title">Select Icon</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-description">
|
||||
<RadioGroup
|
||||
row
|
||||
sx={{
|
||||
marginTop: '15px'
|
||||
}}
|
||||
aria-labelledby="demo-error-radios"
|
||||
name="icon_slug"
|
||||
value={formik.values.icon_slug}
|
||||
onChange={formik.handleChange}
|
||||
>
|
||||
{iconSlugs.map((iconSlug) => (
|
||||
<MyFormControlLabel
|
||||
key={iconSlug}
|
||||
value={iconSlug}
|
||||
control={<Radio style={{ display: 'none' }} />}
|
||||
label={GetIconFromSlug(iconSlug)}
|
||||
/>
|
||||
))}
|
||||
</RadioGroup>
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button autoFocus onClick={handleIconSlugClose}>
|
||||
No
|
||||
</Button>
|
||||
<Button onClick={() => handleIconSlug(formik.values.icon_slug)}>Yes</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Box>
|
||||
</Grid>
|
||||
<MDBox sx={{ ml: 'auto', mr: 'auto', mt: 3 }}>
|
||||
|
||||
@@ -44,7 +44,7 @@ const tHeads = [
|
||||
|
||||
function ItemListing() {
|
||||
const dispatch = useDispatch();
|
||||
const { widgetName, inventoryId } = useParams();
|
||||
const { inventoryName, widgetName, inventoryId } = useParams();
|
||||
const [page, setPage] = React.useState(1);
|
||||
const [perPage, setPerPage] = React.useState(10);
|
||||
LOGGER.log({ widgetName, inventoryId });
|
||||
@@ -103,6 +103,7 @@ function ItemListing() {
|
||||
{ name: 'Home', path: '/home' },
|
||||
{ name: 'Setup', path: '/setup' },
|
||||
{ name: 'Inventory', path: '/setup/inventory' },
|
||||
{ name: inventoryName || 'Inventory' },
|
||||
{ name: `${widgetName}s List` }
|
||||
]}
|
||||
/>
|
||||
@@ -162,7 +163,9 @@ function ItemListing() {
|
||||
perPage={perPage}
|
||||
setPerPage={setPerPage}
|
||||
editHandler={(id) => {
|
||||
navigateTo(`/setup/inventory/browse/${widgetName}/${inventoryId}/edit/${id}`);
|
||||
navigateTo(
|
||||
`/setup/inventory/browse/${inventoryName}/${widgetName}/${inventoryId}/edit/${id}`
|
||||
);
|
||||
}}
|
||||
deleteHandler={(id) => {
|
||||
handleDeleteAlertOpen(id);
|
||||
@@ -175,8 +178,7 @@ function ItemListing() {
|
||||
<>
|
||||
<Grid item sx={4}>
|
||||
<Select
|
||||
select
|
||||
variant="outlined"
|
||||
displayEmpty
|
||||
value={pFam}
|
||||
inputProps={{ 'aria-label': 'Without label' }}
|
||||
sx={{
|
||||
@@ -187,7 +189,7 @@ function ItemListing() {
|
||||
setPFam(e.target.value);
|
||||
}}
|
||||
>
|
||||
<MenuItem key={'none'} value={''}>
|
||||
<MenuItem disabled key={'none'} value={''}>
|
||||
Widget family L1
|
||||
</MenuItem>
|
||||
{primaryFamilies &&
|
||||
@@ -200,8 +202,7 @@ function ItemListing() {
|
||||
</Grid>
|
||||
<Grid item sx={4}>
|
||||
<Select
|
||||
select
|
||||
fullWidth
|
||||
displayEmpty
|
||||
variant="outlined"
|
||||
value={sFam}
|
||||
inputProps={{ 'aria-label': 'Without label' }}
|
||||
@@ -212,7 +213,7 @@ function ItemListing() {
|
||||
setSFam(e.target.value);
|
||||
}}
|
||||
>
|
||||
<MenuItem key={'none'} value={''}>
|
||||
<MenuItem disabled key={'none'} value={''}>
|
||||
Widget family L2
|
||||
</MenuItem>
|
||||
{secondaryFamilies &&
|
||||
|
||||
@@ -42,51 +42,54 @@ const useStyles = makeStyles({
|
||||
}
|
||||
});
|
||||
|
||||
const headCells = [
|
||||
{
|
||||
id: 'warehouse',
|
||||
label: 'Warehouse'
|
||||
},
|
||||
{
|
||||
id: 'zone',
|
||||
label: 'Zone'
|
||||
},
|
||||
{
|
||||
id: 'area',
|
||||
label: 'Area'
|
||||
},
|
||||
{
|
||||
id: 'row',
|
||||
label: 'Row'
|
||||
},
|
||||
{
|
||||
id: 'bay',
|
||||
label: 'Bay'
|
||||
}
|
||||
];
|
||||
|
||||
function LabelingScreen() {
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [warehouseId, setWarehouseId] = useState('');
|
||||
const [zoneId, setZoneId] = useState('');
|
||||
const [areaId, setAreaId] = useState('');
|
||||
const [rowId, setRowId] = useState('');
|
||||
const [bayId, setBayId] = useState('');
|
||||
|
||||
const warehouseData = useSelector(WarehouseSelectors.getWarehouseDetail);
|
||||
const zonedata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(warehouseId));
|
||||
const areadata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(zoneId));
|
||||
const rowdata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(areaId));
|
||||
|
||||
const [allLabelData, setAllLabelData] = useState([]);
|
||||
const [totemLabelData, setTotemLabelData] = useState([]);
|
||||
const [locationLabelData, setLocationLabelData] = useState([]);
|
||||
|
||||
const warehouseData = useSelector(WarehouseSelectors.getWarehouseDetail);
|
||||
const zonedata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(zoneId));
|
||||
const areadata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(areaId));
|
||||
const rowdata = useSelector(WarehouseLocationsSelectors.getChildrenOfParent(rowId));
|
||||
const labelData = useSelector(LabellingSelectors.getLabelDetail);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (labelData && zoneId && areaId && rowId && bayId) {
|
||||
if (labelData && warehouseId && zoneId && areaId && rowId) {
|
||||
setAllLabelData(labelData);
|
||||
}
|
||||
}, [labelData, zoneId, areaId, rowId]);
|
||||
|
||||
const headCells = [
|
||||
{
|
||||
id: 'warehouse',
|
||||
label: 'Warehouse'
|
||||
},
|
||||
{
|
||||
id: 'zone',
|
||||
label: 'Zone'
|
||||
},
|
||||
{
|
||||
id: 'area',
|
||||
label: 'Area'
|
||||
},
|
||||
{
|
||||
id: 'row',
|
||||
label: 'Row'
|
||||
},
|
||||
{
|
||||
id: 'bay',
|
||||
label: 'Bay'
|
||||
}
|
||||
];
|
||||
}, [labelData, warehouseId, zoneId, areaId]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(
|
||||
@@ -99,10 +102,12 @@ function LabelingScreen() {
|
||||
}, []);
|
||||
|
||||
const warehouseChange = (event) => {
|
||||
const filterData = warehouseData.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
const id = event.target.value;
|
||||
const type = 'warehouse';
|
||||
setZoneId(id);
|
||||
setWarehouseId(id);
|
||||
setZoneId('');
|
||||
setAreaId('');
|
||||
setRowId('');
|
||||
dispatch(
|
||||
WarehouseLocationsActions.locationRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -114,10 +119,11 @@ function LabelingScreen() {
|
||||
};
|
||||
|
||||
const zoneChange = (event) => {
|
||||
const filterData = zonedata.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
const type = filterData[0].location;
|
||||
setAreaId(id);
|
||||
const id = event.target.value;
|
||||
const type = 'zone';
|
||||
setZoneId(id);
|
||||
setAreaId('');
|
||||
setRowId('');
|
||||
dispatch(
|
||||
WarehouseLocationsActions.locationRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -129,10 +135,10 @@ function LabelingScreen() {
|
||||
};
|
||||
|
||||
const areaChange = (event) => {
|
||||
const filterData = areadata.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
const type = filterData[0].location;
|
||||
setRowId(id);
|
||||
const id = event.target.value;
|
||||
const type = 'area';
|
||||
setAreaId(id);
|
||||
setRowId('');
|
||||
dispatch(
|
||||
WarehouseLocationsActions.locationRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -144,31 +150,8 @@ function LabelingScreen() {
|
||||
};
|
||||
|
||||
const rowChange = (event) => {
|
||||
const filterData = rowdata.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
const type = filterData[0].location;
|
||||
setBayId(id);
|
||||
dispatch(
|
||||
WarehouseLocationsActions.locationRequest({
|
||||
loader: 'loading-request',
|
||||
slug: API.GET_CHILDREN_FROM_PARENT,
|
||||
method: 'post',
|
||||
data: { id, type }
|
||||
})
|
||||
);
|
||||
dispatch(
|
||||
LabellingActions.getLabelAction({
|
||||
loader: 'labelling-request',
|
||||
slug: API.GET_LABEL,
|
||||
method: 'post',
|
||||
data: {
|
||||
warehouse: zoneId,
|
||||
zone: areaId,
|
||||
area: rowId,
|
||||
row: bayId
|
||||
}
|
||||
})
|
||||
);
|
||||
const id = event.target.value;
|
||||
setRowId(id);
|
||||
};
|
||||
|
||||
const getTableItem = (e, item) => {
|
||||
@@ -195,22 +178,53 @@ function LabelingScreen() {
|
||||
]}
|
||||
/>
|
||||
<MDBox px={5} py={5}>
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Grid container spacing={2} alignItems="end">
|
||||
<Grid item xs={12} md={2.5}>
|
||||
<Dropdown
|
||||
dropdownData={warehouseData}
|
||||
dropdownChange={warehouseChange}
|
||||
value={warehouseId}
|
||||
label="Select warehouse"
|
||||
onChange={warehouseChange}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown dropdownData={zonedata} dropdownChange={zoneChange} label="Select Zone" />
|
||||
<Grid item xs={12} md={2.5}>
|
||||
<Dropdown dropdownData={zonedata} label="Select Zone" onChange={zoneChange} />
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown dropdownData={areadata} dropdownChange={areaChange} label="Select Area" />
|
||||
<Grid item xs={12} md={2.5}>
|
||||
<Dropdown dropdownData={areadata} label="Select Area" onChange={areaChange} />
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown dropdownData={rowdata} dropdownChange={rowChange} label="Select Row" />
|
||||
<Grid item xs={12} md={2.5}>
|
||||
<Dropdown dropdownData={rowdata} label="Select Row" onChange={rowChange} />
|
||||
</Grid>
|
||||
<Grid item xs={12} md={2}>
|
||||
<MDButton
|
||||
fullWidth
|
||||
color="primary"
|
||||
sx={{
|
||||
height: '45px'
|
||||
}}
|
||||
onClick={() => {
|
||||
warehouseId &&
|
||||
zoneId &&
|
||||
areaId &&
|
||||
rowId &&
|
||||
dispatch(
|
||||
LabellingActions.getLabelAction({
|
||||
loader: 'labelling-request',
|
||||
slug: API.GET_LABEL,
|
||||
method: 'post',
|
||||
data: {
|
||||
warehouse: warehouseId,
|
||||
zone: zoneId,
|
||||
area: areaId,
|
||||
row: rowId
|
||||
}
|
||||
})
|
||||
);
|
||||
}}
|
||||
>
|
||||
Filter
|
||||
</MDButton>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<br />
|
||||
@@ -221,7 +235,7 @@ function LabelingScreen() {
|
||||
color="#8D8D8D"
|
||||
>
|
||||
<TableBody>
|
||||
{bayId ? (
|
||||
{rowId ? (
|
||||
allLabelData &&
|
||||
allLabelData.map((item) => (
|
||||
<TableRow key={item._id}>
|
||||
@@ -245,13 +259,13 @@ function LabelingScreen() {
|
||||
</TableBody>
|
||||
</BasicTable>
|
||||
<Grid container spacing={2} py={5}>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Grid item xs={12} md={3}>
|
||||
<Box sx={{ backgroundColor: '#FFBC26', padding: '3px 12px' }}>Bay Totem Labels</Box>
|
||||
<Box sx={{ border: '1px solid black', padding: '3px 12px', height: '300px' }}>
|
||||
{totemLabelData && totemLabelData.map((item, index) => <div key={index}>{item}</div>)}
|
||||
</Box>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Grid item xs={12} md={3}>
|
||||
<Box sx={{ backgroundColor: '#FFBC26', padding: '3px 12px' }}>Bin Location Labels</Box>
|
||||
<Box sx={{ border: '1px solid black', padding: '3px 12px', height: '300px' }}>
|
||||
{locationLabelData &&
|
||||
|
||||
@@ -15,6 +15,7 @@ import Breadcrumbs from 'components/Breadcrumbs';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { InventorySelectors } from 'redux/InventoryRedux';
|
||||
import InventoryActions from 'redux/InventoryRedux';
|
||||
import schema from 'services/ValidationServices';
|
||||
|
||||
function NewWarehouseDetails() {
|
||||
const dispatch = useDispatch();
|
||||
@@ -54,7 +55,7 @@ function NewWarehouseDetails() {
|
||||
specs: '',
|
||||
image: []
|
||||
},
|
||||
// validationSchema: schema.warehouseForm,
|
||||
validationSchema: schema.warehouseForm,
|
||||
onSubmit: (values) => {
|
||||
dispatch(
|
||||
WarehouseActions.createWarehouseAction({
|
||||
@@ -112,7 +113,12 @@ function NewWarehouseDetails() {
|
||||
name="warehousename"
|
||||
value={formik.values.warehousename}
|
||||
error={formik.touched.warehousename && Boolean(formik.errors.warehousename)}
|
||||
helperText={formik.touched.warehousename && formik.errors.warehousename}
|
||||
helperText={
|
||||
formik.touched.warehousename &&
|
||||
formik.errors.warehousename && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.warehousename}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -135,7 +141,12 @@ function NewWarehouseDetails() {
|
||||
name="address"
|
||||
value={formik.values.address}
|
||||
error={formik.touched.address && Boolean(formik.errors.address)}
|
||||
helperText={formik.touched.address && formik.errors.address}
|
||||
helperText={
|
||||
formik.touched.address &&
|
||||
formik.errors.address && (
|
||||
<div style={{ color: 'red' }}>{formik.errors.address}</div>
|
||||
)
|
||||
}
|
||||
onChange={formik.handleChange}
|
||||
/>
|
||||
</Box>
|
||||
@@ -186,7 +197,7 @@ function NewWarehouseDetails() {
|
||||
);
|
||||
}}
|
||||
>
|
||||
<MenuItem key={''} value={''}>
|
||||
<MenuItem disabled key={'none'} value={''}>
|
||||
None Selected
|
||||
</MenuItem>
|
||||
{inventoryTypes &&
|
||||
|
||||
@@ -105,9 +105,11 @@ const headCellsNew = [
|
||||
function WidgetLabel() {
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [labelData, setLabelData] = useState([]);
|
||||
const [inventoryId, setInventoryId] = useState('');
|
||||
const [familyId, setFamilyId] = useState('');
|
||||
const [subFamilyId, setSubFamilyId] = useState('');
|
||||
const [allProductData, setAllProductData] = useState([]);
|
||||
const [filterClick, setFilterClick] = useState(false);
|
||||
|
||||
@@ -133,9 +135,10 @@ function WidgetLabel() {
|
||||
}, [productData, filterClick]);
|
||||
|
||||
const inventoryChange = (event) => {
|
||||
const filterData = inventoryData.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
setInventoryId(filterData[0]._id);
|
||||
const id = event.target.value;
|
||||
setInventoryId(id);
|
||||
setFamilyId('');
|
||||
setSubFamilyId('');
|
||||
dispatch(
|
||||
WidgetActions.widgetRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -146,9 +149,9 @@ function WidgetLabel() {
|
||||
};
|
||||
|
||||
const familyChange = (event) => {
|
||||
const filterData = familyData.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
setFamilyId(filterData[0]._id);
|
||||
const id = event.target.value;
|
||||
setFamilyId(id);
|
||||
setSubFamilyId('');
|
||||
dispatch(
|
||||
WidgetActions.widgetRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -159,8 +162,8 @@ function WidgetLabel() {
|
||||
};
|
||||
|
||||
const subFamilyChange = (event) => {
|
||||
const filterData = subFamilyData.filter((item) => item.name === event.target.value);
|
||||
const id = filterData[0]._id;
|
||||
const id = event.target.value;
|
||||
setSubFamilyId(id);
|
||||
dispatch(
|
||||
WidgetActions.widgetRequest({
|
||||
loader: 'loading-request',
|
||||
@@ -169,8 +172,8 @@ function WidgetLabel() {
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const filterHandler = () => {
|
||||
setInventoryId('');
|
||||
setFilterClick(true);
|
||||
dispatch(
|
||||
ProductActions.getProductByIdAction({
|
||||
@@ -206,23 +209,26 @@ function WidgetLabel() {
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown
|
||||
dropdownData={inventoryData}
|
||||
dropdownChange={inventoryChange}
|
||||
label="Select Inventory"
|
||||
dropdownData={inventoryData}
|
||||
value={inventoryId}
|
||||
onChange={inventoryChange}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown
|
||||
dropdownData={familyData}
|
||||
dropdownChange={familyChange}
|
||||
label="Select Family"
|
||||
dropdownData={familyData}
|
||||
value={familyId}
|
||||
onChange={familyChange}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
<Dropdown
|
||||
dropdownData={subFamilyData}
|
||||
label="Select Sub Family"
|
||||
dropdownChange={subFamilyChange}
|
||||
value={subFamilyId}
|
||||
dropdownData={subFamilyData}
|
||||
onChange={subFamilyChange}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6} md={3}>
|
||||
@@ -235,7 +241,15 @@ function WidgetLabel() {
|
||||
</MDButton>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Box sx={{ marginTop: '24px', backgroundColor: '#FFFFFF' }}>
|
||||
<Box
|
||||
sx={{
|
||||
marginTop: '24px',
|
||||
backgroundColor: '#FFFFFF',
|
||||
overflowX: 'auto',
|
||||
overflowY: 'auto',
|
||||
height: '60vh'
|
||||
}}
|
||||
>
|
||||
<BasicTable
|
||||
headCells={headCells}
|
||||
records={allProductData}
|
||||
|
||||
@@ -114,22 +114,21 @@ const protectedRoutes = [
|
||||
name: 'Add New Item',
|
||||
key: 'add-new-item',
|
||||
hide: true,
|
||||
route: '/setup/inventory/new-item/:widgetName/:inventoryId',
|
||||
route: '/setup/inventory/new-item/:inventoryName/:widgetName/:inventoryId',
|
||||
component: <AddNewItem />
|
||||
},
|
||||
{
|
||||
name: 'Update Item',
|
||||
key: 'udpate-item',
|
||||
hide: true,
|
||||
route: '/setup/inventory/browse/:widgetName/:inventoryId/edit/:itemId',
|
||||
route: '/setup/inventory/browse/:inventoryName/:widgetName/:inventoryId/edit/:itemId',
|
||||
component: <AddNewItem />
|
||||
},
|
||||
// /setup/inventory/browse/${payload?.widgetName}/${payload?.inventoryId}/edit/${payload?.id}
|
||||
{
|
||||
name: 'View Items',
|
||||
key: 'view-items',
|
||||
hide: true,
|
||||
route: '/setup/inventory/browse/:widgetName/:inventoryId',
|
||||
route: '/setup/inventory/browse/:inventoryName/:widgetName/:inventoryId',
|
||||
component: <ItemListing />
|
||||
},
|
||||
{
|
||||
@@ -184,7 +183,7 @@ const protectedRoutes = [
|
||||
key: 'create-user',
|
||||
route: '/setup/users-access/create-user',
|
||||
hide: true,
|
||||
component: <CreateEditUser context='new' />
|
||||
component: <CreateEditUser context="new" />
|
||||
},
|
||||
{
|
||||
name: 'Edit User',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AuthorizedAPI } from 'config';
|
||||
import { takeLatest, call, put } from 'redux-saga/effects';
|
||||
import { call, put, takeEvery } from 'redux-saga/effects';
|
||||
import LabellingActions from 'redux/LabellingRedux';
|
||||
import { LabellingTypes } from 'redux/LabellingRedux';
|
||||
import ApiServices from 'services/API/ApiServices';
|
||||
@@ -28,4 +28,4 @@ export function* onRequestGetLabelData({ payload }) {
|
||||
);
|
||||
}
|
||||
}
|
||||
export default [takeLatest(LabellingTypes.GET_LABEL_ACTION, onRequestGetLabelData)];
|
||||
export default [takeEvery(LabellingTypes.GET_LABEL_ACTION, onRequestGetLabelData)];
|
||||
|
||||
@@ -32,17 +32,17 @@ const schema = {
|
||||
addNewItem: Yup.object({
|
||||
commonName: Yup.string('Enter details').required(),
|
||||
formalName: Yup.string('Enter details').required(),
|
||||
description: Yup.string('Enter details').required(),
|
||||
manufacturer: Yup.string('Enter details').required(),
|
||||
size: Yup.string('Enter details').required(),
|
||||
color: Yup.string('Enter details').required(),
|
||||
type: Yup.string('Enter details').required(),
|
||||
unitOfMaterial: Yup.string('Enter details').required(),
|
||||
description: Yup.string('Enter details'),
|
||||
manufacturer: Yup.string('Enter details'),
|
||||
size: Yup.string('Enter details'),
|
||||
color: Yup.string('Enter details'),
|
||||
type: Yup.string('Enter details'),
|
||||
unitOfMaterial: Yup.string('Enter details'),
|
||||
unitCost: Yup.number().test((val) => val >= 0),
|
||||
packageCount: Yup.number().test((val) => val >= 0),
|
||||
countPerPallet: Yup.number().test((val) => val >= 0),
|
||||
countPerPalletPackage: Yup.number().test((val) => val >= 0),
|
||||
primaryWidgetFamilyId: Yup.string('Enter details').required(),
|
||||
primaryWidgetFamilyId: Yup.string('Enter details'),
|
||||
secondaryWidgetFamilyId: Yup.string('Enter details'),
|
||||
policiesMetadata: Yup.object({
|
||||
underStockLevelCount: Yup.number().test((val) => val >= 0),
|
||||
@@ -54,8 +54,8 @@ const schema = {
|
||||
}),
|
||||
|
||||
addInventory: Yup.object({
|
||||
name: Yup.string('Enter Widget Name').required('Widget Name is required'),
|
||||
widgetName: Yup.string('Enter Inventory name').required('Inventory name is required'),
|
||||
name: Yup.string('Enter Inventory Name').required('Inventory Name is required'),
|
||||
widgetName: Yup.string('Enter Widget name').required('Widget Name is required'),
|
||||
policies: Yup.object({
|
||||
orderTracking: Yup.boolean(),
|
||||
alerting: Yup.boolean(),
|
||||
|
||||
@@ -9,6 +9,7 @@ export const GetIconFromSlug = (slug) => {
|
||||
case 'fleet':
|
||||
return <FleetIcon />;
|
||||
case 'rawmaterial':
|
||||
return <RawMaterialIcon />;
|
||||
default:
|
||||
return <RawMaterialIcon />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user