From 3e6185be8f7b5deecb9e9778004d69f5be54822c Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 12 Aug 2025 16:20:04 -0600 Subject: [PATCH] making sure the bin uses the correct data when using libracart as an inventory control --- package-lock.json | 4 +- package.json | 2 +- src/bin/BinSettings.tsx | 67 +++++++++++++++++-- src/bin/graphs/BinLevelOverTime.tsx | 6 +- .../LibraCart/LibraCartAccess.tsx | 28 ++++++-- src/models/Bin.ts | 5 +- src/pages/LibraCart.tsx | 29 +++----- src/providers/pond/libracartProxyAPI.tsx | 43 ++++-------- 8 files changed, 115 insertions(+), 69 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5675e1..b89d4cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#dev", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#libracart", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", @@ -10911,7 +10911,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#1f0c0924fc9bca00e4512a29ffa75904cc8468c0", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#c68c727be5b1076bbb534996a13d5e3285c6ca68", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/package.json b/package.json index 88ba7d0..89efa4d 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mui-tel-input": "^7.0.0", "notistack": "^3.0.1", "openweathermap-ts": "^1.2.10", - "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#dev", + "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#libracart", "query-string": "^9.2.1", "react": "^18.3.1", "react-beautiful-dnd": "^13.1.1", diff --git a/src/bin/BinSettings.tsx b/src/bin/BinSettings.tsx index 5558230..2c97be1 100644 --- a/src/bin/BinSettings.tsx +++ b/src/bin/BinSettings.tsx @@ -58,7 +58,7 @@ import { Bin } from "models"; import moment from "moment"; import { GetBinShapeDescribers } from "pbHelpers/Bin"; import { pond } from "protobuf-ts/pond"; -import { useBinAPI, useBinYardAPI, useGlobalState } from "providers"; +import { useBinAPI, useBinYardAPI, useGlobalState, useLibraCartProxyAPI } from "providers"; import React, { useCallback, useEffect, useState } from "react"; // import { useHistory } from "react-router"; import { getDistanceUnit, or, getTemperatureUnit, getGrainUnit } from "utils"; @@ -176,7 +176,7 @@ export default function BinSettings(props: Props) { const grainOptions = GrainOptions(); const grainUseOptions = GetGrainUseOptions(); const [inputCapacity, setInputCapacity] = useState(""); - const [{ as }] = useGlobalState(); + const [{ user, as }] = useGlobalState(); const [grainDiff, setGrainDiff] = useState(0); const [isCustomInventory, setIsCustomInventory] = useState(false); const [grainUpdate, setGrainUpdate] = useState(false); @@ -197,10 +197,13 @@ export default function BinSettings(props: Props) { const [inventoryControl, setInventoryControl] = useState( pond.BinInventoryControl.BIN_INVENTORY_CONTROL_UNKNOWN ); - const [storageType, setStorageType] = useState( pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN ); + //libracart stuff + const libracartAPI = useLibraCartProxyAPI() + const [lcDestination, setlcDestination] = useState