├── .gitignore
├── App.js
├── Components
├── Component
│ ├── BookingScreen
│ │ ├── ScheduleDateCoursele.js
│ │ ├── pendingBookingCoursele.js
│ │ └── seats.js
│ ├── HomeScreen
│ │ ├── HomeButtonComponent.js
│ │ └── HomeCarousel.js
│ └── InputComponent.js
├── Containers
│ ├── SimpleContainer.js
│ └── loginContainer.js
└── Modals
│ ├── CityModal.js
│ ├── ComplainModal.js
│ ├── TicketPurchasedRefundModal.js
│ ├── TicketPurchasingAccountModal.js
│ └── TicketPurchasingDoneModal.js
├── Context
├── FireBaseContext.js
└── LoginContext.js
├── Data
├── BusSchedule.json
├── Buses.json
├── Cities.json
├── Data.js
└── PersonDetail.json
├── Firebase Database.json
├── Functions.js
├── Navigations
└── Stacks
│ ├── HomeStack.js
│ └── LoginStack.js
├── README.md
├── Screen
├── Booking
│ ├── BookingBuses.js
│ ├── BookingDestination.js
│ ├── BookingPending.js
│ └── BookingSeats.js
├── Complain
│ └── Complain.js
├── Home
│ └── Home.js
├── Login
│ ├── Login.js
│ ├── LoginRegister.js
│ ├── LoginRegisterVerify.js
│ ├── LoginReset.js
│ └── LoginResetNew.js
├── Ticket
│ ├── TicketDetail.js
│ ├── TicketPurchased.js
│ └── TicketPurchasedRefund.js
└── wait.js
├── ScreenShot
├── book seat.PNG
├── home.PNG
├── login.PNG
└── select bus.PNG
├── Styles
└── global.js
├── anchor-coursel
├── carousel.js
└── index.js
├── app.json
├── assets
├── Images
│ ├── BusLogo.png
│ ├── BusLogo1.png
│ ├── BusTicketLogo.png
│ ├── Buses
│ │ ├── Image1.jpg
│ │ ├── Image2.jpg
│ │ └── Image3.jpg
│ ├── Calender.png
│ ├── HomeLogo
│ │ ├── cart.js
│ │ ├── complaint.js
│ │ ├── refund.js
│ │ ├── safety-seat.js
│ │ └── tickets.js
│ ├── Icons
│ │ ├── Arrival.js
│ │ ├── Date.js
│ │ ├── DropDown.js
│ │ ├── Left.js
│ │ ├── Right.js
│ │ ├── bin.js
│ │ ├── close.js
│ │ ├── password.js
│ │ ├── propfile.js
│ │ └── search.js
│ ├── background.jpg
│ ├── clock.png
│ ├── log.png
│ ├── log.svg
│ ├── profile.js
│ └── seats.js
└── fonts
│ ├── RussoOne-Regular.ttf
│ ├── Teko-Bold.ttf
│ ├── Teko-Light.ttf
│ ├── Teko-Medium.ttf
│ ├── Teko-Regular.ttf
│ └── Teko-SemiBold.ttf
├── babel.config.js
├── config.js
├── debug.log
├── package.json
├── react-native.config.js
├── yarn-error.log
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/**/*
2 | .expo/*
3 | npm-debug.*
4 | *.jks
5 | *.p8
6 | *.p12
7 | *.key
8 | *.mobileprovision
9 | *.orig.*
10 | web-build/
11 |
12 | # macOS
13 | .DS_Store
14 |
--------------------------------------------------------------------------------
/App.js:
--------------------------------------------------------------------------------
1 | // React Native Imports
2 | import React, { useState,useEffect } from 'react';
3 | import { Text,View,Button } from 'react-native';
4 | // Navigation Related import
5 | import { NavigationContainer } from '@react-navigation/native';
6 | import HomeStack from './Navigations/Stacks/HomeStack';
7 | import LoginStack from './Navigations/Stacks/LoginStack';
8 | // Context
9 | import LoginContextProvider from './Context/LoginContext';
10 | // Firebase
11 | import firebase from 'firebase';
12 | import {firebaseConfig} from './config';
13 |
14 |
15 | if (!firebase.apps.length) {
16 | firebase.initializeApp(firebaseConfig);
17 | }else {
18 | firebase.app(); // if already initialized, use that one
19 | }
20 |
21 | export default function App() {
22 |
23 | /*===== Firebase ================================================= */
24 | const rootReference=firebase.database().ref();
25 |
26 | /*===== Firebase ================================================= */
27 |
28 |
29 | /*===== Required Data ============================================= */
30 |
31 | /*===================================== Require Data Ends Here===== */
32 |
33 |
34 |
35 |
36 |
37 |
38 | /*===== State Data ================================================= */
39 | let [isSignedIn, setSignedIn] = useState(false);
40 | /*=========================================State Data Ends Here===== */
41 |
42 |
43 |
44 |
45 |
46 | /*===== Function Handlers ========================================== */
47 | let [Loginperson, setLoginPerson] = useState({});
48 | const LoginHandler = (person) => {
49 | if (person != "Logout") {
50 | setLoginPerson(person);
51 | setSignedIn(true);
52 | }
53 | else {
54 | setLoginPerson({});
55 | setSignedIn(false);
56 | }
57 | }
58 |
59 | return (
60 |
61 |
62 | {isSignedIn ? () : ()}
63 |
64 |
65 | );
66 | }
--------------------------------------------------------------------------------
/Components/Component/BookingScreen/ScheduleDateCoursele.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { View, StyleSheet, TouchableOpacity, Dimensions, Text } from 'react-native';
3 | // Component
4 | import Carousel from '../../../anchor-coursel/index';
5 | // Importing Styles
6 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox, primaryButton } from '../../../Styles/global';
7 | // Icons
8 | import LeftIcon from '../../../assets/Images/Icons/Left';
9 | import RightIcon from '../../../assets/Images/Icons/Right';
10 |
11 |
12 |
13 |
14 | // Global Data
15 | const { width } = Dimensions.get('window');
16 | var data = [];
17 |
18 |
19 |
20 |
21 |
22 | /*====== Slider Item goes here ================================================================================================== */
23 | /**
24 | *
25 | * {*Day,*Date} props
26 | */
27 | function Item(props) {
28 | return (
29 |
30 |
31 | {props.Day}
32 | {props.Date}
33 |
34 |
35 | );
36 | }
37 | /*===================================================================================================Slider Item goes here ===== */
38 |
39 |
40 |
41 |
42 | /**
43 | * {*Date,*DateHandler}
44 | */
45 | function ScheduleDate(props) {
46 |
47 | data=props.DateSchedule;
48 |
49 |
50 | var numberCarousel;
51 | var currentIndex;
52 | props.DateSchedule.map((item, index) => {
53 | if (item == props.Date) {
54 | currentIndex = index;
55 | }
56 | })
57 |
58 |
59 |
60 |
61 |
62 |
63 | /*================== Render Item ===============================*/
64 | var renderItem = ({ item, index }) => {
65 | return (
66 | pressHandler(index, item)}>
70 |
71 |
72 | );
73 | };
74 | /*================== Render Item ================================ */
75 |
76 |
77 |
78 |
79 |
80 | /*================== Bus Change Handler Item ===================== */
81 | var pressHandler = (index, item) => {
82 | if (index != currentIndex) // Means you want to see the nex detail
83 | {
84 | currentIndex = index;
85 | numberCarousel.scrollToIndex(currentIndex);
86 | }
87 | else if (index == currentIndex && props.Date != item) // Means you need to change the date
88 | {
89 | props.DateHandler(item);
90 | console.log("You have been gone to the bext date");
91 | }
92 | }
93 | var previousHandler = () => {
94 | if (currentIndex == 0) {
95 | currentIndex = data.length - 1;
96 | numberCarousel.scrollToIndex(currentIndex);
97 | }
98 | else {
99 | currentIndex--;
100 | numberCarousel.scrollToIndex(currentIndex);
101 | }
102 | }
103 |
104 | var NextHandler = () => {
105 | if (currentIndex == (data.length - 1)) {
106 | currentIndex = 0;
107 | numberCarousel.scrollToIndex(currentIndex);
108 | }
109 | else {
110 | currentIndex++;
111 | numberCarousel.scrollToIndex(currentIndex);
112 | }
113 | }
114 | /*================== Bus Change Handler Item ===================== */
115 |
116 |
117 |
118 |
119 |
120 |
121 | return (
122 |
123 | previousHandler()} activeOpacity={0.9}>
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | {
140 | if (c != null) {
141 | numberCarousel = c;
142 | c.scrollToIndex(currentIndex);
143 | }
144 | }}
145 | />
146 |
147 | NextHandler()} activeOpacity={0.9}>
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 | );
156 | }
157 | const styles = StyleSheet.create({
158 | carouselStyle: {
159 | }
160 | })
161 | export default ScheduleDate;
--------------------------------------------------------------------------------
/Components/Component/BookingScreen/pendingBookingCoursele.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {StyleSheet,Text,TouchableOpacity,Dimensions,View} from 'react-native';
3 | import Carousel from '../../../anchor-coursel/index';
4 | // Imporing Data
5 | // Importing Styles
6 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox, primaryButton } from '../../../Styles/global';
7 |
8 |
9 |
10 |
11 | // Global Data
12 | const { width } = Dimensions.get('window');
13 | var data = {};
14 |
15 |
16 |
17 |
18 |
19 |
20 | /**
21 | * props(Departure,Arrival,onPress,Date)
22 | */
23 | function PendingBookingContainer(props) {
24 | return (
25 |
26 | {/* Departure/Arrival */}
27 |
28 | {props.Departure}
29 | To
30 | {props.Arrival}
31 |
32 | {/* Book Now */}
33 |
34 | {props.Date}
35 | Buy Ticket
36 |
37 |
38 | );
39 | }
40 |
41 |
42 |
43 |
44 |
45 | /**
46 | * { PhoneNumber={person.PhoneNumber} navigation={navigation} onPress={navigation}}
47 | */
48 | function ImageCarousel(props) {
49 | data = props.pendingBooking1;
50 | var renderItem = ({ item, index }) => {
51 | return (
52 | {
56 | numberCarousel.scrollToIndex(index);
57 | }}
58 | >
59 | props.navigation.navigate("TicketDetailScreen", { Bus:item,person:props.person })} Date={item.Date} >
60 |
61 | );
62 | };
63 | var numberCarousel;
64 | return (
65 | {
73 | numberCarousel = c;
74 | }}
75 | />
76 | );
77 | }
78 | const styles = StyleSheet.create({
79 | carouselStyle:{
80 | flex:1
81 | },
82 | })
83 | export default ImageCarousel;
--------------------------------------------------------------------------------
/Components/Component/BookingScreen/seats.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/Components/Component/BookingScreen/seats.js
--------------------------------------------------------------------------------
/Components/Component/HomeScreen/HomeButtonComponent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, StyleSheet, Text, TouchableOpacity } from 'react-native';
3 | // Icon
4 | import Icon from 'react-native-vector-icons/Ionicons';
5 | // Styles
6 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox } from '../../../Styles/global';
7 |
8 | /**
9 | *
10 | * In Home screen we will use this as a link to another screen
11 | * {*iconName,*title,*onPress,buttonWidth,buttonHeight}
12 | */
13 | function HomeButton(props) {
14 | var {buttonWidth=120,buttonHeight=90}=props;
15 | return (
16 |
17 |
18 |
19 | {props.children}
20 |
21 |
22 | {props.title}
23 |
24 |
25 |
26 | );
27 | }
28 |
29 | export default HomeButton;
--------------------------------------------------------------------------------
/Components/Component/HomeScreen/HomeCarousel.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {
3 | StyleSheet,
4 | Text,
5 | TouchableOpacity,
6 | Dimensions,
7 | Image,
8 | View
9 | } from 'react-native';
10 | import Carousel from '../../../anchor-coursel/index';
11 |
12 |
13 | /**
14 | * {heightFlex,widthSubtract,carouselStyle
15 | * *data,*renderItem}
16 | */
17 | const { width } = Dimensions.get('window');
18 |
19 |
20 |
21 | const data = [
22 | { url: require("../../../assets/Images/Buses/Image1.jpg") },
23 | { url: require("../../../assets/Images/Buses/Image2.jpg") },
24 | { url: require("../../../assets/Images/Buses/Image3.jpg") },
25 | ];
26 | function ImageCarousel() {
27 |
28 | var renderItem = ({ item, index }) => {
29 | const { url } = item;
30 | return (
31 | {
35 | numberCarousel.scrollToIndex(index);
36 | }}
37 | >
38 |
39 |
40 |
41 | );
42 | };
43 | var numberCarousel;
44 | return (
45 | {
54 | numberCarousel = c;
55 | }}
56 | />
57 | );
58 | }
59 |
60 |
61 |
62 |
63 | const styles = StyleSheet.create({
64 | carouselStyle: {
65 | flex: 0.7
66 | },
67 | item: {
68 | borderWidth: 2,
69 | backgroundColor: 'white',
70 | flex: 1,
71 | borderRadius: 5,
72 | borderColor: 'white',
73 | elevation: 3
74 | },
75 | imageBackground: {
76 | flex: 2,
77 | backgroundColor: '#EBEBEB',
78 | borderWidth: 5,
79 | borderColor: 'white'
80 | },
81 | rightTextContainer: {
82 | marginLeft: 'auto',
83 | marginRight: -2,
84 | backgroundColor: 'rgba(49, 49, 51,0.5)',
85 | padding: 3,
86 | marginTop: 3,
87 | borderTopLeftRadius: 5,
88 | borderBottomLeftRadius: 5
89 | },
90 | rightText: { color: 'white' },
91 | lowerContainer: {
92 | flex: 1,
93 | margin: 10
94 | },
95 | titleText: {
96 | fontWeight: 'bold',
97 | fontSize: 18
98 | },
99 | contentText: {
100 | fontSize: 12
101 | }
102 | })
103 | export default ImageCarousel;
--------------------------------------------------------------------------------
/Components/Component/InputComponent.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { View, TextInput, StyleSheet } from 'react-native';
3 |
4 | import { GlobalBackgroundColors } from '../../Styles/global';
5 |
6 | /**
7 | * This is the text input whihc required following things
8 | * {onchange,iconName,value,placeHolder,secure,fullWidth}
9 | */
10 | var size = [200, 200]
11 | function InputComponent(props) {
12 | const [focusStyle, setFocusStyle] = useState({});
13 | const { fullWidth = false } = props;
14 | if (fullWidth)
15 | size = ["100%", "90%"];
16 |
17 | return (
18 |
19 |
20 | {props.children}
21 |
22 | { props.onchange(text) }}
25 | value={props.value}
26 | placeholder={props.placeHolder}
27 | secureTextEntry={props.secure}
28 | onFocus={() => setFocusStyle({ outline: "none" })
29 | }
30 | />
31 |
32 | )
33 | }
34 |
35 | const styles = StyleSheet.create({
36 | textInputStyle: {
37 | width: size[1],
38 | height: 40,
39 | borderBottomColor: '#B7B7B7',
40 | borderBottomWidth: 1,
41 | paddingLeft: 30
42 | }
43 | });
44 | export default InputComponent;
45 |
--------------------------------------------------------------------------------
/Components/Containers/SimpleContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3 | // Styling
4 | import { GlobalBackgroundColors, GlobalBackgroundTextColors } from '../../Styles/global';
5 |
6 |
7 |
8 |
9 | /**
10 | * Blue and white screen container
11 | * Props(*isBottomVisible,BottomLeftText,bottomRightLink,BottomRightText,headerContent,headerExtraStyle)
12 | *
13 | */
14 |
15 |
16 | function SimpleContainer(props) {
17 | var {headerContent=}=props;
18 | var {headerExtraStyle={}}=props;
19 | var {headerFlexSize=35}=props;
20 | var secondFlex=100-headerFlexSize;
21 | return (
22 |
23 |
24 |
25 | {/* Header Content */}
26 |
27 | {headerContent}
28 |
29 |
30 |
31 | {/* Main Content */}
32 |
33 |
34 |
35 | {/* Main Content */}
36 |
37 | {props.children}
38 |
39 |
40 |
41 | {/* Inner Links */}
42 | {props.isBottomVisible ?
43 |
44 | {props.BottomLeftText}
45 | {props.BottomRightText}
46 |
47 | : }
48 | {/* Inner Links Ends */}
49 |
50 |
51 |
52 |
53 | );
54 | }
55 |
56 |
57 | const styles = StyleSheet.create({
58 | userInfoContainer:
59 | {
60 | backgroundColor: GlobalBackgroundColors.ternaryColor,
61 | width: '80%',
62 | flexDirection: 'row',
63 | marginLeft: 'auto',
64 | marginRight: 'auto',
65 | marginTop: -60,
66 | paddingLeft: 10,
67 | borderBottomColor: GlobalBackgroundColors.primaryColor,
68 | borderBottomWidth: 5,
69 | borderTopLeftRadius: 30,
70 | borderTopEndRadius: 30
71 | },
72 | menueContinerStyle: {
73 | flexDirection: 'row',
74 | justifyContent: 'space-around',
75 | marginTop: 15
76 | },
77 | bottomLink: {
78 | color: GlobalBackgroundColors.secondaryColor,
79 | fontWeight: 'bold'
80 | }
81 | })
82 |
83 | export default SimpleContainer;
84 |
--------------------------------------------------------------------------------
/Components/Containers/loginContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, StyleSheet, Text, Image, TouchableOpacity, ScrollView } from 'react-native';
3 | // Importing styles
4 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, primaryButton, globalShadowBox, FontFamily } from '../../Styles/global';
5 |
6 |
7 |
8 | /**
9 | * Container for our (Login,Register,ForgetPassword related all screens)
10 | * Props tha will be passed are {title,leftBottomText,rightBottomText,rightBottomLink,mainButtonText,mainButtonLink}
11 | */
12 | function LoginContainer(props) {
13 | return (
14 |
15 | // Overall container
16 |
17 | {/* */}
18 | {/* Header (Containing only title) */}
19 |
20 | {props.title}
21 |
22 | {/* Content Area Container */}
23 |
24 | {/* Everything that is passed as child */}
25 |
26 |
27 |
28 |
29 |
30 | {props.children}
31 | {props.mainButtonText}
32 |
33 |
34 | {/* Bottom Links container */}
35 |
36 | {props.leftBottomText}
37 | {props.rightBottomText}
38 |
39 |
40 | {/* */}
41 |
42 | )
43 | }
44 |
45 | const styles = StyleSheet.create({
46 | title:
47 | {
48 | textAlign: "center",
49 | marginTop: 'auto',
50 | marginBottom: 'auto',
51 | color: (GlobalBackgroundTextColors.primaryColor),
52 |
53 | },
54 | linkBottom: {
55 | color: (GlobalBackgroundColors.secondaryColor),
56 | fontWeight: "bold"
57 | },
58 | stretch: {
59 | minWidth: 90,
60 | minHeight: 80,
61 | marginBottom: 10
62 | },
63 | contentArea: {
64 | backgroundColor: (GlobalBackgroundColors.ternaryColor),
65 | flex: 75,
66 | borderTopEndRadius: 100,
67 | paddingTop: 40,
68 | }
69 | })
70 | export default LoginContainer;
--------------------------------------------------------------------------------
/Components/Modals/CityModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Text, Modal, ScrollView, TouchableOpacity, StyleSheet } from 'react-native';
3 | import SearchIcon from '../../assets/Images/Icons/search';
4 | import CloseIcon from '../../assets/Images/Icons/close';
5 | // TextInput
6 | import Input from '../Component/InputComponent';
7 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox } from '../../Styles/global';
8 |
9 |
10 | /**
11 | *
12 | * {searchValue,searchValueChange,modalVisible,modalVisibleChange,finalHandler} props
13 | */
14 | function CityModal(props) {
15 | return (
16 |
17 |
18 |
19 | props.modalVisibleChange(false)} style={{ marginTop: 4, marginLeft: 4, marginBottom: 20 }}>
20 |
21 |
22 |
23 |
24 |
25 | {props.data.map((item) => {
26 | if (props.searchValue == '') {
27 | return ( props.finalHandler(item)}>{item})
28 | }
29 | else {
30 | if (item.includes(props.searchValue)) {
31 | return ( props.finalHandler(item)}>{item})
32 | }
33 | }
34 | })}
35 |
36 |
37 |
38 |
39 |
40 | );
41 | }
42 |
43 | const styles = StyleSheet.create({
44 | City:
45 | {
46 | width: '90%',
47 | marginLeft: 'auto',
48 | marginRight: 'auto',
49 | marginTop: 30,
50 | paddingBottom: 10,
51 | paddingLeft: 5,
52 | borderBottomColor: GlobalBackgroundTextColors.textBoxColor,
53 | borderBottomWidth: 1
54 | }
55 | })
56 |
57 | export default CityModal;
--------------------------------------------------------------------------------
/Components/Modals/ComplainModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Button, Text, Modal } from 'react-native';
3 | import { TouchableOpacity } from 'react-native-gesture-handler';
4 | // importing syles
5 | import { globalShadowBox, GlobalBackgroundColors, GlobalBackgroundTextColors } from '../../Styles/global'
6 |
7 | function ComplainModal(props) {
8 | return (
9 |
10 |
11 |
12 |
13 | Your suggestion/complaint has been submitted. We will try to act on it as soon as possible.
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | );
23 | }
24 | export default ComplainModal;
--------------------------------------------------------------------------------
/Components/Modals/TicketPurchasedRefundModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {View,Button,Text,Modal} from 'react-native';
3 |
4 | function TicketPurchasedRefundModal(props)
5 | {
6 | return(
7 |
8 |
9 | Refund Complete "Amount has been transfered to your accounnt"
10 |
12 |
13 | );
14 | }
15 | export default TicketPurchasedRefundModal;
--------------------------------------------------------------------------------
/Components/Modals/TicketPurchasingAccountModal.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { View, Button, Text, Modal, StyleSheet, TextInput } from 'react-native';
3 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox } from '../../Styles/global';
4 |
5 | function TicketPurchaseModal(props) {
6 |
7 |
8 | const [focusStyle, setFocusStyle] = useState({});
9 | var [error,setError]=useState("");
10 | return (
11 |
12 |
13 |
14 | {error}
15 | { props.setAccountNumber(text) }}
18 | value={props.value}
19 | placeholder="Jazz cash account number"
20 | onFocus={() => setFocusStyle({ outline: "none" })
21 | }
22 | />
23 |
26 |
27 |
28 | );
29 | }
30 |
31 | const styles = StyleSheet.create({
32 | textInputStyle: {
33 | width: '100%',
34 | height: 40,
35 | borderBottomColor: '#B7B7B7',
36 | borderBottomWidth: 1,
37 | paddingLeft: 30
38 | }
39 | });
40 | export default TicketPurchaseModal;
--------------------------------------------------------------------------------
/Components/Modals/TicketPurchasingDoneModal.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { View, Button, Text, Modal } from 'react-native';
3 |
4 | function TicketPurchasingDoneModal(props) {
5 | return (
6 |
7 |
8 | Ticket has been Purchased
9 | props.PurchaseDoneHandler()}/>
10 |
11 |
12 | );
13 | }
14 | export default TicketPurchasingDoneModal;
--------------------------------------------------------------------------------
/Context/FireBaseContext.js:
--------------------------------------------------------------------------------
1 | import React,{createContext} from 'react';
2 |
3 | const FireBaseContext=React.createContext("Null");
4 | export default FireBaseContext;
--------------------------------------------------------------------------------
/Context/LoginContext.js:
--------------------------------------------------------------------------------
1 | import React,{createContext} from 'react';
2 |
3 | const LoginContext=React.createContext("Null");
4 | export default LoginContext;
--------------------------------------------------------------------------------
/Data/BusSchedule.json:
--------------------------------------------------------------------------------
1 | [
2 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":1,"Price":1000 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
3 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":1,"Price":1000 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
4 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":2,"Price":500 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
5 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":2,"Price":500 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
6 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":3,"Price":100 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
7 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":3,"Price":100 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
8 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":4,"Price":1000 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
9 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":4,"Price":1000 ,"Booked":[{"Seat":20,"Gender":0},{"Seat:":10,"Gender":1}],"Pending":[{"Seat":5,"Gender":0},{"Seat":1,"Gender":1}]},
10 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":5,"Price":500 ,"Booked":[],"Pending":[]},
11 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":5,"Price":500 ,"Booked":[],"Pending":[]},
12 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":6,"Price":100 ,"Booked":[],"Pending":[]},
13 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":6,"Price":100 ,"Booked":[],"Pending":[]},
14 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":7,"Price":1000 ,"Booked":[],"Pending":[]},
15 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":7,"Price":1000 ,"Booked":[],"Pending":[]},
16 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":8,"Price":500 ,"Booked":[],"Pending":[]},
17 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":8,"Price":500 ,"Booked":[],"Pending":[]},
18 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":9,"Price":100 ,"Booked":[],"Pending":[]},
19 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":9,"Price":100 ,"Booked":[],"Pending":[]},
20 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":10,"Price":1000 ,"Booked":[],"Pending":[]},
21 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":10,"Price":1000 ,"Booked":[],"Pending":[]},
22 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":11,"Price":500 ,"Booked":[],"Pending":[]},
23 | {"Date":"25-10-2020","Day":"Sunday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":11,"Price":500 ,"Booked":[],"Pending":[]},
24 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":2,"Price":500 ,"Booked":[],"Pending":[]},
25 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":5,"Price":500 ,"Booked":[],"Pending":[]},
26 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":5,"Price":500 ,"Booked":[],"Pending":[]},
27 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":6,"Price":100 ,"Booked":[],"Pending":[]},
28 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":1,"Price":1000 ,"Booked":[],"Pending":[]},
29 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":1,"Price":1000 ,"Booked":[],"Pending":[]},
30 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":2,"Price":500 ,"Booked":[],"Pending":[]},
31 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":3,"Price":100 ,"Booked":[],"Pending":[]},
32 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":3,"Price":100 ,"Booked":[],"Pending":[]},
33 | {"Date":"26-10-2020","Day":"Monday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":4,"Price":1000 ,"Booked":[],"Pending":[]},
34 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":1,"Price":1000 ,"Booked":[],"Pending":[]},
35 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":1,"Price":1000 ,"Booked":[],"Pending":[]},
36 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":2,"Price":500 ,"Booked":[],"Pending":[]},
37 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"Lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":2,"Price":500 ,"Booked":[],"Pending":[]},
38 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":3,"Price":100 ,"Booked":[],"Pending":[]},
39 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":8,"Price":500 ,"Booked":[],"Pending":[]},
40 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":9,"Price":100 ,"Booked":[],"Pending":[]},
41 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":9,"Price":100 ,"Booked":[],"Pending":[]},
42 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":10,"Price":1000,"Booked":[],"Pending":[]},
43 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":10,"Price":1000,"Booked":[],"Pending":[]},
44 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Lahore","Destination":"Multan","DepartureTime":"09:00","ArrivalTime":"12:00","BusID":11,"Price":500 ,"Booked":[],"Pending":[]},
45 | {"Date":"27-10-2020","Day":"Tuesday","Arrival":"Multan","Destination":"lahore","DepartureTime":"15:00","ArrivalTime":"16:00","BusID":11,"Price":500 ,"Booked":[],"Pending":[]}
46 | ]
--------------------------------------------------------------------------------
/Data/Buses.json:
--------------------------------------------------------------------------------
1 | [{"BusID":1, "BusStandard":"Luxury", "Seats":30, "Price":"1000"},
2 | {"BusID":2, "BusStandard":"Business", "Seats":30, "Price":"500"},
3 | {"BusID":3, "BusStandard":"Economy", "Seats":30, "Price":"100"},
4 | {"BusID":4, "BusStandard":"Luxury", "Seats":30, "Price":"1000"},
5 | {"BusID":5, "BusStandard":"Business", "Seats":30, "Price":"500"},
6 | {"BusID":6, "BusStandard":"Economy", "Seats":30, "Price":"100"},
7 | {"BusID":7, "BusStandard":"Luxury", "Seats":30, "Price":"1000"},
8 | {"BusID":8, "BusStandard":"Business", "Seats":30, "Price":"500"},
9 | {"BusID":9, "BusStandard":"Economy", "Seats":30, "Price":"100"}]
--------------------------------------------------------------------------------
/Data/Cities.json:
--------------------------------------------------------------------------------
1 | [
2 | "America",
3 | "Banu",
4 | "Chitral",
5 | "DG Khan",
6 | "India",
7 | "Islamabad",
8 | "Karachi",
9 | "Lahore",
10 | "Multan",
11 | "Sahiwal",
12 | "Sawat"
13 | ]
--------------------------------------------------------------------------------
/Data/PersonDetail.json:
--------------------------------------------------------------------------------
1 | [
2 | {"Name":"Muhammad Usama", "PhoneNumber":"03472547540","Password":"password1" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":1}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":1}]},
3 | {"Name":"Muhammad Anees", "PhoneNumber":"03049758360","Password":"password2" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":1}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":1}]},
4 | {"Name":"Muhammad Waseem", "PhoneNumber":"03422547740","Password":"password3" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":2}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":2}]},
5 | {"Name":"Muhammad Sarwat", "PhoneNumber":"09472446240","Password":"password4" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":2}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":2}]},
6 | {"Name":"Muhammad Asim", "PhoneNumber":"04473547140","Password":"password5" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":3}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":3}]},
7 | {"Name":"Muhammad Ramzan", "PhoneNumber":"03472544540","Password":"password6" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":3}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Multan","BusID":3}]},
8 | {"Name":"Muhammad Sarwat", "PhoneNumber":"03471537510","Password":"password7" ,"Booked":[{"Seat":20,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":4}] ,"Pending":[{"Seat":5,"Gender":0,"Date":"25-10-2020","Arrival":"Lahore","BusID":4}]},
9 | {"Name":"Muhammad Waseem", "PhoneNumber":"03472999999","Password":"password9" ,"Booked":[{"Seat":-1,"Gender":-1,"Date":"00-00-0000","Arrival":"No Where","BusID":-1}] ,"Pending":[{"Seat":-1,"Gender":-1,"Date":"00-00-0000","Arrival":"No Where","BusID":-1}]}
10 | ]
--------------------------------------------------------------------------------
/Firebase Database.json:
--------------------------------------------------------------------------------
1 | {
2 | "BusSchedule" : [ {
3 | "Arrival" : "Lahore",
4 | "ArrivalTime" : "16:00",
5 | "Booked" : [ {
6 | "PhoneNumber" : "03472547540",
7 | "seats" : [ {
8 | "Gender" : 1,
9 | "seatID" : 2
10 | }, {
11 | "Gender" : 0,
12 | "seatID" : 1
13 | } ]
14 | } ],
15 | "BusID" : 1,
16 | "BusStandard" : "Luxury",
17 | "Date" : "25-10-2020",
18 | "Day" : "Sunday",
19 | "DepartureTime" : "15:00",
20 | "Destination" : "Multan",
21 | "Price" : 1000,
22 | "TotalSeats" : 30
23 | }, {
24 | "Arrival" : "Lahore",
25 | "ArrivalTime" : "12:00",
26 | "BusID" : 2,
27 | "BusStandard" : "Business",
28 | "Date" : "25-10-2020",
29 | "Day" : "Sunday",
30 | "DepartureTime" : "09:00",
31 | "Destination" : "Multan",
32 | "Price" : 500,
33 | "TotalSeats" : 30
34 | }, {
35 | "Arrival" : "Multan",
36 | "ArrivalTime" : "16:00",
37 | "BusID" : 2,
38 | "BusStandard" : "Business",
39 | "Date" : "25-10-2020",
40 | "Day" : "Sunday",
41 | "DepartureTime" : "15:00",
42 | "Destination" : "Lahore",
43 | "Price" : 500,
44 | "TotalSeats" : 30
45 | }, {
46 | "Arrival" : "Lahore",
47 | "ArrivalTime" : "12:00",
48 | "BusID" : 3,
49 | "BusStandard" : "Economy",
50 | "Date" : "25-10-2020",
51 | "Day" : "Sunday",
52 | "DepartureTime" : "09:00",
53 | "Destination" : "Multan",
54 | "Price" : 100,
55 | "TotalSeats" : 30
56 | }, {
57 | "Arrival" : "Multan",
58 | "ArrivalTime" : "16:00",
59 | "BusID" : 3,
60 | "BusStandard" : "Economy",
61 | "Date" : "25-10-2020",
62 | "Day" : "Sunday",
63 | "DepartureTime" : "15:00",
64 | "Destination" : "Lahore",
65 | "Price" : 100,
66 | "TotalSeats" : 30
67 | }, {
68 | "Arrival" : "Lahore",
69 | "ArrivalTime" : "12:00",
70 | "BusID" : 4,
71 | "BusStandard" : "Luxury",
72 | "Date" : "25-10-2020",
73 | "Day" : "Sunday",
74 | "DepartureTime" : "09:00",
75 | "Destination" : "Multan",
76 | "Price" : 1000,
77 | "TotalSeats" : 30
78 | }, {
79 | "Arrival" : "Multan",
80 | "ArrivalTime" : "16:00",
81 | "BusID" : 4,
82 | "BusStandard" : "Luxury",
83 | "Date" : "25-10-2020",
84 | "Day" : "Sunday",
85 | "DepartureTime" : "15:00",
86 | "Destination" : "lahore",
87 | "Price" : 1000,
88 | "TotalSeats" : 30
89 | }, {
90 | "Arrival" : "Lahore",
91 | "ArrivalTime" : "12:00",
92 | "BusID" : 5,
93 | "BusStandard" : "Business",
94 | "Date" : "25-10-2020",
95 | "Day" : "Sunday",
96 | "DepartureTime" : "09:00",
97 | "Destination" : "Multan",
98 | "Price" : 500,
99 | "TotalSeats" : 30
100 | }, {
101 | "Arrival" : "Multan",
102 | "ArrivalTime" : "16:00",
103 | "BusID" : 5,
104 | "BusStandard" : "Business",
105 | "Date" : "25-10-2020",
106 | "Day" : "Sunday",
107 | "DepartureTime" : "15:00",
108 | "Destination" : "lahore",
109 | "Price" : 500,
110 | "TotalSeats" : 30
111 | }, {
112 | "Arrival" : "Lahore",
113 | "ArrivalTime" : "12:00",
114 | "BusID" : 6,
115 | "BusStandard" : "Economy",
116 | "Date" : "25-10-2020",
117 | "Day" : "Sunday",
118 | "DepartureTime" : "09:00",
119 | "Destination" : "Multan",
120 | "Price" : 100,
121 | "TotalSeats" : 30
122 | }, {
123 | "Arrival" : "Multan",
124 | "ArrivalTime" : "16:00",
125 | "BusID" : 6,
126 | "BusStandard" : "Economy",
127 | "Date" : "25-10-2020",
128 | "Day" : "Sunday",
129 | "DepartureTime" : "15:00",
130 | "Destination" : "lahore",
131 | "Price" : 100,
132 | "TotalSeats" : 30
133 | }, {
134 | "Arrival" : "Lahore",
135 | "ArrivalTime" : "12:00",
136 | "BusID" : 7,
137 | "BusStandard" : "Luxury",
138 | "Date" : "25-10-2020",
139 | "Day" : "Sunday",
140 | "DepartureTime" : "09:00",
141 | "Destination" : "Multan",
142 | "Price" : 1000,
143 | "TotalSeats" : 30
144 | }, {
145 | "Arrival" : "Multan",
146 | "ArrivalTime" : "16:00",
147 | "BusID" : 7,
148 | "BusStandard" : "Luxury",
149 | "Date" : "25-10-2020",
150 | "Day" : "Sunday",
151 | "DepartureTime" : "15:00",
152 | "Destination" : "lahore",
153 | "Price" : 1000,
154 | "TotalSeats" : 30
155 | }, {
156 | "Arrival" : "Lahore",
157 | "ArrivalTime" : "12:00",
158 | "BusID" : 8,
159 | "BusStandard" : "Business",
160 | "Date" : "25-10-2020",
161 | "Day" : "Sunday",
162 | "DepartureTime" : "09:00",
163 | "Destination" : "Multan",
164 | "Price" : 500,
165 | "TotalSeats" : 30
166 | }, {
167 | "Arrival" : "Multan",
168 | "ArrivalTime" : "16:00",
169 | "BusID" : 8,
170 | "BusStandard" : "Business",
171 | "Date" : "25-10-2020",
172 | "Day" : "Sunday",
173 | "DepartureTime" : "15:00",
174 | "Destination" : "lahore",
175 | "Price" : 500,
176 | "TotalSeats" : 30
177 | }, {
178 | "Arrival" : "Lahore",
179 | "ArrivalTime" : "12:00",
180 | "BusID" : 9,
181 | "BusStandard" : "Economy",
182 | "Date" : "25-10-2020",
183 | "Day" : "Sunday",
184 | "DepartureTime" : "09:00",
185 | "Destination" : "Multan",
186 | "Price" : 100,
187 | "TotalSeats" : 30
188 | }, {
189 | "Arrival" : "Multan",
190 | "ArrivalTime" : "16:00",
191 | "BusID" : 9,
192 | "BusStandard" : "Economy",
193 | "Date" : "25-10-2020",
194 | "Day" : "Sunday",
195 | "DepartureTime" : "15:00",
196 | "Destination" : "lahore",
197 | "Price" : 100,
198 | "TotalSeats" : 30
199 | }, {
200 | "Arrival" : "Lahore",
201 | "ArrivalTime" : "12:00",
202 | "Booked" : [ {
203 | "PhoneNumber" : "03472547540",
204 | "seats" : [ {
205 | "Gender" : 1,
206 | "seatID" : 8
207 | }, {
208 | "Gender" : 0,
209 | "seatID" : 4
210 | }, {
211 | "Gender" : 1,
212 | "seatID" : 22
213 | }, {
214 | "Gender" : 0,
215 | "seatID" : 12
216 | } ]
217 | }, {
218 | "PhoneNumber" : "09472446240",
219 | "seats" : [ {
220 | "Gender" : 0,
221 | "seatID" : 21
222 | }, {
223 | "Gender" : 1,
224 | "seatID" : 11
225 | } ]
226 | } ],
227 | "BusID" : 1,
228 | "BusStandard" : "Luxury",
229 | "Date" : "26-10-2020",
230 | "Day" : "Monday",
231 | "DepartureTime" : "09:00",
232 | "Destination" : "Multan",
233 | "Price" : 1000,
234 | "TotalSeats" : 30
235 | }, {
236 | "Arrival" : "Multan",
237 | "ArrivalTime" : "16:00",
238 | "BusID" : 1,
239 | "BusStandard" : "Luxury",
240 | "Date" : "26-10-2020",
241 | "Day" : "Monday",
242 | "DepartureTime" : "15:00",
243 | "Destination" : "Lahore",
244 | "Price" : 1000,
245 | "TotalSeats" : 30
246 | }, {
247 | "Arrival" : "Lahore",
248 | "ArrivalTime" : "12:00",
249 | "BusID" : 2,
250 | "BusStandard" : "Business",
251 | "Date" : "26-10-2020",
252 | "Day" : "Monday",
253 | "DepartureTime" : "09:00",
254 | "Destination" : "Multan",
255 | "Price" : 500,
256 | "TotalSeats" : 30
257 | }, {
258 | "Arrival" : "Multan",
259 | "ArrivalTime" : "16:00",
260 | "BusID" : 2,
261 | "BusStandard" : "Business",
262 | "Date" : "26-10-2020",
263 | "Day" : "Monday",
264 | "DepartureTime" : "15:00",
265 | "Destination" : "Lahore",
266 | "Price" : 500,
267 | "TotalSeats" : 30
268 | }, {
269 | "Arrival" : "Lahore",
270 | "ArrivalTime" : "12:00",
271 | "BusID" : 3,
272 | "BusStandard" : "Economy",
273 | "Date" : "26-10-2020",
274 | "Day" : "Monday",
275 | "DepartureTime" : "09:00",
276 | "Destination" : "Multan",
277 | "Price" : 100,
278 | "TotalSeats" : 30
279 | }, {
280 | "Arrival" : "Multan",
281 | "ArrivalTime" : "16:00",
282 | "BusID" : 3,
283 | "BusStandard" : "Economy",
284 | "Date" : "26-10-2020",
285 | "Day" : "Monday",
286 | "DepartureTime" : "15:00",
287 | "Destination" : "Lahore",
288 | "Price" : 100,
289 | "TotalSeats" : 30
290 | }, {
291 | "Arrival" : "Lahore",
292 | "ArrivalTime" : "12:00",
293 | "BusID" : 4,
294 | "BusStandard" : "Luxury",
295 | "Date" : "26-10-2020",
296 | "Day" : "Monday",
297 | "DepartureTime" : "09:00",
298 | "Destination" : "Multan",
299 | "Price" : 1000,
300 | "TotalSeats" : 30
301 | }, {
302 | "Arrival" : "Multan",
303 | "ArrivalTime" : "16:00",
304 | "BusID" : 4,
305 | "BusStandard" : "Luxury",
306 | "Date" : "26-10-2020",
307 | "Day" : "Monday",
308 | "DepartureTime" : "15:00",
309 | "Destination" : "lahore",
310 | "Price" : 1000,
311 | "TotalSeats" : 30
312 | }, {
313 | "Arrival" : "Lahore",
314 | "ArrivalTime" : "12:00",
315 | "BusID" : 5,
316 | "BusStandard" : "Business",
317 | "Date" : "26-10-2020",
318 | "Day" : "Monday",
319 | "DepartureTime" : "09:00",
320 | "Destination" : "Multan",
321 | "Price" : 500,
322 | "TotalSeats" : 30
323 | }, {
324 | "Arrival" : "Multan",
325 | "ArrivalTime" : "16:00",
326 | "BusID" : 5,
327 | "BusStandard" : "Business",
328 | "Date" : "26-10-2020",
329 | "Day" : "Monday",
330 | "DepartureTime" : "15:00",
331 | "Destination" : "lahore",
332 | "Price" : 500,
333 | "TotalSeats" : 30
334 | }, {
335 | "Arrival" : "Lahore",
336 | "ArrivalTime" : "12:00",
337 | "BusID" : 6,
338 | "BusStandard" : "Economy",
339 | "Date" : "26-10-2020",
340 | "Day" : "Monday",
341 | "DepartureTime" : "09:00",
342 | "Destination" : "Multan",
343 | "Price" : 100,
344 | "TotalSeats" : 30
345 | }, {
346 | "Arrival" : "Multan",
347 | "ArrivalTime" : "16:00",
348 | "BusID" : 6,
349 | "BusStandard" : "Economy",
350 | "Date" : "26-10-2020",
351 | "Day" : "Monday",
352 | "DepartureTime" : "15:00",
353 | "Destination" : "lahore",
354 | "Price" : 100,
355 | "TotalSeats" : 30
356 | }, {
357 | "Arrival" : "Lahore",
358 | "ArrivalTime" : "12:00",
359 | "BusID" : 7,
360 | "BusStandard" : "Luxury",
361 | "Date" : "26-10-2020",
362 | "Day" : "Monday",
363 | "DepartureTime" : "09:00",
364 | "Destination" : "Multan",
365 | "Price" : 1000,
366 | "TotalSeats" : 30
367 | }, {
368 | "Arrival" : "Multan",
369 | "ArrivalTime" : "16:00",
370 | "BusID" : 7,
371 | "BusStandard" : "Luxury",
372 | "Date" : "26-10-2020",
373 | "Day" : "Monday",
374 | "DepartureTime" : "15:00",
375 | "Destination" : "lahore",
376 | "Price" : 1000,
377 | "TotalSeats" : 30
378 | }, {
379 | "Arrival" : "Lahore",
380 | "ArrivalTime" : "12:00",
381 | "BusID" : 8,
382 | "BusStandard" : "Business",
383 | "Date" : "26-10-2020",
384 | "Day" : "Monday",
385 | "DepartureTime" : "09:00",
386 | "Destination" : "Multan",
387 | "Price" : 500,
388 | "TotalSeats" : 30
389 | }, {
390 | "Arrival" : "Multan",
391 | "ArrivalTime" : "16:00",
392 | "BusID" : 8,
393 | "BusStandard" : "Business",
394 | "Date" : "26-10-2020",
395 | "Day" : "Monday",
396 | "DepartureTime" : "15:00",
397 | "Destination" : "lahore",
398 | "Price" : 500,
399 | "TotalSeats" : 30
400 | }, {
401 | "Arrival" : "Lahore",
402 | "ArrivalTime" : "12:00",
403 | "BusID" : 9,
404 | "BusStandard" : "Economy",
405 | "Date" : "26-10-2020",
406 | "Day" : "Monday",
407 | "DepartureTime" : "09:00",
408 | "Destination" : "Multan",
409 | "Price" : 100,
410 | "TotalSeats" : 30
411 | }, {
412 | "Arrival" : "Multan",
413 | "ArrivalTime" : "16:00",
414 | "BusID" : 9,
415 | "BusStandard" : "Economy",
416 | "Date" : "26-10-2020",
417 | "Day" : "Monday",
418 | "DepartureTime" : "15:00",
419 | "Destination" : "lahore",
420 | "Price" : 100,
421 | "TotalSeats" : 30
422 | } ],
423 | "Buses" : [ {
424 | "BusID" : 1,
425 | "BusStandard" : "Luxury",
426 | "Price" : "1000",
427 | "seatID" : 30
428 | }, {
429 | "BusID" : 2,
430 | "BusStandard" : "Business",
431 | "Price" : "500",
432 | "seatID" : 30
433 | }, {
434 | "BusID" : 3,
435 | "BusStandard" : "Economy",
436 | "Price" : "100",
437 | "seatID" : 30
438 | }, {
439 | "BusID" : 4,
440 | "BusStandard" : "Luxury",
441 | "Price" : "1000",
442 | "seatID" : 30
443 | }, {
444 | "BusID" : 5,
445 | "BusStandard" : "Business",
446 | "Price" : "500",
447 | "seatID" : 30
448 | }, {
449 | "BusID" : 6,
450 | "BusStandard" : "Economy",
451 | "Price" : "100",
452 | "seatID" : 30
453 | }, {
454 | "BusID" : 7,
455 | "BusStandard" : "Luxury",
456 | "Price" : "1000",
457 | "seatID" : 30
458 | }, {
459 | "BusID" : 8,
460 | "BusStandard" : "Business",
461 | "Price" : "500",
462 | "seatID" : 30
463 | }, {
464 | "BusID" : 9,
465 | "BusStandard" : "Economy",
466 | "Price" : "100",
467 | "seatID" : 30
468 | } ],
469 | "Cities" : [ "America", "Banu", "Chitral", "DG Khan", "India", "Islamabad", "Karachi", "Lahore", "Multan", "Sahiwal", "Sawat" ],
470 | "PersonDetail" : [ {
471 | "Name" : "Muhammad Usama",
472 | "Password" : "password1",
473 | "PhoneNumber" : "03472547540"
474 | }, {
475 | "Name" : "Muhammad Anees",
476 | "Password" : "password2",
477 | "PhoneNumber" : "03049758360"
478 | }, {
479 | "Name" : "Muhammad Waseem",
480 | "Password" : "password3",
481 | "PhoneNumber" : "03422547740"
482 | }, {
483 | "Name" : "Muhammad Sarwat",
484 | "Password" : "password4",
485 | "PhoneNumber" : "09472446240"
486 | }, {
487 | "Name" : "Muhammad Asim",
488 | "Password" : "password5",
489 | "PhoneNumber" : "04473547140"
490 | }, {
491 | "Name" : "Muhammad Ramzan",
492 | "Password" : "password6",
493 | "PhoneNumber" : "03472544540"
494 | }, {
495 | "Name" : "Muhammad Sarwat",
496 | "Password" : "password7",
497 | "PhoneNumber" : "03471537510"
498 | } ]
499 | }
500 |
--------------------------------------------------------------------------------
/Functions.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | /**
12 | *
13 | * @param {*} Bus
14 | * @param {*} BusSchedule
15 | * When the bus is selected we have to get its seat detail again so that we get its lates updates in the next screen
16 | */
17 | function GetSingleBus(Bus, BusSchedule,PhoneNumber) {
18 | var newBus = [];
19 | var pendingIndex = -1;
20 | var bookedIndex = -1;
21 |
22 | BusSchedule.map((bus, index) => {
23 | if (bus.Arrival == Bus.Arrival && bus.Destination == Bus.Destination && bus.BusID == Bus.BusID && bus.ArrivalTime == Bus.ArrivalTime && bus.Date == Bus.Date) {
24 | newBus = { ...bus, FireBaseIndex: index };
25 | }
26 | })
27 |
28 | if (newBus.Pending != null) {
29 | newBus.Pending.map(((pending, index1) => {
30 | if (pending.PhoneNumber == PhoneNumber) {
31 | pendingIndex = index1;
32 | }
33 | }))
34 | }
35 |
36 |
37 | if (newBus.Booked != null) {
38 | newBus.Booked.map(((booked, index2) => {
39 | if (booked.PhoneNumber == PhoneNumber) {
40 | bookedIndex = index2;
41 | }
42 | }))
43 | }
44 |
45 | newBus.pendingIndex=pendingIndex;
46 | newBus.bookedIndex=bookedIndex;
47 |
48 | if(newBus.Pending==null)
49 | newBus.Pending=[];
50 | if(newBus.Booked==null)
51 | newBus.Booked=[];
52 |
53 | return newBus;
54 | }
55 | /**
56 | *
57 | * @param {*} BusSchedule
58 | * Getting the dates from bus schedule
59 | */
60 | function onlyUnique(value, index, self) {
61 | return self.indexOf(value) === index;
62 | }
63 | function GetDate(BusSchedule) {
64 | var Dates = [];
65 | BusSchedule.map(Bus => {
66 | Dates.push(Bus.Date);
67 | })
68 | var unique = Dates.filter(onlyUnique);
69 | return unique;
70 | }
71 | /**
72 | *
73 | * @param {*} scheduleBuses
74 | * GEtting pending detail from the bus schedule
75 | */
76 | function GetPending(scheduleBuses) {
77 | var Buses = [];
78 | scheduleBuses.map((bus) => {
79 | if (bus.Pending.length != 0) {
80 | Buses.push(bus);
81 | }
82 | })
83 | return Buses;
84 | }
85 | /**
86 | *
87 | * @param {*} scheduleBuses
88 | * Getting booked ticket detail from the bus schedule
89 | */
90 | function GetBooked(scheduleBuses) {
91 | var Buses = [];
92 |
93 | scheduleBuses.map((bus) => {
94 | if (bus.Booked.length != 0) {
95 | Buses.push(bus);
96 | }
97 | })
98 | return Buses;
99 | }
100 | /**
101 | *
102 | * @param {*} scheduleBuses
103 | * @param {*} PhoneNumber
104 | * Filtering the bus schedule getting all the pending and booking in the form of aray
105 | * if phone number is given then also filter with respect to phone number
106 | */
107 | function FilterBusSchedule(scheduleBuses, PhoneNumber) {
108 | if (scheduleBuses != null) {
109 | var Buses = [];
110 | // Maping bus schedule
111 | scheduleBuses.map(((bus, index) => {
112 | // Mapin pending schedule
113 | var pendingfound = false;
114 | var bookedfound = false;
115 | var pendingbusSeats = [];
116 | var bookedbusSeats = [];
117 |
118 | var pendingIndex = -1;
119 | var bookedIndex = -1;
120 |
121 | // Filtering with respect to phone number
122 | if (PhoneNumber != false) {
123 | if (bus.Pending != null) {
124 | bus.Pending.map(((pending, index1) => {
125 | if (pending.PhoneNumber == PhoneNumber) {
126 | pendingfound = true;
127 | pendingbusSeats = pending.seats;
128 | pendingIndex = index1;
129 | }
130 | }))
131 | }
132 |
133 |
134 | if (bus.Booked != null) {
135 | bus.Booked.map(((booked, index2) => {
136 | if (booked.PhoneNumber == PhoneNumber) {
137 | bookedfound = true;
138 | bookedbusSeats = booked.seats;
139 | bookedIndex = index2;
140 | }
141 | }))
142 | }
143 | }
144 | // Filtering without user respective
145 | else {
146 | if (bus.Pending != null) {
147 | bus.Pending.map((pending => {
148 | pendingbusSeats = pending.seats;
149 | }))
150 | }
151 |
152 |
153 | if (bus.Booked != null) {
154 | bus.Booked.map((booked => {
155 | bookedbusSeats = booked.seats;
156 | }))
157 | }
158 | }
159 |
160 |
161 | var tempPending = pendingbusSeats;
162 | var tempBooked = bookedbusSeats;
163 | var singleBus = { ...bus, Pending: tempPending, Booked: tempBooked, FireBaseIndex: index, pendingIndex, bookedIndex }
164 | Buses.push(singleBus);
165 | }
166 | ))
167 | return Buses;
168 | }
169 | return scheduleBuses;
170 | }
171 | /**
172 | *
173 | * @param {*} singleBus
174 | * @param {*} PhoneNumber
175 | * @param {*} selectedSeats
176 | * When the user selected the bus then adding these seats into array and updating on the firebase
177 | */
178 | function updatePendingSeats(singleBus, PhoneNumber, selectedSeats) {
179 | var userIndex = -1;
180 | var seats = [];
181 | var found = false;
182 | console.log("Single=>",singleBus);
183 | if (singleBus != null) {
184 | singleBus.map(((pen, index) => {
185 | if (pen.PhoneNumber == PhoneNumber) {
186 | found = true;
187 | seats = [...pen.seats, ...selectedSeats];
188 | userIndex = index;
189 | }
190 | }))
191 | }
192 | else
193 | {
194 | singleBus=[];
195 | }
196 |
197 | if (found == false) {
198 | console.log(singleBus)
199 | seats=[...singleBus,{PhoneNumber,"seats":selectedSeats}];
200 | // seats=singleBus.Pending;
201 | // seats.push()
202 | // seats = selectedSeats;
203 | // seats = { PhoneNumber, seats };
204 | }
205 | return { userIndex, seats };
206 | }
207 | function updateBookingSeats(singleBus, PhoneNumber, selectedSeats) {
208 |
209 | }
210 | /**
211 | *
212 | * @param {*} singleBus
213 | * When selecting the seat we need to get all the seat that is booked and pending
214 | */
215 | function GetAllSeats(singleBus) {
216 | var bookedSeats = [];
217 | if (singleBus.Booked != null) {
218 | singleBus.Booked.map((book => {
219 | book.seats.map((seat => {
220 | bookedSeats.push(seat.seatID);
221 | }))
222 | }))
223 | }
224 | if (singleBus.Pending != null) {
225 | singleBus.Pending.map((book => {
226 | book.seats.map((seat => {
227 | bookedSeats.push(seat.seatID);
228 | }))
229 | }))
230 | }
231 | return bookedSeats;
232 | }
233 | export { GetDate, GetPending, GetBooked, GetSingleBus, FilterBusSchedule, GetAllSeats, updatePendingSeats,updateBookingSeats };
--------------------------------------------------------------------------------
/Navigations/Stacks/HomeStack.js:
--------------------------------------------------------------------------------
1 | // React Native Imports
2 | import React from 'react';
3 | // Navigation Related Imports
4 | import { createStackNavigator } from '@react-navigation/stack';
5 | // Screens Imports
6 | import HomeScreen from '../../Screen/Home/Home';
7 |
8 | import BookingDestinationScreen from '../../Screen/Booking/BookingDestination';
9 | import BookingBusesScreen from '../../Screen/Booking/BookingBuses';
10 | import BookingBusSeatsScreen from '../../Screen/Booking/BookingSeats';
11 |
12 | import BookingPendingScreen from '../../Screen/Booking/BookingPending';
13 | import TicketDetailScreen from '../../Screen/Ticket/TicketDetail';
14 |
15 | import PurchasedTicketScreen from '../../Screen/Ticket/TicketPurchased';
16 | import RefundTicketScreen from '../../Screen/Ticket/TicketPurchasedRefund';
17 |
18 | import ComplaintScreen from '../../Screen/Complain/Complain'
19 | // Style
20 | import {GlobalBackgroundColors, GlobalBackgroundTextColors} from '../../Styles/global';
21 |
22 | const Stack = createStackNavigator();
23 | function HomeStack(props) {
24 | return (
25 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | );
45 | }
46 | export default HomeStack;
--------------------------------------------------------------------------------
/Navigations/Stacks/LoginStack.js:
--------------------------------------------------------------------------------
1 | // React Native Imports
2 | import React from 'react';
3 | // Navigation Related Imports
4 | import { createStackNavigator } from '@react-navigation/stack';
5 | // Screens Imports
6 | import Login from '../../Screen/Login/Login';
7 | import LoginReset from '../../Screen/Login/LoginReset';
8 | import LoginResetNew from '../../Screen/Login/LoginResetNew';
9 | import LoginRegister from '../../Screen/Login/LoginRegister';
10 | import LoginRegisterVerify from '../../Screen/Login/LoginRegisterVerify';
11 | // Style
12 | import {GlobalBackgroundColors, GlobalBackgroundTextColors} from '../../Styles/global';
13 |
14 |
15 | const Stack = createStackNavigator();
16 | function LoginStack(props)
17 | {
18 | return(
19 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | }
36 | export default LoginStack;
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bus-Ticket-Booking
2 | This is the app for booking tickets. Created with react native and firebase as database.
3 |
4 | # Issues
5 | 1. need to work on Backend it has several security issues.
6 |
7 | # Installation Guide
8 | 1. Run command "npm install" in the main directory of your project
9 | 2. Create your firebae project.
10 | 1. Create Real time database in your firebase project.
11 | 2. Import some dummy data (Present in main directory of the project) into your firebase database.
12 | 3. Add CDN information of your database in config.js file.
13 | 4. Run the project and enjoy.
14 |
15 | # ScreenShot
16 |
17 | ## Login
18 | 
19 |
20 | ## Home
21 | 
22 |
23 | ## Select Bus
24 | 
25 |
26 | ## Select Seat
27 | 
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Screen/Booking/BookingBuses.js:
--------------------------------------------------------------------------------
1 | import React, { useState,useEffect,useContext } from 'react';
2 | import { View, Button, Text, Image, StyleSheet, ScrollView, FlatList, TouchableOpacity } from 'react-native';
3 | // import LinearGradient from 'react-native-linear-gradient';
4 | // Components
5 | import Container from '../../Components/Containers/SimpleContainer';
6 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox } from '../../Styles/global';
7 | import Slider from '../../Components/Component/BookingScreen/ScheduleDateCoursele';
8 | // Importing scree
9 | import Wait from '../wait';
10 | // importing contex
11 | import LoginContext from '../../Context/LoginContext';
12 | // Function
13 | import {FilterBusSchedule} from '../../Functions';
14 |
15 |
16 |
17 |
18 |
19 |
20 | /*===== Header Function Goes Here ============================================================================================= */
21 | function Header(props) {
22 | return (
23 |
24 |
25 |
26 | {/* Arrival */}
27 |
28 | {props.Arrival}
29 | Departure
30 |
31 | {/* Border */}
32 |
33 | {/* Destination */}
34 |
35 | {props.Destination}
36 | Destination
37 |
38 |
39 |
40 |
41 | {props.Date}
42 |
43 |
44 |
45 | );
46 | }
47 | /*===== Header Function Goes Here ============================================================================================= */
48 |
49 |
50 |
51 |
52 |
53 | /*===== Bus Function Goes Here ============================================================================================= */
54 | function Bus(props) {
55 | var { person, item: Bus } = props;
56 | return (
57 | props.navigation.navigate("BookingBusSeatsScreen", { person, Bus })} style={[globalShadowBox, { width: '90%', marginLeft: 'auto', marginRight: 'auto', backgroundColor: 'white', borderRadius: 30, padding: 10, marginTop: 30 }]}>
58 | {/* Bus Detail */}
59 |
60 | {Bus.BusStandard}
61 | {Bus.Price}
62 |
63 | {/* Traveling Detail */}
64 |
65 | {Bus.Arrival}
66 |
67 | {Bus.Destination}
68 |
69 | {/* Time Detail */}
70 |
71 | {Bus.DepartureTime}
72 | {Bus.ArrivalTime}
73 |
74 |
75 | );
76 | }
77 | /*===== Bus Function Ends Here ============================================================================================= */
78 |
79 |
80 |
81 |
82 |
83 |
84 | function BookingBuses({ navigation, route }) {
85 |
86 |
87 | /*===== Getting Passed Data ===================================================================== */
88 | var { ArrivalSelected, DestinationSelected, DateData, person, DateSchedule1 } = route.params;
89 | const { rootReference } = useContext(LoginContext);
90 | /*===== Getting Passed Data ===================================================================== */
91 |
92 |
93 | /*===== Data created ============================================================================ */
94 | var [Date, DateHandler] = useState(DateData);
95 | var [promise, setPromise] = useState(false);
96 | var [BusSchedule,setBusSchedule] = useState([]);
97 | /*===== Data created ============================================================================ */
98 |
99 |
100 |
101 | var busScheduleTemp=[];
102 | useEffect(() => {
103 | const CitiesNode = rootReference.child("BusSchedule");
104 | CitiesNode.once("value").then(datasnap => {
105 | busScheduleTemp = datasnap.val();
106 | }).then(readCountTxn => {
107 | busScheduleTemp=FilterBusSchedule(busScheduleTemp,false);
108 | setBusSchedule(busScheduleTemp);
109 | setPromise(true);
110 | })
111 | }, []);
112 |
113 |
114 |
115 | var AllBuses=BusSchedule.filter((bus,index)=>{
116 | if (bus.Date == Date && bus.Destination==DestinationSelected && bus.Arrival==ArrivalSelected ) {
117 | return bus;
118 | }
119 | })
120 |
121 |
122 |
123 | var show = false;
124 | if (AllBuses.length >= 0) {
125 | show = true;
126 | }
127 |
128 |
129 | if (promise == true) {
130 | navigation.setOptions({ headerShown: true });
131 | }
132 | else {
133 | navigation.setOptions({ headerShown: false });
134 | }
135 |
136 | return (
137 |
138 | {
139 | promise ?
140 | }>
141 |
142 | {
143 | show ?
144 |
145 | index.toString()}
147 | data={AllBuses}
148 | renderItem={({ item }) => (
149 |
150 | )}
151 | />
152 |
153 | :
154 | Can not Find Any Bus
155 | }
156 |
157 | :
158 |
159 | }
160 |
161 | );
162 | }
163 | export default BookingBuses;
--------------------------------------------------------------------------------
/Screen/Booking/BookingDestination.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useContext, useEffect } from 'react';
2 | import { View, Button, Text, TouchableOpacity, ScrollView } from 'react-native';
3 | import { Picker } from '@react-native-picker/picker';
4 | // Components Import
5 | import SimpleContainer from '../../Components/Containers/SimpleContainer';
6 | import CityModal from '../../Components/Modals/CityModal';
7 | // Importing Styles
8 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox, primaryButton } from '../../Styles/global';
9 | // Importing Data
10 | import Carousele from '../../Components/Component/BookingScreen/pendingBookingCoursele';
11 | import ArrivalIcon from '../../assets/Images/Icons/Arrival';
12 | import Date from '../../assets/Images/Icons/Date';
13 | import DropDown from '../../assets/Images/Icons/DropDown';
14 | // Importing context
15 | import LoginContext from '../../Context/LoginContext';
16 | import Wait from '../wait';
17 | // Importing Funcions
18 | import { GetDate, FilterBusSchedule, GetPending } from '../../Functions';
19 |
20 |
21 |
22 |
23 |
24 | /*============================== Inline Function City Modal ========================================== */
25 | function Destination(props) {
26 | return (
27 |
28 |
29 |
30 |
31 | {props.title}
32 |
33 | props.modalVisibleChange(true)}>
34 |
35 | {props.Selected}
36 |
37 |
38 |
39 |
40 | );
41 | }
42 | /*============================== Inline Function City Model ========================================== */
43 |
44 |
45 |
46 |
47 |
48 | /*============================== Inline Function DatePicker ========================================== */
49 | function DatePicker(props) {
50 | return (
51 |
52 |
53 |
54 | Date
55 |
56 |
57 | { props.onPress(itemValue); }}>
58 | {props.DateSchedule.map((item) => )}
59 |
60 |
61 |
62 | );
63 | }
64 | /*============================== Inline Function DatePicker =========================================== */
65 |
66 |
67 |
68 |
69 |
70 | function BookingDestination({ navigation, route }) {
71 |
72 |
73 | /* ===== Passed Data =========================================================================================*/
74 | var { person = false } = route.params;
75 | const { rootReference } = useContext(LoginContext);
76 | /* ===========================================================================================Passed Data=====*/
77 |
78 |
79 | /*===== Data Created Goes Here ============================================================================== */
80 | var [promised, setpromised] = useState(false);
81 |
82 |
83 | var [DateSchedule1, setDateSchedule] = useState([]);
84 | var [cities1, setCities] = useState([]);
85 | var [pendingBooking1, setPendingBooking] = useState([]);
86 |
87 |
88 | let [ArrivalTerminal, changeArrivalTerminal] = useState(""); // For searching bar
89 | let [ArrivalTerminalModal, ArrivalTerminalModalHandler] = useState(false); // For changing Model
90 | var [ArrivalSelected, changeArrivalSelected] = useState(cities1[0]); // Final Last value of search bar
91 | const arrivalFinal = (city) => { // Handler when the City is selected
92 | changeArrivalTerminal("");
93 | changeArrivalSelected(city);
94 | ArrivalTerminalModalHandler(false);
95 | }
96 |
97 |
98 |
99 | let [DestinationTerminal, changeDestinationTerminal] = useState("");;
100 | let [DestinationTerminalModal, DestinationTerminalModalHandler] = useState(false);
101 | var [DestinationSelected, changeDestinationSelected] = useState(cities1[0]);
102 | function destinationFinal(city) {
103 | changeDestinationTerminal("");
104 | changeDestinationSelected(city);
105 | DestinationTerminalModalHandler(false);
106 | }
107 |
108 |
109 |
110 | let [DateData, changeDateData] = useState(DateSchedule1[0]);
111 | // In case if date is not found then disabling the find bus button
112 | var disable = false;
113 | var disableColor = GlobalBackgroundColors.secondaryColor;
114 | if (DateSchedule1.length <= 0) {
115 | disable = true;
116 | disableColor = "black";
117 | }
118 |
119 |
120 |
121 |
122 |
123 | var citiesTemp = [];
124 | var busScheduleTemp = [];
125 | useEffect(() => {
126 | const CitiesNode = rootReference.child("Cities"); // Getting the city reference
127 | CitiesNode.once("value").then(datasnap => {
128 | citiesTemp = datasnap.val();
129 | }).then(readCountTxn => { // When the propmise to get the city is made
130 | const BusScheduleNode = rootReference.child("BusSchedule");
131 | BusScheduleNode.once("value").then(datasnap => {
132 | busScheduleTemp = datasnap.val();
133 | }).then(readCountTxn => { // When promise to get the BusSchedule is made
134 | var dateTemp = GetDate(busScheduleTemp);
135 | var pendingTemp = FilterBusSchedule(busScheduleTemp, person.PhoneNumber);
136 | pendingTemp=GetPending(pendingTemp);
137 | setpromised(!promised);
138 | setDateSchedule(dateTemp);
139 | setCities(citiesTemp);
140 | setPendingBooking(pendingTemp);
141 |
142 | arrivalFinal(citiesTemp[0]);
143 | destinationFinal(citiesTemp[0]);
144 | changeDateData(dateTemp[0]);
145 |
146 | })
147 | })
148 | }, []);
149 | /*==========================================================================================Data Ends Here===== */
150 |
151 |
152 |
153 | if (promised == true) {
154 | navigation.setOptions({ headerShown: true });
155 | }
156 | else {
157 | navigation.setOptions({ headerShown: false });
158 | }
159 |
160 | return (
161 |
162 | {promised ?
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 | navigation.navigate("BookingBusesScreen", { ArrivalSelected, DestinationSelected, DateData, person, DateSchedule1 })} disabled={disable} style={[primaryButton, { marginTop: 10, marginBottom: 10, backgroundColor: disableColor }]} >Find Bus
181 |
182 | {/* Slider */}
183 |
184 |
185 |
186 |
187 |
188 |
189 | :
190 |
191 | }
192 |
193 | );
194 | }
195 | export default BookingDestination;
--------------------------------------------------------------------------------
/Screen/Booking/BookingPending.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useState, useEffect } from 'react';
2 | import { View, Button, Text, FlatList, TouchableOpacity, ScrollView } from 'react-native';
3 | import Icon from 'react-native-vector-icons/Ionicons';
4 | import TicketIcon from '../../assets/Images/HomeLogo/tickets';
5 | // Importing styles
6 | import { globalShadowBox, GlobalBackgroundColors, GlobalBackgroundTextColors, primaryButton } from '../../Styles/global'
7 | // Contex
8 | import LoginContext from '../../Context/LoginContext';
9 | // Screens
10 | import WaitScreen from '../../Screen/wait';
11 | import { GetPending, FilterBusSchedule } from '../../Functions';
12 | // Importing icons
13 | import Bin from '../../assets/Images/Icons/bin';
14 |
15 | // Ticket Component
16 | function Ticket(props) {
17 | var { Bus, selectedData, person, navigation, deleteData } = props;
18 | return (
19 |
20 | {/* Ticket Header */}
21 |
22 |
23 | {person.Name}
24 | deleteData(Bus)}>
25 |
26 |
27 | {/* Route detail */}
28 |
29 | {/* Title */}
30 |
31 | Date
32 | Time
33 |
34 |
35 | {Bus.Day}, {Bus.Date}
36 | {Bus.DepartureTime}
37 |
38 |
39 |
40 | {/* Total Price */}
41 |
42 | {/* Title */}
43 |
44 | Price
45 | {selectedData.length * Bus.Price}
46 |
47 |
48 |
49 | {/* Burtton */}
50 | navigation.navigate("TicketDetailScreen", { Bus, person })}>Purchase Now
51 |
52 | );
53 | }
54 |
55 |
56 |
57 |
58 |
59 | function BookingPending({ navigation, route }) {
60 |
61 |
62 | /*===== getting passed=======================================================*/
63 | var { person } = route.params;
64 | const { rootReference } = useContext(LoginContext);
65 | var [reload, changeReload] = useState(false);
66 | /*===================================================getting passed data=====*/
67 |
68 |
69 | /*===== Created Data =======================================================*/
70 | var [promised, setpromised] = useState(false);
71 | var [pendingBookingBus1, setpendingBooking] = useState([]);
72 | /*===== Created Data =======================================================*/
73 |
74 |
75 | /*===== Getting Data from database ======================================== */
76 | var scheduleBuses = [];
77 | useEffect(() => {
78 | // Getting Schedule Data
79 | const BusNode = rootReference.child("BusSchedule");
80 | BusNode.once("value").then(datasnap => {
81 | scheduleBuses = datasnap.val();
82 | }).then(readCountTxn => {
83 | var duppendingBookingBus = [];
84 | // Getting pending related data
85 | duppendingBookingBus = FilterBusSchedule(scheduleBuses, person.PhoneNumber);
86 | duppendingBookingBus = GetPending(duppendingBookingBus);
87 | setpendingBooking(duppendingBookingBus);
88 | setpromised(true);
89 | });
90 | }, [reload]);
91 | /*============================================== Getting Data from database===== */
92 |
93 |
94 |
95 |
96 |
97 | /*======================= Function to handle booked button ====================== */
98 | var tempBusSchedule = [];
99 | function deleteBooking(Bus) {
100 | console.log("Deleting", Bus);
101 | setpromised(false);
102 |
103 | var NewPendingNode = rootReference.child("BusSchedule/" + Bus.FireBaseIndex + "/Pending/" + Bus.pendingIndex);
104 | NewPendingNode.set([]).then(readCountTxn => {
105 | changeReload(!reload);
106 | });
107 | }
108 | /*======================= Function to handle booked button ====================== */
109 | if (promised == true) {
110 | navigation.setOptions({ headerShown: true });
111 | }
112 | else {
113 | navigation.setOptions({ headerShown: false });
114 | }
115 |
116 |
117 |
118 | return (
119 |
120 | {
121 | promised ?
122 |
123 |
124 | index.toString()}
126 | data={pendingBookingBus1}
127 | renderItem={({ item }) => (
128 |
129 | )}
130 | />
131 |
132 |
133 | :
134 |
135 | }
136 |
137 | );
138 | }
139 | export default BookingPending;
--------------------------------------------------------------------------------
/Screen/Booking/BookingSeats.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect, useContext } from 'react';
2 | import { View, Button, Text, Image, ScrollView, TouchableOpacity, StyleSheet } from 'react-native';
3 |
4 | // Styles
5 | import { GlobalBackgroundColors, globalShadowBox, primaryButton, GlobalBackgroundTextColors } from '../../Styles/global';
6 | //Components
7 | import Seat from '../../assets/Images/seats';
8 | // Data
9 | import LoginContext from '../../Context/LoginContext';
10 | import Wait from '../wait';
11 | import { GetSingleBus, GetAllSeats, updatePendingSeats } from '../../Functions';
12 | /**
13 | * Data passed from BookingBuses.js
14 | * Bus:{Arrival, ArrivalTime, BusID, BusStandard, Date, Day, DepartureTime, Destination, Price}
15 | * person: {Name,Password,PhoneNumber}
16 | */
17 |
18 |
19 |
20 |
21 |
22 | /* ======================= Bus Detail Component Goes Here ============================================== */
23 | function BusDetailCar(props) {
24 | var { Bus } = props;
25 | return (
26 |
27 | {/* Bus Detail */}
28 |
29 | {Bus.Price}
30 |
31 | {Bus.Arrival}
32 |
33 | {Bus.Destination}
34 |
35 |
36 | {Bus.DepartureTime}
37 | {Bus.ArrivalTime}
38 |
39 |
40 | {/* Seats */}
41 |
42 | )
43 | }
44 |
45 | function SeatInfo() {
46 | return (
47 |
48 |
49 |
50 |
51 |
52 | Male
53 |
54 |
55 |
56 |
57 |
58 | Female
59 |
60 |
61 |
62 |
63 |
64 | Booked
65 |
66 |
67 | );
68 | }
69 |
70 | function FullSeat(props) {
71 | // Initial Daa
72 | var { color, seatsHandler, seatID } = props;
73 | // Seat Color
74 | var [seatColor, seatColorChange] = useState(color);
75 | // Disable color or not
76 | var disable = false;
77 | if (color == -1)
78 | disable = true;
79 |
80 | function pressHandler() {
81 | seatsHandler(seatColor, seatID, seatColorChange);
82 | }
83 | return (
84 | pressHandler()} style={[styles.SeatContainer, globalShadowBox, { width: 40, height: 40, marginBottom: 10 }]}>
85 |
86 |
87 | );
88 | }
89 | /* ======================= Bus Detail Component Goes Here ============================================== */
90 |
91 |
92 |
93 |
94 |
95 |
96 | function BookingSeats({ navigation, route }) {
97 |
98 |
99 | /*==================== Getting Data ============================================ */
100 | var { Bus, person } = route.params;
101 | const { rootReference, firebase } = useContext(LoginContext);
102 | /*==================== PAssed Data ============================================= */
103 |
104 | /*==================== Created Data ============================================ */
105 | var [Error, setError] = useState("");
106 | var selectedData = [];
107 | var [selectedBus, setSelectedBus] = useState(Bus);
108 | // var BusSeatData = Bus;
109 | var [Booked, setBooked] = useState([]);
110 | var [promise, setPromise] = useState(false);
111 | /*==================== Created Data =============================================*/
112 |
113 |
114 |
115 |
116 |
117 |
118 | /*======================= Getting the data of busschedule ======================= */
119 | var tempraryBusSchedule = [];
120 | React.useEffect(() => {
121 | const unsubscribe = navigation.addListener('focus', () => {
122 | const BusScheduleNode = rootReference.child("BusSchedule"); // Getting the city reference
123 | BusScheduleNode.once("value").then(datasnap => {
124 | tempraryBusSchedule = datasnap.val();
125 | }).then(readCountTxn => { // When the propmise to get the city is made
126 | var single = GetSingleBus(Bus, tempraryBusSchedule,person.PhoneNumber);
127 | var tempBooked = GetAllSeats(single);
128 | setSelectedBus(single);
129 | setBooked(tempBooked);
130 | console.log("Woooo =>",single,tempBooked)
131 | setPromise(true);
132 | })
133 | });
134 | return unsubscribe;
135 | }, [navigation]);
136 | /*======================= Getting the data of busschedule ======================= */
137 |
138 |
139 |
140 |
141 |
142 | /*======================= Function to handle booked button ====================== */
143 | var tempBusSchedule = [];
144 | function bookSeat() {
145 | if(selectedData.length==0)
146 | {
147 | setError("Please select the seats");
148 | return;
149 | }
150 |
151 | setPromise(false);
152 | setError("");
153 | const CitiesNode = rootReference.child("BusSchedule/" + selectedBus.FireBaseIndex + "/Pending"); // Getting the Busschedule
154 | CitiesNode.once("value").then(datasnap => {
155 | tempBusSchedule = datasnap.val();
156 | }).then(readCountTxn => { // updating
157 | var temp = updatePendingSeats(tempBusSchedule, person.PhoneNumber, selectedData);
158 | var { userIndex, seats } = temp;
159 | var NewBookedNode = null;
160 |
161 | if (userIndex == -1) {
162 | NewBookedNode = rootReference.child("BusSchedule/" + selectedBus.FireBaseIndex + "/Pending");
163 | NewBookedNode.set(seats).then(readCountTxn => {
164 | setPromise(true);
165 | selectedBus.pendingIndex=seats.length-1;
166 | navigation.navigate("TicketDetailScreen", { Bus: selectedBus, selectedData, person });
167 | });
168 | }
169 | else {
170 | NewBookedNode = rootReference.child("BusSchedule/" + selectedBus.FireBaseIndex + "/Pending/" + userIndex + "/seats");
171 | NewBookedNode.set([...seats]).then(readCountTxn => {
172 | setPromise(true);
173 | navigation.navigate("TicketDetailScreen", { Bus: selectedBus, selectedData, person });
174 | });
175 | }
176 | })
177 | }
178 | /*======================= Function to handle booked button ====================== */
179 |
180 |
181 |
182 |
183 |
184 | /*==================== Function to handle seat that is selected ==================*/
185 | var seatsHandler = (seatColor, seatID, seatColorChange) => {
186 | var found = false;
187 | selectedData = selectedData.filter((item) => {
188 | if (item.seatID == seatID) {
189 | found = true;
190 | if (seatColor == 2) //If seat color is black
191 | {
192 | item.Gender = 0;
193 | seatColorChange(0);
194 | return item;
195 | }
196 | else if (seatColor == 0) {
197 | item.Gender = 1;
198 | seatColorChange(1);
199 | return item;
200 | }
201 | else if (seatColor == 1) {
202 | seatColorChange(2);
203 |
204 | }
205 | }
206 | else {
207 | return item;
208 | }
209 | });
210 |
211 | if (found == false) {
212 | selectedData.push({ seatID, Gender: 0 });
213 | seatColorChange(0);
214 | }
215 | }
216 | /*==================== Function to handle seat that is selected ==================*/
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 | /* creating component of seats and applying colours on them ===================== */
228 | var BusSeatDataComponent = [];
229 |
230 | for (var i = 1; i <= selectedBus.TotalSeats; i++) {
231 | var marginRight = 0;
232 | var newLine = false;
233 | if ((i - 1) % 4 == 0) {
234 | BusSeatDataComponent.push();
235 | newLine = true;
236 | }
237 | if ((i + 1) % 2 == 0 && newLine == false) {
238 | BusSeatDataComponent.push()
239 | }
240 | if (Booked.includes(i)) {
241 | BusSeatDataComponent.push()
242 | }
243 | else {
244 | BusSeatDataComponent.push()
245 | }
246 | newLine = false;
247 | }
248 | /* creating component of seats and applying colours on them ===================== */
249 |
250 |
251 |
252 | if (promise == true) {
253 | navigation.setOptions({ headerShown: true });
254 | }
255 | else {
256 | navigation.setOptions({ headerShown: false });
257 | }
258 |
259 |
260 |
261 |
262 | return (
263 |
264 | { promise ?
265 |
266 |
267 |
268 | {/* Seats Goes Here */}
269 |
270 |
271 | {Error}
272 |
273 |
274 | {/* Seats*/}
275 |
276 |
277 | {BusSeatDataComponent}
278 |
279 |
280 |
281 |
282 | {/* Butons */}
283 |
284 | bookSeat()} style={[primaryButton, { marginLeft: 'auto', marginRight: 'auto' }]}>Book Now
285 |
286 |
287 |
288 |
289 | :
290 |
291 | }
292 |
293 | );
294 | }
295 |
296 | const styles = StyleSheet.create({
297 | SeatContainer: {
298 | backgroundColor: GlobalBackgroundColors.ternaryColor,
299 | padding: 5,
300 | width: '100%',
301 | height: '100%',
302 | borderRadius: 10
303 | }
304 | });
305 | export default BookingSeats;
--------------------------------------------------------------------------------
/Screen/Complain/Complain.js:
--------------------------------------------------------------------------------
1 | import React, { useState,useContext } from 'react';
2 | import { View, Button, Text, Image, StyleSheet, TextInput, ScrollView, TouchableOpacity } from 'react-native';
3 | import RadioForm, { RadioButton, RadioButtonInput, RadioButtonLabel } from 'react-native-simple-radio-button';
4 | import Textarea from 'react-native-textarea';
5 | // Importing Components
6 | import ComplainModal from '../../Components/Modals/ComplainModal';
7 | import SimpleContainer from '../../Components/Containers/SimpleContainer';
8 | import Wait from '../wait';
9 | import LoginContext from '../../Context/LoginContext';
10 | // Importing Styles
11 | import { globalShadowBox, GlobalBackgroundColors, GlobalBackgroundTextColors, primaryButton } from '../../Styles/global';
12 |
13 |
14 |
15 |
16 |
17 | /*================================== Inner Component ======================================================================== */
18 | function Radio(props) {
19 | var radio_props = [
20 | { label: 'Suggestion', value: 'Suggestion' },
21 | { label: 'Complain', value: 'Complain' }
22 | ];
23 |
24 |
25 | return (
26 |
27 |
28 | {
29 | radio_props.map((obj, i) => (
30 |
31 | props.changeRadioData(obj.value)}
36 | borderWidth={1}
37 |
38 | buttonSize={15}
39 | buttonOuterSize={15}
40 | buttonInnerColor={obj.value === props.radioData ? GlobalBackgroundColors.primaryColor : 'white'}
41 | buttonOuterColor={GlobalBackgroundTextColors.textBoxColor}
42 |
43 | />
44 | props.changeRadioData(obj.value)}
49 | labelStyle={{ fontSize: 15, color: GlobalBackgroundTextColors }}
50 | labelWrapStyle={{ marginLeft: 5 }}
51 | />
52 |
53 | ))
54 | }
55 |
56 | );
57 | }
58 | /*================================== Inner Cmponent ======================================================================== */
59 |
60 |
61 |
62 |
63 |
64 | function Complain({ navigation,route }) {
65 |
66 | var {person}=route.params;
67 | // Context
68 | const { rootReference} = useContext(LoginContext);
69 | // Radio related datagoes here
70 | var [radioData, changeRadioData] = useState('Suggestion');
71 | // Modal Data goes here
72 | var [iscomplainVisible, complainVisibleChange] = useState(false);
73 | // TextInput Data goes here
74 | var [textInput, changeTextInput] = useState('');
75 | // Promise
76 | var [promise, setPromise] = useState(true);
77 | // Error
78 | var [error, setError] = useState('');
79 |
80 |
81 | // Function goes here
82 | const ErrorHandler=()=>{
83 | setError("Please Enter the digit greater then or equal to 10");
84 | }
85 | const ComplainDone = () => {
86 | if (textInput.length <= 10) {
87 | ErrorHandler();
88 | return;
89 | }
90 | else
91 | {
92 | setPromise(false);
93 | var allComplains=null;
94 | var complainNode=rootReference.child(radioData);
95 | complainNode.once("value").then(datasnap => {
96 | allComplains = datasnap.val();
97 | }).then(readCountTxn => {
98 | allComplains=[...allComplains,{PhoneNumber:person.PhoneNumber,Message:textInput}];
99 |
100 | var updateNode = rootReference.child(radioData);
101 | updateNode.set(allComplains).then(readCountTxn => {
102 | setPromise(true);
103 | complainVisibleChange(true);
104 | });
105 | });
106 | }
107 | }
108 |
109 | const messageReceived = () => {
110 | navigation.navigate("HomeScreen");
111 | }
112 |
113 |
114 |
115 | if (promise == true) {
116 | navigation.setOptions({ headerShown: true });
117 | }
118 | else {
119 | navigation.setOptions({ headerShown: false });
120 | }
121 |
122 |
123 | // Return goes here
124 | return (
125 |
126 | {
127 | promise ?
128 |
129 | {/* Complain */}
130 |
131 |
132 |
133 |
134 |
135 | {error}
136 |
137 |
138 |
148 |
149 |
150 |
151 | ComplainDone()} >
152 | Submit
153 |
154 |
155 |
156 | :
157 |
158 | }
159 |
160 |
161 |
162 | );
163 | }
164 |
165 | const styles = StyleSheet.create({
166 | stretch: {
167 | width: 120,
168 | height: 120,
169 | marginBottom: 30,
170 | marginTop: 30,
171 | marginLeft: 'auto',
172 | marginRight: 'auto'
173 | },
174 | textInputStyle: {
175 | width: '100%',
176 | height: '100%',
177 | borderBottomColor: '#B7B7B7',
178 | borderBottomWidth: 1,
179 | paddingLeft: 30
180 | },
181 | container: {
182 | padding: 0,
183 | justifyContent: 'center',
184 | alignItems: 'center',
185 | },
186 | textareaContainer: {
187 | height: 180,
188 | padding: 5,
189 | backgroundColor: 'white',
190 | },
191 | textarea: {
192 | textAlignVertical: 'top', // hack android
193 | height: 170,
194 | fontSize: 14,
195 | color: '#333',
196 | },
197 | })
198 | export default Complain;
--------------------------------------------------------------------------------
/Screen/Home/Home.js:
--------------------------------------------------------------------------------
1 | import React, { useContext } from 'react';
2 | import { View, Button, Text, StyleSheet, ScrollView, TouchableOpacity, Image } from 'react-native';
3 | // Importing styles
4 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, globalShadowBox } from '../../Styles/global';
5 | // Importing components
6 | import HomeButtom from '../../Components/Component/HomeScreen/HomeButtonComponent';
7 | import Icon from 'react-native-vector-icons/Ionicons';
8 | import BookBusIcon from '../../assets/Images/HomeLogo/safety-seat';
9 | import BookingIcon from '../../assets/Images/HomeLogo/cart';
10 | import TicketsIcon from '../../assets/Images/HomeLogo/tickets';
11 | import RefundIcon from '../../assets/Images/HomeLogo/refund';
12 | import ComplaintIcon from '../../assets/Images/HomeLogo/complaint';
13 | import ProfileIcon from '../../assets/Images/profile';
14 |
15 | // Importing Container
16 | import SimpleContainer from '../../Components/Containers/SimpleContainer';
17 | // Contex
18 | import LoginContext from '../../Context/LoginContext';
19 |
20 |
21 |
22 | // Faltu
23 | import Carousele from '../../Components/Component/HomeScreen/HomeCarousel';
24 |
25 | function Slider() {
26 | return (
27 |
28 |
29 |
30 | );
31 | }
32 |
33 |
34 |
35 | function Home({ route, navigation }) {
36 |
37 | /*===== Getting the passed data====================================================*/
38 | let { person } = route.params;
39 | const { LoginStateHandler } = useContext(LoginContext);
40 | /*===== Getting the passed data====================================================*/
41 |
42 |
43 |
44 |
45 |
46 | return (
47 |
48 |
49 | } BottomLeftText={person.Name} bottomRightLink={() => LoginStateHandler("Logout")} BottomRightText="Logout">
50 | {/* Profile */}
51 |
52 | {/* Profile Person Detail */}
53 |
54 |
55 |
56 | {person.Name}
57 | {person.PhoneNumber}
58 |
59 |
60 |
61 | {/* Options */}
62 |
63 |
64 | navigation.navigate("BookingDestinationScreen", { person })} iconName="ios-lock" title="Book Seat">
65 |
66 |
67 | navigation.navigate("BookingPendingScreen", { person })} iconName="ios-lock" title="My Booking">
68 |
69 |
70 |
71 |
72 | navigation.navigate("PurchasedTicketScreen", { person })} iconName="ios-lock" title="My Ticket">
73 |
74 |
75 |
76 |
77 | navigation.navigate("PurchasedTicketScreen", { person })} iconName="ios-lock" title="Refund">
78 |
79 |
80 | navigation.navigate("ComplaintScreen", { person })} iconName="ios-lock" title="Complain">
81 |
82 |
83 |
84 |
85 |
86 |
87 | );
88 | }
89 |
90 |
91 |
92 |
93 |
94 |
95 | const styles = StyleSheet.create({
96 | userInfoContainer:
97 | {
98 | backgroundColor: GlobalBackgroundColors.ternaryColor,
99 | width: '90%',
100 | flexDirection: 'row',
101 | marginLeft: 'auto',
102 | marginRight: 'auto',
103 | marginTop: -30,
104 | paddingLeft: 10,
105 | borderBottomColor: GlobalBackgroundColors.primaryColor,
106 | borderBottomWidth: 5,
107 | borderTopLeftRadius: 30,
108 | borderTopEndRadius: 30
109 | },
110 | menueContinerStyle: {
111 | flexDirection: 'row',
112 | justifyContent: 'space-around',
113 | marginTop: 15,
114 | },
115 | bottomLink: {
116 | color: GlobalBackgroundColors.secondaryColor,
117 | fontWeight: 'bold'
118 | },
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | item: {
128 | borderWidth: 2,
129 | backgroundColor: 'white',
130 | flex: 1,
131 | borderRadius: 5,
132 | borderColor: 'white',
133 | elevation: 3
134 | },
135 | imageBackground: {
136 | flex: 2,
137 | backgroundColor: '#EBEBEB',
138 | borderWidth: 5,
139 | borderColor: 'white'
140 | },
141 | rightTextContainer: {
142 | marginLeft: 'auto',
143 | marginRight: -2,
144 | backgroundColor: 'rgba(49, 49, 51,0.5)',
145 | padding: 3,
146 | marginTop: 3,
147 | borderTopLeftRadius: 5,
148 | borderBottomLeftRadius: 5
149 | },
150 | rightText: { color: 'white' },
151 | lowerContainer: {
152 | flex: 1,
153 | margin: 10
154 | },
155 | titleText: {
156 | fontWeight: 'bold',
157 | fontSize: 18
158 | },
159 | contentText: {
160 | fontSize: 12
161 | }
162 | })
163 | export default Home;
--------------------------------------------------------------------------------
/Screen/Login/Login.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useState, useEffect } from 'react';
2 | import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3 | import ion from 'react-native-vector-icons/Ionicons';
4 | // Component
5 | import LoginContainer from '../../Components/Containers/loginContainer';
6 | import GlobalInput from '../../Components/Component/InputComponent';
7 | // Contex
8 | import LoginContext from '../../Context/LoginContext';
9 | // Data
10 | import { LoginDetail } from '../../Data/Data';
11 | // Styles
12 | import { GlobalBackgroundTextColors } from '../../Styles/global';
13 | // Importing icon
14 | import ProfileIcon from '../../assets/Images/Icons/propfile';
15 | import PasswordIcon from '../../assets/Images/Icons/password';
16 | import Wait from '../wait';
17 |
18 |
19 | function Login({ route, navigation }, props) {
20 |
21 | /*====== Passed Data ============================================== */
22 | const { LoginStateHandler, rootReference } = useContext(LoginContext);
23 | /*====== Passed Data ============================================== */
24 |
25 |
26 | /*====== UseStateData ====================================== */
27 | const [loginId, setLoginId] = useState("");
28 | const [password, setPassword] = useState("");
29 | const [error, setError] = useState("");
30 | const [promise, setPromise] = useState(false);
31 | var [persons, setPerson] = useState([]);
32 | /*========================================UseStateData ===== */
33 |
34 |
35 |
36 | var tempPerson = [];
37 | useEffect(() => {
38 | const LoginNode = rootReference.child("PersonDetail");
39 | LoginNode.once("value").then(datasnap => {
40 | tempPerson = datasnap.val();
41 | }).then(readCountTxn => {
42 | setPerson(tempPerson);
43 | setPromise(true);
44 | })
45 | }, []);
46 |
47 |
48 |
49 | /*===== Important Function ====================================== */
50 | // When the login button is pressed then this button is clicked
51 | function checkLogin() {
52 | var ismatch = false;
53 | var loggedPerson = null;
54 | persons.map(person => {
55 | if (person.PhoneNumber == loginId && person.Password == password) {
56 | loggedPerson = person;
57 | ismatch = true;
58 | return;
59 | }
60 | });
61 |
62 | if (ismatch === true) {
63 | LoginStateHandler(loggedPerson, rootReference);
64 | }
65 | else {
66 | setError("Invalid User Name or Password");
67 | }
68 | }
69 | /*===== Important Function ====================================== */
70 |
71 |
72 |
73 | return (
74 |
75 | {
76 | promise ?
77 | navigation.navigate("LoginRegister",{persons})} mainButtonText="Login" mainButtonLink={() => checkLogin()}>
78 |
79 | {error}
80 |
81 |
82 |
83 | navigation.navigate("LoginReset", {persons})}>Forget Password
84 |
85 |
86 | :
87 |
88 | }
89 |
90 | );
91 | }
92 | export default Login;
--------------------------------------------------------------------------------
/Screen/Login/LoginRegister.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useContext } from 'react';
2 | import { View, Text, ScrollView } from 'react-native';
3 | // Component
4 | import LoginContainer from '../../Components/Containers/loginContainer';
5 | import GlobalInput from '../../Components/Component/InputComponent';
6 | // Data
7 | import { LoginDetail } from '../../Data/Data';
8 | import ProfileIcon from '../../assets/Images/Icons/propfile';
9 | import PasswordIcon from '../../assets/Images/Icons/password';
10 | // Contex
11 | import LoginContext from '../../Context/LoginContext';
12 | import Wait from '../wait';
13 |
14 |
15 |
16 | function Register({ navigation, route }) {
17 |
18 | /*====== Passed data ====================================== */
19 | var { persons } = route.params;
20 | const { LoginStateHandler, rootReference } = useContext(LoginContext);
21 | /*====== Passed data ====================================== */
22 |
23 |
24 | /*====== UseStateData ====================================== */
25 | const [phone, setPhone] = useState("");
26 | const [password, setPassword] = useState("");
27 | const [name, setName] = useState("");
28 | const [error, setError] = useState("");
29 | const [promise, setPromise] = useState(true);
30 | /*========================================UseStateData ===== */
31 |
32 |
33 |
34 | /*===== Important Function ====================================== */
35 | function checkRegister() {
36 | if (password.length <= 5) {
37 | setError("Please enter password atleast greater then 5");
38 | return;
39 | }
40 | if (name.length == 0) {
41 | setError("Please enter yout name");
42 | return;
43 | }
44 | if (phone.length != 11) {
45 | setError("Please Enter 11 digit number");
46 | return;
47 | }
48 |
49 | var index = persons.findIndex(person => person.PhoneNumber == phone);
50 | if (index != -1) {
51 | setError("Number already exist in database.");
52 | return;
53 | }
54 |
55 |
56 | setPromise(false);
57 | var tempPerson = [];
58 | const LoginNode = rootReference.child("PersonDetail");
59 | LoginNode.once("value").then(datasnap => {
60 | tempPerson = datasnap.val();
61 | }).then(readCountTxn => {
62 | tempPerson = [...tempPerson, { Name: name, Password: password, PhoneNumber: phone }];
63 | var updateNode = rootReference.child("PersonDetail/");
64 | updateNode.set(tempPerson).then(readCountTxn => {
65 | setPromise(true);
66 | console.log(tempPerson);
67 | LoginStateHandler(tempPerson);
68 | });
69 | })
70 | }
71 | /*===== Important Function ====================================== */
72 |
73 |
74 |
75 | if (promise == true) {
76 | navigation.setOptions({ headerShown: true });
77 | }
78 | else {
79 | navigation.setOptions({ headerShown: false });
80 | }
81 |
82 | return (
83 |
84 | {promise ?
85 |
86 | navigation.navigate("Login")} mainButtonText="Verify" mainButtonLink={() => checkRegister()}>
87 |
88 | {error}
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | :
99 |
100 | }
101 |
102 | );
103 | }
104 | export default Register;
--------------------------------------------------------------------------------
/Screen/Login/LoginRegisterVerify.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useState } from 'react';
2 | import { View, Button, Text, TextInput, StyleSheet } from 'react-native';
3 | import ion from 'react-native-vector-icons/Ionicons';
4 | // Component
5 | import LoginContainer from '../../Components/Containers/loginContainer';
6 | import GlobalInput from '../../Components/Component/InputComponent';
7 | // Contex
8 | import LoginContext from '../../Context/LoginContext';
9 | // Data
10 | import { LoginDetail } from '../../Data/Data';
11 | import ProfileIcon from '../../assets/Images/Icons/propfile';
12 | import PasswordIcon from '../../assets/Images/Icons/password';
13 |
14 |
15 |
16 | function LoginRegisterVerify({ route, navigation }) {
17 | const { LoginStateHandler } = useContext(LoginContext);
18 |
19 |
20 | /*====== UseStateData ====================================== */
21 | const [pin, setPin] = useState("");
22 | const [error, setError] = useState("");
23 | /*========================================UseStateData ===== */
24 |
25 |
26 |
27 | /*===== Important Function ====================================== */
28 | // When the login button is pressed then this button is clicked
29 | function checkPin() {
30 |
31 | if (pin == 1) // Match (Temprary value)
32 | {
33 | var { phone, password, name } = route.params;
34 | LoginStateHandler({ Name: name, PhoneNumber: phone, Password: password });
35 | }
36 | else {
37 | setError("Invalid User Name or Password");
38 | }
39 | }
40 | /*===== Important Function ====================================== */
41 |
42 |
43 |
44 | return (
45 | navigation.navigate("Login")} mainButtonText="Register" mainButtonLink={() => checkPin()}>
46 |
47 | {error}
48 |
49 |
50 |
51 | );
52 | }
53 | export default LoginRegisterVerify;
--------------------------------------------------------------------------------
/Screen/Login/LoginReset.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useState } from 'react';
2 | import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3 | // Component
4 | import LoginContainer from '../../Components/Containers/loginContainer';
5 | import GlobalInput from '../../Components/Component/InputComponent';
6 | // Styles
7 | import { GlobalBackgroundTextColors } from '../../Styles/global';
8 | import ProfileIcon from '../../assets/Images/Icons/propfile';
9 | import PasswordIcon from '../../assets/Images/Icons/password';
10 |
11 |
12 |
13 | function LoginReset({ navigation,route }) {
14 |
15 |
16 | /*====== Passed Data ================================================= */
17 | var {persons} =route.params;
18 | /*====== Passed Data ================================================= */
19 |
20 |
21 | /*====== UseStateData ================================================= */
22 | const [phone, setPhone] = useState("");
23 | const [error, setError] = useState("");
24 | /*========================================UseStateData ================ */
25 |
26 |
27 |
28 | /*===== Important Function ====================================== */
29 | function checkPhoneNo() {
30 | var index=-1;
31 | index=persons.findIndex(person=> person.PhoneNumber == phone);
32 | console.log(index,persons);
33 | if (index!=-1) {
34 | navigation.navigate("LoginResetNew", { phone: phone,persons,personIndex:index });
35 | }
36 | else {
37 | setError("Number is not register");
38 | }
39 | }
40 | /*===== Important Function ====================================== */
41 |
42 |
43 |
44 | return (
45 | navigation.navigate("LoginRegister")} mainButtonText="Verify" mainButtonLink={() => checkPhoneNo()}>
46 |
47 | {error}
48 |
49 |
50 |
51 |
52 | );
53 | }
54 | export default LoginReset;
--------------------------------------------------------------------------------
/Screen/Login/LoginResetNew.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useState } from 'react';
2 | import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3 | import ion from 'react-native-vector-icons/Ionicons';
4 | // Component
5 | import LoginContainer from '../../Components/Containers/loginContainer';
6 | import GlobalInput from '../../Components/Component/InputComponent';
7 | // Contex
8 | import LoginContext from '../../Context/LoginContext';
9 | // Data
10 | import { LoginDetail } from '../../Data/Data';
11 | // Styles
12 | import { GlobalBackgroundTextColors } from '../../Styles/global';
13 | import ProfileIcon from '../../assets/Images/Icons/propfile';
14 | import PasswordIcon from '../../assets/Images/Icons/password';
15 | import Wait from '../wait';
16 |
17 |
18 |
19 | function LoginResetNew({ route, navigation }) {
20 |
21 | /*====== Passed data ====================================== */
22 | const { LoginStateHandler,rootReference } = useContext(LoginContext);
23 | var { persons, phone, personIndex } = route.params;
24 | /*====== Passed data ====================================== */
25 |
26 |
27 | /*====== UseStateData ====================================== */
28 | var [pin, setPin] = useState("");
29 | var [password, setPassword] = useState("");
30 | var [error, setError] = useState("");
31 | var [promise, setPromise] = useState(true);
32 | /*========================================UseStateData ===== */
33 |
34 |
35 |
36 | /*===== Important Function ====================================== */
37 | // When the login button is pressed then this button is clicked
38 | function checkReset() {
39 | if (pin == 1) {
40 |
41 | if(password.length<=5)
42 | {
43 | setError("Please enter password atleast greater then 5");
44 | return;
45 | }
46 |
47 |
48 | setPromise(false);
49 | var tempPerson=persons[personIndex];
50 | tempPerson.Password=password;
51 |
52 | var updateNode = rootReference.child("PersonDetail/"+personIndex);
53 | updateNode.set(tempPerson).then(readCountTxn => {
54 | setPromise(true);
55 | LoginStateHandler(tempPerson);
56 | });
57 | }
58 | else {
59 | setError("Invalid Pin (Temprary is 1)");
60 | }
61 | }
62 | /*===== Important Function ====================================== */
63 |
64 |
65 | if (promise == true) {
66 | navigation.setOptions({ headerShown: true });
67 | }
68 | else {
69 | navigation.setOptions({ headerShown: false });
70 | }
71 |
72 |
73 |
74 | return (
75 |
76 | {
77 | promise ?
78 | navigation.navigate("Login")} mainButtonText="Reset" mainButtonLink={() => checkReset()}>
79 |
80 | {error}
81 |
82 |
83 |
84 | navigation.navigate("LoginReset")}>Try Again
85 |
86 |
87 | :
88 |
89 | }
90 |
91 | );
92 | }
93 | export default LoginResetNew;
--------------------------------------------------------------------------------
/Screen/Ticket/TicketDetail.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useContext, useEffect } from 'react';
2 | import { View, Button, Text, ScrollView, Image, TouchableOpacity, FlatList } from 'react-native';
3 | // Importing Syles
4 | import { GlobalBackgroundColors, GlobalBackgroundTextColors, primaryButton, globalShadowBox } from '../../Styles/global';
5 | // Modals
6 | import AccountModel from '../../Components/Modals/TicketPurchasingAccountModal';
7 | import PurchasedDoneModel from '../../Components/Modals/TicketPurchasingDoneModal';
8 | import Wait from '../wait';
9 | // Contex
10 | import LoginContext from '../../Context/LoginContext';
11 |
12 |
13 |
14 |
15 |
16 | // Main function goes here
17 | function TicketDetail({ navigation, route }) {
18 |
19 |
20 |
21 | /*============================= Data passed ====================================================== */
22 | var { selectedData = false, person = false } = route.params; // When passed by params
23 | const { LoginStateHandler, rootReference } = useContext(LoginContext);
24 | /*============================= Data passed ====================================================== */
25 |
26 |
27 | /*============================= Created Data ===================================================== */
28 | var [Bus, setBus] = useState(route.params.Bus)
29 | /*============================= Created Data ===================================================== */
30 |
31 |
32 | /*============================= Modfying data because of different screen ======================== */
33 | var tempBusPending = [];
34 | var tempBusBooked = [];
35 |
36 | useEffect(() => {
37 | if (selectedData != false) // If we are coming from seat selection
38 | {
39 |
40 | if (Bus.Pending != null) {
41 | Bus.Pending.map((Pending) => {
42 | if (Pending.PhoneNumber == person.PhoneNumber) {
43 | tempBusPending = Pending.seats;
44 | }
45 | })
46 | }
47 |
48 | if (Bus.Booked != null) {
49 | Bus.Booked.map((Pending) => {
50 | if (Pending.PhoneNumber == person.PhoneNumber) {
51 | tempBusBooked = Pending.seats;
52 | }
53 | })
54 | }
55 | tempBusPending = selectedData.concat(tempBusPending);
56 |
57 | var tempBus={...Bus};
58 | tempBus.Pending = tempBusPending;
59 | tempBus.Booked = tempBusBooked;
60 | setBus(tempBus);
61 | }
62 | console.log("Bus=>", Bus);
63 | },[])
64 | /*============================= Modfying data because of different screen ======================== */
65 |
66 |
67 | /*============================= My Data created ================================================== */
68 | var [promise, setPromise] = useState(true);
69 |
70 |
71 | var GenderDetail = ['Male', 'Female'];
72 | var amount = Bus.Price;
73 | var totalTicket = Bus.Pending.length;
74 | var totalamount = amount * totalTicket;
75 |
76 |
77 | // Modal Data
78 | let [isAccountVisible, setAccountVisible] = useState(false);
79 | let [accountNumber, setAccountNumber] = useState('');
80 | // Functions
81 | const AccountModalOkHandler = (setError) => {
82 | if (accountNumber.length != 11) {
83 | setError("Enter 11 digit number");
84 | return;
85 | }
86 |
87 | // Geting new Booked seats
88 | setPromise(false);
89 | var newBookedSeats = [];
90 | var updateNode = null;
91 | var tempraryBusSchedule = [];
92 | console.log(Bus);
93 |
94 | if (Bus.bookedIndex == -1) // Means there is no booking for the user so we have to gett all the booking and then insert the booking o user as well
95 | {
96 | newBookedSeats=[{PhoneNumber:person.PhoneNumber,seats:[...Bus.Pending]}];
97 |
98 | Node = rootReference.child("BusSchedule/"+Bus.FireBaseIndex); // Getting the city reference
99 | Node.once("value").then(datasnap => {
100 | tempraryBusSchedule = datasnap.val();
101 | }).then(readCountTxn => { // When the propmise to get the city is made
102 | if(tempraryBusSchedule.Booked!=null)
103 | tempraryBusSchedule.Booked=[...tempraryBusSchedule.Booked,{"PhoneNumber":person.PhoneNumber,"seats":Bus.Pending}];
104 | else
105 | tempraryBusSchedule.Booked=[{"PhoneNumber":person.PhoneNumber,"seats":Bus.Pending}];
106 |
107 | console.log(tempraryBusSchedule.Booked);
108 |
109 | Node = rootReference.child("BusSchedule/" + Bus.FireBaseIndex + "/Booked");
110 | Node.set([...tempraryBusSchedule.Booked]).then(readCountTxn => {
111 | Node = rootReference.child("BusSchedule/" + Bus.FireBaseIndex + "/Pending/"+Bus.pendingIndex);
112 | Node.set([]).then(readCountTxn => {
113 | setPromise(true);
114 | setAccountVisible(false);
115 | setPurchasedDoneVisible(true);
116 | });
117 | });
118 | })
119 |
120 | }
121 | else {
122 | updateNode = rootReference.child("BusSchedule/" + Bus.FireBaseIndex + "/Booked/"+Bus.bookedIndex+'/seats');
123 | updateNode.set([...Bus.Pending,...Bus.Booked]).then(readCountTxn => {
124 | updateNode = rootReference.child("BusSchedule/" + Bus.FireBaseIndex + "/Pending/"+Bus.pendingIndex);
125 | updateNode.set([]).then(readCountTxn => {
126 | setPromise(true);
127 | setAccountVisible(false);
128 | setPurchasedDoneVisible(true);
129 | });
130 | });
131 | }
132 | }
133 | const AccountCancelHandler = () => {
134 | setAccountVisible(false);
135 | }
136 |
137 |
138 | let [isPurchasedDoneVisible, setPurchasedDoneVisible] = useState(false);
139 | const PurchaseDoneHandler = () => {
140 | setPurchasedDoneVisible(false);
141 | navigation.navigate("HomeScreen");
142 | }
143 | /*============================= My Data created ================================================== */
144 |
145 |
146 | return (
147 |
148 | {promise ?
149 |
150 |
151 |
152 |
153 | {/* Models */}
154 | AccountCancelHandler()} setAccountNumber={setAccountNumber} />
155 |
156 |
157 |
158 |
159 |
160 | {/* Tickets */}
161 |
162 | {/* Tickets detail container*/}
163 |
164 | {/* Header */}
165 |
166 |
167 |
168 |
169 |
170 |
171 | {Bus.Arrival}
172 |
173 | {Bus.Destination}
174 |
175 |
176 | {Bus.DepartureTime}
177 |
178 |
179 |
180 |
181 |
182 | {Bus.ArrivalTime}
183 |
184 |
185 |
186 |
187 |
188 |
189 | {/* Body */}
190 |
191 |
192 | Name
193 | Date
194 |
195 |
196 | {person.Name}
197 | {Bus.Day}, {Bus.Date}
198 |
199 |
200 | Information
201 |
202 |
203 | SeatNo
204 | Gender
205 |
206 |
207 | {console.log(Bus.Pending)}
208 | index.toString()}
210 | data={Bus.Pending}
211 | renderItem={({ item }) =>
212 | (
213 |
214 | {item.seatID}
215 | {GenderDetail[item.Gender]}
216 |
217 | )}
218 | />
219 |
220 |
221 | Total Amount
222 | {totalamount}
223 |
224 | {/* Just a line*/}
225 |
226 |
227 |
228 |
229 |
230 | {/* Buttons */}
231 |
232 | setAccountVisible(true)} >Purchase Ticket
233 | navigation.navigate('HomeScreen')} >Go to home
234 |
235 |
236 |
237 |
238 | :
239 |
240 | }
241 |
242 | );
243 | }
244 | export default TicketDetail;
--------------------------------------------------------------------------------
/Screen/Ticket/TicketPurchased.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useEffect, useState } from 'react';
2 | import { View, Button, Text, FlatList, TouchableOpacity, ScrollView } from 'react-native';
3 | // Imorting Data
4 | import { purchasedTicket } from '../../Data/Data';
5 | import TicketIcon from '../../assets/Images/HomeLogo/tickets';
6 | // Importing styles
7 | import { globalShadowBox, GlobalBackgroundColors, GlobalBackgroundTextColors, primaryButton } from '../../Styles/global';
8 | // Contex
9 | import LoginContext from '../../Context/LoginContext';
10 | // Scrren
11 | import WaitScreen from '../wait';
12 | // Importing functions
13 | import { GetBooked, FilterBusSchedule } from '../../Functions';
14 |
15 |
16 | // Ticket Component
17 | function Ticket(props) {
18 | var { Bus, selectedData, person, navigation } = props;
19 | return (
20 |
21 | {/* Ticket Header */}
22 |
23 |
24 | {person.Name}
25 |
26 |
27 | {/* Route detail */}
28 |
29 | {/* Title */}
30 |
31 | Date
32 | Time
33 |
34 |
35 | {Bus.Day}, {Bus.Date}
36 | {Bus.DepartureTime}
37 |
38 |
39 |
40 | {/* Total Price */}
41 |
42 | {/* Title */}
43 |
44 | Price
45 | {selectedData.length * Bus.Price}
46 |
47 |
48 |
49 | {/* Burtton */}
50 | navigation.navigate("RefundTicketScreen", { Bus, person, selectedData })}>Refund
51 |
52 | );
53 | }
54 |
55 |
56 |
57 |
58 |
59 | function BookingPending({ navigation, route }) {
60 |
61 |
62 | /* ===== Getting passed data ========================================================================== */
63 | var { person } = route.params;
64 | const { rootReference } = useContext(LoginContext);
65 | /* ============================================================================Getting passed data===== */
66 |
67 |
68 |
69 | /*===== Vreated Data ================================================================================== */
70 | var [promised, setpromised] = useState(false);
71 | var [purchasedTicket1, setPurchasedTicket] = useState([]);
72 | /*===== Vreated Data ================================================================================== */
73 |
74 |
75 |
76 | /*===== Getting Data from database ======================================== */
77 | // var allPurchasedTicket = [];
78 | // useEffect(() => {
79 | // // Getting Schedule Data
80 | // const BusNode = rootReference.child("BusSchedule");
81 | // BusNode.once("value").then(datasnap => {
82 | // allPurchasedTicket = datasnap.val();
83 | // }).then(readCountTxn => {
84 | // var dupPurchasedTicket = [];
85 | // dupPurchasedTicket =GetPurchaseTicket(allPurchasedTicket,person.PhoneNumber);
86 | // // Getting pending related data
87 | // setPurchasedTicket(dupPurchasedTicket);
88 | // setpromised(true);
89 | // });
90 | // }, []); // Use Effect Ends
91 | /*============================================== Getting Data from database===== */
92 |
93 |
94 |
95 | /*===== Getting Data from database ======================================== */
96 | var scheduleBuses = [];
97 | useEffect(() => {
98 | // Getting Schedule Data
99 | const BusNode = rootReference.child("BusSchedule");
100 | BusNode.once("value").then(datasnap => {
101 | scheduleBuses = datasnap.val();
102 | }).then(readCountTxn => {
103 | var duppendingBookingBus = [];
104 | // Getting pending related data
105 | duppendingBookingBus = FilterBusSchedule(scheduleBuses, person.PhoneNumber);
106 | duppendingBookingBus = GetBooked(duppendingBookingBus);
107 | setPurchasedTicket(duppendingBookingBus);
108 | setpromised(true);
109 | });
110 | }, []);
111 | /*============================================== Getting Data from database===== */
112 |
113 |
114 |
115 |
116 | if (promised == true) {
117 | navigation.setOptions({ headerShown: true });
118 | }
119 | else {
120 | navigation.setOptions({ headerShown: false });
121 | }
122 |
123 |
124 | return (
125 |
126 | {
127 | promised ?
128 |
129 | index.toString()}
131 | data={purchasedTicket1}
132 | renderItem={({ item }) => (
133 |
134 | )}
135 | />
136 |
137 | :
138 |
139 | }
140 |
141 | );
142 | }
143 | export default BookingPending;
--------------------------------------------------------------------------------
/Screen/Ticket/TicketPurchasedRefund.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { View, Button, Text,TouchableOpacity } from 'react-native';
3 |
4 | // Importing Modal
5 | import RefundModal from '../../Components/Modals/TicketPurchasedRefundModal';
6 | import Input from '../../Components/Component/InputComponent';
7 | // Importing styles
8 | import { GlobalBackgroundColors,primaryButton } from '../../Styles/global';
9 |
10 |
11 |
12 |
13 |
14 | {/* />
15 | Ticket Purchased Refund
16 | setModalVisible(true)} /> */}
17 | function TicketPurchasedRefund({ navigation, route }) {
18 | console.log(route.params);
19 | // Function goes here
20 |
21 | const purchaseDone = () => {
22 | setModalVisible(false);
23 | navigation.navigate('HomeScreen');
24 | }
25 | // Data goes here
26 | var [isModalVisible, setModalVisible] = useState(false);
27 | var [mobileNo, changeMobileNo] = useState('');
28 | return (
29 |
30 | purchaseDone()} />
31 | Please Enter the Jazz Cash mobile number for refund
32 |
33 | setModalVisible(true)}>Refund
34 |
35 | );
36 | }
37 | export default TicketPurchasedRefund;
--------------------------------------------------------------------------------
/Screen/wait.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Text, View, ImageBackground,ActivityIndicator } from 'react-native';
3 |
4 | function Wait() {
5 | return (
6 |
7 |
8 |
9 |
10 | waiting....
11 |
12 |
13 |
14 | )
15 | }
16 | export default Wait;
--------------------------------------------------------------------------------
/ScreenShot/book seat.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/ScreenShot/book seat.PNG
--------------------------------------------------------------------------------
/ScreenShot/home.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/ScreenShot/home.PNG
--------------------------------------------------------------------------------
/ScreenShot/login.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/ScreenShot/login.PNG
--------------------------------------------------------------------------------
/ScreenShot/select bus.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/ScreenShot/select bus.PNG
--------------------------------------------------------------------------------
/Styles/global.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {StyleSheet} from 'react-native';
3 |
4 |
5 |
6 |
7 |
8 | // Colors Goes Here
9 | const GlobalBackgroundColors=
10 | {
11 | primaryColor:"#5641B6", // Blue Color for background
12 | secondaryColor:"#FB8549", // Orange color for buttons and inner links
13 | ternaryColor:"#FFFFFF", // White Color
14 | }
15 | const GlobalBackgroundTextColors=
16 | {
17 | primaryColor:"#FFFFFF", // White color (used over blue one)
18 | secondaryColor:"#FFFFFF", // White color (over yellow)
19 | ternaryColor:"black", // black color (used with text box)
20 | textBoxColor:"#585858" // Text color
21 | }
22 |
23 |
24 |
25 |
26 |
27 | // Styles goes here
28 | const primaryButton=
29 | {
30 | backgroundColor:(GlobalBackgroundColors.secondaryColor),
31 | height:30,
32 | width:150,
33 | borderRadius:50,
34 | textAlign:'center',
35 | justifyContent:'center',
36 | color:'white',
37 | marginLeft:'auto',
38 | marginRight:'auto',
39 | shadowColor: "#000",
40 | shadowOffset: {
41 | width: 0,
42 | height: 1,
43 | },
44 | shadowOpacity: 0.60,
45 | shadowRadius: 1.61,
46 | elevation: 2,
47 | }
48 |
49 | const globalShadowBox={
50 | shadowColor: "#B4B4B4",
51 | shadowOffset: {
52 | width: 0,
53 | height: 6,
54 | },
55 | shadowOpacity: 0.39,
56 | shadowRadius: 8.30,
57 |
58 | elevation: 13,
59 | }
60 |
61 |
62 | const FontFamily={
63 | TitleFont:
64 | {
65 | // fontFamily:'Teko',
66 | fontWeight:'bold',
67 | fontSize:50,
68 | letterSpacing:5
69 | },
70 | NormalFont:{
71 | // fontFamily:'RussoOne'
72 | }
73 | }
74 |
75 |
76 |
77 |
78 | export {GlobalBackgroundColors,GlobalBackgroundTextColors,primaryButton,globalShadowBox,FontFamily}
--------------------------------------------------------------------------------
/anchor-coursel/carousel.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import {
3 | Animated,
4 | StyleSheet,
5 | Dimensions,
6 | ViewPropTypes,
7 | FlatList
8 | } from 'react-native';
9 | import PropTypes from 'prop-types';
10 |
11 | const { width } = Dimensions.get('window');
12 |
13 | const styles = StyleSheet.create({
14 | container: {},
15 | itemContainer: { justifyContent: 'center' },
16 | button: {}
17 | });
18 |
19 | const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
20 |
21 | class Carousel extends Component {
22 | constructor(props) {
23 | super(props);
24 | this.scrollToIndex = this.scrollToIndex.bind(this);
25 | this.itemAnimatedStyles = this.itemAnimatedStyles.bind(this);
26 | this.renderItemContainer = this.renderItemContainer.bind(this);
27 | this.handleOnScrollBeginDrag = this.handleOnScrollBeginDrag.bind(this);
28 | this.handleOnScrollEndDrag = this.handleOnScrollEndDrag.bind(this);
29 | this.getItemLayout = this.getItemLayout.bind(this);
30 | this.initialize();
31 | this.setScrollHandler();
32 | }
33 |
34 | initialize() {
35 | const {
36 | itemWidth,
37 | separatorWidth,
38 | data,
39 | containerWidth,
40 | initialIndex
41 | } = this.props;
42 | this.currentIndex = initialIndex;
43 | this.scrollXBegin = 0;
44 | this.xOffset = new Animated.Value(0);
45 | this.halfContainerWidth = containerWidth / 2;
46 | this.halfItemWidth = itemWidth / 2;
47 | }
48 |
49 | setScrollHandler() {
50 | this.handleOnScroll = Animated.event(
51 | [{ nativeEvent: { contentOffset: { x: this.xOffset } } }],
52 | {
53 | useNativeDriver: true,
54 | listener: (event) => {
55 | this.scrollX = event.nativeEvent.contentOffset.x;
56 | }
57 | }
58 | );
59 | }
60 |
61 | scrollToIndex(index) {
62 | const { onScrollEnd, data, itemWidth, separatorWidth } = this.props;
63 | if (index < 0 || index >= data.length) return;
64 | onScrollEnd(data[index], index);
65 | this.currentIndex = index;
66 | setTimeout(() => {
67 | this._scrollView.getNode().scrollToOffset({
68 | offset:
69 | index * (itemWidth + separatorWidth) +
70 | this.halfItemWidth -
71 | this.halfContainerWidth,
72 | animated: true
73 | });
74 | });
75 | }
76 | handleOnScrollBeginDrag() {
77 | const { onScrollBeginDrag } = this.props;
78 | onScrollBeginDrag && onScrollBeginDrag();
79 | this.scrollXBegin = this.scrollX;
80 | }
81 | l;
82 | handleOnScrollEndDrag() {
83 | const { minScrollDistance, onScrollEndDrag } = this.props;
84 | onScrollEndDrag && onScrollEndDrag();
85 | if (this.scrollX < 0) {
86 | return;
87 | }
88 | let scrollDistance = this.scrollX - this.scrollXBegin;
89 | this.scrollXBegin = 0;
90 | if (Math.abs(scrollDistance) < minScrollDistance) {
91 | this.scrollToIndex(this.currentIndex);
92 | return;
93 | }
94 | scrollDistance < 0
95 | ? this.scrollToIndex(this.currentIndex - 1)
96 | : this.scrollToIndex(this.currentIndex + 1);
97 | }
98 |
99 | itemAnimatedStyles(index) {
100 | const {
101 | data,
102 | inActiveScale,
103 | inActiveOpacity,
104 | itemWidth,
105 | separatorWidth,
106 | containerWidth
107 | } = this.props;
108 | const animatedOffset =
109 | index === 0
110 | ? this.halfItemWidth
111 | : index === data.length - 1
112 | ? containerWidth - this.halfItemWidth
113 | : this.halfContainerWidth;
114 | const midPoint =
115 | index * (itemWidth + separatorWidth) +
116 | this.halfItemWidth -
117 | animatedOffset;
118 | const startPoint =
119 | index === 1
120 | ? 0
121 | : index === data.length - 1
122 | ? (data.length - 2) * (itemWidth + separatorWidth) +
123 | this.halfItemWidth -
124 | this.halfContainerWidth
125 | : midPoint - itemWidth - separatorWidth;
126 | const endPoint =
127 | index === 0
128 | ? itemWidth +
129 | separatorWidth +
130 | this.halfItemWidth -
131 | this.halfContainerWidth
132 | : index === data.length - 2
133 | ? (data.length - 1) * (itemWidth + separatorWidth) +
134 | itemWidth -
135 | containerWidth
136 | : midPoint + itemWidth + separatorWidth;
137 |
138 | const animatedOpacity = {
139 | opacity: this.xOffset.interpolate({
140 | inputRange: [startPoint, midPoint, endPoint],
141 | outputRange: [inActiveOpacity, 1, inActiveOpacity]
142 | })
143 | };
144 |
145 | const animatedScale = {
146 | transform: [
147 | {
148 | scale: this.xOffset.interpolate({
149 | inputRange: [startPoint, midPoint, endPoint],
150 | outputRange: [inActiveScale, 1, inActiveScale]
151 | })
152 | }
153 | ]
154 | };
155 |
156 | return { ...animatedOpacity, ...animatedScale };
157 | }
158 |
159 | renderItemContainer({ item, index }) {
160 | const {
161 | data,
162 | renderItem,
163 | inverted,
164 | itemWidth,
165 | separatorWidth,
166 | itemContainerStyle
167 | } = this.props;
168 | let marginWidth = index !== data.length - 1 ? separatorWidth : 0;
169 | let marginStyle = !!inverted
170 | ? { marginLeft: marginWidth }
171 | : { marginRight: marginWidth };
172 | return (
173 |
183 | {renderItem({ item, index })}
184 |
185 | );
186 | }
187 | getItemLayout(data, index) {
188 | const {itemWidth,separatorWidth}=this.props;
189 | return {
190 | offset:index * (itemWidth + separatorWidth) +
191 | this.halfItemWidth -
192 | this.halfContainerWidth,
193 | length: itemWidth,
194 | index
195 | };
196 | }
197 |
198 | render() {
199 | const {
200 | data,
201 | bounces,
202 | style,
203 | itemWidth,
204 | containerWidth,
205 | initialIndex,
206 | keyExtractor,
207 | ...otherProps
208 | } = this.props;
209 | return (
210 | (this._scrollView = ref)}
219 | renderItem={this.renderItemContainer}
220 | style={[styles.container, { width: containerWidth }, style]}
221 | showsHorizontalScrollIndicator={false}
222 | initialScrollIndex={initialIndex}
223 | onScrollBeginDrag={this.handleOnScrollBeginDrag}
224 | onScroll={this.handleOnScroll}
225 | onScrollEndDrag={this.handleOnScrollEndDrag}
226 | getItemLayout={this.getItemLayout}
227 | //scrollEnabled//snapToInterval={itemWidth}
228 | />
229 | );
230 | }
231 | }
232 |
233 | Carousel.propTypes = {
234 | // style: ViewPropTypes.style,
235 | bounces: PropTypes.bool,
236 | itemWidth: PropTypes.number,
237 | separatorWidth: PropTypes.number,
238 | containerWidth: PropTypes.number,
239 | // itemContainerStyle: ViewPropTypes.style,
240 | inActiveScale: PropTypes.number,
241 | inActiveOpacity: PropTypes.number,
242 | keyExtractor: PropTypes.func,
243 | renderItem: PropTypes.func,
244 | onScrollEnd: PropTypes.func,
245 | pagingEnable: PropTypes.bool,
246 | initialIndex: PropTypes.number,
247 | minScrollDistance: PropTypes.number,
248 | onScrollBeginDrag: PropTypes.func,
249 | onScrollEndDrag: PropTypes.func,
250 | data: PropTypes.arrayOf(PropTypes.object)
251 | //itemHeight: PropTypes.number,
252 | //containerHeight: PropTypes.number,
253 | };
254 |
255 | Carousel.defaultProps = {
256 | inActiveScale: 0.8,
257 | inActiveOpacity: 0.8,
258 | separatorWidth: 0,
259 | containerWidth: width,
260 | itemWidth: 0.9 * width,
261 | bounces: true,
262 | data: [],
263 | style: {},
264 | initialIndex: 0,
265 | pagingEnable: true,
266 | minScrollDistance: 25,
267 | itemContainerStyle: {},
268 | keyExtractor: (item, index) => index.toString(),
269 | renderItem: () => {},
270 | onScrollEnd: () => {},
271 | onScrollBeginDrag: () => {},
272 | onScrollEndDrag: () => {}
273 | //containerHeight: 200
274 | //itemHeight: 0.2 * height - 20,
275 | };
276 | export default Carousel;
277 |
--------------------------------------------------------------------------------
/anchor-coursel/index.js:
--------------------------------------------------------------------------------
1 | import Carousel from './carousel';
2 |
3 | export default Carousel;
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "FinalProject",
4 | "slug": "FinalProject",
5 | "version": "1.0.0",
6 | "orientation": "portrait",
7 | "icon": "./assets/icon.png",
8 | "splash": {
9 | "image": "./assets/splash.png",
10 | "resizeMode": "contain",
11 | "backgroundColor": "#ffffff"
12 | },
13 | "updates": {
14 | "fallbackToCacheTimeout": 0
15 | },
16 | "assetBundlePatterns": [
17 | "**/*"
18 | ],
19 | "ios": {
20 | "supportsTablet": true
21 | },
22 | "android": {
23 | "adaptiveIcon": {
24 | "foregroundImage": "./assets/adaptive-icon.png",
25 | "backgroundColor": "#FFFFFF"
26 | }
27 | },
28 | "web": {
29 | "favicon": "./assets/favicon.png"
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/assets/Images/BusLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/BusLogo.png
--------------------------------------------------------------------------------
/assets/Images/BusLogo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/BusLogo1.png
--------------------------------------------------------------------------------
/assets/Images/BusTicketLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/BusTicketLogo.png
--------------------------------------------------------------------------------
/assets/Images/Buses/Image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/Buses/Image1.jpg
--------------------------------------------------------------------------------
/assets/Images/Buses/Image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/Buses/Image2.jpg
--------------------------------------------------------------------------------
/assets/Images/Buses/Image3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/Buses/Image3.jpg
--------------------------------------------------------------------------------
/assets/Images/Calender.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/Calender.png
--------------------------------------------------------------------------------
/assets/Images/HomeLogo/complaint.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Svg, { Path,G,Circle } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var {width=30,height=30}=props;
6 | return (
7 |
153 | )
154 | }
155 |
156 | export default SvgComponent
157 |
--------------------------------------------------------------------------------
/assets/Images/HomeLogo/refund.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Svg ,{Path,G} from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var {width=30,height=30}=props;
6 | return (
7 |
83 | )
84 | }
85 |
86 | export default SvgComponent
87 |
--------------------------------------------------------------------------------
/assets/Images/HomeLogo/safety-seat.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Svg ,{Path} from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var {width=30,height=30}=props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/HomeLogo/tickets.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Svg ,{Path,G} from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var {width=30,height=30}=props;
6 | return (
7 |
76 | )
77 | }
78 |
79 | export default SvgComponent
80 |
--------------------------------------------------------------------------------
/assets/Images/Icons/Arrival.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
19 | )
20 | }
21 |
22 | export default SvgComponent
23 |
--------------------------------------------------------------------------------
/assets/Images/Icons/Date.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/Icons/DropDown.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
15 | )
16 | }
17 |
18 | export default SvgComponent
19 |
--------------------------------------------------------------------------------
/assets/Images/Icons/Left.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
15 | )
16 | }
17 |
18 | export default SvgComponent
19 |
--------------------------------------------------------------------------------
/assets/Images/Icons/Right.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/Icons/bin.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 |
3 | function SvgComponent(props) {
4 | return (
5 |
16 | )
17 | }
18 | export default SvgComponent;
--------------------------------------------------------------------------------
/assets/Images/Icons/close.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/Icons/password.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/Icons/propfile.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/Icons/search.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
18 | )
19 | }
20 |
21 | export default SvgComponent
22 |
--------------------------------------------------------------------------------
/assets/Images/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/background.jpg
--------------------------------------------------------------------------------
/assets/Images/clock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/clock.png
--------------------------------------------------------------------------------
/assets/Images/log.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/Images/log.png
--------------------------------------------------------------------------------
/assets/Images/profile.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import Svg, { Path, Defs, Pattern, Image } from 'react-native-svg';
3 |
4 | function SvgComponent(props) {
5 | var { width = 30, height = 30 } = props;
6 | return (
7 |
24 | )
25 | }
26 |
27 | export default SvgComponent
28 |
--------------------------------------------------------------------------------
/assets/Images/seats.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Svg ,{Path} from 'react-native-svg';
3 |
4 | /**
5 | *
6 | * {color=(-1=noaction(default), 0=male, 1=female, 2=purchased)
7 | * width={100%(default)}
8 | * height={100%(default)}
9 | * }
10 | */
11 | function SvgComponent(props) {
12 | var {color=-1,width='100%',height='100%'}=props;
13 | var fill='#AFADAD'; // Purchased
14 |
15 | if(color==0) // Male
16 | fill='#5641B6';
17 | else if(color==1)
18 | fill='#FB8549'; // Female
19 | else if(color==2)
20 | fill='black'; // Not selected
21 |
22 | return (
23 |
34 | )
35 | }
36 |
37 | export default SvgComponent
38 |
--------------------------------------------------------------------------------
/assets/fonts/RussoOne-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/RussoOne-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Teko-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/Teko-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Teko-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/Teko-Light.ttf
--------------------------------------------------------------------------------
/assets/fonts/Teko-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/Teko-Medium.ttf
--------------------------------------------------------------------------------
/assets/fonts/Teko-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/Teko-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Teko-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/assets/fonts/Teko-SemiBold.ttf
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ['babel-preset-expo'],
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | // Coneection to your firebase data goes here
2 | export const firebaseConfig={
3 | apiKey: "",
4 | authDomain: "",
5 | databaseURL: "",
6 | projectId: "",
7 | storageBucket: "",
8 | messagingSenderId: "",
9 | appId: "",
10 | measurementId: ""
11 | };
--------------------------------------------------------------------------------
/debug.log:
--------------------------------------------------------------------------------
1 | [1213/210313.941:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
2 | [1216/072034.224:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
3 | [1218/064159.168:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
4 | [1219/112013.808:ERROR:crash_report_database_win.cc(455)] unexpected header
5 | [1219/112052.343:ERROR:crash_report_database_win.cc(455)] unexpected header
6 | [1219/114343.078:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
7 | [1227/233056.318:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
8 | [0101/104024.945:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "node_modules/expo/AppEntry.js",
3 | "scripts": {
4 | "start": "expo start",
5 | "android": "expo start --android",
6 | "ios": "expo start --ios",
7 | "web": "expo start --web",
8 | "eject": "expo eject"
9 | },
10 | "dependencies": {
11 | "@react-native-community/masked-view": "0.1.10",
12 | "@react-native-picker/picker": "^1.9.4",
13 | "@react-navigation/native": "^5.8.10",
14 | "@react-navigation/stack": "^5.12.8",
15 | "expo": "~39.0.2",
16 | "expo-status-bar": "~1.0.2",
17 | "firebase": "^8.2.1",
18 | "react": "16.13.1",
19 | "react-dom": "16.13.1",
20 | "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
21 | "react-native-carousel-control": "^2.0.1",
22 | "react-native-gesture-handler": "~1.7.0",
23 | "react-native-linear-gradient": "^2.5.6",
24 | "react-native-modal": "^11.6.1",
25 | "react-native-reanimated": "^1.13.2",
26 | "react-native-safe-area-context": "3.1.4",
27 | "react-native-screens": "~2.10.1",
28 | "react-native-simple-radio-button": "^2.7.4",
29 | "react-native-snap-carousel": "^3.9.1",
30 | "react-native-svg": "^12.1.0",
31 | "react-native-textarea": "^1.0.4",
32 | "react-native-vector-icons": "^7.1.0",
33 | "react-native-web": "~0.13.12"
34 | },
35 | "devDependencies": {
36 | "@babel/core": "~7.9.0"
37 | },
38 | "private": true
39 | }
40 |
--------------------------------------------------------------------------------
/react-native.config.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MentorUsama/ReactNativeTicketBooking/fd205b22ac084077f8fe1a9a0869a59f3f04e034/react-native.config.js
--------------------------------------------------------------------------------