qr code for bins re-implemented with new table
This commit is contained in:
parent
0a53a16cd7
commit
d800aedcdf
2 changed files with 316 additions and 16 deletions
|
|
@ -46,7 +46,7 @@ import BinsList from "bin/BinsList";
|
|||
// import BinYard from "bin/BinYard";
|
||||
import BinInventoryChart, { GrainAmount } from "charts/BinInventoryChart";
|
||||
import BinUtilizationChart from "charts/BinUtilizationChart";
|
||||
// import QrCodeGenerator, { QrCodeKey } from "common/QrCodeGenerator";
|
||||
import QrCodeGenerator, { QrCodeKey } from "common/QrCodeGenerator";
|
||||
import GrainDescriber, { grainName } from "grain/GrainDescriber";
|
||||
// import GrainBagList from "grainBag/grainBagList";
|
||||
// import GrainBagSettings from "grainBag/grainBagSettings";
|
||||
|
|
@ -184,7 +184,7 @@ export default function Bins(props: Props) {
|
|||
const [expandUtilization, setExpandUtilization] = useState(false);
|
||||
const [expandFanTable, setExpandFanTable] = useState(false);
|
||||
const [openQrGenerator, setOpenQrGenerator] = useState(false);
|
||||
// const [qrKeyList, setQrKeyList] = useState<QrCodeKey[]>([]);
|
||||
const [qrKeyList, setQrKeyList] = useState<QrCodeKey[]>([]);
|
||||
const [totalFanControllers, setTotalFanControllers] = useState(0);
|
||||
const [totalFanControllersOn, setTotalFanControllersOn] = useState(0);
|
||||
const [yardsLoading, setYardsLoading] = useState(false);
|
||||
|
|
@ -313,7 +313,7 @@ export default function Bins(props: Props) {
|
|||
let grain: Bin[] = [];
|
||||
let empty: Bin[] = [];
|
||||
let fert: Bin[] = [];
|
||||
// let qr: QrCodeKey[] = [];
|
||||
let qr: QrCodeKey[] = [];
|
||||
let b = resp.data.bins.map(b => Bin.any(b));
|
||||
b.forEach(bin => {
|
||||
if (bin.empty()) {
|
||||
|
|
@ -324,12 +324,12 @@ export default function Bins(props: Props) {
|
|||
grain.push(bin);
|
||||
}
|
||||
//build qr keys here
|
||||
// qr.push({
|
||||
// key: bin.key(),
|
||||
// name: bin.name()
|
||||
// });
|
||||
qr.push({
|
||||
key: bin.key(),
|
||||
name: bin.name()
|
||||
});
|
||||
});
|
||||
// setQrKeyList(qr);
|
||||
setQrKeyList(qr);
|
||||
setGrainBins(grain);
|
||||
if (fert.length > 0) {
|
||||
setDisplayFert(true);
|
||||
|
|
@ -428,7 +428,7 @@ export default function Bins(props: Props) {
|
|||
let empty: Bin[] = offset ? emptyBins : [];
|
||||
let fert: Bin[] = offset ? fertilizerBins : [];
|
||||
let grain: Bin[] = offset ? grainBins : [];
|
||||
// let newKeyList: QrCodeKey[] = qrKeyList;
|
||||
let newKeyList: QrCodeKey[] = qrKeyList;
|
||||
newBins.forEach(bin => {
|
||||
if (bin.empty()) {
|
||||
empty.push(bin);
|
||||
|
|
@ -437,10 +437,10 @@ export default function Bins(props: Props) {
|
|||
} else {
|
||||
grain.push(bin);
|
||||
}
|
||||
// newKeyList.push({
|
||||
// key: bin.key(),
|
||||
// name: bin.name()
|
||||
// });
|
||||
newKeyList.push({
|
||||
key: bin.key(),
|
||||
name: bin.name()
|
||||
});
|
||||
});
|
||||
if (fert.length > 0) {
|
||||
setDisplayFert(true);
|
||||
|
|
@ -451,7 +451,7 @@ export default function Bins(props: Props) {
|
|||
setGrainBins([...grain]);
|
||||
setEmptyBins([...empty]);
|
||||
setFertilizerBins([...fert]);
|
||||
// setQrKeyList([...newKeyList]);
|
||||
setQrKeyList([...newKeyList]);
|
||||
})
|
||||
.catch(err => {
|
||||
setPaginatedBins({ bins: [], binsOffset: 0, binsTotal: 0 });
|
||||
|
|
@ -1390,14 +1390,14 @@ export default function Bins(props: Props) {
|
|||
setAddBagOpen(false);
|
||||
}}
|
||||
/>
|
||||
{/* <QrCodeGenerator
|
||||
<QrCodeGenerator
|
||||
open={openQrGenerator}
|
||||
close={() => {
|
||||
setOpenQrGenerator(false);
|
||||
}}
|
||||
keyList={qrKeyList}
|
||||
requiredUrlAffix={"bins"}
|
||||
/> */}
|
||||
/>
|
||||
{binMenu()}
|
||||
<AddBinFab onClick={() => setAddBinOpen(true)} pulse={binsTotal < 1 && !allLoading} />
|
||||
</Box>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue