Merge pull request 'feat: refs #6968 Changed groupingMode to enum' (!295) from 6968-groupingModeRefactor into dev
Reviewed-on: #295 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
dca954850b
|
@ -268,16 +268,11 @@ const importBuys = () => {
|
||||||
|
|
||||||
const toggleGroupingMode = async (buy, mode) => {
|
const toggleGroupingMode = async (buy, mode) => {
|
||||||
try {
|
try {
|
||||||
const grouping = 1;
|
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
||||||
const packing = 2;
|
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
||||||
const groupingMode = mode === 'grouping' ? grouping : packing;
|
|
||||||
|
|
||||||
const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
groupingMode: newGroupingMode,
|
groupingMode: newGroupingMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
await axios.patch(`Buys/${buy.id}`, params);
|
await axios.patch(`Buys/${buy.id}`, params);
|
||||||
buy.groupingMode = newGroupingMode;
|
buy.groupingMode = newGroupingMode;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -287,9 +282,9 @@ const toggleGroupingMode = async (buy, mode) => {
|
||||||
|
|
||||||
const lockIconType = (groupingMode, mode) => {
|
const lockIconType = (groupingMode, mode) => {
|
||||||
if (mode === 'packing') {
|
if (mode === 'packing') {
|
||||||
return groupingMode === 2 ? 'lock' : 'lock_open';
|
return groupingMode === 'packing' ? 'lock' : 'lock_open';
|
||||||
} else {
|
} else {
|
||||||
return groupingMode === 1 ? 'lock' : 'lock_open';
|
return groupingMode === 'grouping' ? 'lock' : 'lock_open';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue