Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppUms_Lecturer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tungnq
AppUms_Lecturer
Commits
8f594117
Commit
8f594117
authored
Sep 09, 2025
by
tungnq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TODO: Đã hoàn thiện giao diện điểm danh theo từng lớp học
parent
6c9b806c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
46 deletions
+89
-46
style.js
src/screens/roll_call/list_student_roll_call/style.js
+12
-26
view.js
src/screens/roll_call/list_student_roll_call/view.js
+77
-20
No files found.
src/screens/roll_call/list_student_roll_call/style.js
View file @
8f594117
...
@@ -12,12 +12,13 @@ const styles = StyleSheet.create({
...
@@ -12,12 +12,13 @@ const styles = StyleSheet.create({
container
:{
container
:{
flex
:
1
,
flex
:
1
,
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
},
},
body
:{
body
:{
flex
:
1
,
flex
:
1
,
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
paddingHorizontal
:
15
,
paddingHorizontal
:
15
,
paddingVertical
:
10
,
marginBottom
:
15
,
},
},
textTitle
:{
textTitle
:{
fontSize
:
R
.
fontsize
.
fontsSizeTitle
,
fontSize
:
R
.
fontsize
.
fontsSizeTitle
,
...
@@ -26,24 +27,6 @@ const styles = StyleSheet.create({
...
@@ -26,24 +27,6 @@ const styles = StyleSheet.create({
color
:
R
.
colors
.
blue
,
color
:
R
.
colors
.
blue
,
marginBottom
:
10
,
marginBottom
:
10
,
},
},
summaryContainer
:
{
flexDirection
:
'row'
,
justifyContent
:
'space-around'
,
backgroundColor
:
R
.
colors
.
blue4
,
padding
:
10
,
borderRadius
:
8
,
marginBottom
:
15
,
},
summaryText
:
{
fontSize
:
14
,
fontFamily
:
R
.
fonts
.
fontMedium
,
color
:
R
.
colors
.
black
,
},
summaryNumber
:
{
fontSize
:
16
,
fontWeight
:
'700'
,
fontFamily
:
R
.
fonts
.
fontBold
,
},
tableContainer
:
{
tableContainer
:
{
flex
:
1
,
flex
:
1
,
borderWidth
:
1
,
borderWidth
:
1
,
...
@@ -59,8 +42,7 @@ const styles = StyleSheet.create({
...
@@ -59,8 +42,7 @@ const styles = StyleSheet.create({
},
},
headerCell
:
{
headerCell
:
{
height
:
50
,
height
:
50
,
paddingVertical
:
12
,
paddingVertical
:
10
,
paddingHorizontal
:
4
,
borderRightWidth
:
1
,
borderRightWidth
:
1
,
borderRightColor
:
R
.
colors
.
gray3
,
borderRightColor
:
R
.
colors
.
gray3
,
borderBottomWidth
:
1
,
borderBottomWidth
:
1
,
...
@@ -70,7 +52,7 @@ const styles = StyleSheet.create({
...
@@ -70,7 +52,7 @@ const styles = StyleSheet.create({
backgroundColor
:
R
.
colors
.
blue2
,
backgroundColor
:
R
.
colors
.
blue2
,
},
},
headerText
:
{
headerText
:
{
fontSize
:
12
,
fontSize
:
R
.
fontsize
.
fontSizeContent
,
fontWeight
:
'600'
,
fontWeight
:
'600'
,
fontFamily
:
R
.
fonts
.
fontMedium
,
fontFamily
:
R
.
fonts
.
fontMedium
,
color
:
R
.
colors
.
black
,
color
:
R
.
colors
.
black
,
...
@@ -84,7 +66,6 @@ const styles = StyleSheet.create({
...
@@ -84,7 +66,6 @@ const styles = StyleSheet.create({
tableCell
:
{
tableCell
:
{
height
:
60
,
height
:
60
,
paddingVertical
:
10
,
paddingVertical
:
10
,
paddingHorizontal
:
4
,
borderRightWidth
:
1
,
borderRightWidth
:
1
,
borderRightColor
:
R
.
colors
.
gray3
,
borderRightColor
:
R
.
colors
.
gray3
,
borderBottomWidth
:
1
,
borderBottomWidth
:
1
,
...
@@ -113,16 +94,15 @@ const styles = StyleSheet.create({
...
@@ -113,16 +94,15 @@ const styles = StyleSheet.create({
},
},
noteColumn
:
{
noteColumn
:
{
width
:
NOTE_COLUMN
,
width
:
NOTE_COLUMN
,
fontSize
:
10
,
fontSize
:
R
.
fontsize
.
fontSizeContent
,
},
},
statusContainer
:
{
statusContainer
:
{
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
},
},
statusText
:
{
statusText
:
{
fontSize
:
10
,
fontSize
:
R
.
fontsize
.
fontSizeContent
,
fontFamily
:
R
.
fonts
.
fontMedium
,
fontFamily
:
R
.
fonts
.
fontMedium
,
marginTop
:
2
,
textAlign
:
'center'
,
textAlign
:
'center'
,
},
},
noteInput
:
{
noteInput
:
{
...
@@ -135,6 +115,11 @@ const styles = StyleSheet.create({
...
@@ -135,6 +115,11 @@ const styles = StyleSheet.create({
paddingHorizontal
:
8
,
paddingHorizontal
:
8
,
paddingVertical
:
4
,
paddingVertical
:
4
,
},
},
textTitleStatus
:{
fontSize
:
R
.
fontsize
.
fontSizeContent
,
fontFamily
:
R
.
fonts
.
fontRegular
,
color
:
R
.
colors
.
black
,
},
})
})
export
default
styles
export
default
styles
\ No newline at end of file
src/screens/roll_call/list_student_roll_call/view.js
View file @
8f594117
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Text
,
View
,
TouchableOpacity
,
StyleSheet
,
ScrollView
,
FlatList
,
RefreshControl
,
Switch
,
TextInput
}
from
'react-native'
;
import
{
Text
,
View
,
TouchableOpacity
,
StyleSheet
,
ScrollView
,
FlatList
,
RefreshControl
,
Switch
,
TextInput
,
}
from
'react-native'
;
import
styles
from
'./style'
;
import
styles
from
'./style'
;
import
Header
from
'../../../components/Header/Header'
;
import
Header
from
'../../../components/Header/Header'
;
import
R
from
'../../../assets/R'
;
import
R
from
'../../../assets/R'
;
import
Button
from
'../../../components/Button'
;
const
ListStudentRollCallView
=
props
=>
{
const
ListStudentRollCallView
=
props
=>
{
const
{
refreshing
,
setRefreshing
,
studentList
,
setStudentList
}
=
props
;
const
{
refreshing
,
setRefreshing
,
studentList
,
setStudentList
}
=
props
;
const
onRefresh
=
()
=>
{
const
onRefresh
=
()
=>
{
setRefreshing
(
true
);
setRefreshing
(
true
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -15,36 +25,41 @@ const ListStudentRollCallView = props => {
...
@@ -15,36 +25,41 @@ const ListStudentRollCallView = props => {
},
1000
);
},
1000
);
};
};
const
toggleAttendance
=
(
studentId
)
=>
{
const
toggleAttendance
=
studentId
=>
{
setStudentList
(
prevList
=>
setStudentList
(
prevList
=>
prevList
.
map
(
student
=>
{
prevList
.
map
(
student
=>
{
if
(
student
.
id
===
studentId
)
{
if
(
student
.
id
===
studentId
)
{
const
newIsPresent
=
!
student
.
isPresent
;
const
newIsPresent
=
!
student
.
isPresent
;
// Auto-fill "nghỉ ko phép" when switching to absent if no custom note
// Auto-fill "nghỉ ko phép" when switching to absent if no custom note
const
newNote
=
!
newIsPresent
&&
(
!
student
.
note
||
student
.
note
===
''
)
const
newNote
=
!
newIsPresent
&&
(
!
student
.
note
||
student
.
note
===
''
)
?
'Nghỉ không phép'
?
'Nghỉ không phép'
:
(
newIsPresent
?
''
:
student
.
note
);
:
newIsPresent
?
''
:
student
.
note
;
return
{...
student
,
isPresent
:
newIsPresent
,
note
:
newNote
};
return
{...
student
,
isPresent
:
newIsPresent
,
note
:
newNote
};
}
}
return
student
;
return
student
;
})
})
,
);
);
};
};
const
updateStudentNote
=
(
studentId
,
note
)
=>
{
const
updateStudentNote
=
(
studentId
,
note
)
=>
{
setStudentList
(
prevList
=>
setStudentList
(
prevList
=>
prevList
.
map
(
student
=>
prevList
.
map
(
student
=>
student
.
id
===
studentId
student
.
id
===
studentId
?
{...
student
,
note
:
note
}
:
student
,
?
{...
student
,
note
:
note
}
),
:
student
)
);
);
};
};
const
countAttendance
=
()
=>
{
const
countAttendance
=
()
=>
{
const
present
=
studentList
.
filter
(
studentList
=>
studentList
.
isPresent
).
length
;
const
present
=
studentList
.
filter
(
const
absent
=
studentList
.
filter
(
studentList
=>
!
studentList
.
isPresent
).
length
;
studentList
=>
studentList
.
isPresent
,
).
length
;
const
absent
=
studentList
.
filter
(
studentList
=>
!
studentList
.
isPresent
,
).
length
;
console
.
log
(
`Có mặt:
${
present
}
, Vắng mặt:
${
absent
}
`
);
console
.
log
(
`Có mặt:
${
present
}
, Vắng mặt:
${
absent
}
`
);
return
{
present
,
absent
};
return
{
present
,
absent
};
};
};
...
@@ -84,14 +99,19 @@ const ListStudentRollCallView = props => {
...
@@ -84,14 +99,19 @@ const ListStudentRollCallView = props => {
<
View
style
=
{[
styles
.
tableCell
,
styles
.
dateColumn
]}
>
<
View
style
=
{[
styles
.
tableCell
,
styles
.
dateColumn
]}
>
<
Text
style
=
{
styles
.
cellText
}
>
{
item
.
date
}
<
/Text
>
<
Text
style
=
{
styles
.
cellText
}
>
{
item
.
date
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{[
styles
.
tableCell
,
styles
.
statusColumn
,
styles
.
statusContainer
]}
>
<
View
style
=
{[
styles
.
tableCell
,
styles
.
statusColumn
,
styles
.
statusContainer
]}
>
<
Switch
<
Switch
value
=
{
item
.
isPresent
}
value
=
{
item
.
isPresent
}
onValueChange
=
{()
=>
toggleAttendance
(
item
.
id
)}
onValueChange
=
{()
=>
toggleAttendance
(
item
.
id
)}
trackColor
=
{{
false
:
R
.
colors
.
red
,
true
:
R
.
colors
.
green
}}
trackColor
=
{{
false
:
R
.
colors
.
red
,
true
:
R
.
colors
.
green
}}
thumbColor
=
{
item
.
isPresent
?
R
.
colors
.
white
:
R
.
colors
.
white
}
thumbColor
=
{
item
.
isPresent
?
R
.
colors
.
white
:
R
.
colors
.
white
}
/
>
/
>
<
Text
style
=
{[
styles
.
statusText
,
{
color
:
item
.
isPresent
?
R
.
colors
.
green
:
R
.
colors
.
red
}]}
>
<
Text
style
=
{[
styles
.
statusText
,
{
color
:
item
.
isPresent
?
R
.
colors
.
green
:
R
.
colors
.
red
},
]}
>
{
item
.
isPresent
?
'Có mặt'
:
'Vắng mặt'
}
{
item
.
isPresent
?
'Có mặt'
:
'Vắng mặt'
}
<
/Text
>
<
/Text
>
<
/View
>
<
/View
>
...
@@ -99,7 +119,7 @@ const ListStudentRollCallView = props => {
...
@@ -99,7 +119,7 @@ const ListStudentRollCallView = props => {
<
TextInput
<
TextInput
style
=
{
styles
.
noteInput
}
style
=
{
styles
.
noteInput
}
value
=
{
item
.
note
||
''
}
value
=
{
item
.
note
||
''
}
onChangeText
=
{
(
text
)
=>
updateStudentNote
(
item
.
id
,
text
)}
onChangeText
=
{
text
=>
updateStudentNote
(
item
.
id
,
text
)}
placeholder
=
"Ghi chú..."
placeholder
=
"Ghi chú..."
placeholderTextColor
=
{
R
.
colors
.
gray2
}
placeholderTextColor
=
{
R
.
colors
.
gray2
}
multiline
=
{
true
}
multiline
=
{
true
}
...
@@ -114,10 +134,8 @@ const ListStudentRollCallView = props => {
...
@@ -114,10 +134,8 @@ const ListStudentRollCallView = props => {
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Header
title
=
{
'Điểm danh lớp: ATTT2024.P1'
}
isBack
/>
<
Header
title
=
{
'Điểm danh lớp: ATTT2024.P1'
}
isBack
/>
<
View
style
=
{
styles
.
body
}
>
<
ScrollView
showsVerticalScrollIndicator
=
{
false
}
style
=
{
styles
.
body
}
>
<
Text
style
=
{
styles
.
textTitle
}
>
<
Text
style
=
{
styles
.
textTitle
}
>
Danh
s
á
ch
l
ớ
p
<
/Text
>
Danh
s
á
ch
l
ớ
p
<
/Text
>
<
View
style
=
{
styles
.
tableContainer
}
>
<
View
style
=
{
styles
.
tableContainer
}
>
<
ScrollView
horizontal
showsHorizontalScrollIndicator
=
{
false
}
>
<
ScrollView
horizontal
showsHorizontalScrollIndicator
=
{
false
}
>
...
@@ -126,7 +144,7 @@ const ListStudentRollCallView = props => {
...
@@ -126,7 +144,7 @@ const ListStudentRollCallView = props => {
<
FlatList
<
FlatList
data
=
{
studentList
}
data
=
{
studentList
}
renderItem
=
{
renderStudentItem
}
renderItem
=
{
renderStudentItem
}
keyExtractor
=
{
(
item
)
=>
item
.
id
.
toString
()}
keyExtractor
=
{
item
=>
item
.
id
.
toString
()}
refreshControl
=
{
refreshControl
=
{
<
RefreshControl
<
RefreshControl
refreshing
=
{
refreshing
}
refreshing
=
{
refreshing
}
...
@@ -142,7 +160,46 @@ const ListStudentRollCallView = props => {
...
@@ -142,7 +160,46 @@ const ListStudentRollCallView = props => {
<
/View
>
<
/View
>
<
/ScrollView
>
<
/ScrollView
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginVertical
:
10
,
}}
>
<
Text
style
=
{
styles
.
textTitleStatus
}
>
C
ó
m
ặ
t
:{
' '
}
<
Text
style
=
{[
styles
.
statusText
,
{
color
:
R
.
colors
.
green
}]}
>
{
present
}
<
/Text
>
,
V
ắ
ng
m
ặ
t
:{
' '
}
<
Text
style
=
{[
styles
.
statusText
,
{
color
:
R
.
colors
.
red
}]}
>
{
absent
}
<
/Text
>
<
/Text
>
<
Button
title
=
"Đồng bộ kết quả "
onPress
=
{()
=>
{}}
containerStyle
=
{{
paddingHorizontal
:
5
,
paddingVertical
:
5
,
borderRadius
:
20
,
}}
backgroundColor
=
{
R
.
colors
.
blue
}
textColor
=
{
R
.
colors
.
white
}
fontSize
=
{
12
}
/
>
<
/View
>
<
View
>
<
Text
style
=
{[
styles
.
textTitleStatus
,{
color
:
R
.
colors
.
blue
,
fontWeight
:
'600'
,
fontFamily
:
R
.
fonts
.
fontMedium
}]}
>
Gi
ả
ng
vi
ê
n
l
ư
u
ý
:
<
/Text
>
<
Text
style
=
{
styles
.
textTitleStatus
}
>
Đ
i
ể
m
danh
ch
ỉ
đượ
c
th
ự
c
hi
ệ
n
trong
15
p
tr
ướ
c
v
à
15
p
sau
khi
đã
v
à
o
ti
ế
p
(
trong
30
p
)
sau
th
ờ
i
gian
đ
i
ể
m
danh
gi
ả
ng
vi
ê
n
s
ẽ
kh
ô
ng
đượ
c
c
ậ
p
nh
ậ
t
k
ế
t
qu
ả
đ
i
ể
m
danh
đã
l
ư
u
tr
ướ
c
đ
o
<
/Text
>
<
/View
>
<
/View
>
<
/ScrollView
>
<
/View
>
<
/View
>
);
);
};
};
...
...
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