-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from SocialGouv/feat/discount-online
feat: discount online
- Loading branch information
Showing
70 changed files
with
5,056 additions
and
693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ | |
|
||
## Developpement | ||
|
||
## Base de donnée | ||
|
||
Lancez la base de donnée Postgres via docker compose : | ||
|
||
```bash | ||
docker compose up -d | ||
``` | ||
|
||
### Webapp | ||
|
||
Accédez au dossier de l'application NextJS webapp : | ||
|
@@ -27,11 +35,17 @@ yarn | |
Générez les données de test : | ||
|
||
```bash | ||
yarn seed | ||
yarn seed:dev | ||
``` | ||
|
||
Lancez l'application, qui sera accessible sur le port 3000 : | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
Voici les informations des utilisateurs prêts à être utilisés en développement grâce aux données de test : | ||
| Email | Type de compte | Mot de passe | | ||
| -------- | -------- | -------- | | ||
| [email protected] | Utilisateur | user123 | | ||
| [email protected] | Administrateur | admin123 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
code,validityTo | ||
H1D1,01/06/24 | ||
H1D2,02/06/24 | ||
H1D3,03/06/24 | ||
H1D4,04/06/24 | ||
H1D5,05/06/24 | ||
H1D6,06/06/24 | ||
H1D7,07/06/24 | ||
H1D8,08/06/24 | ||
H1D9,09/06/24 | ||
H1D10,10/06/24 | ||
H1D11,11/06/24 | ||
H1D12,12/06/24 | ||
H1D13,13/06/24 | ||
H1D14,14/06/24 | ||
H1D15,15/06/24 | ||
H1D16,16/06/24 | ||
H1D17,17/06/24 | ||
H1D18,18/06/24 | ||
H1D19,19/06/24 | ||
H1D20,20/06/24 | ||
H1D21,21/06/24 | ||
H1D22,22/06/24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Spinner } from "@chakra-ui/react"; | ||
|
||
export default function LoadingLoader() { | ||
return ( | ||
<Spinner | ||
thickness="4px" | ||
speed="0.65s" | ||
emptyColor="gray.200" | ||
color="blue.400" | ||
size="xl" | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Flex, Icon, Text } from "@chakra-ui/react"; | ||
import { IconType } from "react-icons/lib"; | ||
|
||
export default function ToastComponent({ | ||
text, | ||
icon, | ||
}: { | ||
text: string; | ||
icon: IconType; | ||
}) { | ||
return ( | ||
<Flex | ||
alignItems="center" | ||
justifyContent="space-between" | ||
bgColor="success" | ||
color="white" | ||
px={6} | ||
py={4} | ||
borderRadius="xl" | ||
> | ||
<Text fontWeight="medium">{text}</Text> | ||
<Icon as={icon} w={6} h={6} ml={2} aria-label="Fermer le code promo" /> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Icon, IconProps } from "@chakra-ui/react"; | ||
|
||
export const CouponIcon = (props: IconProps) => { | ||
return ( | ||
<Icon width="24px" height="24px" viewBox="0 0 24 22" {...props}> | ||
<path | ||
d="M21 5H3C2.44772 5 2 5.44772 2 6V9.5H2.6C3.98071 9.5 5.1 10.6193 5.1 12C5.1 13.3807 3.98071 14.5 2.6 14.5H2V18C2 18.5523 2.44772 19 3 19H21C21.5523 19 22 18.5523 22 18V14.5H21.9C20.5193 14.5 19.4 13.3807 19.4 12C19.4 10.6193 20.5193 9.5 21.9 9.5H22V6C22 5.44772 21.5523 5 21 5Z" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M15 5V19" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeDasharray="3 3" | ||
/> | ||
</Icon> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { ArrowForwardIcon } from '@chakra-ui/icons'; | ||
import { | ||
Button, | ||
Text, | ||
List, | ||
ListIcon, | ||
ListItem, | ||
ModalBody, | ||
ModalContent, | ||
ModalHeader | ||
} from '@chakra-ui/react'; | ||
import { FiClock, FiGlobe, FiRotateCw, FiTag } from 'react-icons/fi'; | ||
import { IconType } from 'react-icons/lib'; | ||
import { TbBuildingStore } from 'react-icons/tb'; | ||
import { OfferIncluded } from '~/server/api/routers/offer'; | ||
|
||
const OfferActivationModal = ({ | ||
onClose, | ||
onlyCgu, | ||
offer, | ||
mutateCouponToUser | ||
}: { | ||
onClose: () => void; | ||
onlyCgu?: boolean; | ||
offer: OfferIncluded; | ||
mutateCouponToUser: ({ offer_id }: { offer_id: number }) => void; | ||
}) => { | ||
const validityToDate = new Date(offer.validityTo); | ||
|
||
const cguItems: { icon: IconType; text: string; cross?: boolean }[] = [ | ||
{ icon: FiGlobe, text: 'Utilisable en ligne' }, | ||
{ icon: TbBuildingStore, text: 'À utiliser en magasin', cross: true }, | ||
{ | ||
icon: FiClock, | ||
text: `À utiliser avant le ${validityToDate.toLocaleDateString()} !` | ||
}, | ||
{ icon: FiRotateCw, text: 'Utilisation illimité' }, | ||
{ icon: FiTag, text: 'Non cumulable' } | ||
]; | ||
|
||
return ( | ||
<ModalContent h="full"> | ||
{onlyCgu && <ModalHeader mt={4}>Conditions d’utilisation</ModalHeader>} | ||
<ModalBody | ||
pos="sticky" | ||
display="flex" | ||
flexDir="column" | ||
justifyContent="end" | ||
h="full" | ||
py={10} | ||
> | ||
<List spacing={6} my="auto"> | ||
{cguItems.map(({ icon, text, cross }, index) => ( | ||
<ListItem key={index} display="flex" alignItems="center"> | ||
<ListIcon as={icon} w={6} h={6} mr={3}></ListIcon> | ||
<Text | ||
fontWeight="medium" | ||
textDecorationLine={cross ? 'line-through' : 'none'} | ||
> | ||
{text} | ||
</Text> | ||
</ListItem> | ||
))} | ||
</List> | ||
<Button | ||
rightIcon={!onlyCgu ? <ArrowForwardIcon w={6} h={6} /> : undefined} | ||
onClick={() => { | ||
if (!onlyCgu) mutateCouponToUser({ offer_id: offer.id }); | ||
onClose(); | ||
}} | ||
> | ||
{!onlyCgu ? 'Activer le code promo' : 'Fermer'} | ||
</Button> | ||
</ModalBody> | ||
</ModalContent> | ||
); | ||
}; | ||
|
||
export default OfferActivationModal; |
Oops, something went wrong.