diff --git a/App.js b/App.js
index d0c5f6d..89aedf5 100644
--- a/App.js
+++ b/App.js
@@ -8,8 +8,12 @@ import Login from "./Screens/Auth/Login";
import ClientProfile from "./Screens/Profile/ClientProfile";
import LawyerProfile from "./Screens/Profile/LawyerProfile";
import SetupLawyerProfile from "./Screens/Profile/SetupLawyerProfile";
+import AdminProfile from "./Screens/Profile/AdminProfile";
+import ChatEntry from "./Screens/Chat/ChatEntry";
+import ChatImpl from "./Screens/Chat/ChatImpl";
import Fire from './Fire';
import CaseSearch from "./Screens/Cases/CaseSearch";
+import LawyerAuth from "./Screens/Admin/LawyerAuth";
//import CaseList from "./Screens/Cases/CaseList";
import ClientCases from "./Screens/Cases/ClientCases";
import EditClientProfile from "./Screens/Profile/EditClientProfile";
@@ -61,6 +65,12 @@ const MainStack = createStackNavigator({
SignUp: {
screen: SignUp
},
+ AdminTabNav: {
+ screen: AdminProfile
+ },
+ LawyerAuth: {
+ screen: LawyerAuth
+ },
SetupLawyerProfile: {
screen: SetupLawyerProfile
},
diff --git a/Screens/Admin/LawyerAuth.js b/Screens/Admin/LawyerAuth.js
new file mode 100644
index 0000000..ac8d2a3
--- /dev/null
+++ b/Screens/Admin/LawyerAuth.js
@@ -0,0 +1,322 @@
+import React, { Component } from 'react';
+import {
+ View, Text, Button, TextInput, TouchableOpacity,
+ Image, Dimensions, Alert, FlatList, Keyboard, TouchableWithoutFeedback, Linking
+} from 'react-native';
+import Modal from "react-native-modal";
+import * as firebase from 'firebase';
+
+const { width, height } = Dimensions.get('window');
+export default class LawyerAuth extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ isModalVisible: false,
+ lawyerName: '',
+ lawyerId: '',
+ avail: '',
+ bar: '',
+ email: '',
+ experience: '',
+ firm: '',
+ location: '',
+ phoneNumber: '',
+ radius: '',
+ lawyersLoaded: false,
+ lawyers: []
+ };
+ this.fetchLawyers();
+ }
+
+
+ _toggleModal = () => {
+ this.setState({isModalVisible: !this.state.isModalVisible});
+ };
+
+ _authorize = () => {
+ const {lawyerId} = this.state;
+ firebase.database().ref('lawyerProfiles/' + lawyerId + '/authorized').set(true);
+ this.fetchLawyers();
+ this._toggleModal();
+ }
+
+ _deny = () => {
+ const {lawyerId} = this.state;
+ firebase.database().ref('lawyerProfiles/' + lawyerId).remove();
+ this.fetchLawyers();
+ this._toggleModal();
+ }
+
+ render() {
+ const {isModalVisible, lawyerName, lawyerId, avail, bar, email, experience, firm, location, phoneNumber, radius, lawyersLoaded, lawyers} = this.state;
+ if (lawyersLoaded)
+ return (
+
+
+
+
+
+
+
+ {this.mainScreen()}
+
+
+
+
+
+ Lawyer Name:
+ {lawyerName}
+
+ Email:
+ {email}
+
+ Phone Number:
+ {phoneNumber}
+
+ Firm:
+ {firm}
+
+ Bar:
+ {bar}
+
+ Experience:
+ {experience}
+
+ Location:
+ {location}
+
+ Radius:
+ {radius}
+
+ Availability:
+ {avail}
+
+
+
+
+
+
+
+
+ );
+ else
+ return (
+
+ {this.loadingScreen()}
+
+ );
+ }
+
+ renderListItem(item) {
+ return (
+ {
+ this.setState({
+ lawyerName: item.fullName,
+ lawyerId: item.lawyer,
+ avail: item.avail,
+ bar: item.bar,
+ email: item.email,
+ experience: item.experience,
+ firm: item.firm,
+ location: item.location,
+ phoneNumber: item.phoneNumber,
+ radius: item.radius
+ });
+ this._toggleModal();
+ }}>
+ {item.fullName}
+
+ );
+ }
+
+ fetchLawyers = () => {
+ let user = firebase.auth().currentUser;
+ let lawyers = firebase.database().ref("lawyerProfiles/");
+ let stateVar = this;
+ let lawyerArr = [];
+ lawyers.once('value', function (snapshot) {
+ let obj = snapshot.val();
+ for (let lawyer in obj) {
+ if (obj[lawyer].authorized == false) {
+ lawyerArr.push(obj[lawyer]);
+ lawyerArr[lawyerArr.length - 1].lawyer = lawyer;
+ }
+ console.log(lawyer);
+ }
+ stateVar.setState({lawyers: lawyerArr});
+ })
+ .then(() => {
+ this.setState({lawyersLoaded: true})
+ })
+ .catch((error) => {
+ Alert.alert("Lawyer Fetch Failed", error);
+ });
+
+
+ };
+
+
+
+ mainScreen = () => {
+ return (
+
+
+ item.lawyerName}
+ renderItem={({item}) => this.renderListItem(item)}
+ ItemSeparatorComponent={() => {
+ return ()
+ }}
+ />
+
+ )
+
+ };
+
+ loadingScreen = () => {
+ return (
+
+ Fetching Lawyers
+
+
+ )
+ };
+
+}
+
+const Jtheme = {
+
+ backgroundColor: '#112853',
+
+ BackButton: {
+ color: '#cc7832',
+ paddingLeft: 0,
+ paddingRight: 0,
+ paddingTop: 0,
+ paddingBottom: 100,
+ marginTop: -5,
+ position: 'absolute', // add if dont work with above
+ },
+
+ Button: {
+ color: '#cc7832',
+ paddingLeft: 70,
+ paddingRight: 70,
+ paddingTop: 10,
+ paddingBottom: 10,
+ },
+
+ Container: {
+ flex: 1,
+ color: '#cc7832',
+ backgroundColor: '#112853',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ borderColor: '#111111',
+ borderWidth: 1,
+ },
+
+ Input: {
+ flex: 1,
+ backgroundColor: '#111111',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ borderColor: '#111111',
+ borderWidth: 3,
+ paddingLeft: 50,
+ },
+
+ Text: {
+ fontWeight: 'bold',
+ flexDirection: 'column',
+ color: '#112853',
+ justifyContent: 'center',
+ fontSize: 20,
+ paddingTop: 5,
+ paddingLeft: 10,
+ paddingRight: 10,
+ borderTopWidth: 7,
+ borderBottomWidth: 3
+ },
+
+ InputText: {
+ fontWeight: 'bold',
+ flexDirection: 'column',
+ flex: .5,
+ color: '#112853',
+ justifyContent: 'center',
+ fontSize: 15,
+ paddingBottom: 5,
+ paddingLeft: 10,
+ paddingRight: 50,
+ },
+
+};
diff --git a/Screens/Admin/loadingGif.gif b/Screens/Admin/loadingGif.gif
new file mode 100644
index 0000000..237fa10
Binary files /dev/null and b/Screens/Admin/loadingGif.gif differ
diff --git a/Screens/Profile/AdminProfile.js b/Screens/Profile/AdminProfile.js
new file mode 100644
index 0000000..f75a34b
--- /dev/null
+++ b/Screens/Profile/AdminProfile.js
@@ -0,0 +1,110 @@
+import React, { Component } from 'react';
+import {View, Linking} from 'react-native';
+import * as firebase from 'firebase';
+import { SecureStore } from 'expo';
+import DataStorage from "../../DataStorage";
+import CaseSearch from "../Cases/CaseSearch";
+import {Button, Text, ThemeConsumer, ThemeProvider} from "react-native-elements";
+
+class AdminProfile extends Component {
+ render() {
+ return (
+
+ My Admin
+
+ )
+ }
+
+
+ _logout = () => {
+ firebase.auth().signOut();
+
+ // Delete SecureStore user and pass and replace with - as placeholder
+ SecureStore.getItemAsync('lastUser')
+ .then((user) => {
+ SecureStore.setItemAsync('lastUser', '-')
+ .then(() => {
+ SecureStore.setItemAsync('pass', '-')
+ .then(() => {
+ DataStorage.clearData();
+
+ const { navigate } = this.props.navigation;
+
+ navigate('Login');
+ })
+ })
+ })
+ }
+}
+
+export default AdminProfile;
+
+const Jtheme = {
+
+ backgroundColor: '#112853',
+
+ BackButton: {
+ color: '#cc7832',
+ paddingLeft: 0,
+ paddingRight: 0,
+ paddingTop: 0,
+ paddingBottom: 100,
+ marginTop: -5,
+ position: 'absolute', // add if dont work with above
+ },
+
+ Button: {
+ color: '#cc7832',
+ paddingLeft: 70,
+ paddingRight: 70,
+ paddingTop: 30,
+ paddingBottom: 30,
+ },
+
+ Container: {
+ flex: 1,
+ color: '#cc7832',
+ backgroundColor: '#112853',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ borderColor: '#111111',
+ borderWidth: 1,
+ },
+
+ Input: {
+ flex: 1,
+ backgroundColor: '#111111',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ borderColor: '#111111',
+ borderWidth: 3,
+ paddingLeft: 50,
+ },
+
+ Text: {
+ fontWeight: 'bold',
+ flexDirection: 'column',
+ color: '#112853',
+ justifyContent: 'center',
+ fontSize: 40,
+ paddingTop: 50,
+ paddingLeft: 50,
+ paddingRight: 50,
+ },
+
+ InputText: {
+ fontWeight: 'bold',
+ flexDirection: 'column',
+ color: '#112853',
+ justifyContent: 'center',
+ fontSize: 15,
+ paddingBottom: 30,
+ paddingLeft: 10,
+ paddingRight: 50,
+ },
+
+};
diff --git a/Screens/Profile/LawyerProfile.js b/Screens/Profile/LawyerProfile.js
index 383b89d..3c1a9c9 100644
--- a/Screens/Profile/LawyerProfile.js
+++ b/Screens/Profile/LawyerProfile.js
@@ -20,11 +20,25 @@ class LawyerProfile extends Component {
title={I18n.curLang.lawyer_profile.edit_profile}/>
-
)
}
+ _caseSearch = () => {
+ // check if authorized
+ const uid = firebase.auth().currentUser.uid;
+ let authorized = false;
+ firebase.database().ref('lawyerProfiles/' + uid).once('value', (snapshot) => {
+ auuthorized = snapshot.val().authorized;
+ if (!authorized) {
+ alert('Awaiting authorization')
+ }
+ else {
+ this.props.navigation.navigate('CaseSearch')
+ }
+ })
+ }
+
_openWhatsApp = () => {
if (Linking.canOpenURL('whatsapp://app')) {
Linking.openURL('whatsapp://app')
@@ -120,4 +134,4 @@ const Jtheme = {
paddingRight: 50,
},
-};
\ No newline at end of file
+};
diff --git a/Screens/Profile/SetupLawyerProfile.js b/Screens/Profile/SetupLawyerProfile.js
index c43ba24..1e45529 100644
--- a/Screens/Profile/SetupLawyerProfile.js
+++ b/Screens/Profile/SetupLawyerProfile.js
@@ -11,6 +11,7 @@ class SetupLawyerProfile extends Component {
constructor(props) {
super(props);
this.state = {
+ authorized: false,
exp: '',
bar: '',
firm: '',
@@ -112,11 +113,12 @@ class SetupLawyerProfile extends Component {
}
_submitChanges = () => {
- const {exp, bar, firm, location, radius, avail, expertise} = this.state;
+ const {exp, authorized, bar, firm, location, radius, avail, expertise} = this.state;
let userId = firebase.auth().currentUser.uid;
firebase.database().ref('lawyerProfiles/' + userId).update({
+ authorized: authorized,
experience: exp,
bar: bar,
firm: firm,
@@ -131,10 +133,11 @@ class SetupLawyerProfile extends Component {
};
_loadData = () => {
- let {exp, bar, firm, location, radius, avail, expertise, dataLoaded} = '';
+ let {authorized, exp, bar, firm, location, radius, avail, expertise, dataLoaded} = '';
let userId = firebase.auth().currentUser.uid;
firebase.database().ref('lawyerProfiles/' + userId).once('value',(snapshot) => {
let data = snapshot.val();
+ authorized = data.authorized;
exp = data.experience;
bar = data.bar;
firm = data.firm;