Fakultas Ilmu Komputer UI

Commit 79bd553e authored by Doan Andreas Nathanael's avatar Doan Andreas Nathanael
Browse files

[GREEN] implemented client list admin

parent 5fe31b52
......@@ -182,7 +182,17 @@ export const adminNavigation: NavRoute[] = [
},
{
name: ROUTES.clientProfileAdmin,
component: ClientProfileForAdmin,
component: ComingSoonPage,
header: 'Profil Klien',
},
{
name: ROUTES.clientDietReportAdmin,
component: ComingSoonPage,
header: 'Profil Klien',
},
{
name: ROUTES.clientChatAdmin,
component: ComingSoonPage,
header: 'Profil Klien',
},
];
......
import React, { FC } from 'react';
import { Text } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { BigButton, Loader } from 'components/core';
import { useNavigation } from '@react-navigation/core';
import { useApi, useDownloadFiles } from 'hooks';
const ClientListAdmin: FC = () => <Text>hai</Text>;
import { ClientCardNutritionist } from 'scenes/nutritionist/ClientListNutritionist/components';
import { retrieveClientListApi } from 'services/profiles';
import * as ROUTES from 'constants/routes';
import { layoutStyles } from 'styles';
import { Dimensions, StyleSheet, View } from 'react-native';
import { Section } from 'components/layout';
import { getAbsoluteUrl } from 'utils/format';
const ClientListAdmin: FC = () => {
const navigation = useNavigation();
const { isLoading, data: clients = [] } = useApi(retrieveClientListApi);
const { download } = useDownloadFiles(getAbsoluteUrl('exportcsv'));
if (isLoading) {
return <Loader />;
}
return (
<View style={layoutStyles}>
<ScrollView style={styles.container}>
{clients.map((client, idx) => (
<ClientCardNutritionist
key={idx}
clientName={client.user.name}
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileAdmin, {
id: client.diet_questionnaire_id,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportAdmin, {});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatAdmin, {});
}}
/>
))}
</ScrollView>
<Section>
<BigButton title="Download CSV" onPress={download} />
</Section>
</View>
);
};
const styles = StyleSheet.create({
container: { height: Dimensions.get('window').height * 0.83 },
});
export default ClientListAdmin;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment