+
-
-
{quantity}
-
colis mis en vente
-
{quantity * packageLot.netWeight} kg
-
{quantity * packageLot.netWeight * packageLot.unitPrice} € TTC
+
+
{quantity}
+
colis mis en vente
+
{quantity * packageLot.netWeight} kg
+
{quantity * packageLot.netWeight * packageLot.unitPrice} € TTC
-
+
@@ -104,6 +113,7 @@ export default function PackageLotConfigurator({packageLot: packageLot, changeCa
}
function openEditionPopin() {
+ //form.reset()
setEditionPopinOpen(true)
}
@@ -111,11 +121,22 @@ export default function PackageLotConfigurator({packageLot: packageLot, changeCa
setEditionPopinOpen(false)
}
+ function cancelForm(formData) {
+ form.reset({
+ label: packageLot.label,
+ description: packageLot.description,
+ netWeight: packageLot.netWeight,
+ unitPrice: packageLot.unitPrice
+ })
+ closeEditionPopin()
+ }
+
function validForm(formData) {
packageLot.label = formData.label
packageLot.description = formData.description
packageLot.unitPrice = formData.unitPrice
packageLot.netWeight = formData.netWeight
+ changeCallback(packageLot)
closeEditionPopin()
}
diff --git a/frontend/app/src/domains/production/components/ProductionCard.tsx b/frontend/app/src/domains/production/components/ProductionCard.tsx
index b30d4ba..151fcc2 100644
--- a/frontend/app/src/domains/production/components/ProductionCard.tsx
+++ b/frontend/app/src/domains/production/components/ProductionCard.tsx
@@ -4,7 +4,7 @@ import BeefProductionCard from "./BeefProductionCard.tsx"
export default function ProductionCard({
production: production,
showActions: showActions,
- setPackageModificationLayoutContent: setPackageModificationLayoutContent
+ viewBeefProductionCallback: viewBeefProductionCallback
}) {
switch (production.productionType) {
@@ -13,7 +13,7 @@ export default function ProductionCard({
key={production.id}
production={production}
showActions={showActions}
- setPackageModificationLayoutContent={setPackageModificationLayoutContent}>
+ viewBeefProductionCallback={viewBeefProductionCallback}>
default :
return <>>
diff --git a/frontend/app/src/domains/production/views/BeefProductionView.tsx b/frontend/app/src/domains/production/views/BeefProductionView.tsx
new file mode 100644
index 0000000..ca2cfa4
--- /dev/null
+++ b/frontend/app/src/domains/production/views/BeefProductionView.tsx
@@ -0,0 +1,53 @@
+import { Typography, ButtonGroup, Button, Tab, Tabs } from '@mui/material'
+import React from 'react'
+import { useEffect, useState } from 'react'
+import { useKeycloak } from '@react-keycloak/web'
+import { ApiBuilder } from '../../../api/ApiBuilder.ts'
+import BreedingPropertiesForm from './beefProductionCreator/forms/BreedingPropertiesForm.tsx'
+import SlaughterPropertiesForm from './beefProductionCreator/forms/SlaughterPropertiesForm.tsx'
+import CuttingPropertiesForm from './beefProductionCreator/forms/CuttingPropertiesForm.tsx'
+import TabContext from '@mui/lab/TabContext';
+import TabList from '@mui/lab/TabList';
+import TabPanel from '@mui/lab/TabPanel';
+
+
+export default function BeefProductionView({ beefProduction: beefProduction, backCallback: backCallback }) {
+
+ const [currentTab, setCurrentTab] = React.useState('1');
+
+ const changeTab = (event: React.SyntheticEvent, newValue: string) => {
+ setCurrentTab(newValue);
+ };
+
+
+ return <>
+
Abattage bovin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+}
\ No newline at end of file
diff --git a/frontend/app/src/domains/production/views/PackageLotsCreator.js b/frontend/app/src/domains/production/views/PackageLotsCreator.tsx
similarity index 100%
rename from frontend/app/src/domains/production/views/PackageLotsCreator.js
rename to frontend/app/src/domains/production/views/PackageLotsCreator.tsx
diff --git a/frontend/app/src/domains/production/views/ProductionsList.tsx b/frontend/app/src/domains/production/views/ProductionsList.tsx
index cfef1ba..64d85fd 100644
--- a/frontend/app/src/domains/production/views/ProductionsList.tsx
+++ b/frontend/app/src/domains/production/views/ProductionsList.tsx
@@ -8,7 +8,9 @@ import { Button, Typography } from "@mui/material"
import ProductionCard from '../components/ProductionCard.tsx'
-export default function ProductionsList({createBeefProductionCallback: createBeefProductionCallback}) {
+export default function ProductionsList({
+ createBeefProductionCallback: createBeefProductionCallback,
+ viewBeefProductionCallback: viewBeefProductionCallback}) {
const [productions, setProductions] = useState([])
const { keycloak, initialized } = useKeycloak()
@@ -46,7 +48,7 @@ export default function ProductionsList({createBeefProductionCallback: createBee
return productions.map(production =>
+ viewBeefProductionCallback={viewBeefProductionCallback}>
)
}
}
\ No newline at end of file
diff --git a/frontend/app/src/domains/production/views/beefProductionCreator/BeefProductionCreator.tsx b/frontend/app/src/domains/production/views/beefProductionCreator/BeefProductionCreator.tsx
index dbc7247..5933971 100644
--- a/frontend/app/src/domains/production/views/beefProductionCreator/BeefProductionCreator.tsx
+++ b/frontend/app/src/domains/production/views/beefProductionCreator/BeefProductionCreator.tsx
@@ -10,7 +10,7 @@ import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction.js"
import { ApiBuilder } from '../../../../api/ApiBuilder.ts'
import { useKeycloak } from '@react-keycloak/web'
-import PackageLotsCreator from "../PackageLotsCreator.js"
+import PackageLotsCreator from "../PackageLotsCreator.tsx"
import BreedingPropertiesForm from "./forms/BreedingPropertiesForm.tsx"
import SlaughterPropertiesForm from "./forms/SlaughterPropertiesForm.tsx"
import CuttingPropertiesForm from "./forms/CuttingPropertiesForm.tsx"
@@ -24,8 +24,7 @@ export default function BeefProductionCreator({ callback }) {
const PRODUCTS_STEP = 3
const { keycloak } = useKeycloak()
- //const [ activeStep, setActiveStep ] = useState
(BREEDING_PROPERTIES_STEP)
- const [ activeStep, setActiveStep ] = useState(PRODUCTS_STEP)
+ const [ activeStep, setActiveStep ] = useState(BREEDING_PROPERTIES_STEP)
const [ beefProduction, setBeefProduction] = useState({ productionType: "BeefProduction"})
const [completedSteps, setCompletedSteps] = useState>([])
const apiBuilder = new ApiBuilder()
diff --git a/frontend/app/src/domains/production/views/beefProductionCreator/forms/BreedingPropertiesForm.tsx b/frontend/app/src/domains/production/views/beefProductionCreator/forms/BreedingPropertiesForm.tsx
index 7496d64..a368881 100644
--- a/frontend/app/src/domains/production/views/beefProductionCreator/forms/BreedingPropertiesForm.tsx
+++ b/frontend/app/src/domains/production/views/beefProductionCreator/forms/BreedingPropertiesForm.tsx
@@ -4,6 +4,7 @@ import { Button, ButtonGroup } from "@mui/material"
import { CheckboxElement, DatePickerElement, FormContainer, SelectElement, SubmitHandler, TextFieldElement, useForm } from 'react-hook-form-mui'
import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction"
+import dayjs from "dayjs"
export default function BreedingPropertiesForm({
beefProduction: beefProduction,
@@ -22,7 +23,12 @@ export default function BreedingPropertiesForm({
{ id: 'CHAROLAISE', label: 'charolaise' }
]
- const form = useForm({defaultValues: beefProduction})
+ const form = useForm({defaultValues: {
+ ...beefProduction,
+ birthDate: dayjs(beefProduction.birthDate),
+ slaughterDate: dayjs(beefProduction.slaughterDate),
+ cuttingDate: dayjs(beefProduction.cuttingDate)
+ }})
return
@@ -57,7 +63,7 @@ export default function BreedingPropertiesForm({
({defaultValues: beefProduction})
-
+ const form = useForm({defaultValues: {
+ ...beefProduction,
+ birthDate: dayjs(beefProduction.birthDate),
+ slaughterDate: dayjs(beefProduction.slaughterDate),
+ cuttingDate: dayjs(beefProduction.cuttingDate)
+ }})
+
return
diff --git a/frontend/app/src/domains/production/views/beefProductionCreator/forms/SlaughterPropertiesForm.tsx b/frontend/app/src/domains/production/views/beefProductionCreator/forms/SlaughterPropertiesForm.tsx
index d8438de..67e76dd 100644
--- a/frontend/app/src/domains/production/views/beefProductionCreator/forms/SlaughterPropertiesForm.tsx
+++ b/frontend/app/src/domains/production/views/beefProductionCreator/forms/SlaughterPropertiesForm.tsx
@@ -4,13 +4,20 @@ import { DatePickerElement, FormContainer, SliderElement, TextFieldElement, useF
import BeefProduction from "viandeendirect_eu/dist/model/BeefProduction"
import { BeefProductionService } from '../../../service/BeefProductionService.ts'
+import dayjs from 'dayjs'
export default function SlaughterPropertiesForm({
beefProduction: beefProduction,
validFormCallback: validFormCallback,
cancelFormCallback: cancelFormCallback }) {
- const form = useForm({defaultValues: beefProduction})
+ const form = useForm({defaultValues: {
+ ...beefProduction,
+ birthDate: dayjs(beefProduction.birthDate),
+ slaughterDate: dayjs(beefProduction.slaughterDate),
+ cuttingDate: dayjs(beefProduction.cuttingDate)
+ }})
+
const warmCarcassWeight = form.watch('warmCarcassWeight')