Fix Gauge ItemsInfo

This commit is contained in:
Tim
2025-06-15 15:43:32 +02:00
parent 82a86f21bb
commit f6b5efb7cc

View File

@@ -4,7 +4,7 @@ import {Box, Button, IconButton, Toolbar, useTheme} from "@mui/material";
import Item from "../../components/Item";
import {useTranslation} from "react-i18next";
import {DataGrid, GridColDef, GridRowId, GridRowSelectionModel} from "@mui/x-data-grid";
import {useEffect, useState} from "react";
import {useState} from "react";
import {Gauge, gaugeClasses} from "@mui/x-charts";
export default function ItemsInfo() {
@@ -147,23 +147,23 @@ export default function ItemsInfo() {
width: 100,
editable: true,
type: 'number',
renderCell: params => <Gauge value={params.row.stock} valueMin={0} valueMax={params.row.stockExpected} startAngle={-90} endAngle={90} sx={{
renderCell: params => <Gauge value={Math.min(params.row.stock, params.row.stockExpected)} valueMin={0} valueMax={params.row.stockExpected} startAngle={-90} endAngle={90} sx={{
[`& .${gaugeClasses.valueArc}`]: {
fill: () => {return mapValueToColor(0, params.row.stockExpected, params.row.stock)},
},
}}/>
}} text={() => `${params.row.stock}`} />
},
{
field: 'rating',
headerName: t('rating'),
width: 100,
editable: true,
editable: false, //the rating is averaged from ratings
type: 'number',
renderCell: params => <Gauge value={params.row.rating} valueMin={0} valueMax={10} startAngle={-90} endAngle={90} sx={{
renderCell: params => <Gauge value={Math.min(params.row.rating, 10)} valueMin={0} valueMax={10} startAngle={-90} endAngle={90} sx={{
[`& .${gaugeClasses.valueArc}`]: {
fill: () => {return mapValueToColor(0, 10, params.row.rating)},
},
}}/>
}} text={() => `${params.row.rating}`} />
},
{ //edit billing information button
field: "actualPrice",