Skip to content

Commit 9426270

Browse files
Drawer updated
1 parent bd0654a commit 9426270

15 files changed

+364
-252
lines changed

config/const.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ export const updateOrderStatus = 'order/';
2727
export const confirmOffer = 'order/confirmOffer/';
2828
export const getAllOrders = 'order';
2929
export const getAllComplains = 'complain';
30+
export const blockSeller = 'user/block/';

navigation/AdminStack.js

+34-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Tab = createBottomTabNavigator();
2121

2222
const AdminStack = (myProps) => {
2323
return (
24-
<Drawer.Navigator drawerContent={(props) => <Text>Drawer Content</Text>}>
24+
<Drawer.Navigator drawerContent={(props) => <DrawerContent {...props} />}>
2525
<Drawer.Screen name="Welcome to the App" component={MainBottomTabStack} />
2626
{/* <Drawer.Screen name="Notifications" component={NotificationsScreen} /> */}
2727
</Drawer.Navigator>
@@ -31,11 +31,29 @@ const AdminStack = (myProps) => {
3131
const MainBottomTabStack = () => {
3232
return (
3333
<Tab.Navigator
34-
initialRouteName="Home"
35-
activeColor="black"
36-
inactiveColor="#3e2465"
37-
labeled={false}
38-
barStyle={{backgroundColor: 'white', height: 50}}>
34+
// initialRouteName="Home"
35+
// activeColor="black"
36+
// inactiveColor="#3e2465"
37+
tabBarOptions={{
38+
showLabel: false,
39+
40+
style: {
41+
position: 'absolute',
42+
elevation: 0,
43+
border: 4,
44+
height: 55,
45+
// backgroundColor: '#FFFFFF',
46+
47+
// borderColor: '#000000',
48+
borderTopLeftRadius: 25,
49+
borderTopRightRadius: 25,
50+
51+
// backgroundColor: 'red',
52+
...styles.shadow,
53+
},
54+
}}
55+
// barStyle={{backgroundColor: 'white', height: 50}}
56+
>
3957
<Tab.Screen
4058
name="HomeScreen"
4159
options={{
@@ -154,6 +172,16 @@ const styles = StyleSheet.create({
154172
justifyContent: 'center',
155173
alignItems: 'center',
156174
},
175+
shadow: {
176+
shadowColor: '#7F5Df0',
177+
shadowOffset: {
178+
width: 0,
179+
height: 10,
180+
},
181+
shadowOpacity: 0.25,
182+
shadowRadius: 3.5,
183+
elevation: 5,
184+
},
157185
});
158186

159187
export default AdminStack;

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@react-navigation/bottom-tabs": "^5.11.8",
1616
"@react-navigation/drawer": "^5.12.4",
1717
"@react-navigation/material-bottom-tabs": "^5.3.14",
18+
"@react-navigation/material-top-tabs": "^5.3.15",
1819
"@react-navigation/native": "^5.9.3",
1920
"@react-navigation/stack": "^5.14.3",
2021
"axios": "^0.21.1",
@@ -29,10 +30,12 @@
2930
"react-native-multiple-select": "^0.5.6",
3031
"react-native-paper": "^4.7.2",
3132
"react-native-picker-select": "^8.0.4",
33+
"react-native-pull-to-refresh": "^2.1.3",
3234
"react-native-ratings": "^8.0.3",
3335
"react-native-reanimated": "^2.0.1",
3436
"react-native-safe-area-context": "^3.2.0",
3537
"react-native-screens": "^2.18.1",
38+
"react-native-tab-view": "^2.16.0",
3639
"react-native-vector-icons": "^8.1.0",
3740
"react-redux": "^7.2.3",
3841
"react-redux-form": "^1.16.14",
@@ -42,9 +45,7 @@
4245
"redux-thunk": "^2.3.0",
4346
"sharingan-rn-modal-dropdown": "^1.3.0",
4447
"yarn": "^1.22.10",
45-
"yup": "^0.32.9",
46-
"@react-navigation/material-top-tabs": "^5.3.15",
47-
"react-native-tab-view": "^2.16.0"
48+
"yup": "^0.32.9"
4849
},
4950
"devDependencies": {
5051
"@babel/core": "^7.12.17",

screens/admin/BookingCard.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ export default function bookingCard(props) {
139139
}
140140
};
141141

142-
useEffect(() => {
143-
allOrders();
144-
}, []);
142+
// useEffect(() => {
143+
// allOrders();
144+
// }, []);
145145

146146
return (
147147
<SafeAreaView style={styles.container}>
148148
<FlatList
149-
data={pendingBookings}
149+
data={props.bookings}
150150
renderItem={renderItem}
151151
keyExtractor={(item) => item._id}
152152
/>

screens/admin/Complain.js

+110-64
Original file line numberDiff line numberDiff line change
@@ -6,87 +6,133 @@ import {
66
SafeAreaView,
77
FlatList,
88
TouchableOpacity,
9+
Alert,
910
} from 'react-native';
1011
import moment from 'moment';
1112
import Icon from 'react-native-vector-icons/FontAwesome5';
1213
import Entypo from 'react-native-vector-icons/Entypo';
1314
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
14-
import {URL, getAllComplains} from '../../config/const';
15+
import {URL, getAllComplains, blockSeller} from '../../config/const';
1516
import axios from 'axios';
1617
import {connect} from 'react-redux';
1718

18-
const Item = ({item}) => (
19-
<View style={styles.complains}>
20-
<View style={styles.details}>
21-
<Text style={{fontSize: 16, fontWeight: '700'}}>
22-
Complain No:{' '}
23-
{item._id.substring(item._id.length - 10, item._id.length - 3)}
24-
</Text>
25-
</View>
26-
<View style={styles.BuyerDetails}>
27-
<View style={styles.userdetails}>
28-
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
29-
<Icon
30-
name="user-alt"
31-
color="black"
32-
size={20}
33-
style={{marginRight: 10}}
34-
/>
35-
<Text style={{fontSize: 18, color: '#000', fontWeight: '400'}}>
36-
{item.buyer.name}
37-
</Text>
38-
</View>
19+
const ComplainScreen = (props) => {
20+
const renderItem = ({item}) => <Item item={item} />;
3921

40-
<TouchableOpacity style={styles.update}>
41-
<Text
42-
style={{
43-
color: '#fff',
44-
}}>
45-
Block Seller
46-
</Text>
47-
</TouchableOpacity>
22+
const Item = ({item}) => (
23+
<View style={styles.complains}>
24+
<View style={styles.details}>
25+
<Text style={{fontSize: 16, fontWeight: '700'}}>
26+
Complain No:{' '}
27+
{item._id.substring(item._id.length - 10, item._id.length - 3)}
28+
</Text>
4829
</View>
49-
</View>
50-
<View style={styles.sellerDetails}>
51-
<View style={styles.userdetails}>
52-
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
53-
<Entypo
54-
name="smashing"
55-
color="black"
56-
size={20}
57-
style={{marginRight: 10}}
58-
/>
59-
<Text style={{fontSize: 18, fontWeight: '400', color: 'black'}}>
60-
{item.seller.name}
61-
</Text>
30+
<View style={styles.BuyerDetails}>
31+
<View style={styles.userdetails}>
32+
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
33+
<Icon
34+
name="user-alt"
35+
color="black"
36+
size={20}
37+
style={{marginRight: 10}}
38+
/>
39+
<Text style={{fontSize: 18, color: '#000', fontWeight: '400'}}>
40+
{item.buyer.name}
41+
</Text>
42+
</View>
43+
44+
<TouchableOpacity
45+
style={styles.update}
46+
onPress={() => onPressBlockSeller(item.seller._id)}>
47+
<Text
48+
style={{
49+
color: '#fff',
50+
}}>
51+
Block Seller
52+
</Text>
53+
</TouchableOpacity>
6254
</View>
55+
</View>
56+
<View style={styles.sellerDetails}>
57+
<View style={styles.userdetails}>
58+
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
59+
<Entypo
60+
name="smashing"
61+
color="black"
62+
size={20}
63+
style={{marginRight: 10}}
64+
/>
65+
<Text style={{fontSize: 18, fontWeight: '400', color: 'black'}}>
66+
{item.seller.name}
67+
</Text>
68+
</View>
6369

64-
<View style={styles.update1}>
65-
<MaterialCommunityIcons
66-
name="message-text-outline"
67-
size={20}
68-
color="white"
69-
/>
70+
<View style={styles.update1}>
71+
<MaterialCommunityIcons
72+
name="message-text-outline"
73+
size={20}
74+
color="white"
75+
/>
76+
</View>
7077
</View>
7178
</View>
79+
<View style={styles.descriptionRow}>
80+
<Text style={{fontWeight: '700'}}>Description : </Text>
81+
<Text
82+
style={{
83+
flexWrap: 'wrap',
84+
flex: 1,
85+
}}>
86+
{item.description}
87+
</Text>
88+
</View>
7289
</View>
73-
<View style={styles.descriptionRow}>
74-
<Text style={{fontWeight: '700'}}>Description : </Text>
75-
<Text
76-
style={{
77-
flexWrap: 'wrap',
78-
flex: 1,
79-
}}>
80-
{item.description}
81-
</Text>
82-
</View>
83-
</View>
84-
);
85-
const ComplainScreen = (props) => {
86-
const renderItem = ({item}) => <Item item={item} />;
90+
);
8791

8892
const [complains, setComplains] = useState([]);
8993

94+
const onPressBlockSeller = async (id) => {
95+
console.log('in block seller', props.token, id);
96+
try {
97+
let response = await axios.put(
98+
`${URL}${blockSeller}${id}`,
99+
{},
100+
{
101+
headers: {
102+
Authorization: `Bearer ${props.token}`,
103+
},
104+
},
105+
);
106+
console.log('in blockseller', response.data.result);
107+
Alert.alert(
108+
'Seller Blocked',
109+
'This seller has been blocked.',
110+
[
111+
// {
112+
// text: 'Cancel',
113+
// onPress: () => console.log('Cancel Pressed'),
114+
// style: 'cancel',
115+
// },
116+
{
117+
text: 'Continue',
118+
onPress: () => allComplains(),
119+
color: 'green',
120+
},
121+
],
122+
{
123+
cancelable: true,
124+
},
125+
);
126+
return response.data.result;
127+
} catch (error) {
128+
console.log('error', error.message);
129+
if (error?.response?.data?.result) {
130+
console.log('error', error.response.data);
131+
return {error: error.response.data.result};
132+
}
133+
}
134+
};
135+
90136
const allComplains = async () => {
91137
try {
92138
let response = await axios.get(`${URL}${getAllComplains}`, {
@@ -167,7 +213,7 @@ const styles = StyleSheet.create({
167213
marginBottom: 5,
168214
},
169215
update: {
170-
backgroundColor: '#43c58d',
216+
backgroundColor: 'red',
171217
shadowColor: '#000',
172218
shadowOffset: {
173219
width: 0,

0 commit comments

Comments
 (0)