diff --git a/src/features/Core/screens/ChatsScreen.js b/src/features/Core/screens/ChatsScreen.js
index 764ef310..67a1e032 100644
--- a/src/features/Core/screens/ChatsScreen.js
+++ b/src/features/Core/screens/ChatsScreen.js
@@ -16,6 +16,7 @@ const ChatsScreen = () => {
const isMounted = useMountedState();
const fleetbase = useFleetbase();
const [channels, setChannels] = useState([]);
+ const [isCreatingChat, setIsCreatingChat] = useState(false);
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
@@ -91,25 +92,20 @@ const ChatsScreen = () => {
);
- if (isLoading) {
- return (
-
-
-
- );
- }
return (
-
-
- navigation.navigate('ChannelScreen')}>
-
- {translate('Core.ChatsScreen.create-channel')}
-
-
+ <>
+
+
+ navigation.navigate('ChannelScreen')}>
+
+ {translate('Core.ChatsScreen.create-channel')}
+
+
+
-
-
+
+ >
);
};
diff --git a/src/features/Core/screens/IssueScreen.js b/src/features/Core/screens/IssueScreen.js
index dd6140ca..53c4ebd6 100644
--- a/src/features/Core/screens/IssueScreen.js
+++ b/src/features/Core/screens/IssueScreen.js
@@ -1,6 +1,6 @@
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
-import { IssuePriority, IssueType, Status } from 'constant/Enum';
+import { IssuePriority, IssueType, Status, IssueCategory } from 'constant/Enum';
import { useDriver, useFleetbase } from 'hooks';
import React, { useEffect, useState } from 'react';
import { ActivityIndicator, Alert, Keyboard, KeyboardAvoidingView, Pressable, Text, TextInput, TouchableOpacity, View } from 'react-native';
@@ -19,7 +19,7 @@ const IssueScreen = ({ navigation, route }) => {
const [driverId] = useState(driver.getAttribute('id'));
const [type, setType] = useState(issue.type);
- const [categories, setCategories] = useState([]);
+ const [categories, setCategories] = useState(getIssueCategories('VEHICLE'));
const [category, setCategory] = useState();
const [priority, setPriority] = useState();
const [status, setStatus] = useState();
@@ -130,7 +130,7 @@ const IssueScreen = ({ navigation, route }) => {
};
const validateInputs = () => {
- if (!type || !category || !priority || !status ||!report?.trim()) {
+ if (!type || !category || !priority || !status || !report?.trim()) {
setError('Please enter a required value.');
return false;
} else if (report.trim().length === 0) {
diff --git a/src/features/Core/screens/IssuesScreen.js b/src/features/Core/screens/IssuesScreen.js
index 4feecf45..a446e736 100644
--- a/src/features/Core/screens/IssuesScreen.js
+++ b/src/features/Core/screens/IssuesScreen.js
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { FlatList, RefreshControl, Text, TouchableOpacity, View, ActivityIndicator } from 'react-native';
import tailwind from 'tailwind';
import { useNavigation } from '@react-navigation/native';
+import { format } from 'date-fns';
import { useDriver, useFleetbase, useMountedState } from 'hooks';
import { getColorCode, translate } from 'utils';
@@ -12,17 +13,19 @@ const IssuesScreen = () => {
const fleetbase = useFleetbase();
const [issues, setIssueList] = useState([]);
const [isRefreshing, setIsRefreshing] = useState(false);
- const [isLoading, setIsLoading] = useState(true);
+ const [isCreatingIssue, setIsCreatingIssue] = useState(false);
+ const [isLoading, setIsLoading] = useState(true);
const fetchIssues = async () => {
- setIsLoading(true);
+ setIsLoading(true);
try {
const adapter = fleetbase.getAdapter();
const response = await adapter.get('issues');
- setIssueList(response);
+ const sortedIssues = response.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
+ setIssueList(sortedIssues);
} catch (error) {
console.error('Error fetching issue:', error);
- setIssueList([]);
+ setIssueList([]);
} finally {
setIsLoading(false);
}
@@ -55,6 +58,12 @@ const IssuesScreen = () => {
+
+
+ {translate('Core.IssueScreen.createdAt')}:
+
+ {format(new Date(item.created_at), 'MM/dd/yyyy HH:mm')}
+
{translate('Core.IssueScreen.driverName')}:
@@ -75,14 +84,6 @@ const IssuesScreen = () => {
);
- if (isLoading) {
- return (
-
-
-
- );
- }
-
return (
@@ -91,25 +92,28 @@ const IssuesScreen = () => {
- }
- data={issues}
- keyExtractor={item => item.id}
- renderItem={renderItem}
- />
-
-
- {
- navigation.navigate('IssueScreen');
- }}>
-
- {translate('Core.IssueScreen.createIssue')}
-
-
+ <>
+ }
+ data={issues}
+ keyExtractor={item => item.id}
+ renderItem={renderItem}
+ />
+
+
+ {
+ setIsCreatingIssue(true);
+ navigation.navigate('IssueScreen');
+ }}>
+
+ {translate('Core.IssueScreen.createIssue')}
+
+
+
-
+ >
);
};
diff --git a/translations/en.json b/translations/en.json
index 37c635be..a842230e 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -73,7 +73,8 @@
"updateIssue": "Update Issue",
"report": "Report",
"driverName": "Driver Name",
- "vehicleName": "Vehicle Name"
+ "vehicleName": "Vehicle Name",
+ "createdAt": "Created Date"
},
"ChannelScreen": {
"name": "Name",