Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2021
Kelas D
PT Gizi Sehat - Dietela
Dietela Mobile
Commits
c3abd2a5
Commit
c3abd2a5
authored
May 10, 2021
by
Kefas Satrio Bangkit Solidedantyo
Browse files
integrate client list with backend
parent
add3980a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/scenes/nutritionist/ClientListNutritionist/index.tsx
View file @
c3abd2a5
...
...
@@ -4,84 +4,35 @@ import { layoutStyles } from 'styles';
import
{
ClientCardNutritionist
}
from
'
./components
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
import
*
as
ROUTES
from
'
constants/routes
'
;
import
{
retrieveClientListApi
}
from
'
services/profiles
'
;
const
ClientListNutritionist
:
FC
=
()
=>
{
const
navigation
=
useNavigation
();
const
clients
=
retrieveClientListApi
();
return
(
<
ScrollView
style
=
{
layoutStyles
}
>
<
ClientCardNutritionist
clientName
=
"Kefas Satrio Bangkit Solideantyo"
onPressClientProfile
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientProfileNutritionist
,
{
id
:
1
,
});
}
}
onPressClientDietReport
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientDietReportNutritionist
,
{
id
:
1
,
});
}
}
onPressClientChat
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientChatNutritionist
,
{
id
:
1
,
});
}
}
/>
<
ClientCardNutritionist
clientName
=
"Doan Di Dinding"
onPressClientProfile
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientProfileNutritionist
,
{
id
:
2
,
});
}
}
onPressClientDietReport
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientDietReportNutritionist
,
{
id
:
2
,
});
}
}
onPressClientChat
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientChatNutritionist
,
{
id
:
2
,
});
}
}
/>
<
ClientCardNutritionist
clientName
=
"Shin Ryujin"
onPressClientProfile
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientProfileNutritionist
,
{
id
:
3
,
});
}
}
onPressClientDietReport
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientDietReportNutritionist
,
{
id
:
3
,
});
}
}
onPressClientChat
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientChatNutritionist
,
{
id
:
3
,
});
}
}
/>
<
ClientCardNutritionist
clientName
=
"Nais"
onPressClientProfile
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientProfileNutritionist
,
{
id
:
4
,
});
}
}
onPressClientDietReport
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientDietReportNutritionist
,
{
id
:
4
,
});
}
}
onPressClientChat
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientChatNutritionist
,
{
id
:
4
,
});
}
}
/>
{
clients
.
map
((
client
,
idx
)
=>
(
<
ClientCardNutritionist
key
=
{
idx
}
clientName
=
{
client
.
name
}
onPressClientProfile
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientProfileNutritionist
,
{
id
:
client
.
id
,
});
}
}
onPressClientDietReport
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientDietReportNutritionist
,
{
id
:
client
.
id
,
});
}
}
onPressClientChat
=
{
()
=>
{
navigation
.
navigate
(
ROUTES
.
clientChatNutritionist
,
{
id
:
client
.
id
,
});
}
}
/>
))
}
</
ScrollView
>
);
};
...
...
src/services/payment/models.ts
View file @
c3abd2a5
...
...
@@ -23,6 +23,7 @@ export interface CartResponse {
unique_code
:
DietelaProgram
;
};
nutritionist
:
Nutritionist
;
user
:
number
;
}
export
interface
MidtransResponse
{
...
...
src/services/profiles/index.ts
0 → 100644
View file @
c3abd2a5
import
{
api
,
RequestMethod
,
ApiResponse
}
from
'
../api
'
;
import
*
as
apiUrls
from
'
./urls
'
;
import
{
Client
}
from
'
./models
'
;
export
const
retrieveClientListApi
=
():
ApiResponse
<
Client
[]
>
=>
{
return
api
(
RequestMethod
.
GET
,
apiUrls
.
profiles
);
};
src/services/profiles/models.ts
0 → 100644
View file @
c3abd2a5
import
{
UserRole
}
from
'
services/auth/models
'
;
import
{
CartResponse
}
from
'
services/payment/models
'
;
export
interface
Client
{
id
:
number
|
null
;
email
:
string
;
name
:
string
;
role
:
UserRole
|
null
;
cart
:
CartResponse
;
}
src/services/profiles/urls.ts
0 → 100644
View file @
c3abd2a5
export
const
profiles
=
'
profiles/
'
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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