Skip to content

Commit

Permalink
Add default address display
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-LHOSTE committed Nov 8, 2024
1 parent 3d7018d commit 1dfb88f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/navigation/store/NewDeliveryPickup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function NewDeliveryPickup(props) {
const backgroundColor = useBackgroundContainerColor();
const backgroundHighlightColor = useBackgroundHighlightColor();
const primaryColor = usePrimaryColor();
const [pickupAddress, setPickupAddress] = useState(true);
const [customAddress, setCustomAddress] = useState(false);

const {
store,
Expand Down Expand Up @@ -99,6 +99,9 @@ function NewDeliveryPickup(props) {
}

function validate(values) {
console.log(customAddress);

if (!customAddress) return {};
const errors = {};

if (_.isEmpty(values.telephone)) {
Expand Down Expand Up @@ -138,7 +141,7 @@ function NewDeliveryPickup(props) {
}

function submit(values) {
const pickup = pickupAddress
const pickup = customAddress
? {
telephone: parsePhoneNumberFromString(
values.telephone,
Expand Down Expand Up @@ -187,14 +190,20 @@ function NewDeliveryPickup(props) {
default values.
</Text>
</View>
<View style={[styles.formGroup, { zIndex: 2 }]}>
<Text style={styles.label}>Default pick up address</Text>
<Text style={styles.optional}>{store.address.name}</Text>
<Text>{store.address.streetAddress}</Text>
<Text>{store.address.telephone}</Text>
</View>
<View style={[styles.formGroup, { zIndex: 2 }]}>
<Checkbox
value={pickupAddress}
onChange={() => setPickupAddress(!pickupAddress)}>
value={customAddress}
onChange={() => setCustomAddress(!customAddress)}>
<Text>Use custom pickup address</Text>
</Checkbox>
</View>
<View style={pickupAddress ? styles.disabled : {}}>
<View style={customAddress ? {} : styles.disabled}>
<View style={[styles.formGroup, { zIndex: 2 }]}>
<Text style={styles.label}>
{t('STORE_NEW_DELIVERY_SEARCH_CLIENT')}{' '}
Expand Down

0 comments on commit 1dfb88f

Please sign in to comment.