Skip to content

Commit

Permalink
Ajouter une fonction 'vente privée' #25 - finalization
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpochat committed Sep 22, 2024
1 parent 1517499 commit e830cc0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
21 changes: 17 additions & 4 deletions frontend/app/src/domains/sale/components/SaleCard.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -32,10 +33,15 @@ export default function SaleCard({sale: sale}) {

return (
<Card>
<CardHeader
title={<Stack alignItems="center" direction="row" gap={2} justifyContent='space-between'>
<div>{`Vente du ${dayjs(sale.deliveryStart).format('DD/MM/YYYY')}`}</div>
{getPrivateAccessKeyChip()}
</Stack>
}
subheader={sale.deliveryAddressName}>
</CardHeader>
<CardContent>
<Typography variant="subtitle1" gutterBottom>
Vente du {dayjs(sale.deliveryStart).format('DD/MM/YYYY')} - {sale.deliveryAddressName}
</Typography>
<div className='sale-card-line-1'>
<div>
<Typography color="text.secondary">
Expand Down Expand Up @@ -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 <Chip icon={<LockIcon/>} size='small' color='warning' label={`code accès privé : ${sale.privateAccessKey}`}/>
}
return <></>
}
}
3 changes: 3 additions & 0 deletions frontend/app/src/layouts/ThemeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class ThemeFactory {
//mode: 'dark',
primary: {
main: '#556b2f',
},
warning: {
main: '#ff3333'
}
},
typography: {
Expand Down

0 comments on commit e830cc0

Please sign in to comment.