Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9942652
updated websocket
jsayago77 May 18, 2025
7865a77
Merge branch 'dev' into fix/active-orders
jsayago77 May 25, 2025
96c0b3f
Update @pharmatech/sdk to version 0.4.19 and adjust styles in OrderTr…
jsayago77 May 25, 2025
f52a55f
Add VerticalStepper component and integrate it into OrderTrackingScreen
jsayago77 May 28, 2025
74740a6
Update @pharmatech/sdk to version 0.4.21 and enhance OrderTrackingScr…
jsayago77 May 29, 2025
a2435fb
Add refresh functionality to ActiveOrdersScreen and update OrderTrack…
jsayago77 May 29, 2025
068e798
Update delivery status check in OrderTrackingScreen from ASSIGNED to …
jsayago77 May 29, 2025
b7a542f
Merge branch 'dev' into fix/active-orders
jsayago77 May 29, 2025
d68e0bb
Refactor delivery status check in OrderTrackingScreen to simplify con…
jsayago77 May 29, 2025
2cfdd20
Update OrderBadge labels and enhance OrderDetailScreen with subtotal …
jsayago77 May 29, 2025
5bf31d4
Merge branch 'dev' into fix/active-orders
jsayago77 May 30, 2025
973998e
Calculate discount based on price and quantity in OrderDetailScreen
jsayago77 May 30, 2025
3b22ce9
Merge branch 'dev' into fix/active-orders
jsayago77 May 30, 2025
d6a1566
Update OrderDetailScreen to display full product details and correct …
jsayago77 May 30, 2025
d716735
Height styles
IglesiasMiguel May 30, 2025
63648cd
Merge branch 'fix/active-orders' of https://github.com/PharmaTechVe/a…
IglesiasMiguel May 30, 2025
ed1b775
Fix translation for 'ready_for_pickup' status and enhance OrderTracki…
jsayago77 May 30, 2025
9f602c2
Merge branch 'fix/active-orders' of https://github.com/PharmaTechVe/a…
jsayago77 May 30, 2025
57ed903
Showing delivery map to client
IglesiasMiguel May 30, 2025
6f2bc67
Adding more cent prices and eliminating stars rating
IglesiasMiguel May 30, 2025
8cbdb10
Using icons for delivery maps
IglesiasMiguel May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 47 additions & 20 deletions src/components/DeliveryMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import MapView, { Marker, Polyline } from 'react-native-maps';
import { StyleSheet, View, ActivityIndicator, ViewStyle } from 'react-native';
import { Config } from '../config';
import { Colors } from '../styles/theme';
import PoppinsText from '../components/PoppinsText';
import { MapPinIcon, UserIcon } from 'react-native-heroicons/solid';
import { FontAwesome5 } from '@expo/vector-icons';

