TP-34976 | Contract changes

This commit is contained in:
Aman Chaturvedi
2023-08-23 15:57:29 +05:30
parent 547ddd51f5
commit 101b9db39c
11 changed files with 32 additions and 89 deletions

View File

@@ -128,7 +128,6 @@ const AnswerRender: React.FC<IAnswerRender> = (props) => {
return (
<GeolocationAddressAnswer caseId={caseId} addressId={answer?.answer} metadata={metaData} />
);
return <DarkBoldText text={getAddressFromId(answer.answer)} />;
case AnswerType.phoneNumber:
return <DarkBoldText text={getPhoneNumberStringFromNumber(answer.answer)} />;
case AnswerType.date:

View File

@@ -32,66 +32,6 @@ export const VisitTypeSelection = {
ADDRESS_SELECTION: 'ADDRESS_SELECTION',
};
// TODO: Remove this mock data
export const MOCK_GEOLOCATIONS = [
{
latitude: 12.9716,
longitude: 77.5946,
type: '',
primarySource: GeolocationSource.DATA_SUTRAM,
secondarySource: '',
customer_id: '',
tag: 'GL_1',
capturedTimestamp: '',
createdAt: '2023-07-24T18:25:11.197371',
updatedAt: '',
metadata: '',
referenceId: 'GL_1',
},
{
latitude: 12.9716,
longitude: 77.5946,
type: '',
primarySource: GeolocationSource.DATA_SUTRAM,
secondarySource: '',
customer_id: '',
tag: 'GL_2',
capturedTimestamp: '',
createdAt: '2023-07-24T18:25:11.197371',
updatedAt: '',
metadata: '',
referenceId: 'GL_2',
},
{
latitude: 12.9716,
longitude: 77.5946,
type: '',
primarySource: GeolocationSource.DATA_SUTRAM,
secondarySource: '',
customer_id: '',
tag: 'GL_3',
capturedTimestamp: '',
createdAt: '2023-07-24T18:25:11.197371',
updatedAt: '',
metadata: '',
referenceId: 'GL_3',
},
{
latitude: 12.9716,
longitude: 77.5946,
type: '',
primarySource: GeolocationSource.DATA_SUTRAM,
secondarySource: '',
customer_id: '',
tag: 'GL_4',
capturedTimestamp: '',
createdAt: '2023-07-24T18:25:11.197371',
updatedAt: '',
metadata: '',
referenceId: 'GL_4',
},
];
export const AddressSourceMap: Record<GeolocationSource, string> = {
DATA_SUTRAM: 'Data sutram',
COSMOS: 'Cosmos',
@@ -122,7 +62,7 @@ const AddressSelection: React.FC<IAddressSelection> = (props) => {
const addresses =
question?.tag === VisitTypeSelection.GEOLOCATION_SELECTION
? currentCase?.geolocations || (MOCK_GEOLOCATIONS as IGeolocation[]) //TODO: Remove this mock data
? currentCase?.geolocations
: currentCase?.addresses;
return (
@@ -150,7 +90,7 @@ const AddressSelection: React.FC<IAddressSelection> = (props) => {
: getAddressString(address as Address);
return (
<RNRadioButton
id={address.referenceId}
id={(address as IGeolocation).id}
value={addressLabel}
customOptionTemplate={
isGeolocation && <GeolocationAddress address={address as IGeolocation} />

View File

@@ -38,7 +38,7 @@ const GeolocationAddress: React.FC<IGeolocationAddress> = ({
loanAccountNumber,
handlePageRouting,
}) => {
const { latitude, longitude, createdAt, primarySource, tag, referenceId } = address;
const { latitude, longitude, createdAt, primarySource, tag, id } = address;
const { deviceGeolocationCoordinate, prefilledAddressScreenTemplate } = useAppSelector(
(state) => ({
deviceGeolocationCoordinate: state.foregroundService?.deviceGeolocationCoordinate,
@@ -71,7 +71,7 @@ const GeolocationAddress: React.FC<IGeolocationAddress> = ({
const { visitedWidgets, widgetContext } = getCollectionFeedbackOnAddressPreDefinedJourney(
prefilledAddressScreenTemplate,
addressKey,
referenceId,
id,
true
);
@@ -107,7 +107,7 @@ const GeolocationAddress: React.FC<IGeolocationAddress> = ({
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_GEOLOCATION_OLD_FEEDBACK_CLICKED);
handlePageRouting?.(PageRouteEnum.GEOLOCATION_OLD_FEEDBACKS, {
geolocation: address,
addressReferenceIds: [address?.referenceId],
addressReferenceIds: [address?.id],
loanAccountNumber,
});
};

View File

@@ -1,12 +1,9 @@
import { StyleSheet } from 'react-native';
import React from 'react';
import { getAddressString, memoize } from '../../utlis/commonFunctions';
import { useAppSelector } from '../../../hooks';
import { MOCK_GEOLOCATIONS, VisitTypeSelection } from './AddressSelection';
import { VisitTypeSelection } from './AddressSelection';
import GeolocationAddress from './GeolocationAddress';
import Text from '../../../../RN-UI-LIB/src/components/Text';
import { IGeolocation } from '../../../screens/caseDetails/interface';
import { COLORS } from '../../../../RN-UI-LIB/src/styles/colors';
interface IGeolocationAddressAnswer {
caseId: string;
@@ -27,12 +24,12 @@ const GeolocationAddressAnswer: React.FC<IGeolocationAddressAnswer> = ({
});
if (isGeolocation) {
const index = (currentCase?.geolocations || (MOCK_GEOLOCATIONS as IGeolocation[]))?.findIndex(
(a) => a.referenceId === addressId
);
if (index !== -1) {
const address = (currentCase?.geolocations || (MOCK_GEOLOCATIONS as IGeolocation[]))[index];
return <GeolocationAddress address={address} showOpenMap />;
if (currentCase?.geolocations) {
const index = currentCase?.geolocations?.findIndex((a) => a.id === addressId);
if (index !== -1) {
const address = currentCase?.geolocations?.[index];
return <GeolocationAddress address={address} showOpenMap />;
}
}
return (
<Text dark bold>

View File

@@ -13,7 +13,12 @@ import {
caseVerdict,
ICaseItem,
} from '../screens/allCases/interface';
import { CaseDetail, CONTEXT_TASK_STATUSES, DOCUMENT_TYPE } from '../screens/caseDetails/interface';
import {
CaseDetail,
CONTEXT_TASK_STATUSES,
DOCUMENT_TYPE,
IGeolocation,
} from '../screens/caseDetails/interface';
import { addClickstreamEvent } from '../services/clickstreamEventService';
import { getLoanAccountNumber } from '../components/utlis/commonFunctions';
import { getVisitedWidgetsNodeList } from '../components/form/services/forms.service';
@@ -42,6 +47,7 @@ interface IAllCasesSlice {
completedList: ICaseItem[];
pinnedList: ICaseItem[];
newVisitedCases: string[];
geolocations?: IGeolocation[];
}
const initialState: IAllCasesSlice = {

View File

@@ -26,7 +26,7 @@ const initialState = {
allCases: [],
templateData: {
[CaseAllocationType.ADDRESS_VERIFICATION_CASE]: {} as FormTemplateV1,
[CaseAllocationType.COLLECTION_CASE]: mockTemplate as FormTemplateV1, //TODO: remove this mock
[CaseAllocationType.COLLECTION_CASE]: {} as FormTemplateV1,
},
showAlternateText: '',
} as ICaseReducer;
@@ -96,7 +96,7 @@ export const caseSlice = createSlice({
state.templateData[CaseAllocationType.ADDRESS_VERIFICATION_CASE] = action.payload;
},
updateCollectionTemplateData: (state, action: PayloadAction<FormTemplateV1>) => {
state.templateData[CaseAllocationType.COLLECTION_CASE] = mockTemplate; //TODO: remove mock and action.payload;
state.templateData[CaseAllocationType.COLLECTION_CASE] = action.payload;
},
updateAlternateHeader: (state, action) => {
state.showAlternateText = action.payload;

View File

@@ -8,6 +8,7 @@ import GeolocationAddress from '../../components/form/components/GeolocationAddr
import CustomLocationSmallIcon from '../../assets/icons/CustomLocationSmallIcon';
import { IGeolocation } from '../caseDetails/interface';
import { GenericFunctionArgs } from '../../common/GenericTypes';
import { IGeoLocation } from '../../types/addressGeolocation.types';
interface IGeolocationContainer {
caseId: string;
@@ -40,7 +41,7 @@ const GeolocationContainer: React.FC<IGeolocationContainer> = ({
return (
<View style={[GenericStyles.whiteBackground, GenericStyles.ph16]}>
{geolocationList.map((geolocation: IGeolocation) => (
<View style={[GenericStyles.row, styles.geolocationItem]} key={geolocation.referenceId}>
<View style={[GenericStyles.row, styles.geolocationItem]} key={geolocation.id}>
<View style={styles.geolocationIcon}>
<CustomLocationSmallIcon />
</View>

View File

@@ -23,7 +23,6 @@ import SuspenseLoader from '../../../RN-UI-LIB/src/components/suspense_loader/Su
import LineLoader from '../../../RN-UI-LIB/src/components/suspense_loader/LineLoader';
import { CaptureGeolocation } from '../../components/form/services/geoLocation.service';
import { setDeviceGeolocation } from '../../reducer/foregroundServiceSlice';
import { MOCK_GEOLOCATIONS } from '../../components/form/components/AddressSelection';
const PAGE_TITLE = 'All addresses';
@@ -159,7 +158,7 @@ const AddressGeolocation: React.FC<IAddressGeolocation> = ({ route: routeParams
</View>
<Text style={[styles.textContainer, GenericStyles.p16]}>User geolocations</Text>
<GeolocationContainer
geolocationList={MOCK_GEOLOCATIONS} //TODO: remove mock and add addressGeolocation.geoLocations
geolocationList={addressGeolocation.geoLocations}
caseId={caseId}
handlePageRouting={handleRouting}
loanAccountNumber={loanAccountNumber}

View File

@@ -99,10 +99,9 @@ const ProtectedRouter = () => {
(state: RootState) => state.case.templateData[CaseAllocationType.ADDRESS_VERIFICATION_CASE]
);
//TODO: Remove this mockTemplate
const collectionTemplate = mockTemplate; //useSelector(
// (state: RootState) => state.case.templateData[CaseAllocationType.COLLECTION_CASE]
// );
const collectionTemplate = useSelector(
(state: RootState) => state.case.templateData[CaseAllocationType.COLLECTION_CASE]
);
// This checks for unsubmitted feedbacks in case of offline and retry submitting them
interactionsHandler();

View File

@@ -186,7 +186,7 @@ export interface IGeolocation {
createdAt: string;
updatedAt: string;
metadata: string;
referenceId: string;
id: string;
visitType: VisitType;
}
@@ -239,7 +239,7 @@ export interface CaseDetail {
feedbackStatus?: FeedbackStatus;
attemptedAt?: number;
forceSubmit?: boolean;
geolocations: IGeolocation[];
geolocations?: IGeolocation[];
}
export interface AddressesGeolocationPayload {

View File

@@ -1,3 +1,5 @@
import { IGeolocation } from '../screens/caseDetails/interface';
export interface IGeolocationCoordinate {
latitude: number;
longitude: number;
@@ -49,7 +51,7 @@ export interface IGroupedAddressesItem {
export interface IGroupedGeolocationAddressItem {
groupedAddresses: IGroupedAddressesItem[];
geoLocations: IGeoLocation[];
geoLocations: IGeolocation[];
}
export interface IAddressGeolocationPayload {