adding the transaction page
This commit is contained in:
parent
975f3bba54
commit
97bbd41492
7 changed files with 371 additions and 15 deletions
|
|
@ -50,7 +50,7 @@ import {
|
|||
// import FanPicker from "fans/fanPicker";
|
||||
import { GrainOptions, ToGrainOption } from "grain";
|
||||
import GrainDescriber from "grain/GrainDescriber";
|
||||
// import GrainTransaction from "grain/GrainTransaction";
|
||||
import GrainTransaction from "grain/GrainTransaction";
|
||||
import { GetGrainUseOptions, ToGrainUseOption } from "grain/GrainUse";
|
||||
import { useMobile, useSnackbar } from "hooks";
|
||||
import { clone, cloneDeep } from "lodash";
|
||||
|
|
@ -424,6 +424,7 @@ export default function BinSettings(props: Props) {
|
|||
};
|
||||
|
||||
const updateBin = () => {
|
||||
console.log("bin settings update")
|
||||
// If initial moisture is updated, so does the timestamp
|
||||
if (form.inventory?.initialMoisture !== bin?.settings.inventory?.initialMoisture) {
|
||||
if (form.inventory) form.inventory.initialTimestamp = moment().format();
|
||||
|
|
@ -450,7 +451,7 @@ export default function BinSettings(props: Props) {
|
|||
form.lowTemp = lowTempC;
|
||||
form.autoGrainNode = autoTopNode;
|
||||
if (form.inventory) form.inventory.inventoryControl = inventoryControl;
|
||||
|
||||
console.log("bin api update")
|
||||
binAPI
|
||||
.updateBin(bin.key(), form)
|
||||
.then(response => {
|
||||
|
|
@ -473,19 +474,18 @@ export default function BinSettings(props: Props) {
|
|||
newBin.settings.inventory.grainBushels = bin.settings.inventory?.grainBushels ?? 0; //but also need to use the old inventory amount so the diff is applied correctly
|
||||
}
|
||||
return (
|
||||
// <GrainTransaction
|
||||
// open={grainUpdate}
|
||||
// mainObject={newBin}
|
||||
// grainAdjustment={grainDiff}
|
||||
// close={() => {
|
||||
// setGrainUpdate(false);
|
||||
// setGrainDiff(0);
|
||||
// }}
|
||||
// callback={() => {
|
||||
// close(true);
|
||||
// }}
|
||||
// />
|
||||
null
|
||||
<GrainTransaction
|
||||
open={grainUpdate}
|
||||
mainObject={newBin}
|
||||
grainAdjustment={grainDiff}
|
||||
close={() => {
|
||||
setGrainUpdate(false);
|
||||
setGrainDiff(0);
|
||||
}}
|
||||
callback={() => {
|
||||
close(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue