Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 16
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 16
22_23-J 16
Commits
0b0ad575
Commit
0b0ad575
authored
May 18, 2023
by
Ishini Kiridena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
button changes completed
parent
59b88213
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
340 additions
and
80 deletions
+340
-80
emma-frontend/App.js
emma-frontend/App.js
+36
-6
emma-frontend/components/patientscreens/allPractitioners.js
emma-frontend/components/patientscreens/allPractitioners.js
+28
-5
emma-frontend/components/patientscreens/nftRequests.js
emma-frontend/components/patientscreens/nftRequests.js
+5
-1
emma-frontend/components/patientscreens/patientMainChatView.js
...frontend/components/patientscreens/patientMainChatView.js
+5
-5
emma-frontend/components/patientscreens/patientMenu.js
emma-frontend/components/patientscreens/patientMenu.js
+8
-3
emma-frontend/components/patientscreens/registration/login.js
...-frontend/components/patientscreens/registration/login.js
+35
-3
emma-frontend/components/patientscreens/registration/regEight.js
...ontend/components/patientscreens/registration/regEight.js
+9
-5
emma-frontend/components/patientscreens/registration/regFour.js
...rontend/components/patientscreens/registration/regFour.js
+8
-4
emma-frontend/components/patientscreens/registration/regFourOptional.js
...components/patientscreens/registration/regFourOptional.js
+9
-5
emma-frontend/components/patientscreens/registration/regOne.js
...frontend/components/patientscreens/registration/regOne.js
+9
-5
emma-frontend/components/patientscreens/registration/regSeven.js
...ontend/components/patientscreens/registration/regSeven.js
+9
-6
emma-frontend/components/patientscreens/registration/regSix.js
...frontend/components/patientscreens/registration/regSix.js
+2
-3
emma-frontend/components/patientscreens/registration/regThree.js
...ontend/components/patientscreens/registration/regThree.js
+10
-6
emma-frontend/components/practitionerscreens/login.js
emma-frontend/components/practitionerscreens/login.js
+35
-3
emma-frontend/components/practitionerscreens/mainViewWithMenu.js
...ontend/components/practitionerscreens/mainViewWithMenu.js
+16
-4
emma-frontend/components/practitionerscreens/nft-view.js
emma-frontend/components/practitionerscreens/nft-view.js
+45
-2
emma-frontend/components/practitionerscreens/patientRequestsView.js
...end/components/practitionerscreens/patientRequestsView.js
+31
-4
emma-frontend/components/practitionerscreens/recievedNfts.js
emma-frontend/components/practitionerscreens/recievedNfts.js
+9
-4
emma-frontend/components/practitionerscreens/registration.js
emma-frontend/components/practitionerscreens/registration.js
+2
-1
emma-frontend/components/practitionerscreens/treatingPatients.js
...ontend/components/practitionerscreens/treatingPatients.js
+29
-5
No files found.
emma-frontend/App.js
View file @
0b0ad575
...
...
@@ -111,33 +111,63 @@ export default function App() {
<
Stack
.
Screen
name
=
"
PatientMainChatView
"
component
=
{
PatientMainChatView
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
All Practitioners
"
component
=
{
PatientAllPractitioners
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PatientNFTRequests
"
component
=
{
PatientNFTRequests
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PractitionerRegistration
"
component
=
{
PractitionerRegistration
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PractitionerMainView
"
component
=
{
PractitionerMainView
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PatientLogin
"
component
=
{
PatientLogin
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PatientRequests
"
component
=
{
PatientRequests
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PatientLogin
"
component
=
{
PatientLogin
}
/
>
<
Stack
.
Screen
name
=
"
PatientRequests
"
component
=
{
PatientRequests
}
/
>
<
Stack
.
Screen
name
=
"
PractitionerLogin
"
component
=
{
PractitionerLogin
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
TreatingPatients
"
component
=
{
TreatingPatients
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
ReceivedNFT
"
component
=
{
ReceivedNFT
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
NftView
"
component
=
{
NftView
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
PatientMainMenu
"
component
=
{
PatientMainMenu
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"
TreatingPatients
"
component
=
{
TreatingPatients
}
/
>
<
Stack
.
Screen
name
=
"
ReceivedNFT
"
component
=
{
ReceivedNFT
}
/
>
<
Stack
.
Screen
name
=
"
NftView
"
component
=
{
NftView
}
/
>
<
Stack
.
Screen
name
=
"
PatientMainMenu
"
component
=
{
PatientMainMenu
}
/
>
<
/Stack.Navigator
>
)
:
(
<
SplashScreenComponent
/>
...
...
emma-frontend/components/patientscreens/allPractitioners.js
View file @
0b0ad575
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
View
,
Text
,
StyleSheet
,
Button
}
from
"
react-native
"
;
import
{
View
,
Text
,
StyleSheet
,
Button
,
ActivityIndicator
,
}
from
"
react-native
"
;
import
{
LOCALBACKEND
}
from
"
../../env
"
;
import
AsyncStorage
from
"
@react-native-async-storage/async-storage
"
;
export
default
function
PatientAllPractitioners
({
navigation
,
router
})
{
const
[
data
,
setData
]
=
useState
([]);
const
[
stellarPublicKey
,
setStellarPublicKey
]
=
useState
(
""
);
const
[
isRequested
,
setRequested
]
=
useState
(
false
);
useEffect
(()
=>
{
fetchData
();
...
...
@@ -27,16 +34,21 @@ export default function PatientAllPractitioners({ navigation, router }) {
const
renderItem
=
(
item
)
=>
{
return
(
<
View
key
=
{
item
.
_id
}
>
<
View
style
=
{
styles
.
item
}
key
=
{
item
.
_id
}
>
<
Text
>
Full
Name
:
{
item
.
fullname
}
<
/Text
>
<
Text
>
Public
Key
:
{
item
.
publickey
}
<
/Text
>
<
Text
>
Workspace
:
{
item
.
workspace
}
<
/Text
>
<
Button
title
=
"
Request
"
onPress
=
{()
=>
handleRequest
(
item
)}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
Request
"
onPress
=
{()
=>
handleRequest
(
item
)}
/
>
<
/View
>
);
};
const
handleRequest
=
async
(
item
)
=>
{
setRequested
(
true
);
try
{
const
value
=
await
AsyncStorage
.
getItem
(
"
patientStellarPublicKey
"
);
if
(
value
!=
null
)
{
...
...
@@ -58,6 +70,7 @@ export default function PatientAllPractitioners({ navigation, router }) {
});
const
responseData
=
await
reqResponse
.
json
();
setRequested
(
false
);
}
catch
(
errorWhenSendingReqObj
)
{
console
.
log
(
"
Error when sending request to practitioner
"
);
}
...
...
@@ -69,24 +82,34 @@ export default function PatientAllPractitioners({ navigation, router }) {
"
Error fetching public key from async storage data:
"
,
errorWhenPublicKey
);
setRequested
(
false
);
}
// Handle the request for the specific item by requesting the practitioner
console
.
log
(
"
Requested:
"
,
item
);
};
return
(
<
View
style
=
{
styles
.
container
}
>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
<
/View
>
<
View
style
=
{
styles
.
container
}
>
{
isRequested
?
(
<
ActivityIndicator
size
=
"
large
"
color
=
"
#000
"
/>
)
:
(
<>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
<
/
>
)}
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
padding
:
20
,
},
text
:
{
fontSize
:
24
,
fontWeight
:
"
bold
"
,
},
item
:
{
padding
:
10
,
},
});
emma-frontend/components/patientscreens/nftRequests.js
View file @
0b0ad575
...
...
@@ -44,7 +44,11 @@ export default function PatientNFTRequests({ navigation }) {
return
(
<
View
key
=
{
item
.
_id
}
>
<
Text
>
Key
:
{
item
.
requesterpk
}
<
/Text
>
<
Button
title
=
"
Send NFT
"
onPress
=
{()
=>
handleSendNFT
(
item
)}
><
/Button
>
<
Button
color
=
"
#703BE7
"
title
=
"
Send NFT
"
onPress
=
{()
=>
handleSendNFT
(
item
)}
><
/Button
>
<
/View
>
);
};
...
...
emma-frontend/components/patientscreens/patientMainChatView.js
View file @
0b0ad575
...
...
@@ -44,9 +44,9 @@ export default function PatientMainChatView({ route }) {
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
alignItems
:
"
center
"
,
padding
:
10
}}
>
<
Text
style
=
{{
fontSize
:
20
,
marginLeft
:
10
}}
>
Chat
<
/Text
>
<
/View
>
<
View
style
=
{{
flexDirection
:
"
row
"
,
alignItems
:
"
center
"
,
padding
:
10
}}
>
<
/View
>
{
/* Chat messages */
}
<
View
style
=
{{
flex
:
1
,
padding
:
10
}}
>
{
chatMessages
.
map
((
msg
)
=>
(
...
...
@@ -81,7 +81,7 @@ export default function PatientMainChatView({ route }) {
<
/TouchableOpacity
>
<
/View
>
{
/* Bottom buttons
*/
}
{
/* Bottom buttons
<View
style={{
flexDirection: "row",
...
...
@@ -99,7 +99,7 @@ export default function PatientMainChatView({ route }) {
<TouchableOpacity onPress={navigateToOthers}>
<Text>Others</Text>
</TouchableOpacity>
<
/View
>
</View>
*/
}
<
/View
>
);
}
emma-frontend/components/patientscreens/patientMenu.js
View file @
0b0ad575
...
...
@@ -20,18 +20,23 @@ export default function PatientMainMenu({ navigation }) {
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
color
=
"
#703BE7
"
title
=
"
View Practitioners
"
onPress
=
{()
=>
handlePractitioners
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Chat
"
onPress
=
{()
=>
handleChatView
()}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
Chat
"
onPress
=
{()
=>
handleChatView
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
NFT requests
"
onPress
=
{()
=>
handleNftRequests
()}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
NFT requests
"
onPress
=
{()
=>
handleNftRequests
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Logout
"
onPress
=
{()
=>
handleLogout
()}
/
>
<
Button
color
=
"
red
"
title
=
"
Logout
"
onPress
=
{()
=>
handleLogout
()}
/
>
<
/View
>
<
/View
>
);
...
...
emma-frontend/components/patientscreens/registration/login.js
View file @
0b0ad575
import
React
,
{
useState
}
from
"
react
"
;
import
{
View
,
TextInput
,
Button
,
Alert
}
from
"
react-native
"
;
import
{
View
,
TextInput
,
Button
,
Alert
,
StyleSheet
}
from
"
react-native
"
;
import
{
LOCALBACKEND
}
from
"
../../../env
"
;
import
EncryptWithServerKey
from
"
../../../services/encryptByServerKey
"
;
...
...
@@ -37,19 +37,51 @@ export default function PatientLogin({ navigation, route }) {
};
return
(
<
View
>
<
View
style
=
{
styles
.
container
}
>
<
TextInput
style
=
{
styles
.
input
}
placeholder
=
"
Username
"
value
=
{
username
}
onChangeText
=
{
setUsername
}
/
>
<
TextInput
style
=
{
styles
.
input
}
placeholder
=
"
Password
"
value
=
{
password
}
onChangeText
=
{
setPassword
}
secureTextEntry
/>
<
Button
title
=
"
Login
"
onPress
=
{
handleLogin
}
/
>
<
Button
title
=
"
Login
"
onPress
=
{
handleLogin
}
color
=
"
#703BE7
"
/>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
justifyContent
:
"
center
"
,
},
input
:
{
width
:
"
80%
"
,
height
:
40
,
marginVertical
:
10
,
paddingHorizontal
:
10
,
borderColor
:
"
gray
"
,
borderWidth
:
1
,
borderRadius
:
5
,
},
button
:
{
width
:
"
80%
"
,
height
:
60
,
// Adjust the height value to make the button taller
backgroundColor
:
"
#560CCE
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
borderRadius
:
30
,
// Adjust the border radius value to make the edges rounder
marginTop
:
10
,
},
buttonText
:
{
color
:
"
white
"
,
fontSize
:
16
,
fontWeight
:
"
bold
"
,
},
});
emma-frontend/components/patientscreens/registration/regEight.js
View file @
0b0ad575
...
...
@@ -167,7 +167,7 @@ export default function PatientRegEight({ navigation, route }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
Highest
Education
Level
:
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
Highest
Education
Level
:
<
/Text
>
<
View
style
=
{
styles
.
separator
}
/
>
<
RadioForm
animation
=
{
true
}
>
{
educationLevelOptions
.
map
((
option
,
index
)
=>
(
...
...
@@ -201,7 +201,7 @@ export default function PatientRegEight({ navigation, route }) {
))}
<
/RadioForm
>
<
View
style
=
{
styles
.
separator
}
/
>
<
Text
>
Employed
:
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
Employed
:
<
/Text
>
<
View
style
=
{
styles
.
separator
}
/
>
<
RadioForm
animation
=
{
true
}
>
{
employedOptions
.
map
((
option
,
index
)
=>
(
...
...
@@ -235,7 +235,7 @@ export default function PatientRegEight({ navigation, route }) {
))}
<
/RadioForm
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
All Done
"
onPress
=
{
handleSave
}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
All Done
"
onPress
=
{
handleSave
}
color
=
"
#703BE7
"
/>
<
/View
>
<
/View
>
);
...
...
@@ -243,14 +243,18 @@ export default function PatientRegEight({ navigation, route }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
padding
:
16
,
justifyContent
:
"
center
"
,
},
buttonContainer
:
{
width
:
"
8
0%
"
,
width
:
"
10
0%
"
,
marginTop
:
10
,
},
separator
:
{
height
:
20
,
},
label
:
{
fontSize
:
16
,
marginBottom
:
8
,
},
});
emma-frontend/components/patientscreens/registration/regFour.js
View file @
0b0ad575
...
...
@@ -43,7 +43,7 @@ export default function PatientRegFour({ navigation, route }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
Did
you
grow
up
with
parents
?
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
Did
you
grow
up
with
parents
?
<
/Text
>
<
RadioForm
radio_props
=
{
radioOptions
}
initial
=
{
parentStatus
}
...
...
@@ -56,7 +56,7 @@ export default function PatientRegFour({ navigation, route }) {
style
=
{{
marginVertical
:
10
}}
/
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
/View
>
<
/View
>
);
...
...
@@ -64,11 +64,15 @@ export default function PatientRegFour({ navigation, route }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
padding
:
16
,
justifyContent
:
"
center
"
,
},
buttonContainer
:
{
width
:
"
8
0%
"
,
width
:
"
10
0%
"
,
marginTop
:
10
,
},
label
:
{
fontSize
:
16
,
marginBottom
:
8
,
},
});
emma-frontend/components/patientscreens/registration/regFourOptional.js
View file @
0b0ad575
...
...
@@ -21,7 +21,7 @@ export default function PatientRegFourOptional({ navigation, route }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
How
many
siblings
did
you
have
?
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
How
many
siblings
did
you
have
?
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{(
text
)
=>
setSiblingCount
(
text
)}
...
...
@@ -29,7 +29,7 @@ export default function PatientRegFourOptional({ navigation, route }) {
keyboardType
=
"
numeric
"
/>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
/View
>
<
/View
>
);
...
...
@@ -37,7 +37,7 @@ export default function PatientRegFourOptional({ navigation, route }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
padding
:
16
,
justifyContent
:
"
center
"
,
},
inputContainer
:
{
...
...
@@ -45,14 +45,18 @@ const styles = StyleSheet.create({
},
input
:
{
height
:
40
,
width
:
200
,
width
:
"
100%
"
,
borderColor
:
"
gray
"
,
borderWidth
:
1
,
paddingHorizontal
:
10
,
marginTop
:
20
,
},
buttonContainer
:
{
width
:
"
8
0%
"
,
width
:
"
10
0%
"
,
marginTop
:
20
,
},
label
:
{
fontSize
:
16
,
marginBottom
:
8
,
},
});
emma-frontend/components/patientscreens/registration/regOne.js
View file @
0b0ad575
import
React
,
{
useState
}
from
"
react
"
;
import
{
View
,
TextInput
,
Button
,
StyleSheet
,
TouchableHighlight
,
Text
}
from
"
react-native
"
;
import
{
View
,
TextInput
,
Button
,
StyleSheet
,
TouchableHighlight
,
Text
,
}
from
"
react-native
"
;
import
{
useNavigation
}
from
"
@react-navigation/native
"
;
export
default
function
PatientRegOne
()
{
...
...
@@ -39,10 +46,7 @@ export default function PatientRegOne() {
secureTextEntry
=
{
true
}
/
>
{
/* <Button title="Next" onPress={handleNext} color="#703BE7"/> */
}
<
TouchableHighlight
style
=
{
styles
.
button
}
onPress
=
{
handleNext
}
>
<
TouchableHighlight
style
=
{
styles
.
button
}
onPress
=
{
handleNext
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Next
<
/Text
>
<
/TouchableHighlight
>
<
/View
>
...
...
emma-frontend/components/patientscreens/registration/regSeven.js
View file @
0b0ad575
...
...
@@ -30,24 +30,24 @@ export default function PatientRegSeven({ navigation, route }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
Ethnicity
:
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
placeholder
=
"
Ethnicity
"
value
=
{
ethnicity
}
onChangeText
=
{
setEthnicity
}
maxLength
=
{
64
}
/
>
<
Text
>
Religion
:
<
/Text
>
<
TextInput
placeholder
=
"
Religion
"
style
=
{
styles
.
input
}
value
=
{
religion
}
onChangeText
=
{
setReligion
}
maxLength
=
{
64
}
/
>
<
Text
>
Nationality
:
<
/Text
>
<
TextInput
placeholder
=
"
Nationality
"
style
=
{
styles
.
input
}
value
=
{
nationality
}
onChangeText
=
{
setNationality
}
...
...
@@ -67,10 +67,13 @@ const styles = StyleSheet.create({
alignItems
:
"
center
"
,
},
input
:
{
borderWidth
:
1
,
width
:
"
80%
"
,
height
:
40
,
marginVertical
:
10
,
paddingHorizontal
:
10
,
borderColor
:
"
gray
"
,
marginBottom
:
10
,
marginTop
:
10
,
borderWidth
:
1
,
borderRadius
:
5
,
},
buttonContainer
:
{
width
:
"
80%
"
,
...
...
emma-frontend/components/patientscreens/registration/regSix.js
View file @
0b0ad575
...
...
@@ -53,7 +53,7 @@ export default function PatientRegSix({ navigation, route }) {
selectedButtonColor
=
{
"
#703BE7
"
}
/
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
/View
>
<
/View
>
);
...
...
@@ -63,7 +63,6 @@ const styles = StyleSheet.create({
container
:
{
flex
:
1
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
padding
:
20
,
},
label
:
{
...
...
@@ -71,7 +70,7 @@ const styles = StyleSheet.create({
marginBottom
:
10
,
},
buttonContainer
:
{
width
:
"
8
0%
"
,
width
:
"
10
0%
"
,
marginTop
:
10
,
},
});
emma-frontend/components/patientscreens/registration/regThree.js
View file @
0b0ad575
...
...
@@ -60,9 +60,13 @@ export default function PatientRegThree({ navigation, route }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
>
Date
of
Birth
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
Date
of
Birth
<
/Text
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Pick a date
"
onPress
=
{()
=>
setShowDatePicker
(
true
)}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
Pick a date
"
onPress
=
{()
=>
setShowDatePicker
(
true
)}
color
=
"
#703BE7
"
/>
<
/View
>
{
showDatePicker
&&
(
<
DateTimePicker
...
...
@@ -73,7 +77,7 @@ export default function PatientRegThree({ navigation, route }) {
/
>
)}
<
Text
>
Gender
<
/Text
>
<
Text
style
=
{
styles
.
label
}
>
Gender
<
/Text
>
<
RadioForm
radio_props
=
{
radioOptions
}
initial
=
{
0
}
...
...
@@ -86,7 +90,7 @@ export default function PatientRegThree({ navigation, route }) {
style
=
{{
marginVertical
:
10
}}
/
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
Button
title
=
"
Next
"
onPress
=
{
handleNext
}
color
=
"
#703BE7
"
/>
<
/View
>
<
/View
>
);
...
...
@@ -94,7 +98,7 @@ export default function PatientRegThree({ navigation, route }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
padding
:
16
,
justifyContent
:
"
center
"
,
},
input
:
{
...
...
@@ -134,7 +138,7 @@ const styles = StyleSheet.create({
color
:
"
#666
"
,
},
buttonContainer
:
{
width
:
"
8
0%
"
,
width
:
"
10
0%
"
,
marginTop
:
10
,
},
});
emma-frontend/components/practitionerscreens/login.js
View file @
0b0ad575
import
React
,
{
useState
}
from
"
react
"
;
import
{
View
,
TextInput
,
Button
,
Alert
}
from
"
react-native
"
;
import
{
View
,
TextInput
,
Button
,
Alert
,
StyleSheet
}
from
"
react-native
"
;
import
{
LOCALBACKEND
}
from
"
../../env
"
;
import
EncryptWithServerKey
from
"
../../services/encryptByServerKey
"
;
...
...
@@ -37,19 +37,51 @@ export default function PractitionerLogin({ navigation, route }) {
};
return
(
<
View
>
<
View
style
=
{
styles
.
container
}
>
<
TextInput
style
=
{
styles
.
input
}
placeholder
=
"
Username
"
value
=
{
username
}
onChangeText
=
{
setUsername
}
/
>
<
TextInput
style
=
{
styles
.
input
}
placeholder
=
"
Password
"
value
=
{
password
}
onChangeText
=
{
setPassword
}
secureTextEntry
/>
<
Button
title
=
"
Login
"
onPress
=
{
handleLogin
}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
Login
"
onPress
=
{
handleLogin
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
justifyContent
:
"
center
"
,
},
input
:
{
width
:
"
80%
"
,
height
:
40
,
marginVertical
:
10
,
paddingHorizontal
:
10
,
borderColor
:
"
gray
"
,
borderWidth
:
1
,
borderRadius
:
5
,
},
button
:
{
width
:
"
80%
"
,
height
:
60
,
// Adjust the height value to make the button taller
backgroundColor
:
"
#560CCE
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
borderRadius
:
30
,
// Adjust the border radius value to make the edges rounder
marginTop
:
10
,
},
buttonText
:
{
color
:
"
white
"
,
fontSize
:
16
,
fontWeight
:
"
bold
"
,
},
});
emma-frontend/components/practitionerscreens/mainViewWithMenu.js
View file @
0b0ad575
...
...
@@ -21,16 +21,28 @@ export default function PractitionerMainView({ navigation }) {
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
User Requests
"
onPress
=
{()
=>
handleUserReq
()}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
User Requests
"
onPress
=
{()
=>
handleUserReq
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Request EHRs
"
onPress
=
{()
=>
handleRequesting
()}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
Request EHRs
"
onPress
=
{()
=>
handleRequesting
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
View NFTs
"
onPress
=
{()
=>
handleView
()}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
View NFTs
"
onPress
=
{()
=>
handleView
()}
/
>
<
/View
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
Button
title
=
"
Logout
"
onPress
=
{()
=>
handleLogout
()}
/
>
<
Button
color
=
"
red
"
title
=
"
Logout
"
onPress
=
{()
=>
handleLogout
()}
/
>
<
/View
>
<
/View
>
);
...
...
emma-frontend/components/practitionerscreens/nft-view.js
View file @
0b0ad575
...
...
@@ -4,7 +4,14 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import
RSADecrypt
from
"
../../services/decryptByRsaKey
"
;
import
DecryptWithAssetKey
from
"
../../services/decryptByAssetKey
"
;
import
{
WebView
}
from
"
react-native-webview
"
;
import
{
View
,
Text
,
useWindowDimensions
,
ScrollView
}
from
"
react-native
"
;
import
{
View
,
Text
,
useWindowDimensions
,
ScrollView
,
ActivityIndicator
,
StyleSheet
,
}
from
"
react-native
"
;
import
RenderHTML
from
"
react-native-render-html
"
;
export
default
function
NftView
({
navigation
,
route
})
{
...
...
@@ -14,12 +21,14 @@ export default function NftView({ navigation, route }) {
const
[
ipfsContent
,
setIpfsContent
]
=
useState
(
""
);
const
[
decryptedContent
,
setDecrypted
]
=
useState
(
""
);
const
{
width
}
=
useWindowDimensions
();
const
[
isLoaded
,
setLoaded
]
=
useState
(
false
);
useEffect
(()
=>
{
fetchRequests
();
},
[]);
const
fetchRequests
=
async
()
=>
{
setLoaded
(
true
);
console
.
log
(
"
Asset code
"
,
assetCode
);
const
assetCode
=
route
.
params
.
assetcode
;
...
...
@@ -48,20 +57,54 @@ export default function NftView({ navigation, route }) {
);
setDecrypted
(
decryptedIpfsContent
);
console
.
log
(
decryptedIpfsContent
);
setLoaded
(
false
);
}
catch
(
errorWhenGGettingIPFSContent
)
{
console
.
error
(
"
Error when getting IPFS content :
"
,
errorWhenGGettingIPFSContent
);
setLoaded
(
false
);
}
}
catch
(
errorWhenGettingNftDetails
)
{
console
.
log
(
"
Error when getting NFT details
"
);
setLoaded
(
false
);
}
};
return
(
<
ScrollView
>
<
RenderHTML
contentWidth
=
{
width
}
source
=
{{
html
:
decryptedContent
}}
/
>
{
isLoaded
?
(
<
ActivityIndicator
style
=
{
styles
.
item
}
color
=
"
#000
"
size
=
"
large
"
><
/ActivityIndicator
>
)
:
(
<>
<
RenderHTML
contentWidth
=
{
width
}
source
=
{{
html
:
decryptedContent
}}
baseStyle
=
{
styles
.
container
}
/
>
<
/
>
)}
<
/ScrollView
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
alignItems
:
"
center
"
,
padding
:
30
,
},
text
:
{
fontSize
:
24
,
fontWeight
:
"
bold
"
,
},
item
:
{
padding
:
100
,
},
sep
:
{
height
:
20
,
},
});
emma-frontend/components/practitionerscreens/patientRequestsView.js
View file @
0b0ad575
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
LOCALBACKEND
}
from
"
../../env
"
;
import
{
Button
,
StyleSheet
,
View
,
Text
}
from
"
react-native
"
;
import
{
Button
,
StyleSheet
,
View
,
Text
,
ActivityIndicator
,
}
from
"
react-native
"
;
import
AsyncStorage
from
"
@react-native-async-storage/async-storage
"
;
import
EncryptWithServerKey
from
"
../../services/encryptByServerKey
"
;
export
default
function
PatientRequests
()
{
const
[
data
,
setData
]
=
useState
([]);
const
[
isAccepted
,
setAccepted
]
=
useState
(
false
);
useEffect
(()
=>
{
fetchRequests
();
...
...
@@ -43,13 +50,17 @@ export default function PatientRequests() {
const
renderItem
=
(
item
)
=>
{
return
(
<
View
key
=
{
item
.
_id
}
>
<
View
style
=
{
styles
.
item
}
key
=
{
item
.
_id
}
>
<
Text
>
Key
:
{
item
.
patient
}
<
/Text
>
<
View
style
=
{
styles
.
sep
}
><
/View
>
<
Button
color
=
"
#703BE7
"
title
=
"
Accept
"
onPress
=
{()
=>
handleAcceptance
(
item
,
"
Accepted
"
)}
><
/Button
>
<
View
style
=
{
styles
.
sep
}
><
/View
>
<
Button
color
=
"
red
"
title
=
"
Reject
"
onPress
=
{()
=>
handleAcceptance
(
item
,
"
Rejected
"
)}
><
/Button
>
...
...
@@ -58,6 +69,7 @@ export default function PatientRequests() {
};
const
handleAcceptance
=
async
(
item
,
status
)
=>
{
setAccepted
(
true
);
//get the practitioner keys
try
{
const
practitionerKey
=
await
AsyncStorage
.
getItem
(
...
...
@@ -93,27 +105,42 @@ export default function PatientRequests() {
const
responseData
=
await
acceptanceResponse
.
json
();
console
.
log
(
responseData
);
setAccepted
(
false
);
}
catch
(
errorWhenSendingAcceptance
)
{
console
.
log
(
"
Error when sending payload
"
);
setAccepted
(
false
);
}
}
catch
(
errorWheGettingKeyPair
)
{
console
.
log
(
"
Getting key pair from async failed
"
);
setAccepted
(
false
);
}
};
return
(
<
View
style
=
{
styles
.
container
}
>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
<
/View
>
<
View
style
=
{
styles
.
container
}
>
{
isAccepted
?
(
<
ActivityIndicator
color
=
"
#000
"
size
=
"
large
"
><
/ActivityIndicator
>
)
:
(
<>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
<
/
>
)}
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
padding
:
30
,
},
text
:
{
fontSize
:
24
,
fontWeight
:
"
bold
"
,
},
item
:
{
padding
:
10
,
},
sep
:
{
height
:
20
,
},
});
emma-frontend/components/practitionerscreens/recievedNfts.js
View file @
0b0ad575
...
...
@@ -42,9 +42,13 @@ export default function ReceivedNFT({ navigation }) {
const
renderItem
=
(
item
)
=>
{
return
(
<
View
key
=
{
item
.
_id
}
>
<
View
style
=
{
styles
.
item
}
key
=
{
item
.
_id
}
>
<
Text
>
Key
:
{
item
.
assetcode
}
<
/Text
>
<
Button
title
=
"
View NFT
"
onPress
=
{()
=>
handleViewNFT
(
item
)}
><
/Button
>
<
Button
color
=
"
#703BE7
"
title
=
"
View NFT
"
onPress
=
{()
=>
handleViewNFT
(
item
)}
><
/Button
>
<
/View
>
);
};
...
...
@@ -62,11 +66,12 @@ export default function ReceivedNFT({ navigation }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
},
text
:
{
fontSize
:
24
,
fontWeight
:
"
bold
"
,
},
item
:
{
padding
:
20
,
},
});
emma-frontend/components/practitionerscreens/registration.js
View file @
0b0ad575
...
...
@@ -136,7 +136,8 @@ export default function PractitionerRegistration() {
value
=
{
email
}
onChangeText
=
{(
text
)
=>
setEmail
(
text
)}
/
>
<
Button
title
=
"
Register
"
onPress
=
{
handleNext
}
/
>
<
Button
color
=
"
#703BE7
"
title
=
"
Register
"
onPress
=
{
handleNext
}
/
>
<
/View
>
);
}
...
...
emma-frontend/components/practitionerscreens/treatingPatients.js
View file @
0b0ad575
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
LOCALBACKEND
}
from
"
../../env
"
;
import
{
Button
,
StyleSheet
,
View
,
Text
,
Alert
}
from
"
react-native
"
;
import
{
Button
,
StyleSheet
,
View
,
Text
,
Alert
,
ActivityIndicator
,
}
from
"
react-native
"
;
import
AsyncStorage
from
"
@react-native-async-storage/async-storage
"
;
import
EncryptWithServerKey
from
"
../../services/encryptByServerKey
"
;
import
Toast
from
"
react-native-toast-message
"
;
export
default
function
TreatingPatients
({
navigation
})
{
const
[
data
,
setData
]
=
useState
([]);
const
[
isRequested
,
setRequested
]
=
useState
(
false
);
useEffect
(()
=>
{
fetchRequests
();
...
...
@@ -43,10 +51,11 @@ export default function TreatingPatients({ navigation }) {
const
renderItem
=
(
item
)
=>
{
return
(
<
View
key
=
{
item
.
_id
}
>
<
View
style
=
{
styles
.
item
}
key
=
{
item
.
_id
}
>
<
Text
>
Key
:
{
item
.
patient
}
<
/Text
>
<
Button
title
=
"
Request EHR
"
color
=
"
#703BE7
"
onPress
=
{()
=>
handleRequesting
(
item
)}
><
/Button
>
<
/View
>
...
...
@@ -54,6 +63,7 @@ export default function TreatingPatients({ navigation }) {
};
const
handleRequesting
=
async
(
item
)
=>
{
setRequested
(
true
);
//get the practitioner keys
try
{
const
practitionerKey
=
await
AsyncStorage
.
getItem
(
...
...
@@ -92,7 +102,7 @@ export default function TreatingPatients({ navigation }) {
},
body
:
JSON
.
stringify
(
requestOj
),
});
setRequested
(
false
);
Toast
.
show
({
type
:
"
success
"
,
// 'success', 'error', 'info', 'warning'
text1
:
"
Request added
"
,
...
...
@@ -100,17 +110,28 @@ export default function TreatingPatients({ navigation }) {
autoHide
:
true
,
});
const
responseData
=
await
nftRequestResponse
.
json
();
setRequested
(
false
);
}
catch
(
error
)
{
setRequested
(
false
);
console
.
error
(
"
Error when calling the request NFT
"
);
}
}
catch
(
errorWheGettingKeyPair
)
{
setRequested
(
false
);
console
.
error
(
"
Error when getting keypair
"
);
}
};
return
(
<
View
style
=
{
styles
.
container
}
>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
{
isRequested
?
(
<
ActivityIndicator
color
=
"
#000
"
size
=
"
large
"
><
/ActivityIndicator
>
)
:
(
<>
<
View
>
{
data
.
map
((
item
)
=>
renderItem
(
item
))}
<
/View
>
<
/
>
)}
<
Toast
ref
=
{(
ref
)
=>
Toast
.
setRef
(
ref
)}
/
>
<
/View
>
);
...
...
@@ -119,11 +140,14 @@ export default function TreatingPatients({ navigation }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
"
center
"
,
padding
:
30
,
alignItems
:
"
center
"
,
},
text
:
{
fontSize
:
24
,
fontWeight
:
"
bold
"
,
},
item
:
{
padding
:
20
,
},
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment