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 51
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
1
Merge Requests
1
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 51
22_23-j 51
Commits
ef76de86
Commit
ef76de86
authored
Feb 07, 2023
by
Ashan Tharuka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it19202464' into 'main'
It19202464 See merge request
!8
parents
8dfa5ab4
769ca648
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1791 additions
and
303 deletions
+1791
-303
frontend/Screens/Admin/Admin.js
frontend/Screens/Admin/Admin.js
+64
-0
frontend/Screens/Admin/Users.js
frontend/Screens/Admin/Users.js
+132
-0
frontend/Screens/Fuel/Fuel.js
frontend/Screens/Fuel/Fuel.js
+141
-0
frontend/Screens/Settings.js
frontend/Screens/Settings.js
+12
-0
frontend/Screens/Station/Fillingqueue.js
frontend/Screens/Station/Fillingqueue.js
+133
-0
frontend/Screens/Station/Gasstock.js
frontend/Screens/Station/Gasstock.js
+154
-0
frontend/Screens/Station/Queue.js
frontend/Screens/Station/Queue.js
+175
-0
frontend/Screens/Station/Station.js
frontend/Screens/Station/Station.js
+136
-0
frontend/Screens/Station/Stationsingle.js
frontend/Screens/Station/Stationsingle.js
+127
-0
frontend/Screens/Station/Stationview.js
frontend/Screens/Station/Stationview.js
+200
-0
frontend/Screens/User/Stations.js
frontend/Screens/User/Stations.js
+120
-0
frontend/Screens/User/Stationview.js
frontend/Screens/User/Stationview.js
+176
-0
frontend/Screens/User/User.js
frontend/Screens/User/User.js
+68
-0
frontend/Screens/User/Vehicle.js
frontend/Screens/User/Vehicle.js
+153
-0
fuel-sliit-bakend-main/app/Http/Controllers/BowserController.php
...iit-bakend-main/app/Http/Controllers/BowserController.php
+0
-129
fuel-sliit-bakend-main/app/Http/Controllers/StationController.php
...it-bakend-main/app/Http/Controllers/StationController.php
+0
-174
No files found.
frontend/Screens/Admin/Admin.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
}
from
"
react-native
"
;
import
React
from
"
react
"
;
import
{
FontAwesome5
}
from
"
@expo/vector-icons
"
;
import
{
MaterialCommunityIcons
}
from
'
@expo/vector-icons
'
;
import
{
Entypo
}
from
'
@expo/vector-icons
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
export
default
function
Admin
({
userid
,
role
})
{
const
navigation
=
useNavigation
();
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{[
styles
.
row
,
styles
.
mb5
]}
>
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
Station
"
)}
>
<
FontAwesome5
name
=
"
gas-pump
"
size
=
{
40
}
color
=
"
white
"
/>
<
Text
style
=
{
styles
.
boxText
}
>
Gas
Stations
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
Fuel
"
)}
>
<
MaterialCommunityIcons
name
=
"
fuel
"
size
=
{
45
}
color
=
"
white
"
/>
<
Text
style
=
{
styles
.
boxText
}
>
Fuel
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
row
}
>
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
Userslist
"
)}
>
<
Entypo
name
=
"
users
"
size
=
{
40
}
color
=
"
white
"
/>
<
Text
style
=
{
styles
.
boxText
}
>
Users
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
Browser
"
,{
user_id
:
-
1
,
role
:
role
})}
>
<
FontAwesome5
name
=
"
truck-moving
"
size
=
{
40
}
color
=
"
white
"
/>
<
Text
style
=
{
styles
.
boxText
}
>
Bowsers
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:{
flex
:
1
,
justifyContent
:
'
center
'
},
row
:
{
flexDirection
:
"
row
"
,
justifyContent
:
"
space-evenly
"
,
},
mb5
:{
marginBottom
:
20
},
box
:
{
backgroundColor
:
"
#f05a36
"
,
width
:
150
,
height
:
150
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
borderRadius
:
15
,
},
boxText
:
{
color
:
"
#fff
"
,
fontSize
:
18
,
marginTop
:
10
,
},
});
frontend/Screens/Admin/Users.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
FlatList
,
}
from
"
react-native
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
Entypo
}
from
"
@expo/vector-icons
"
;
import
{
MaterialCommunityIcons
}
from
"
@expo/vector-icons
"
;
import
{
useIsFocused
}
from
"
@react-navigation/native
"
;
export
default
function
Users
({
navigation
})
{
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
users
,
setUsers
]
=
useState
([]);
const
isFocused
=
useIsFocused
();
const
fetchData
=
()
=>
{
fetch
(
"
https://fuel.udarax.me/api/user/list
"
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
setUsers
(
data
[
"
respond
"
]);
setLoading
(
false
);
});
};
useEffect
(()
=>
{
if
(
isFocused
)
{
fetchData
();
console
.
log
(
users
);
console
.
log
(
users
.
length
);
}
},
[
loading
,
isFocused
]);
const
Item
=
({
item
})
=>
(
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
Audit
"
,{
user_id
:
item
.
id
,
role
:
'
user
'
})}
>
<
View
style
=
{
styles
.
row
}
>
<
View
style
=
{
styles
.
col70
}
>
<
Text
style
=
{
styles
.
boxTitle
}
>
{
item
.
name
}
<
/Text
>
<
Text
style
=
{
styles
.
boxtext
}
>
{
item
.
email
}
<
/Text
>
<
Text
style
=
{
styles
.
boxtext
}
>
{
item
.
phone
}
<
/Text
>
<
/View
>
<
View
style
=
{[
styles
.
col30
,
styles
.
center
]}
>
<
Entypo
name
=
"
user
"
size
=
{
50
}
color
=
"
black
"
/>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
);
const
renderItem
=
({
item
})
=>
<
Item
item
=
{
item
}
/>
;
return
(
<
View
style
=
{
styles
.
container
}
>
{
loading
&&
(
<
View
>
<
Image
style
=
{
styles
.
tinyLogo
}
source
=
{
require
(
"
../../assets/gasloading.gif
"
)}
/
>
<
/View
>
)}
{
users
.
length
==
0
&&
<
Text
style
=
{{
fontSize
:
20
}}
>
No
Data
<
/Text>
}
{
!
loading
&&
(
<
FlatList
showsVerticalScrollIndicator
=
{
false
}
showsHorizontalScrollIndicator
=
{
false
}
data
=
{
users
}
renderItem
=
{
renderItem
}
keyExtractor
=
{(
item
)
=>
item
.
id
}
onRefresh
=
{()
=>
fetchData
()}
refreshing
=
{
loading
}
/
>
)}
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingHorizontal
:
20
,
paddingTop
:
20
,
backgroundColor
:
"
#fff
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
},
tinyLogo
:
{
backgroundColor
:
"
#f00
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
},
row
:
{
flexDirection
:
"
row
"
,
},
col70
:
{
width
:
"
70%
"
,
},
col30
:
{
width
:
"
30%
"
,
},
center
:
{
alignItems
:
"
center
"
,
justifyContent
:
"
center
"
,
},
floatButton
:
{
width
:
65
,
height
:
65
,
backgroundColor
:
"
#f05a36
"
,
borderRadius
:
100
,
position
:
"
absolute
"
,
right
:
20
,
bottom
:
20
,
},
box
:
{
backgroundColor
:
"
#f7c469
"
,
padding
:
20
,
borderRadius
:
15
,
marginBottom
:
20
,
},
boxTitle
:
{
color
:
"
#000
"
,
fontWeight
:
"
700
"
,
fontSize
:
16
,
},
boxtext
:
{
color
:
"
#000
"
,
},
});
\ No newline at end of file
frontend/Screens/Fuel/Fuel.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
FlatList
,
}
from
"
react-native
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
Entypo
}
from
"
@expo/vector-icons
"
;
import
{
MaterialCommunityIcons
}
from
"
@expo/vector-icons
"
;
import
{
useIsFocused
}
from
"
@react-navigation/native
"
;
export
default
function
Fuel
({
navigation
})
{
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
fuel
,
setFuel
]
=
useState
([]);
const
isFocused
=
useIsFocused
();
const
fetchData
=
()
=>
{
fetch
(
"
https://fuel.udarax.me/api/fuel/
"
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
setFuel
(
data
[
"
respond
"
]);
setLoading
(
false
);
});
};
useEffect
(()
=>
{
if
(
isFocused
)
{
fetchData
();
}
},
[
loading
,
isFocused
]);
function
FloatButton
()
{
return
(
<
TouchableOpacity
style
=
{[
styles
.
floatButton
,
styles
.
center
]}
onPress
=
{()
=>
navigation
.
navigate
(
"
FuelAdd
"
)}
>
<
Entypo
name
=
"
plus
"
size
=
{
30
}
color
=
"
white
"
/>
<
/TouchableOpacity
>
);
}
const
Item
=
({
item
})
=>
(
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
FuelEdit
"
,
{
typeID
:
item
.
id
})}
>
<
View
style
=
{
styles
.
row
}
>
<
View
style
=
{
styles
.
col70
}
>
<
Text
style
=
{
styles
.
boxTitle
}
>
{
item
.
name
}
<
/Text
>
<
Text
style
=
{
styles
.
boxtext
}
>
{
item
.
price
}
<
/Text
>
<
/View
>
<
View
style
=
{[
styles
.
col30
,
styles
.
center
]}
>
<
MaterialCommunityIcons
name
=
"
fuel
"
size
=
{
50
}
color
=
"
black
"
/>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
);
const
renderItem
=
({
item
})
=>
<
Item
item
=
{
item
}
/>
;
return
(
<
View
style
=
{
styles
.
container
}
>
{
loading
&&
(
<
View
>
<
Image
style
=
{
styles
.
tinyLogo
}
source
=
{
require
(
"
../../assets/gasloading.gif
"
)}
/
>
<
/View
>
)}
{
!
loading
&&
(
<
FlatList
showsVerticalScrollIndicator
=
{
false
}
showsHorizontalScrollIndicator
=
{
false
}
data
=
{
fuel
}
renderItem
=
{
renderItem
}
keyExtractor
=
{(
item
)
=>
item
.
id
}
onRefresh
=
{()
=>
fetchData
()}
refreshing
=
{
loading
}
/
>
)}
<
FloatButton
/>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingHorizontal
:
20
,
paddingTop
:
20
,
backgroundColor
:
"
#fff
"
,
justifyContent
:
"
center
"
,
alignItems
:
'
center
'
},
tinyLogo
:{
backgroundColor
:
"
#f00
"
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
},
row
:{
flexDirection
:
'
row
'
},
col70
:{
width
:
"
70%
"
},
col30
:{
width
:
"
30%
"
},
center
:
{
alignItems
:
"
center
"
,
justifyContent
:
"
center
"
,
},
floatButton
:
{
width
:
65
,
height
:
65
,
backgroundColor
:
"
#f05a36
"
,
borderRadius
:
100
,
position
:
"
absolute
"
,
right
:
20
,
bottom
:
20
,
},
box
:
{
backgroundColor
:
"
#f7c469
"
,
padding
:
20
,
borderRadius
:
15
,
marginBottom
:
20
,
},
boxTitle
:
{
color
:
"
#000
"
,
fontWeight
:
"
700
"
,
fontSize
:
16
,
},
boxtext
:
{
color
:
"
#000
"
,
},
});
frontend/Screens/Settings.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
}
from
'
react-native
'
import
React
from
'
react
'
export
default
function
Settings
()
{
return
(
<
View
style
=
{{
flex
:
1
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
}}
>
<
Text
>
Setting
Screen
<
/Text
>
<
/View
>
)
}
const
styles
=
StyleSheet
.
create
({})
\ No newline at end of file
frontend/Screens/Station/Fillingqueue.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TextInput
,
TouchableOpacity
,
Alert
,
}
from
"
react-native
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
export
default
function
Fillingqueue
({
route
,
navigation
})
{
const
{
user_id
,
vehicle_id
,
station_id
,
fueltype_id
,
ftype
,
username
,
vehicle
,
no
,
qid
,
stuid
}
=
route
.
params
;
const
[
qty
,
setQty
]
=
useState
([]);
const
fillFuel
=
()
=>
{
if
(
qty
!=
""
&&
qty
!=
null
)
{
const
requestOptions
=
{
method
:
"
POST
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
},
body
:
JSON
.
stringify
({
qty
:
qty
,
user_id
:
user_id
,
vehicle_id
:
vehicle_id
,
station_id
:
station_id
,
fueltype_id
:
fueltype_id
,
qid
:
qid
,
}),
};
fetch
(
"
https://fuel.udarax.me/api/audit/create
"
,
requestOptions
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
console
.
log
(
data
);
if
(
data
[
"
message
"
]
==
"
success
"
)
{
Alert
.
alert
(
"
Alert!
"
,
"
Fuel Filled Successfully
"
,
[
{
text
:
"
Yes
"
,
onPress
:
()
=>
{
navigation
.
navigate
(
"
Queue
"
,{
user_id
:
stuid
});
},
},
],
{
cancelable
:
false
}
);
}
else
{
alert
(
data
[
"
message
"
]);
}
});
}
else
{
alert
(
"
Qty cannot empty!
"
);
}
};
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
mb5
}
>
<
Text
>
Fuel
Type
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
value
=
{
ftype
}
editable
=
{
false
}
/
>
<
/View
>
<
View
style
=
{
styles
.
mb5
}
>
<
Text
>
User
Name
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
value
=
{
username
}
editable
=
{
false
}
/
>
<
/View
>
<
View
style
=
{
styles
.
mb5
}
>
<
Text
>
Vehicle
Type
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
value
=
{
vehicle
}
editable
=
{
false
}
/
>
<
/View
>
<
View
style
=
{
styles
.
mb5
}
>
<
Text
>
Queue
No
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
value
=
{
no
}
editable
=
{
false
}
/
>
<
/View
>
<
View
style
=
{
styles
.
mb5
}
>
<
Text
>
Amount
of
Leaters
<
/Text
>
<
TextInput
style
=
{
styles
.
input
}
onChangeText
=
{
setQty
}
value
=
{
qty
}
placeholder
=
"
Enter Amount of Leaters
"
keyboardType
=
"
numeric
"
/>
<
/View
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{
fillFuel
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Fill
Fuel
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingHorizontal
:
20
,
paddingTop
:
20
,
backgroundColor
:
"
#fff
"
,
},
mb5
:
{
marginBottom
:
20
,
},
input
:
{
height
:
45
,
marginTop
:
5
,
borderWidth
:
1
,
padding
:
10
,
borderRadius
:
5
,
},
button
:
{
alignItems
:
"
center
"
,
backgroundColor
:
"
#f05a36
"
,
height
:
45
,
borderRadius
:
5
,
justifyContent
:
"
center
"
,
marginBottom
:
20
,
},
buttonText
:
{
color
:
"
#fff
"
,
},
});
frontend/Screens/Station/Gasstock.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
FlatList
,
}
from
"
react-native
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
Entypo
}
from
"
@expo/vector-icons
"
;
import
{
AntDesign
}
from
'
@expo/vector-icons
'
;
import
{
useIsFocused
}
from
"
@react-navigation/native
"
;
export
default
function
Gasstock
({
route
,
navigation
})
{
const
{
user_id
}
=
route
.
params
;
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
stocks
,
setStocks
]
=
useState
([]);
const
isFocused
=
useIsFocused
();
const
fetchData
=
()
=>
{
fetch
(
"
https://fuel.udarax.me/api/station/stocks/
"
+
user_id
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
setStocks
(
data
[
"
respond
"
]);
setLoading
(
false
);
});
};
function
FloatButton
()
{
return
(
<
TouchableOpacity
style
=
{[
styles
.
floatButton
,
styles
.
center
]}
onPress
=
{()
=>
navigation
.
navigate
(
"
GasStockAdd
"
,
{
user_id
:
user_id
,
})
}
>
<
Entypo
name
=
"
plus
"
size
=
{
30
}
color
=
"
white
"
/>
<
/TouchableOpacity
>
);
}
useEffect
(()
=>
{
if
(
isFocused
)
{
fetchData
();
}
},
[
loading
,
isFocused
]);
const
Item
=
({
item
})
=>
(
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
GasStockEdit
"
,
{
stockID
:
item
.
fcid
,
user_id
:
user_id
})}
>
<
View
style
=
{
styles
.
row
}
>
<
View
style
=
{
styles
.
col70
}
>
<
Text
style
=
{
styles
.
boxTitle
}
>
{
item
.
name
}
<
/Text
>
<
Text
style
=
{
styles
.
boxtext
}
>
Initial
Volum
:
{
item
.
ini_qty
}
<
/Text
>
<
Text
style
=
{
styles
.
boxtext
}
>
Current
Volum
:
{
item
.
current_qty
}
<
/Text
>
<
/View
>
<
View
style
=
{[
styles
.
col30
,
styles
.
center
]}
>
<
View
style
=
{
styles
.
delBox
}
>
<
AntDesign
name
=
"
edit
"
size
=
{
20
}
color
=
"
white
"
/>
<
/View
>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
);
const
renderItem
=
({
item
})
=>
<
Item
item
=
{
item
}
/>
;
return
(
<
View
style
=
{
styles
.
container
}
>
{
loading
&&
(
<
View
>
<
Image
style
=
{
styles
.
tinyLogo
}
source
=
{
require
(
"
../../assets/gasloading.gif
"
)}
/
>
<
/View
>
)}
{
!
loading
&&
(
<
FlatList
showsVerticalScrollIndicator
=
{
false
}
showsHorizontalScrollIndicator
=
{
false
}
data
=
{
stocks
}
renderItem
=
{
renderItem
}
keyExtractor
=
{(
item
)
=>
item
.
fcid
}
onRefresh
=
{()
=>
fetchData
()}
refreshing
=
{
loading
}
/
>
)}
<
FloatButton
/>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
paddingHorizontal
:
20
,
paddingTop
:
20
,
backgroundColor
:
"
#fff
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
},
tinyLogo
:
{
backgroundColor
:
"
#f00
"
,
justifyContent
:
"
center
"
,
alignItems
:
"
center
"
,
},
row
:
{
flexDirection
:
"
row
"
,
},
col70
:
{
width
:
"
70%
"
,
},
col30
:
{
width
:
"
30%
"
,
},
center
:
{
alignItems
:
"
center
"
,
justifyContent
:
"
center
"
,
},
floatButton
:
{
width
:
65
,
height
:
65
,
backgroundColor
:
"
#f05a36
"
,
borderRadius
:
100
,
position
:
"
absolute
"
,
right
:
20
,
bottom
:
20
,
},
box
:
{
backgroundColor
:
"
#f7c469
"
,
padding
:
20
,
borderRadius
:
15
,
marginBottom
:
20
,
},
boxTitle
:
{
color
:
"
#000
"
,
fontWeight
:
"
700
"
,
fontSize
:
16
,
},
boxtext
:
{
color
:
"
#000
"
,
},
delBox
:{
backgroundColor
:
"
#f00
"
,
borderRadius
:
50
,
padding
:
15
},
});
frontend/Screens/Station/Queue.js
0 → 100644
View file @
ef76de86
import
{
StyleSheet
,
Text
,
View
,
TouchableOpacity
,
Image
,
FlatList
,
}
from
"
react-native
"
;
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
{
AntDesign
}
from
"
@expo/vector-icons
"
;
import
{
MaterialCommunityIcons
}
from
"
@expo/vector-icons
"
;
import
{
useIsFocused
}
from
"
@react-navigation/native
"
;
import
{
FontAwesome5
}
from
"
@expo/vector-icons
"
;
import
{
Ionicons
}
from
"
@expo/vector-icons
"
;
export
default
function
Queue
({
route
,
navigation
})
{
const
{
user_id
}
=
route
.
params
;
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
queue
,
setQueue
]
=
useState
([]);
const
isFocused
=
useIsFocused
();
const
fetchData
=
()
=>
{
console
.
log
(
queue
.
length
);
fetch
(
"
https://fuel.udarax.me/api/station/queue/
"
+
user_id
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
console
.
log
(
"
aaa
"
);
console
.
log
(
data
[
"
respond
"
]);
if
(
data
[
"
respond
"
]
==
"
error
"
)
{
setQueue
([]);
}
else
{
setQueue
(
data
[
"
respond
"
]);
}
setLoading
(
false
);
});
};
useEffect
(()
=>
{
if
(
isFocused
)
{
fetchData
();
}
},
[
loading
,
isFocused
]);
const
Item
=
({
item
})
=>
(
<
TouchableOpacity
style
=
{
styles
.
box
}
onPress
=
{()
=>
navigation
.
navigate
(
"
FillingQueue
"
,
{
user_id
:
item
.
uid
,
vehicle_id
:
item
.
vid
,
station_id
:
item
.
sid
,
fueltype_id
:
item
.
fid
,
ftype
:
item
.
fname
,
username
:
item
.
uname
,
vehicle
:
item
.
vtype
,
no
:
item
.
no
,
qid
:
item
.
id
,
stuid
:
user_id
,
})
}
>
<
View
style
=
{
styles
.
row
}
>
<
View
style
=
{
styles
.
col70
}
>