Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ReactNativeBase
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
Nguyen Danh Khanh
ReactNativeBase
Commits
e798a306
Commit
e798a306
authored
Jul 06, 2021
by
Nguyen Danh Khanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'khanhHome/fixUI' into 'master'"
This reverts merge request
!2
parent
21c728a3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
60 deletions
+33
-60
src/api/listProduct.ts
src/api/listProduct.ts
+2
-4
src/components/ItemProduct/index.style.ts
src/components/ItemProduct/index.style.ts
+15
-17
src/components/ItemProduct/index.tsx
src/components/ItemProduct/index.tsx
+10
-13
src/redux/reducers/index.ts
src/redux/reducers/index.ts
+0
-5
src/redux/reducers/product.ts
src/redux/reducers/product.ts
+3
-3
src/screens/HomeProductCreate/index.tsx
src/screens/HomeProductCreate/index.tsx
+3
-18
No files found.
src/api/listProduct.ts
View file @
e798a306
import
axios
from
'
axios
'
import
{
useSelector
}
from
'
react-redux
'
import
config
from
'
../configs
'
import
{
store
}
from
'
../redux/store
'
export
function
getListProducts
()
{
export
function
*
getListProducts
()
{
const
token
=
store
.
getState
().
auth
.
token
const
body
=
{
"
drug_barcode
"
:
""
,
"
drug_name
"
:
""
,
...
...
@@ -16,7 +14,7 @@ export function getListProducts() {
}
const
header
=
{
headers
:
{
'
Authorization
'
:
token
'
Authorization
'
:
'
eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIzNjQ5LTAiLCJpYXQiOjE2MjUzOTI5MzIsImV4cCI6MTYyNTQ3OTMzMn0.l_z2ABgvD51hDJmI-mOGM9gOpBTlhyp3UPUNDTbsdWAcZ0KTzeLmJXhV81HdH2S3_mtmM_bGlHCnPi_wHueBkw
'
}
}
const
baseURL
=
config
.
axiosConfig
().
baseURL
...
...
src/components/ItemProduct/index.style.ts
View file @
e798a306
...
...
@@ -3,26 +3,24 @@ import { StyleSheet } from "react-native";
const
styles
=
StyleSheet
.
create
({
container
:
{
flexDirection
:
'
row
'
,
padding
:
10
,
inputLogin
:
{
flexDirection
:
"
row
"
,
height
:
40
,
alignItems
:
"
center
"
,
borderBottomColor
:
'
#FFFFFF
'
,
borderBottomWidth
:
0.5
,
},
image
:
{
width
:
60
,
height
:
60
,
inputText
:
{
paddingLeft
:
5
,
paddingBottom
:
8
,
width
:
'
100%
'
,
},
infoContainer
:
{
marginLeft
:
10
,
justifyContent
:
'
space-between
'
,
padding
:
5
,
validateText
:
{
color
:
'
red
'
,
fontSize
:
11
,
marginLeft
:
0
,
alignItems
:
"
center
"
,
},
textName
:
{
fontSize
:
16
,
fontWeight
:
'
bold
'
},
textInfo
:
{
fontSize
:
16
,
}
});
export
default
styles
;
\ No newline at end of file
src/components/ItemProduct/index.tsx
View file @
e798a306
...
...
@@ -4,24 +4,21 @@ import { View, Text, Image, TextInput } from 'react-native';
import
styles
from
'
./index.style
'
type
Props
=
{
image_url
:
string
drg_drug_cd
:
string
,
drg_drug_name
:
string
,
lot
:
string
,
quantity
:
number
,
exp_date
:
string
drg_drug_cd
:
string
,
drg_drug_name
:
string
,
lot
:
string
,
quantity
:
number
,
exp_date
:
string
}
const
ItemProduct
=
(
props
:
Props
)
=>
{
return
(
<
View
style=
{
styles
.
container
}
>
<
Image
style=
{
styles
.
image
}
source=
{
{
uri
:
props
.
image_url
}
}
/>
<
View
style=
{
styles
.
infoContainer
}
>
<
Text
style=
{
styles
.
textName
}
>
{
`${props.drg_drug_cd} - ${props.drg_drug_name}`
}
</
Text
>
<
Text
style=
{
styles
.
textInfo
}
>
{
`Lô: ${props.lot} - Số lượng: ${props.quantity} - HSD: ${props.exp_date}`
}
</
Text
>
</
View
>
<
View
>
<
Text
>
{
`${props.drg_drug_cd} - ${props.drg_drug_name}`
}
</
Text
>
<
Text
>
{
`Lô: ${props.lot} - Số lượng: ${props.quantity} - HSD: ${props.exp_date}`
}
</
Text
>
</
View
>
)
)
;
};
...
...
src/redux/reducers/index.ts
View file @
e798a306
...
...
@@ -5,21 +5,16 @@ import auth, { InitStateAuth } from "./auth"
import
invoice
,
{
InitStateInvoice
}
from
'
./invoice
'
import
cart
from
'
./cart
'
import
{
Cart
}
from
"
../../model/cart
"
;
import
{
Product
}
from
"
../../model/invoice
"
;
import
product
,
{
InitStateProduct
}
from
"
./product
"
;
export
type
RootState
=
{
auth
:
InitStateAuth
,
invoice
:
InitStateInvoice
,
cart
:
Cart
,
product
:
InitStateProduct
,
}
const
rootReducer
=
combineReducers
({
auth
,
invoice
,
cart
,
product
,
});
export
default
rootReducer
;
\ No newline at end of file
src/redux/reducers/product.ts
View file @
e798a306
...
...
@@ -5,7 +5,7 @@ import Types from '../types'
export
type
InitStateProduct
=
{
type
InitStateProduct
=
{
page
:
number
,
size
:
number
,
...
...
@@ -55,7 +55,7 @@ const defaultData = {
updated_user
:
''
,
vat_percent
:
0
,
unit
:
[]
unit
:
[
defaultUnit
]
}
...
...
@@ -65,7 +65,7 @@ const initState: InitStateProduct = {
total_elements
:
0
,
total_pages
:
1
,
last
:
true
,
data
:
[]
data
:
[
defaultData
]
}
function
invoiceReducer
(
state
:
InitStateProduct
=
initState
,
action
:
AnyAction
)
{
...
...
src/screens/HomeProductCreate/index.tsx
View file @
e798a306
...
...
@@ -19,12 +19,11 @@ import ItemProduct from '../../components/ItemProduct';
import
{
addProductToCart
}
from
'
../../redux/actions/cart
'
;
import
{
Cart
,
Product
}
from
"
../../model/cart
"
;
import
{
Data
}
from
'
../../model/product
'
;
import
{
RootState
}
from
'
../../redux/reducers
'
;
const
App
=
()
=>
{
//data product-------------------------------------------------------
const
products
=
useSelector
(
(
state
:
RootState
)
=>
state
.
product
.
data
)
const
products
=
useSelector
(
state
=>
state
.
product
.
data
)
console
.
log
(
'
Product:
'
,
products
)
//-------------------------------------------------------------------
const
_renderHeaderLeft
=
()
=>
{
...
...
@@ -52,24 +51,12 @@ const App = () => {
/>
)
const
ItemSeparatorView
=
()
=>
{
return
(
// Flat List Item Separator ______________________________________________
<
View
style=
{
{
height
:
1
,
width
:
'
100%
'
,
backgroundColor
:
'
#C8C8C8
'
,
}
}
/>
);
};
const
_renderListProduct
=
(
product
:
Data
)
=>
{
const
product1
=
product
return
(
<
TouchableOpacity
onPress=
{
()
=>
{
addToCart
(
product
)
}
}
>
<
ItemProduct
image_url=
{
product
.
image_url
}
drg_drug_cd=
{
product
.
drg_drug_cd
}
drg_drug_name=
{
product
.
drg_drug_name
}
lot=
{
product
.
lot
}
...
...
@@ -126,11 +113,9 @@ const App = () => {
<
View
>
<
FlatList
data=
{
products
}
ItemSeparatorComponent=
{
ItemSeparatorView
}
renderItem=
{
({
item
})
=>
_renderListProduct
(
item
)
}
// keyExtractor={({ item }) => item.drug_id}
/>
{
/* {_renderButtonSubmit()} */
}
{
_renderButtonSubmit
()
}
</
View
>
</
SafeAreaView
>
);
...
...
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