interface DeliveryMapProps {
deliveryState: number;
Expand All @@ -25,7 +28,7 @@ const DeliveryMap: React.FC<DeliveryMapProps> = ({
const [customerRouteCoordinates, setCustomerRouteCoordinates] = useState<
{ latitude: number; longitude: number }[]
>([]);
const [isLoading, setIsLoading] = useState(true); // Estado de carga
const [, setIsLoading] = useState(true); // Estado de carga

// Obtener la ruta desde Google Maps Directions API
const fetchRoute = async (
Expand Down Expand Up @@ -144,52 +147,52 @@ const DeliveryMap: React.FC<DeliveryMapProps> = ({
return points;
};

if (isLoading) {
// Mostrar un indicador de carga mientras se obtienen los datos
if (
// Solo espera si faltan datos críticos
branchLocation.latitude === 0 ||
branchLocation.longitude === 0 ||
customerLocation.latitude === 0 ||
customerLocation.longitude === 0
) {
return (
<View style={[styles.loadingContainer, style]}>
<ActivityIndicator size="large" color={Colors.primary} />
</View>
);
}

// Mostrar el mapa aunque deliveryLocation sea null
return (
<View style={[styles.container, style]}>
<MapView
style={StyleSheet.absoluteFillObject} // Asegura que el mapa ocupe todo el contenedor
style={StyleSheet.absoluteFillObject}
initialRegion={{
latitude: branchLocation.latitude || 0,
longitude: branchLocation.longitude || 0,
latitudeDelta: 0.05,
longitudeDelta: 0.05,
}}
>
{/* Mostrar la ubicación del delivery */}
{/* Mostrar la ubicación del delivery si existe */}
{deliveryLocation && (
<Marker
coordinate={deliveryLocation}
title="Tu ubicación"
pinColor="red"
/>
<Marker coordinate={deliveryLocation} title="Repartidor">
<FontAwesome5 name="motorcycle" size={26} color={Colors.primary} />
</Marker>
)}

{/* Mostrar la ubicación de la sucursal */}
{branchLocation.latitude !== 0 && branchLocation.longitude !== 0 && (
<Marker
coordinate={branchLocation}
title="Sucursal de origen"
pinColor="blue"
/>
<Marker coordinate={branchLocation} title="Sucursal de origen">
<MapPinIcon size={32} color={Colors.primary} />
</Marker>
)}

{/* Mostrar la ubicación del cliente */}
{customerLocation.latitude !== 0 &&
customerLocation.longitude !== 0 && (
<Marker
coordinate={customerLocation}
title="Ubicación del cliente"
pinColor="green"
/>
<Marker coordinate={customerLocation} title="Ubicación del cliente">
<UserIcon size={32} color={Colors.primary} />
</Marker>
)}

{/* Mostrar la ruta hacia la sucursal */}
Expand All @@ -210,6 +213,30 @@ const DeliveryMap: React.FC<DeliveryMapProps> = ({
/>
)}
</MapView>
{!deliveryLocation && (
<View
style={{
position: 'absolute',
bottom: 32,
left: 16,
right: 16,
alignItems: 'center',
backgroundColor: Colors.textWhite,
borderRadius: 16,
paddingVertical: 12,
paddingHorizontal: 20,
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.15,
shadowRadius: 6,
elevation: 4,
}}
>
<PoppinsText style={{ color: Colors.primary }}>
Esperando ubicación del repartidor...
</PoppinsText>
</View>
)}
</View>
);
};
Expand Down
28 changes: 13 additions & 15 deletions src/components/HistoryMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import React, { useEffect, useState } from 'react';
import MapView, { Marker, Polyline } from 'react-native-maps';
import { StyleSheet, View, Alert, ViewStyle } from 'react-native';
import { Config } from '../config';
import { Colors } from '../styles/theme';

import { MapPinIcon, UserIcon } from 'react-native-heroicons/solid';
import { FontAwesome5 } from '@expo/vector-icons';

interface HistoryMapProps {
deliveryLocation: { latitude: number; longitude: number };
Expand Down Expand Up @@ -131,25 +135,19 @@ const HistoryMap: React.FC<HistoryMapProps> = ({
}}
>
{/* Mostrar la ubicación del delivery */}
<Marker
coordinate={deliveryLocation}
title="Ubicación inicial del delivery"
pinColor="red"
/>
<Marker coordinate={deliveryLocation} title="Repartidor">
<FontAwesome5 name="motorcycle" size={26} color={Colors.primary} />
</Marker>

{/* Mostrar la ubicación de la sucursal */}
<Marker
coordinate={branchLocation}
title="Sucursal de origen"
pinColor="blue"
/>
<Marker coordinate={branchLocation} title="Sucursal de origen">
<MapPinIcon size={32} color={Colors.primary} />
</Marker>

{/* Mostrar la ubicación del cliente */}
<Marker
coordinate={customerLocation}
title="Ubicación del cliente"
pinColor="green"
/>
<Marker coordinate={customerLocation} title="Ubicación del cliente">
<UserIcon size={32} color={Colors.primary} />
</Marker>

{/* Mostrar la ruta hacia la sucursal */}
{routeToBranch.length > 0 && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrderBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const STATUS_COLORS: Record<string, string> = {

const STATUS_LABELS: Record<string, string> = {
requested: 'Pendiente',
ready_for_pickup: 'A Enviar',
ready_for_pickup: 'A Retirar',
completed: 'Entregado',
canceled: 'Cancelado',
in_progress: 'En Proceso',
Expand Down
134 changes: 134 additions & 0 deletions src/components/VerticalStepper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { Colors, FontSizes } from '../styles/theme';
import PoppinsText from './PoppinsText';

interface VerticalStepperProps {
steps: {
title: string;
description: string;
}[];
currentStep: number;
}

const VerticalStepper: React.FC<VerticalStepperProps> = ({
steps,
currentStep,
}) => {
return (
<View style={styles.container}>
{steps.map((step, index) => {
const isCompleted = index < currentStep - 1;
const isActive = index === currentStep - 1;

return (
<View key={index} style={styles.stepContainer}>
<View style={styles.stepIndicatorContainer}>
{/* Línea superior (excepto para el primer paso) */}
{index > 0 && (
<View
style={[
styles.connector,
isCompleted || isActive
? styles.completedConnector
: styles.pendingConnector,
]}
/>
)}

{/* Círculo del paso */}
<View
style={[
styles.stepIndicator,
isCompleted && styles.completedStep,
isActive && styles.activeStep,
]}
></View>

{/* Línea inferior (excepto para el último paso) */}
{index < steps.length - 1 && (
<View
style={[
styles.connector,
isCompleted
? styles.completedConnector
: styles.pendingConnector,
{ top: 0, bottom: 0 },
]}
/>
)}
</View>
<View style={styles.stepContent}>
<PoppinsText
style={[
isActive && styles.activeStepTitle,
isCompleted && styles.activeStepTitle,
]}
>
{step.title}
</PoppinsText>
{step.description && (
<PoppinsText style={styles.stepDescription}>
{step.description}
</PoppinsText>
)}
</View>
</View>
);
})}
</View>
);
};

const styles = StyleSheet.create({
container: {
padding: 0,
},
stepContainer: {
flexDirection: 'row',
},
stepIndicatorContainer: {
width: 24,
alignItems: 'center',
marginRight: 8,
},
stepIndicator: {
width: 13,
height: 13,
borderRadius: 12,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: Colors.gray_500,
zIndex: 1,
},
completedStep: {
backgroundColor: Colors.semanticSuccess,
borderColor: Colors.semanticSuccess,
},
activeStep: {
backgroundColor: Colors.semanticSuccess,
},
connector: {
position: 'absolute',
width: 2,
},
completedConnector: {
backgroundColor: Colors.semanticSuccess,
},
pendingConnector: {
backgroundColor: Colors.gray_100,
},
stepContent: {
flex: 1,
marginBottom: 13,
},
activeStepTitle: {
color: Colors.semanticSuccess,
},
stepDescription: {
color: Colors.secondaryGray,
fontSize: FontSizes.c3.size,
},
});

export default VerticalStepper;
1 change: 0 additions & 1 deletion src/lib/socketUrl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const devModeFlag = process.env.PHARMATECH_DEV_MODE === 'true';

const devUrl = 'https://api-dev-8jfx.onrender.com';
const prodUrl = 'https://api-d8h5.onrender.com';

Expand Down
Loading
Loading