TP-43439 | UAT Fixes
This commit is contained in:
@@ -73,16 +73,15 @@ function AddressItem({
|
||||
|
||||
let relativeDistanceBwLatLong = 0;
|
||||
|
||||
if (isGroupedAddress) {
|
||||
const addressGeolocationCoordinated: IGeolocationCoordinate = {
|
||||
latitude: addressItem.latitude,
|
||||
longitude: addressItem.longitude,
|
||||
};
|
||||
relativeDistanceBwLatLong = getDistanceFromLatLonInKm(
|
||||
currentGeolocationCoordinates,
|
||||
addressGeolocationCoordinated
|
||||
);
|
||||
}
|
||||
const addressGeolocationCoordinated: IGeolocationCoordinate = {
|
||||
latitude: addressItem.latitude,
|
||||
longitude: addressItem.longitude,
|
||||
};
|
||||
relativeDistanceBwLatLong = getDistanceFromLatLonInKm(
|
||||
currentGeolocationCoordinates,
|
||||
addressGeolocationCoordinated
|
||||
);
|
||||
|
||||
const handleAddFeedback = () => {
|
||||
if (prefilledAddressScreenTemplate != null) {
|
||||
const addressKey = '{{addressReferenceId}}';
|
||||
@@ -138,22 +137,22 @@ function AddressItem({
|
||||
<View
|
||||
style={[styles.container, GenericStyles.columnDirection, containerStyle, , { flex: 1 }]}
|
||||
>
|
||||
<View style={[styles.container, GenericStyles.row, { alignItems: 'center' }]}>
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
ellipsizeMode="tail"
|
||||
style={[styles.textContainer, styles.cardBoldTitle, { fontWeight: 'bold' }]}
|
||||
>
|
||||
{sanitizeString([addressItem?.pinCode, addressItem?.city].filter(Boolean).join(', '))}
|
||||
</Text>
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={[GenericStyles.ml4]}>
|
||||
{showRelativeDistance && relativeDistanceBwLatLong ? (
|
||||
<>({relativeDistanceFormatter(relativeDistanceBwLatLong)} km away)</>
|
||||
) : (
|
||||
'--'
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
{addressItem?.pinCode || addressItem?.city || relativeDistanceBwLatLong ? (
|
||||
<View style={[styles.container, GenericStyles.row, { alignItems: 'center' }]}>
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
ellipsizeMode="tail"
|
||||
style={[styles.textContainer, styles.cardBoldTitle, { fontWeight: 'bold' }]}
|
||||
>
|
||||
{sanitizeString([addressItem?.pinCode, addressItem?.city].filter(Boolean).join(', '))}
|
||||
</Text>
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={[GenericStyles.ml4]}>
|
||||
{showRelativeDistance && relativeDistanceBwLatLong ? (
|
||||
<>({relativeDistanceFormatter(relativeDistanceBwLatLong)} km away)</>
|
||||
) : null}
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
{lastFeedbackForAddress?.feedbackPresent ? (
|
||||
<View style={[styles.container, { marginVertical: 8 }]}>
|
||||
<View>
|
||||
|
||||
@@ -29,6 +29,7 @@ import { type GenericFunctionArgs } from '../../common/GenericTypes';
|
||||
import { toast } from '../../../RN-UI-LIB/src/components/toast';
|
||||
import { ToastMessages } from '../allCases/constants';
|
||||
import AddressSource from './AddressSource';
|
||||
import relativeDistanceFormatter from './utils/relativeDistanceFormatter';
|
||||
|
||||
interface IAddressItem {
|
||||
addressItem: IAddress;
|
||||
@@ -167,8 +168,10 @@ function SimilarAddressItem({
|
||||
{showRelativeDistance && relativeDistanceBwLatLong ? (
|
||||
<>
|
||||
<Text style={GenericStyles.tiny}> ● </Text>
|
||||
{!isNaN(relativeDistanceBwLatLong) ? relativeDistanceBwLatLong.toFixed(2) : '--'} km
|
||||
away
|
||||
{!isNaN(relativeDistanceBwLatLong)
|
||||
? relativeDistanceFormatter(relativeDistanceBwLatLong)
|
||||
: '--'}{' '}
|
||||
km away
|
||||
</>
|
||||
) : null}
|
||||
{showSource ? <AddressSource addressItem={addressItem} /> : null}
|
||||
|
||||
@@ -4,10 +4,10 @@ const relativeDistanceFormatter = (relativeDistance: number) => {
|
||||
return '--';
|
||||
}
|
||||
if (relativeDistance >= MAXIMUM_DISTANCE_WITH_DECIMAL) {
|
||||
return Math.round(relativeDistance, 0);
|
||||
return Math.round(relativeDistance);
|
||||
}
|
||||
|
||||
return relativeDistance.toFixed(2);
|
||||
return relativeDistance.toFixed(1);
|
||||
};
|
||||
|
||||
export default relativeDistanceFormatter;
|
||||
|
||||
@@ -33,6 +33,7 @@ import { toast } from '../../../RN-UI-LIB/src/components/toast';
|
||||
import { COMPLETED_STATUSES, ToastMessages } from './constants';
|
||||
import { VisitPlanStatus } from '../../reducer/userSlice';
|
||||
import { PaymentStatus } from '../caseDetails/interface';
|
||||
import relativeDistanceFormatter from '@screens/addressGeolocation/utils/relativeDistanceFormatter';
|
||||
|
||||
interface IListItem {
|
||||
caseListItemDetailObj: ICaseItemCaseDetailObj;
|
||||
@@ -225,7 +226,7 @@ const ListItem: React.FC<IListItem> = (props) => {
|
||||
{nearbyCaseView && distanceInKm && (
|
||||
<View style={[GenericStyles.absolute, styles.distanceContainer]}>
|
||||
<Text style={[GenericStyles.fontSize12, styles.distanceText]}>
|
||||
{distanceInKm?.toFixed(2)} km away
|
||||
{relativeDistanceFormatter(distanceInKm)} km away
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user