Skip to content

Commit

Permalink
production lot description for customers
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpochat committed Jan 21, 2024
1 parent ea374d1 commit f8c359f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 34 deletions.
35 changes: 34 additions & 1 deletion frontend/app/src/api/mock/MockApiProductions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,42 @@ export class MockApiProductions {
getBeefProduction(): BeefProduction {
return {
id: 1,
animalIdentifier: '1234',
slaughterDate: '2023-10-01T10:00:00',
animalLiveWeight: 450,
animalType: 'BEEF_COW'
animalType: 'BEEF_COW',
lots: [
{
id: 1,
label: 'Le petit coli de steaks',
description: 'Un coli avec uniquement des steaks et des steaks hachés',
netWeight: 5.0,
unitPrice: 17.0,
quantity: 10,
quantitySold: 2,
photo: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII='
},
{
id: 2,
label: 'Le coli tradition',
description: 'Un coli avec un peu de tout',
netWeight: 10.0,
unitPrice: 17.0,
quantity: 8,
quantitySold: 1,
photo: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII='
},
{
id: 3,
label: 'Le coli cuisson rapide',
description: 'Un coli avec majoritairement des pièces à griller',
netWeight: 7.0,
unitPrice: 17.0,
quantity: 8,
quantitySold: 8,
photo: 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHN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wAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII='
}
]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import { useEffect, useState } from 'react'
import { Typography } from "@mui/material"

import BeefProduction from 'viandeendirect_eu/dist/model/BeefProduction.js'
import PackageLot from 'viandeendirect_eu/dist/model/PackageLot.js'
import { AnimalTypeUtils } from '../../../enum/AnimalType.ts'
import { ApiInvoker } from '../../../api/ApiInvoker.ts'
import PieChart from '../../commons/components/PieChart.tsx'
import PackageLotDescription from './PackageLotDescription.tsx'

export default function BeefProductionCustomerCard({production: production}) {

const [beefProduction, setBeefProduction] = useState<BeefProduction>({})
const [percentageSold, setPercentageSold] = useState(0)
const [lots, setLots]= useState([])
const apiInvoker = new ApiInvoker()

useEffect(() => {
Expand Down Expand Up @@ -48,8 +51,12 @@ export default function BeefProductionCustomerCard({production: production}) {
</div>
</div>
<div className="sale-customer-card__product-batch-list">
getProducts()
{beefProduction.lots?.map(getLot)}
</div>
</>

function getLot(lot: PackageLot) {
return <PackageLotDescription lot={lot}></PackageLotDescription>
}
}

25 changes: 0 additions & 25 deletions frontend/app/src/domains/sale/components/PackageSelector.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
.package-selector {
margin: 1rem;
display: grid;
grid-template-columns: 1fr 3fr;
}

.package-selector__label {
font-size: large;
grid-column: 1/-1;
}

.package-selector__description {
font-size: smaller;
grid-column: 1/-1;
}

.package-selector__icon {
grid-column: 1;
}

.package-selector__total_price,
.package-selector__unit_price,
.package-selector__weight {
grid-column: 2/-1;
}

.package-selector__unit_price {
font-size: smaller;
}

.package-selector__actions {
Expand Down
9 changes: 2 additions & 7 deletions frontend/app/src/domains/sale/components/PackageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import RemoveIcon from '@mui/icons-material/Remove';
import OrderItem from "viandeendirect_eu/dist/model/OrderItem"
import PackageLot from "viandeendirect_eu/dist/model/PackageLot"

import PackageLotDescription from '../../production/components/PackageLotDescription.tsx';
import './PackageSelector.css'

export default function PackageSelector({ lot: lot, orderItems: orderItems, updateItemsCallback: updateItemsCallback }) {
Expand All @@ -17,13 +18,7 @@ export default function PackageSelector({ lot: lot, orderItems: orderItems, upda

return <>
<div className='package-selector'>
<div className='package-selector__label'>{lot.label}</div>
<div className='package-selector__description'>{lot.description}</div>
<span className='icon euro-icon package-selector__icon'></span>
<div className='package-selector__total_price'>{lot.unitPrice * lot.netWeight}<sup>TTC</sup></div>
<div className='package-selector__unit_price'>({lot.unitPrice}<sup>TTC</sup>/kg)</div>
<span className='icon weight-icon package-selector__icon'></span>
<div className='package-selector__weight'>~{lot.netWeight} kg</div>
<PackageLotDescription lot={lot}></PackageLotDescription>
<div className='package-selector__actions'>{isAddToOrderDisplayed ? getAddToOrderButton() : getChangeQuantityActions()}</div>
</div>
</>
Expand Down

0 comments on commit f8c359f

Please sign in to comment.