From e830cc09a4989a27e7aeb1eb5ad9fb2d2ea1cd93 Mon Sep 17 00:00:00 2001 From: Benjamin POCHAT Date: Sun, 22 Sep 2024 21:44:42 +0200 Subject: [PATCH] =?UTF-8?q?Ajouter=20une=20fonction=20'vente=20priv=C3=A9e?= =?UTF-8?q?'=20#25=20-=20finalization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../changelog/2024-09/changelog-2024-09.yaml | 10 +++++++++ .../src/domains/sale/components/SaleCard.tsx | 21 +++++++++++++++---- frontend/app/src/layouts/ThemeFactory.ts | 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/backend/app/src/main/resources/database/changelog/2024-09/changelog-2024-09.yaml b/backend/app/src/main/resources/database/changelog/2024-09/changelog-2024-09.yaml index 5499c88..a07dc0b 100644 --- a/backend/app/src/main/resources/database/changelog/2024-09/changelog-2024-09.yaml +++ b/backend/app/src/main/resources/database/changelog/2024-09/changelog-2024-09.yaml @@ -18,3 +18,13 @@ databaseChangeLog: - dropColumn: tableName: producers columnName: sales_credits + - changeSet: + id: viandeendirect-2024-09-20 + author: benjamin + changes: + - addColumn: + tableName: sales + columns: + - column: + name: private_access_key + type: VARCHAR(255) diff --git a/frontend/app/src/domains/sale/components/SaleCard.tsx b/frontend/app/src/domains/sale/components/SaleCard.tsx index 53610a9..478bdfc 100644 --- a/frontend/app/src/domains/sale/components/SaleCard.tsx +++ b/frontend/app/src/domains/sale/components/SaleCard.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' -import { Button, ButtonGroup, Card, CardActions, CardContent, Typography } from "@mui/material" +import { Button, ButtonGroup, Card, CardActions, CardContent, CardHeader, Chip, Typography, Stack } from "@mui/material" +import LockIcon from '@mui/icons-material/Lock'; import dayjs from 'dayjs' import SaleCardBeefProduction from './SaleCardBeefProduction.tsx'; import { useKeycloak } from '@react-keycloak/web'; @@ -32,10 +33,15 @@ export default function SaleCard({sale: sale}) { return ( + +
{`Vente du ${dayjs(sale.deliveryStart).format('DD/MM/YYYY')}`}
+ {getPrivateAccessKeyChip()} + + } + subheader={sale.deliveryAddressName}> +
- - Vente du {dayjs(sale.deliveryStart).format('DD/MM/YYYY')} - {sale.deliveryAddressName} -
@@ -105,4 +111,11 @@ export default function SaleCard({sale: sale}) { .map(item => item.unitPrice * item.quantity) .reduce((totalAmout, orderItemAmout) => totalAmout + orderItemAmout, 0) } + + function getPrivateAccessKeyChip() { + if (sale.privateAccessKey) { + return } size='small' color='warning' label={`code accès privé : ${sale.privateAccessKey}`}/> + } + return <> + } } diff --git a/frontend/app/src/layouts/ThemeFactory.ts b/frontend/app/src/layouts/ThemeFactory.ts index 0d0bd93..8abba15 100644 --- a/frontend/app/src/layouts/ThemeFactory.ts +++ b/frontend/app/src/layouts/ThemeFactory.ts @@ -8,6 +8,9 @@ export class ThemeFactory { //mode: 'dark', primary: { main: '#556b2f', + }, + warning: { + main: '#ff3333' } }, typography: {