diff --git a/back-strapi/api/contact/models/contact.settings.json b/back-strapi/api/contact/models/contact.settings.json index 48b6398d..e030c53c 100644 --- a/back-strapi/api/contact/models/contact.settings.json +++ b/back-strapi/api/contact/models/contact.settings.json @@ -21,6 +21,9 @@ }, "zipcode": { "type": "integer" + }, + "box": { + "model": "box" } } } diff --git a/tumeplay-app/src/screens/StayInTouchScreen.js b/tumeplay-app/src/screens/StayInTouchScreen.js index 25a1c8ec..3255cd7a 100644 --- a/tumeplay-app/src/screens/StayInTouchScreen.js +++ b/tumeplay-app/src/screens/StayInTouchScreen.js @@ -148,7 +148,12 @@ export default function StayInTouchScreen(props) { // } if (_isValid) { - ContactsAPI.postContact(localAdress); + let box_id = props.navigation.state.params.box_id; + let userAdress = { + ...localAdress, + box_id: box_id + } + ContactsAPI.postContact(userAdress); props.navigation.navigate('StayInTouchConfirm', {outOfStock: outOfStock}); } } diff --git a/tumeplay-app/src/screens/components/tunnel/ProductCard.js b/tumeplay-app/src/screens/components/tunnel/ProductCard.js index 3b0c193a..67929b5d 100644 --- a/tumeplay-app/src/screens/components/tunnel/ProductCard.js +++ b/tumeplay-app/src/screens/components/tunnel/ProductCard.js @@ -1,6 +1,6 @@ import React, {useState} from 'react'; import PropTypes from 'prop-types'; -import {Text, View, Image, StyleSheet} from 'react-native'; +import {Text, View, Image, StyleSheet, TouchableOpacity} from 'react-native'; import Colors from '../../../styles/Color'; import Styles from '../../../styles/Styles'; @@ -10,6 +10,7 @@ import CustomTouchableOpacity from '../global/CustomTouchableOpacity'; ProductCard.propTypes = { item: PropTypes.object, onPress: PropTypes.func, + navigation: PropTypes.object }; export default function ProductCard(props) { @@ -67,6 +68,30 @@ export default function ProductCard(props) { paddingTop: 0, resizeMode: 'contain', }, + descriptionCard: { + position: 'absolute', + top: '35%', + left: '35%', + marginHorizontal: 'auto', + opacity: 1, + zIndex: 10 + }, + descriptionTitle: { + color: "#FFFF", + fontFamily: Colors.appTitleFont, + fontSize: 30, + marginBottom: 5, + }, + descriptionButton: { + backgroundColor: 'rgb(200,3,82)', + paddingHorizontal: 10, + textAlign: 'center', + paddingVertical: 10, + borderRadius: 30, + }, + descriptionText: { + color: "#FFFF", + }, notAvailableWrapper: { position: 'absolute', flex: 1, @@ -102,7 +127,25 @@ export default function ProductCard(props) { } }; + const redirectContact = () => { + props.navigation.navigate('StayInTouch', { + box_id: props.item.id + }) + } + return ( + <> + { + !productBox.available ? + + Box indisponible + {redirectContact()}}> + Laisse nous tes coordonnées + + + : + null + } + ); } diff --git a/tumeplay-app/src/screens/tunnel/TunnelProductSelect.js b/tumeplay-app/src/screens/tunnel/TunnelProductSelect.js index bfca4111..72005193 100644 --- a/tumeplay-app/src/screens/tunnel/TunnelProductSelect.js +++ b/tumeplay-app/src/screens/tunnel/TunnelProductSelect.js @@ -117,13 +117,14 @@ export default function TunnelProductSelect(props) { return ( _onBoxClicked(item)} /> ); }); } - + return ( diff --git a/tumeplay-app/src/services/api/contact.js b/tumeplay-app/src/services/api/contact.js index 67270295..97d6f87e 100644 --- a/tumeplay-app/src/services/api/contact.js +++ b/tumeplay-app/src/services/api/contact.js @@ -11,6 +11,7 @@ const ContactsAPI = { name: userAdress.firstName, email: userAdress.emailAdress, zipcode: userAdress.zipCode, + box: userAdress.box_id }), }); },