diff --git a/backend/src/backend/App.js b/backend/src/backend/App.js index 59adb6f4891fd737ae81e9915c7060047ab9c343..5deb2862d9365bf665a6c2022a178622251bc95e 100644 --- a/backend/src/backend/App.js +++ b/backend/src/backend/App.js @@ -240,4 +240,4 @@ function formatHour(hour) { var hours = hour.substring(0, 2); var minutes = hour.substring(3, 5); return hours + ":" + minutes; -} +} \ No newline at end of file diff --git a/rpg_app/.gitignore b/mobile_app/.gitignore similarity index 100% rename from rpg_app/.gitignore rename to mobile_app/.gitignore diff --git a/rpg_app/App.js b/mobile_app/App.js similarity index 100% rename from rpg_app/App.js rename to mobile_app/App.js diff --git a/rpg_app/app.json b/mobile_app/app.json similarity index 100% rename from rpg_app/app.json rename to mobile_app/app.json diff --git a/rpg_app/assets/adaptive-icon.png b/mobile_app/assets/adaptive-icon.png similarity index 100% rename from rpg_app/assets/adaptive-icon.png rename to mobile_app/assets/adaptive-icon.png diff --git a/rpg_app/assets/favicon.png b/mobile_app/assets/favicon.png similarity index 100% rename from rpg_app/assets/favicon.png rename to mobile_app/assets/favicon.png diff --git a/rpg_app/assets/fonts/Inter-Bold.ttf b/mobile_app/assets/fonts/Inter-Bold.ttf similarity index 100% rename from rpg_app/assets/fonts/Inter-Bold.ttf rename to mobile_app/assets/fonts/Inter-Bold.ttf diff --git a/rpg_app/assets/fonts/Inter-Light.ttf b/mobile_app/assets/fonts/Inter-Light.ttf similarity index 100% rename from rpg_app/assets/fonts/Inter-Light.ttf rename to mobile_app/assets/fonts/Inter-Light.ttf diff --git a/rpg_app/assets/fonts/Inter-Medium.ttf b/mobile_app/assets/fonts/Inter-Medium.ttf similarity index 100% rename from rpg_app/assets/fonts/Inter-Medium.ttf rename to mobile_app/assets/fonts/Inter-Medium.ttf diff --git a/rpg_app/assets/fonts/Inter-Regular.ttf b/mobile_app/assets/fonts/Inter-Regular.ttf similarity index 100% rename from rpg_app/assets/fonts/Inter-Regular.ttf rename to mobile_app/assets/fonts/Inter-Regular.ttf diff --git a/rpg_app/assets/fonts/Inter-SemiBold.ttf b/mobile_app/assets/fonts/Inter-SemiBold.ttf similarity index 100% rename from rpg_app/assets/fonts/Inter-SemiBold.ttf rename to mobile_app/assets/fonts/Inter-SemiBold.ttf diff --git a/rpg_app/assets/icon.png b/mobile_app/assets/icon.png similarity index 100% rename from rpg_app/assets/icon.png rename to mobile_app/assets/icon.png diff --git a/rpg_app/assets/icons/badge.png b/mobile_app/assets/icons/badge.png similarity index 100% rename from rpg_app/assets/icons/badge.png rename to mobile_app/assets/icons/badge.png diff --git a/rpg_app/assets/icons/calendrier.png b/mobile_app/assets/icons/calendrier.png similarity index 100% rename from rpg_app/assets/icons/calendrier.png rename to mobile_app/assets/icons/calendrier.png diff --git a/rpg_app/assets/icons/eth.png b/mobile_app/assets/icons/eth.png similarity index 100% rename from rpg_app/assets/icons/eth.png rename to mobile_app/assets/icons/eth.png diff --git a/rpg_app/assets/icons/heart.png b/mobile_app/assets/icons/heart.png similarity index 100% rename from rpg_app/assets/icons/heart.png rename to mobile_app/assets/icons/heart.png diff --git a/rpg_app/assets/icons/heure.png b/mobile_app/assets/icons/heure.png similarity index 100% rename from rpg_app/assets/icons/heure.png rename to mobile_app/assets/icons/heure.png diff --git a/rpg_app/assets/icons/left.png b/mobile_app/assets/icons/left.png similarity index 100% rename from rpg_app/assets/icons/left.png rename to mobile_app/assets/icons/left.png diff --git a/rpg_app/assets/icons/search.png b/mobile_app/assets/icons/search.png similarity index 100% rename from rpg_app/assets/icons/search.png rename to mobile_app/assets/icons/search.png diff --git a/rpg_app/assets/images/fond1.jpg b/mobile_app/assets/images/fond1.jpg similarity index 100% rename from rpg_app/assets/images/fond1.jpg rename to mobile_app/assets/images/fond1.jpg diff --git a/rpg_app/assets/images/fond2.jpg b/mobile_app/assets/images/fond2.jpg similarity index 100% rename from rpg_app/assets/images/fond2.jpg rename to mobile_app/assets/images/fond2.jpg diff --git a/rpg_app/assets/images/fond3.jpg b/mobile_app/assets/images/fond3.jpg similarity index 100% rename from rpg_app/assets/images/fond3.jpg rename to mobile_app/assets/images/fond3.jpg diff --git a/rpg_app/assets/images/logo.png b/mobile_app/assets/images/logo.png similarity index 100% rename from rpg_app/assets/images/logo.png rename to mobile_app/assets/images/logo.png diff --git a/rpg_app/assets/images/logo2.png b/mobile_app/assets/images/logo2.png similarity index 100% rename from rpg_app/assets/images/logo2.png rename to mobile_app/assets/images/logo2.png diff --git a/rpg_app/assets/images/nft01.png b/mobile_app/assets/images/nft01.png similarity index 100% rename from rpg_app/assets/images/nft01.png rename to mobile_app/assets/images/nft01.png diff --git a/rpg_app/assets/images/nft02.jpeg b/mobile_app/assets/images/nft02.jpeg similarity index 100% rename from rpg_app/assets/images/nft02.jpeg rename to mobile_app/assets/images/nft02.jpeg diff --git a/rpg_app/assets/images/nft03.jpeg b/mobile_app/assets/images/nft03.jpeg similarity index 100% rename from rpg_app/assets/images/nft03.jpeg rename to mobile_app/assets/images/nft03.jpeg diff --git a/rpg_app/assets/images/nft04.jpeg b/mobile_app/assets/images/nft04.jpeg similarity index 100% rename from rpg_app/assets/images/nft04.jpeg rename to mobile_app/assets/images/nft04.jpeg diff --git a/rpg_app/assets/images/nft05.jpeg b/mobile_app/assets/images/nft05.jpeg similarity index 100% rename from rpg_app/assets/images/nft05.jpeg rename to mobile_app/assets/images/nft05.jpeg diff --git a/rpg_app/assets/images/nft06.jpeg b/mobile_app/assets/images/nft06.jpeg similarity index 100% rename from rpg_app/assets/images/nft06.jpeg rename to mobile_app/assets/images/nft06.jpeg diff --git a/rpg_app/assets/images/nft07.jpeg b/mobile_app/assets/images/nft07.jpeg similarity index 100% rename from rpg_app/assets/images/nft07.jpeg rename to mobile_app/assets/images/nft07.jpeg diff --git a/rpg_app/assets/images/nike1.png b/mobile_app/assets/images/nike1.png similarity index 100% rename from rpg_app/assets/images/nike1.png rename to mobile_app/assets/images/nike1.png diff --git a/rpg_app/assets/images/nike2.png b/mobile_app/assets/images/nike2.png similarity index 100% rename from rpg_app/assets/images/nike2.png rename to mobile_app/assets/images/nike2.png diff --git a/rpg_app/assets/images/nike3.png b/mobile_app/assets/images/nike3.png similarity index 100% rename from rpg_app/assets/images/nike3.png rename to mobile_app/assets/images/nike3.png diff --git a/rpg_app/assets/images/nike4.png b/mobile_app/assets/images/nike4.png similarity index 100% rename from rpg_app/assets/images/nike4.png rename to mobile_app/assets/images/nike4.png diff --git a/rpg_app/assets/images/person01.png b/mobile_app/assets/images/person01.png similarity index 100% rename from rpg_app/assets/images/person01.png rename to mobile_app/assets/images/person01.png diff --git a/rpg_app/assets/images/person02.png b/mobile_app/assets/images/person02.png similarity index 100% rename from rpg_app/assets/images/person02.png rename to mobile_app/assets/images/person02.png diff --git a/rpg_app/assets/images/person03.png b/mobile_app/assets/images/person03.png similarity index 100% rename from rpg_app/assets/images/person03.png rename to mobile_app/assets/images/person03.png diff --git a/rpg_app/assets/images/person04.png b/mobile_app/assets/images/person04.png similarity index 100% rename from rpg_app/assets/images/person04.png rename to mobile_app/assets/images/person04.png diff --git a/rpg_app/assets/images/size.png b/mobile_app/assets/images/size.png similarity index 100% rename from rpg_app/assets/images/size.png rename to mobile_app/assets/images/size.png diff --git a/rpg_app/assets/splash.png b/mobile_app/assets/splash.png similarity index 100% rename from rpg_app/assets/splash.png rename to mobile_app/assets/splash.png diff --git a/rpg_app/babel.config.js b/mobile_app/babel.config.js similarity index 100% rename from rpg_app/babel.config.js rename to mobile_app/babel.config.js diff --git a/rpg_app/components/AccountCard.js b/mobile_app/components/AccountCard.js similarity index 70% rename from rpg_app/components/AccountCard.js rename to mobile_app/components/AccountCard.js index ba0738e670974e990324a41dc585f6f8f5b9119d..98fefa08869daef91939a3ce79640a2e5ff8fd96 100644 --- a/rpg_app/components/AccountCard.js +++ b/mobile_app/components/AccountCard.js @@ -9,22 +9,16 @@ const AccountCard = ({ data }) => { const navigation = useNavigation(); return ( <View style={{width: "48%", backgroundColor: COLORS.white, borderRadius: SIZES.font, marginBottom: SIZES.extraLarge, margin: "1%", ...SHADOWS.dark}}> - <View style={{ width: "100%", height: 150 }}> - <Image source={data.image} resizeMode="cover" style={{width: "100%", height: "100%", borderTopLeftRadius: SIZES.font, borderTopRightRadius: SIZES.font}}/> - <CircleButton imgUrl={assets.heart} right={10} top={10}/> - </View> <View style={{ width: "100%", padding: SIZES.base}}> - <Title title={data.Nom} subTitle={data.Mail} titleSize={SIZES.large} subTitleSize={SIZES.small}/> + <Title title={data.Nom} subTitle={data.Mail} titleSize={SIZES.large} subTitleSize={SIZES.base}/> </View> <View style={{ marginTop: SIZES.font, flexDirection: "row", justifyContent: "space-between", alignItems: "center", paddingHorizontal: 10, paddingBottom: 10}}> <View style={{ flexDirection: "row"}}> <AccountSize size={data.Taille} /> <AccountFootSize footSize={data.Pointure} /> </View> - - - <RectButton minWidth={120} fontSize={SIZES.font} text="Voir détails" handlePress={() => {}}/> </View> + <RectButton minWidth={80} fontSize={SIZES.font} text="Voir détails" handlePress={() => {}}/> </View> ) } diff --git a/rpg_app/components/AccountsHeader.js b/mobile_app/components/AccountsHeader.js similarity index 100% rename from rpg_app/components/AccountsHeader.js rename to mobile_app/components/AccountsHeader.js diff --git a/rpg_app/components/Button.js b/mobile_app/components/Button.js similarity index 73% rename from rpg_app/components/Button.js rename to mobile_app/components/Button.js index b6ff6c871eb0e88ab9defd5a20a16bd7b1362384..1d7ae121c259644517b33e2a81940e90a19703f5 100644 --- a/rpg_app/components/Button.js +++ b/mobile_app/components/Button.js @@ -65,4 +65,28 @@ export const RectButtonWhite = ({ width, fontSize, text, handlePress, ...props}) </Text> </TouchableOpacity> ) +} + +export const RectButtonSchedule = ({ time, selected, state, handlePress, ...props}) => { + return ( + <TouchableOpacity + style={{ + backgroundColor: selected ? 'green' : 'white', + borderRadius: SIZES.small, + padding: SIZES.small, + margin: '1%', + width: '23%', + height: 70, + opacity: state ? 1 : 0.25, + justifyContent: 'center', + ...props + }} + onPress={() => state ? handlePress(time) : null} + > + + <Text style={{ fontFamily: FONTS.semiBold, fontSize: SIZES.font, color: Colors.black, textAlign: 'center'}}> + {time} + </Text> + </TouchableOpacity> + ) } \ No newline at end of file diff --git a/rpg_app/components/DetailsDesc.js b/mobile_app/components/DetailsDesc.js similarity index 100% rename from rpg_app/components/DetailsDesc.js rename to mobile_app/components/DetailsDesc.js diff --git a/rpg_app/components/DetailsProduct.js b/mobile_app/components/DetailsProduct.js similarity index 66% rename from rpg_app/components/DetailsProduct.js rename to mobile_app/components/DetailsProduct.js index 923910d88551c702b7a9897a88997e9c8079d5ff..4eded6200b61af4982768feac96e77be6be19e7b 100644 --- a/rpg_app/components/DetailsProduct.js +++ b/mobile_app/components/DetailsProduct.js @@ -8,21 +8,12 @@ const DetailsProduct = ({product}) => { <View style={{ width:"100%", flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginVertical: SIZES.base, paddingHorizontal: SIZES.base * 2}}> <Image source={product.product} resizeMode="contain" style={{ width: "20%", height: 100 }} /> - <View style={{ width: "50%"}}> - <Text style={{fontSize: SIZES.medium, fontFamily: FONTS.semiBold, color: COLORS.primary}}> - Advice from {product.name} - </Text> - + <View style={{ width: "70%"}}> + <Text style={{fontSize: SIZES.medium, fontFamily: FONTS.semiBold, color: COLORS.primary, textAlign:"justify"}}> Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un imprimeur anonyme </Text> - - <Text style={{fontSize: SIZES.small - 2, fontFamily: FONTS.regular, color: COLORS.secondary, marginTop: 3}}> - Advice placed by {product.date} - </Text> </View> - - <Image source={product.adviser} resizeMode="contain" style={{ width: "20%", height: 100}} /> </View> ) } diff --git a/rpg_app/components/FocusedStatusBar.js b/mobile_app/components/FocusedStatusBar.js similarity index 100% rename from rpg_app/components/FocusedStatusBar.js rename to mobile_app/components/FocusedStatusBar.js diff --git a/rpg_app/components/HomeHeader.js b/mobile_app/components/HomeHeader.js similarity index 100% rename from rpg_app/components/HomeHeader.js rename to mobile_app/components/HomeHeader.js diff --git a/rpg_app/components/RDVCard.js b/mobile_app/components/RDVCard.js similarity index 58% rename from rpg_app/components/RDVCard.js rename to mobile_app/components/RDVCard.js index d2a436678becffbbc459afe3586236bfb76ac09d..48b0db89c52919227142e240aa357577d18cd7c6 100644 --- a/rpg_app/components/RDVCard.js +++ b/mobile_app/components/RDVCard.js @@ -1,10 +1,49 @@ import { View, Image, Text } from 'react-native' import { useNavigation } from '@react-navigation/native' import React from 'react' +import emailjs from '@emailjs/browser' import { assets, COLORS, SHADOWS, SIZES, } from '../constants' import { CircleButton, RectButton } from './Button' import { SubInfo, RDVDate, Title, RDVHour } from './SubInfo' + + + + +const deleteRDV = (datas) => { + const data = { + idclient : 1, + date : datas.date, + idrdv : datas.id + }; + console.log(datas) + console.log(data) + + const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }; + fetch('http://10.0.2.2:3001/supp-rendez-vous', options) + + + var templateParams = { + horaire: datas.hour, + date: datas.date + }; + + emailjs.send('service_kwla1nj', 'template_ijryses', templateParams, 'gkKZTWtimj8jnpE9G','sO7lpUxhWhb0UkdBEAd6F') + .then(function(response) { + console.log('SUCCESS!', response.status, response.text); + }, function(error) { + console.log('FAILED...', error); + }); + + +} + const RDVCard = ({ data }) => { const navigation = useNavigation(); return ( @@ -24,8 +63,8 @@ const RDVCard = ({ data }) => { </View> <View style={{ flexDirection: "row"}}> - <RectButton minWidth={120} fontSize={SIZES.font} text="Voir détails" handlePress={() => navigation.navigate("Details", { data })}/> - <RectButton minWidth={120} fontSize={SIZES.font} text="Annuler" handlePress={() => {}}/> + <RectButton minWidth={85} fontSize={SIZES.font} text="Détails" handlePress={() => navigation.navigate("Details", { data })}/> + <RectButton minWidth={85} fontSize={SIZES.font} text="Annuler" handlePress={() => deleteRDV(data)}/> </View> </View> diff --git a/mobile_app/components/RDVHeader.js b/mobile_app/components/RDVHeader.js new file mode 100644 index 0000000000000000000000000000000000000000..281886ebc95f533593bbb369026d49dda982d173 --- /dev/null +++ b/mobile_app/components/RDVHeader.js @@ -0,0 +1,33 @@ +import { View, Text, Image, TextInput } from 'react-native' +import { assets, COLORS, FONTS, SIZES, SHADOWS } from '../constants' + +const RDVHeader = ({ indication }) => { + return ( + <View style={{ backgroundColor: COLORS.primary, padding: SIZES.font}}> + <View style={{ flexDirection: 'row', justifyContent: "space-between", alignItems: "center"}}> + <View style={{ flexDirection: 'row', alignItems: "center"}}> + <Image source={assets.logo2} resizeMode="contain" style={{ width: 60, height: 50}}/> + <Text style={{fontFamily: FONTS.bold, fontSize: SIZES.extraLarge, color: COLORS.white, marginLeft: 10}}>RPG</Text> + </View> + + <View style={{ width: 45, height: 45}}> + <Image source={assets.person01} resizeMode="contain" style={{ width: "100%", height: '100%'}}/> + <Image source={assets.badge} resizeMode="contain" style={{ position: "absolute", width: 15, height: 15, bottom: 0, right: 0}}/> + </View> + </View> + + <View style={{ marginVertical: SIZES.font}}> + <Text style={{ fontFamily: FONTS.regular, fontSize: SIZES.small, color: COLORS.white}}> + Prendre un rendez-vous + </Text> + <Text style={{ fontFamily: FONTS.bold, fontSize: SIZES.large, color: COLORS.white, marginTop: SIZES.base / 2}}> + {indication} + </Text> + </View> + </View> + + + ) +} + +export default RDVHeader \ No newline at end of file diff --git a/mobile_app/components/ShopCard.js b/mobile_app/components/ShopCard.js new file mode 100644 index 0000000000000000000000000000000000000000..8e9835e29632989f0912734298449e20cbeba99f --- /dev/null +++ b/mobile_app/components/ShopCard.js @@ -0,0 +1,26 @@ +import { View, Image } from 'react-native' +import { useNavigation } from '@react-navigation/native' +import React from 'react' +import { assets, COLORS, SHADOWS, SIZES, } from '../constants' +import { RectButton } from './Button' +import { SubInfo, RDVDate, Title, RDVHour } from './SubInfo' + +const ShopCard = ({ data, shopPress }) => { + const navigation = useNavigation(); + return ( + <View style={{width: "48%", backgroundColor: COLORS.white, borderRadius: SIZES.font, marginBottom: SIZES.extraLarge, margin: "1%", ...SHADOWS.dark}}> + <View style={{ width: "100%", height: 150 }}> + <Image source={{uri:data.Image}} resizeMode="cover" style={{width: "100%", height: "100%", borderTopLeftRadius: SIZES.font, borderTopRightRadius: SIZES.font}}/> + </View> + + <View style={{ width: "100%", padding: SIZES.base}}> + <Title title={data.Adresse} subTitle={"Boutique"} titleSize={SIZES.font} subTitleSize={SIZES.small}/> + </View> + + <RectButton minWidth={120} fontSize={SIZES.font} text="Choisir" handlePress={() => {shopPress(data)}}/> + + </View> + ) +} + +export default ShopCard \ No newline at end of file diff --git a/rpg_app/components/SubInfo.js b/mobile_app/components/SubInfo.js similarity index 96% rename from rpg_app/components/SubInfo.js rename to mobile_app/components/SubInfo.js index a42c05c3d403b5e8ce5cbf9e4b61449548cf8a12..c0128878ae60abae58b3f51957b1fc7b3f51545b 100644 --- a/rpg_app/components/SubInfo.js +++ b/mobile_app/components/SubInfo.js @@ -61,7 +61,7 @@ export const ImageCmp = ({imageUrl, index}) => { return ( <Image source={imageUrl} resizeMode="contain" - style={{ with: 48, height: 48, marginLeft: index === 0 ? 0 : -SIZES.font}}/> + style={{height: 50, marginLeft: index === 0 ? 0 : -70}}/> ) } @@ -89,7 +89,6 @@ export const SubInfo = () => { return ( <View style={{ width: "100%", paddingHorizontal: SIZES.font, marginTop: -SIZES.extraLarge, flexDirection: "row", justifyContent: "space-between"}}> <People /> - <StartDate /> </View> ) } \ No newline at end of file diff --git a/rpg_app/components/index.js b/mobile_app/components/index.js similarity index 71% rename from rpg_app/components/index.js rename to mobile_app/components/index.js index 00b0b797a601f3163854042efc52bb65ca5d2be6..47181fc0752e6111bf58bf84f656fb34bf79a1d9 100644 --- a/rpg_app/components/index.js +++ b/mobile_app/components/index.js @@ -1,13 +1,15 @@ import HomeHeader from "./HomeHeader"; import FocusedStatusBar from "./FocusedStatusBar"; import RDVCard from "./RDVCard"; -import {CircleButton, RectButton} from "./Button"; +import {CircleButton, RectButton, RectButtonSchedule} from "./Button"; import DetailsProduct from "./DetailsProduct"; import DetailsDesc from "./DetailsDesc"; import { SubInfo } from "./SubInfo"; import AccountsHeader from "./AccountsHeader"; import AccountCard from "./AccountCard"; +import RDVHeader from "./RDVHeader"; +import ShopCard from "./ShopCard"; export { - HomeHeader, AccountsHeader, AccountCard, FocusedStatusBar, RDVCard, CircleButton, RectButton, DetailsProduct, DetailsDesc, SubInfo + HomeHeader, AccountsHeader, AccountCard, FocusedStatusBar, RDVCard, CircleButton, RectButton, DetailsProduct, DetailsDesc, SubInfo, RDVHeader, ShopCard, RectButtonSchedule } \ No newline at end of file diff --git a/rpg_app/constants/Assets.js b/mobile_app/constants/Assets.js similarity index 100% rename from rpg_app/constants/Assets.js rename to mobile_app/constants/Assets.js diff --git a/rpg_app/constants/dummy.js b/mobile_app/constants/dummy.js similarity index 100% rename from rpg_app/constants/dummy.js rename to mobile_app/constants/dummy.js diff --git a/rpg_app/constants/dummy2.js b/mobile_app/constants/dummy2.js similarity index 100% rename from rpg_app/constants/dummy2.js rename to mobile_app/constants/dummy2.js diff --git a/rpg_app/constants/index.js b/mobile_app/constants/index.js similarity index 100% rename from rpg_app/constants/index.js rename to mobile_app/constants/index.js diff --git a/rpg_app/constants/theme.js b/mobile_app/constants/theme.js similarity index 100% rename from rpg_app/constants/theme.js rename to mobile_app/constants/theme.js diff --git a/rpg_app/package-lock.json b/mobile_app/package-lock.json similarity index 99% rename from rpg_app/package-lock.json rename to mobile_app/package-lock.json index 60d6110bda4d6a29e5b73c015969720a1dd809ff..b807e670c36100a33d33d58da56759050179301e 100644 --- a/rpg_app/package-lock.json +++ b/mobile_app/package-lock.json @@ -8,12 +8,15 @@ "name": "rpg_app", "version": "1.0.0", "dependencies": { + "@emailjs/browser": "^3.10.0", "@expo/webpack-config": "^0.17.2", "@react-native-community/datetimepicker": "6.5.2", "@react-navigation/native": "6.1.2", "@react-navigation/stack": "6.3.11", "appjs": "0.0.20", "appjs-linux-x64": "0.0.19", + "appjs-win32": "^0.0.19", + "emailjs-com": "^3.2.0", "expo": "~47.0.12", "expo-font": "11.0.1", "expo-status-bar": "~1.4.2", @@ -1882,6 +1885,14 @@ "node": ">=0.8.0" } }, + "node_modules/@emailjs/browser": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-3.10.0.tgz", + "integrity": "sha512-pregUOBkSjjctQoAgn8DcSaeY4ypHjXAJEzWlJysM3RkQXw1ulavfHva3YYeAkxfJ7qbIhpyvRmhyQlgNG4GVg==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@expo/bunyan": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz", @@ -4043,7 +4054,18 @@ "x64" ], "os": [ - "linux" + "win32" + ], + "engines": { + "node": ">=0.8" + } + }, + "node_modules/appjs-win32": { + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/appjs-win32/-/appjs-win32-0.0.19.tgz", + "integrity": "sha512-ide+/pVBbT043Zxx5CQd2R8j2UIhOs4xV17rEf335ooujHtdvWphiyC3R81UWib9vKHEOY7dNlv91J9R/a7pVw==", + "os": [ + "win32" ], "engines": { "node": ">=0.8" @@ -4573,6 +4595,15 @@ "node": ">=8" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -6897,6 +6928,15 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, + "node_modules/emailjs-com": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/emailjs-com/-/emailjs-com-3.2.0.tgz", + "integrity": "sha512-Prbz3E1usiAwGjMNYRv6EsJ5c373cX7/AGnZQwOfrpNJrygQJ15+E9OOq4pU8yC977Z5xMetRfc3WmDX6RcjAA==", + "deprecated": "The SDK name changed to @emailjs/browser", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -7950,6 +7990,12 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "node_modules/filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -11711,6 +11757,12 @@ "thenify-all": "^1.0.0" } }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, "node_modules/nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -14089,6 +14141,18 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "node_modules/react-freeze": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/react-freeze/-/react-freeze-1.0.3.tgz", + "integrity": "sha512-ZnXwLQnGzrDpHBHiC56TXFXvmolPeMjTn1UOm610M4EXGzbEDR7oOIyS2ZiItgbs6eZc4oU/a0hpk8PrcKvv5g==", + "peer": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=17.0.0" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -14183,6 +14247,20 @@ "react-native": "*" } }, + "node_modules/react-native-screens": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-3.20.0.tgz", + "integrity": "sha512-joWUKWAVHxymP3mL9gYApFHAsbd9L6ZcmpoZa6Sl3W/82bvvNVMqcfP7MeNqVCg73qZ8yL4fW+J/syusHleUgg==", + "peer": true, + "dependencies": { + "react-freeze": "^1.0.0", + "warn-once": "^0.1.0" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-web": { "version": "0.18.10", "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.18.10.tgz", @@ -20090,6 +20168,11 @@ "@types/hammerjs": "^2.0.36" } }, + "@emailjs/browser": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-3.10.0.tgz", + "integrity": "sha512-pregUOBkSjjctQoAgn8DcSaeY4ypHjXAJEzWlJysM3RkQXw1ulavfHva3YYeAkxfJ7qbIhpyvRmhyQlgNG4GVg==" + }, "@expo/bunyan": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@expo/bunyan/-/bunyan-4.0.0.tgz", @@ -21901,6 +21984,11 @@ "resolved": "https://registry.npmjs.org/appjs-linux-x64/-/appjs-linux-x64-0.0.19.tgz", "integrity": "sha512-BjONz/ONyx0AUE0bCasx0Tj6QeM/NPPzBBqX+XM9pNZ/1JTYC2H6qvaBGh7iOSShzzHuTrblTB07LnywpZabbQ==" }, + "appjs-win32": { + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/appjs-win32/-/appjs-win32-0.0.19.tgz", + "integrity": "sha512-ide+/pVBbT043Zxx5CQd2R8j2UIhOs4xV17rEf335ooujHtdvWphiyC3R81UWib9vKHEOY7dNlv91J9R/a7pVw==" + }, "application-config-path": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/application-config-path/-/application-config-path-0.1.1.tgz", @@ -22306,6 +22394,15 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "optional": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -24147,6 +24244,11 @@ } } }, + "emailjs-com": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/emailjs-com/-/emailjs-com-3.2.0.tgz", + "integrity": "sha512-Prbz3E1usiAwGjMNYRv6EsJ5c373cX7/AGnZQwOfrpNJrygQJ15+E9OOq4pU8yC977Z5xMetRfc3WmDX6RcjAA==" + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -25004,6 +25106,12 @@ } } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -27977,6 +28085,12 @@ "thenify-all": "^1.0.0" } }, + "nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, "nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -29862,6 +29976,13 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "react-freeze": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/react-freeze/-/react-freeze-1.0.3.tgz", + "integrity": "sha512-ZnXwLQnGzrDpHBHiC56TXFXvmolPeMjTn1UOm610M4EXGzbEDR7oOIyS2ZiItgbs6eZc4oU/a0hpk8PrcKvv5g==", + "peer": true, + "requires": {} + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -30017,6 +30138,16 @@ "integrity": "sha512-N9XTjiuD73ZpVlejHrUWIFZc+6Z14co1K/p1IFMkImU7+avD69F3y+lhkqA2hN/+vljdZrBSiOwXPkuo43nFQA==", "requires": {} }, + "react-native-screens": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-3.20.0.tgz", + "integrity": "sha512-joWUKWAVHxymP3mL9gYApFHAsbd9L6ZcmpoZa6Sl3W/82bvvNVMqcfP7MeNqVCg73qZ8yL4fW+J/syusHleUgg==", + "peer": true, + "requires": { + "react-freeze": "^1.0.0", + "warn-once": "^0.1.0" + } + }, "react-native-web": { "version": "0.18.10", "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.18.10.tgz", diff --git a/rpg_app/package.json b/mobile_app/package.json similarity index 81% rename from rpg_app/package.json rename to mobile_app/package.json index 8d5b67fa068cbdf033fcacacb4319158cb3d2b36..d64ccb14186f0c1dc0128a4c701e80963c2a37e2 100644 --- a/rpg_app/package.json +++ b/mobile_app/package.json @@ -9,11 +9,15 @@ "web": "expo start --web" }, "dependencies": { + "@emailjs/browser": "^3.10.0", "@expo/webpack-config": "^0.17.2", + "@react-native-community/datetimepicker": "6.5.2", "@react-navigation/native": "6.1.2", "@react-navigation/stack": "6.3.11", "appjs": "0.0.20", "appjs-linux-x64": "0.0.19", + "appjs-win32": "^0.0.19", + "emailjs-com": "^3.2.0", "expo": "~47.0.12", "expo-font": "11.0.1", "expo-status-bar": "~1.4.2", @@ -23,9 +27,7 @@ "react-native": "0.70.5", "react-native-gesture-handler": "~2.8.0", "react-native-safe-area-context": "4.4.1", - "react-native-web": "~0.18.9", - "@react-native-community/datetimepicker": "6.5.2" - + "react-native-web": "~0.18.9" }, "devDependencies": { "@babel/core": "^7.12.9" diff --git a/rpg_app/screens/Accounts.js b/mobile_app/screens/Accounts.js similarity index 100% rename from rpg_app/screens/Accounts.js rename to mobile_app/screens/Accounts.js diff --git a/rpg_app/screens/Details.js b/mobile_app/screens/Details.js similarity index 99% rename from rpg_app/screens/Details.js rename to mobile_app/screens/Details.js index 8c3864dcb11f5deb19ed50ade684a05ff88d850e..286ace5066dcfb83b4430fbc06f84c86be233bd5 100644 --- a/rpg_app/screens/Details.js +++ b/mobile_app/screens/Details.js @@ -16,7 +16,8 @@ const DetailsHeader = ({ data, navigation }) => ( const Details = ({ route, navigation }) => { const { data } = route.params; - console.log("TEST") + + console.log(route.params) diff --git a/rpg_app/screens/Home.js b/mobile_app/screens/Home.js similarity index 57% rename from rpg_app/screens/Home.js rename to mobile_app/screens/Home.js index d3443c74c5d5317218352b21c5ea764c59234113..1b6dbe0ffabb2f964ee25f779eb4989cbd49cc28 100644 --- a/rpg_app/screens/Home.js +++ b/mobile_app/screens/Home.js @@ -1,14 +1,85 @@ -import { useState} from 'react'; +import { useEffect, useState } from 'react'; import { View, SafeAreaView, FlatList } from 'react-native'; -import { useNavigation } from '@react-navigation/native' +import { useNavigation } from '@react-navigation/native'; +import { useIsFocused } from "@react-navigation/native"; + +import assets from "../constants/Assets"; + import { COLORS, SIZES, SHADOWS, RPGData } from '../constants'; import { RDVCard, HomeHeader, FocusedStatusBar, RectButton } from '../components'; const Home = () => { const navigation = useNavigation(); - + const isFocused = useIsFocused(); const [rdvData, setRdvData] = useState(RPGData); + const [rdvDatas,setRdvDatas] = useState(); + + const jsonToRdv = ( + result + ) => { + const rdv_list = [] + result.map((item,index) => { + let actual_item = [] + rdv_list.push({ + id: item.Id_RDV, + name: "Rendez-vous", + shop: item.Adresse, + date: item.Date, + hour: item.Heure.substring(0, item.Heure.length - 3), + description: + item.description, + image: assets.fond2, + bids: [] + }) + }) + setRdvDatas(rdv_list) + } + + + let getRDV = () => { + + const data = { + client_id : 1, + }; + + const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }; + fetch('http://10.0.2.2:3001/liste-rdv', options).then(res => res.json()) + .then((result) => ( + jsonToRdv(result))) + .catch(function(error) { + console.log(error) + }) + + + } + + let updateRdv = (result) => { + + } + + + + useEffect(() => { + console.log("called"); + + // Call only when screen open or when back on screen + if(isFocused){ + getRDV(); + } +}, [isFocused]); + + + + + + const handleSearch = (value) => { if(!value.length) { @@ -23,6 +94,7 @@ const Home = () => { } else { + setRdvData(RPGData); } } @@ -38,7 +110,7 @@ const Home = () => { <View style={{ flex: 1 }}> <View style={{ zIndex: 0 }}> - <FlatList data={rdvData} + <FlatList data={rdvDatas} renderItem={({ item }) => <RDVCard data={item}/>} keyExtractor={(item) => item.id} showsVerticalScrollIndicator={false} diff --git a/rpg_app/screens/RdvScreen.js b/mobile_app/screens/RdvScreen.js similarity index 54% rename from rpg_app/screens/RdvScreen.js rename to mobile_app/screens/RdvScreen.js index 122fbb981c24a94b44941e174597c896cefb35ae..9d39892a195cd4e062d818375087843d25027edf 100644 --- a/rpg_app/screens/RdvScreen.js +++ b/mobile_app/screens/RdvScreen.js @@ -2,15 +2,16 @@ import { StatusBar } from 'expo-status-bar'; import { useEffect, useState } from 'react'; import { StyleSheet, Text, View,FlatList, Dimensions, TouchableOpacity, Button, Image, SafeAreaView, Platform } from 'react-native'; import { COLORS, SIZES, SHADOWS, RPGData } from '../constants'; -import { RDVCard, HomeHeader, FocusedStatusBar, RectButton } from '../components'; +import { FocusedStatusBar, RectButton, RDVHeader, ShopCard, RectButtonSchedule } from '../components'; import DateTimePicker from '@react-native-community/datetimepicker'; import { useNavigation } from '@react-navigation/native' +import { RectButtonWhite } from '../components/Button'; -export default function RdvScreen() { - console.log("TESTTESTETST"); +const RdvScreen = () => { + const navigation = useNavigation(); const [schedule,setSchedule] = useState([ - { time: '10:00', id:'1',state : false,selected : false}, + { time: '10:00', id:'1',state : true,selected : false}, { time: '10:30', id:'2',state : true,selected : false}, { time: '11:00', id:'3',state : true,selected : false}, { time: '11:30', id:'4',state : true,selected : false}, @@ -20,7 +21,7 @@ export default function RdvScreen() { { time: '13:30', id:'8',state : true,selected : false}, { time: '14:00', id:'9',state : true,selected : false}, { time: '14:30', id:'10',state : true,selected : false}, - { time: '15:00', id:'11',state : false,selected : false}, + { time: '15:00', id:'11',state : true,selected : false}, { time: '15:30', id:'12',state : true,selected : false}, { time: '16:00', id:'13',state : true,selected : false}, { time: '16:30', id:'14',state : true,selected : false}, @@ -59,31 +60,53 @@ export default function RdvScreen() { .finally(() => setLoading(false)) } - let getHorraires = () => - { + let getHoraires = (shop) => { + const data = { date : date, - address : magasin.Id_Adresse, + address : shop.Id_Adresse, }; const options = { - method: 'GET', + method: 'POST', headers: { 'Content-Type': 'application/json', + }, body: JSON.stringify(data), }; + fetch('http://10.0.2.2:3001/liste-horaires', options).then(res => res.json()) + + .then((result) => (updateRdv(result))) + .catch(function(error) { + }); + } + let updateRdv = (result) => { + const tempSchedule = []; + schedule.map((item,index) => { + result.forEach( + function(d){ + if(d.Heure.substring(0, d.Heure.length - 3) == item.time) { + item.state = false; + } + else { + item.state = true; + } + }) + tempSchedule.push(item) + }) + setSchedule(tempSchedule); + } + + + let selectShop = (shop) => { + setMagasinSelected(true); + setMagasin(shop); + setShow(true); + } - fetch('http://10.0.2.2:3001/prendre-rdv',{ - method: 'POST', - body: '"date ":'+date.toDateString - }).then(res => res.json()) - .then((result) => (console.log(result))) - .catch(function(error) { - }) -} useEffect(() => { setLoading(true); getMagasins(); @@ -91,27 +114,30 @@ export default function RdvScreen() { const onChange = (event, selectedDate) => { + setDate(selectedDate); const currentDate = selectedDate || date; - setShow(false) - setDate(currentDate) + setShow(false); let tempDate = new Date(currentDate); let fDate = tempDate.getDate() + '/' + (tempDate.getMonth() + 1) + '/' + tempDate.getFullYear(); setText(fDate); - setSelected(true); - setDate(new Date(tempDate)); + getHoraires(magasin); - // let result = getHorraires + if(event.type == "set"){ + setSelected(true); + setLoading(true); + setDate(new Date(tempDate)); - const tempSchedule = []; - schedule.map((item,index) => { + const tempSchedule = []; + schedule.map((item,index) => { - item.selected = false; - tempSchedule.push(item); - }) - setSchedule(tempSchedule); + item.selected = false; + tempSchedule.push(item); + }) + setSchedule(tempSchedule); + } } @@ -142,6 +168,7 @@ export default function RdvScreen() { }; fetch('http://10.0.2.2:3001/prendre-rdv', options); console.log("magasin : "+magasin.Id_Adresse+"\n Horraire : "+date) + navigation.navigate("Home") } @@ -160,127 +187,82 @@ export default function RdvScreen() { setisDateSelected(true) }; + const today = new Date() + const minDate = new Date(today) + minDate.setDate(minDate.getDate() + 1) + + const maxDate = new Date(today) + maxDate.setDate(minDate.getDate() + 30) + return ( - <View style={{ flex: 1}}> - <FocusedStatusBar barStyle="dark-content" backgroundColor="transparent" translucent={true} /> + <SafeAreaView style={{ flex: 1 }}> + <FocusedStatusBar background={COLORS.primary}/> - <View style={{ width: "100%", position: "absolute", bottom: 0, paddingVertical: SIZES.large, flexDirection: "row", justifyContent: "center", alignItems: "center", backgroundColor: "rgba(2555, 255, 255, 0.5)", zIndex: 1}}> - <RectButton fonSize={SIZES.large} text="Mon Compte" {...SHADOWS.dark} handlePress={() => navigation.navigate("Home")}/> - <RectButton fonSize={SIZES.large} text="Liste des comptes" {...SHADOWS.dark} /> + <View style={{ position: "absolute", top: 0, bottom: 0, right: 0, left: 0, zIndex: -1}}> + <View style={{ height: 150, backgroundColor: COLORS.primary }}/> + <View style={{ flex: 1, backgroundColor: COLORS.white }}/> </View> - <View style={styles.container} > - - {isLoading && <Text> - Chargement... - </Text> + <View style={{ width: "100%", position: "absolute", bottom: 0, paddingVertical: SIZES.large, flexDirection: "row", justifyContent: "center", alignItems: "center", backgroundColor: "rgba(2555, 255, 255, 0.5)", zIndex: 1}}> + <RectButton fonSize={SIZES.large} text="Mon Compte" handlePress={() => navigation.navigate("Home")} {...SHADOWS.dark} /> + <RectButton fonSize={SIZES.large} text="Liste des comptes" handlePress={() => navigation.navigate("Accounts")} {...SHADOWS.dark} /> + </View> + <View style={{ flex:1 }} > + {!isLoading && + <FlatList + key={'_'} + numColumns={2} + data={magasins} + showsVerticalScrollIndicator={false} + ListHeaderComponent={ + <RDVHeader indication={"Veuillez choisir une boutique"}/> + } + renderItem={ + ({item}) => <ShopCard data={item} shopPress={selectShop}/> + } + /> } - { !isLoading && <FlatList - key={'_'} - numColumns={2} - data={magasins} - renderItem={({item}) => <TouchableOpacity onPress={() => {setMagasinSelected(true); setMagasin(item);}}> - <Image - style = {{width:'80%',height:'20%',padding:100}} - source={{uri:item.Image}}/> - <Text>{item.Adresse}</Text> - </TouchableOpacity>} - />} - - - {magasinSelected && (<TouchableOpacity onPress={() => setShow(true)}> - <View> - <Text style={styles.date}>{text}</Text> - <Text>Select</Text> - </View> - </TouchableOpacity> - - )} - - {show && ( - <DateTimePicker - testID='dateTimePicker' - value={date} - mode={'date'} - is24Hour={true} - display='default' - onChange={onChange} - /> - ) } - - {selected && (<FlatList - numColumns={4} - data={schedule} - renderItem={({ item }) => - {if(item.state == true){ - return <TouchableOpacity onPress={() => pressHandler(item.time)}><Text style={[styles.item,{backgroundColor : item.selected ? 'green' : 'white'}]}>{item.time} </Text></TouchableOpacity> - } - else { - return <Text style={styles.itemDisable}>{item.time}</Text> - } - }}></FlatList>)} - - {isDateSelected && ( - <Button - onPress={PostRDV} - title="Prendre un RDV" - ></Button> - )} + {show && + (<DateTimePicker + testID='dateTimePicker' + value={date} + mode={'date'} + minimumDate={minDate} + maximumDate={maxDate} + is24Hour={true} + display='default' + onChange={onChange} + />) + } + {selected && + (<FlatList + numColumns={4} + data={schedule} + showsVerticalScrollIndicator={false} + ListHeaderComponent={ + <RDVHeader indication={"Veuillez choisir une heure"}/> + } + ListFooterComponent={isDateSelected && + (<RectButton fonSize={SIZES.large} text="Prendre un RDV" handlePress={() => PostRDV()} {...SHADOWS.dark} />) + } + renderItem={({ item }) => <RectButtonSchedule time={item.time} selected={item.selected} state={item.state} handlePress={pressHandler} {...SHADOWS.dark}/> + } + />) + } </View> - </View> + </SafeAreaView> ); } - - -const width = Dimensions.get('window').width - 40; - - const styles = StyleSheet.create({ - container: { - marginTop: StatusBar.currentHeight, - flex:1, - alignItems: 'center', - justifyContent: 'center', - }, - item: { - fontWeight: 'bold', - fontSize: 12, - color: COLORS.primary, - width: width / 4 - 10, - marginTop: 15, - marginHorizontal: 10, - height: 40, - borderColor: COLORS.primary, - textAlign:'center', - verticalAlign:'middle', - borderWidth:2, - }, - itemDisable: { - fontWeight: 'bold', - fontSize: 12, - color: COLORS.primary, - width: width / 4 - 10, - marginTop: 15, - marginHorizontal: 10, - height: 40, - borderColor: COLORS.primary, - textAlign:'center', - verticalAlign:'middle', - borderWidth:2, - opacity:0.25 - }, - date: { - width:"100%", - }, - }); +export default RdvScreen