Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
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
1
Merge Requests
1
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
Giang Tran
InvestCustomer
Commits
4bd6e25d
Commit
4bd6e25d
authored
May 24, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
e2aef260
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
Functions.js
src/Config/Functions.js
+11
-0
ConvertUnit.js
src/Screens/Tool/ConvertUnit.js
+4
-7
index.js
src/Screens/VersionChecker/index.js
+5
-5
No files found.
src/Config/Functions.js
View file @
4bd6e25d
...
@@ -234,6 +234,17 @@ export const toPriceVnd = (str) => {
...
@@ -234,6 +234,17 @@ export const toPriceVnd = (str) => {
}
}
};
};
export
const
floatToPriceVnd
=
(
str
)
=>
{
if
(
str
)
{
let
stringPrice
=
str
.
toString
().
split
(
'.'
)
let
headStringPrice
=
`
${
stringPrice
[
0
].
replace
(
/
(\d)(?=(\d{3})
+
(?!\d))
/g
,
'$1,'
)}
`
return
stringPrice
.
length
===
1
?
headStringPrice
:
headStringPrice
.
concat
(
`.
${
stringPrice
[
1
]}
`
)
}
else
{
return
''
}
}
// cắt chuỗi dạng something...
// cắt chuỗi dạng something...
export
const
ellipsis
=
(
str
=
''
,
max
=
30
)
=>
export
const
ellipsis
=
(
str
=
''
,
max
=
30
)
=>
str
.
length
>
max
?
`
${
str
.
substring
(
0
,
max
)}
...`
:
str
;
str
.
length
>
max
?
`
${
str
.
substring
(
0
,
max
)}
...`
:
str
;
...
...
src/Screens/Tool/ConvertUnit.js
View file @
4bd6e25d
...
@@ -5,7 +5,7 @@ import HeaderBack from '../../components/Header/HeaderBack';
...
@@ -5,7 +5,7 @@ import HeaderBack from '../../components/Header/HeaderBack';
import
PickerItem
from
'../../components/Picker/PickerItem'
;
import
PickerItem
from
'../../components/Picker/PickerItem'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
AppText
from
'../../components/AppText'
;
import
AppText
from
'../../components/AppText'
;
import
{
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
floatToPriceVnd
,
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
{
getUnitList
}
from
'../../apis/Functions/Transaction'
;
import
{
getUnitList
}
from
'../../apis/Functions/Transaction'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert'
;
...
@@ -71,16 +71,12 @@ const ConvertUnit = (props) => {
...
@@ -71,16 +71,12 @@ const ConvertUnit = (props) => {
const
onChangeToUnit
=
(
value
,
item
)
=>
{
const
onChangeToUnit
=
(
value
,
item
)
=>
{
setToUnit
(
item
);
setToUnit
(
item
);
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
let
result
=
parseFloat
(
number
)
*
item
.
rate
;
setResult
(
`
${
parseFloat
(
number
)}
${
fromUnit
.
name
}
=
${
result
}
${
item
.
name
}
`
);
}
};
};
const
calcultorResult
=
()
=>
{
const
calcultorResult
=
()
=>
{
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
let
result
=
parseFloat
(
number
)
*
toUnit
.
rate
;
let
result
=
parseFloat
(
number
)
*
toUnit
.
rate
;
setResult
(
`
${
parseFloat
(
number
)}
${
fromUnit
.
name
}
=
${
result
}
${
toUnit
.
name
}
`
);
setResult
(
`
${
floatToPriceVnd
(
number
.
toString
())}
${
fromUnit
.
name
}
=
${
floatToPriceVnd
(
result
.
toString
())
}
${
toUnit
.
name
}
`
);
}
else
{
}
else
{
setResult
(
''
)
setResult
(
''
)
}
}
...
@@ -98,7 +94,7 @@ const ConvertUnit = (props) => {
...
@@ -98,7 +94,7 @@ const ConvertUnit = (props) => {
keyboardType
=
{
'number-pad'
}
keyboardType
=
{
'number-pad'
}
style
=
{
styles
.
wrapInput
}
style
=
{
styles
.
wrapInput
}
maxLength
=
{
12
}
maxLength
=
{
12
}
value
=
{
t
oPriceVnd
(
number
)}
value
=
{
floatT
oPriceVnd
(
number
)}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -179,6 +175,7 @@ const styles = StyleSheet.create({
...
@@ -179,6 +175,7 @@ const styles = StyleSheet.create({
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
borderRadius
:
5
,
borderRadius
:
5
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
paddingVertical
:
0
,
shadowColor
:
'#000'
,
shadowColor
:
'#000'
,
shadowOffset
:
{
shadowOffset
:
{
width
:
0
,
width
:
0
,
...
...
src/Screens/VersionChecker/index.js
View file @
4bd6e25d
...
@@ -129,15 +129,15 @@ const VersionChecker = (props) => {
...
@@ -129,15 +129,15 @@ const VersionChecker = (props) => {
marginHorizontal
:
WIDTHXD
(
100
),
marginHorizontal
:
WIDTHXD
(
100
),
}]}
>
}]}
>
<
TouchableOpacity
onPress
=
{()
=>
cancelUpdate
()}
<
TouchableOpacity
onPress
=
{()
=>
cancelUpdate
()}
style
=
{[
styles
.
btnButton
,
{
paddingRight
:
WIDTHXD
(
90
)
}]}
>
style
=
{[
styles
.
btnButton
,
{
paddingRight
:
WIDTHXD
(
60
)
}]}
>
<
Text
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
color777
}]}
>
{
I18n
.
t
(
'Cancel'
)}
<
/Text
>
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
color777
,
textAlign
:
'right'
}]}
>
{
I18n
.
t
(
'Cancel'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
dividerStyleVertical
}
><
/View
>
<
View
style
=
{
styles
.
dividerStyleVertical
}
><
/View
>
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
style
=
{[
styles
.
btnButton
,
{
paddingLeft
:
WIDTHXD
(
9
0
)}]}
>
style
=
{[
styles
.
btnButton
,
{
paddingLeft
:
WIDTHXD
(
6
0
)}]}
>
<
Text
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
}]}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
,
textAlign
:
'left'
}]}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
}
}
...
@@ -216,7 +216,7 @@ const styles = StyleSheet.create({
...
@@ -216,7 +216,7 @@ const styles = StyleSheet.create({
},
},
btnButton
:
{
btnButton
:
{
flex
:
0
,
flex
:
1
,
},
},
textNotNowStyle
:
{
textNotNowStyle
:
{
...
...
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