Skip to content

Commit

Permalink
feat: nav graph client module implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 committed Aug 13, 2024
1 parent 37e04dc commit 8c98f04
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,6 @@ import com.mifos.feature.client.clientSignature.SignatureScreen
import com.mifos.feature.client.clientSurveyList.SurveyListScreen
import com.mifos.feature.client.clientSurveyQuestion.SurveyQuestionScreen

fun NavController.navigateClientDetailsScreen(clientId: Int) {
navigate(ClientScreens.ClientDetailScreen.argument(clientId))
}

fun NavController.navigateClientIdentifierScreen(clientId: Int) {
navigate(ClientScreens.ClientIdentifierScreen.argument(clientId))
}

fun NavController.navigateClientChargesScreen(clientId: Int) {
navigate(ClientScreens.ClientChargesScreen.argument(clientId))
}

fun NavController.navigateClientPinPointScreen(clientId: Int) {
navigate(ClientScreens.ClientPinPointScreen.argument(clientId))
}

fun NavController.navigateClientSignatureScreen(clientId: Int) {
navigate(ClientScreens.ClientSignatureScreen.argument(clientId))
}

fun NavController.navigateClientSurveyListScreen(clientId: Int) {
navigate(ClientScreens.ClientSurveyListScreen.argument(clientId))
}

//fun NavController.navigateClientSurveyQuestionScreen(clientId: Int) {
// navigate(ClientScreens.ClientSurveyQuestionScreen.argument(clientId))
//}


fun NavGraphBuilder.clientNavGraph(
navController: NavController,
paddingValues: PaddingValues,
Expand All @@ -75,7 +46,7 @@ fun NavGraphBuilder.clientNavGraph(
onBackPressed = navController::popBackStack,
addLoanAccount = addLoanAccount,
addSavingsAccount = addSavingsAccount,
charges = { navController.navigateClientChargesScreen(it) },
charges = navController::navigateClientChargesScreen,
documents = documents,
identifiers = navController::navigateClientIdentifierScreen,
moreClientInfo = moreClientInfo,
Expand All @@ -88,24 +59,24 @@ fun NavGraphBuilder.clientNavGraph(
activateClient = activateClient
)
clientChargesRoute(
onBackPressed = {}
onBackPressed = navController::popBackStack
)
clientIdentifierRoute(
onDocumentClicked = {},
onBackPressed = {}
onBackPressed = navController::popBackStack
)
clientPinPointRoute(
onBackPressed = {}
onBackPressed = navController::popBackStack
)
clientSignatureRoute(
onBackPressed = {}
onBackPressed = navController::popBackStack
)
clientSurveyListRoute(
onBackPressed = {},
onBackPressed = navController::popBackStack,
onCardClicked = { _, _ -> }
)
clientSurveyQuestionRoute(
onBackPressed = {}
onBackPressed = navController::popBackStack
)
}
}
Expand Down Expand Up @@ -248,4 +219,28 @@ fun NavGraphBuilder.clientSurveyQuestionRoute(
survey = Survey()
)
}
}

fun NavController.navigateClientDetailsScreen(clientId: Int) {
navigate(ClientScreens.ClientDetailScreen.argument(clientId))
}

fun NavController.navigateClientIdentifierScreen(clientId: Int) {
navigate(ClientScreens.ClientIdentifierScreen.argument(clientId))
}

fun NavController.navigateClientChargesScreen(clientId: Int) {
navigate(ClientScreens.ClientChargesScreen.argument(clientId))
}

fun NavController.navigateClientPinPointScreen(clientId: Int) {
navigate(ClientScreens.ClientPinPointScreen.argument(clientId))
}

fun NavController.navigateClientSignatureScreen(clientId: Int) {
navigate(ClientScreens.ClientSignatureScreen.argument(clientId))
}

fun NavController.navigateClientSurveyListScreen(clientId: Int) {
navigate(ClientScreens.ClientSurveyListScreen.argument(clientId))
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -53,6 +54,7 @@ import androidx.compose.ui.unit.sp
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.mifos.core.designsystem.theme.Black
import com.mifos.core.designsystem.theme.White
import com.mifos.mifosxdroid.components.MifosNavigationBar
import com.mifos.mifosxdroid.components.Navigation
import com.mifos.mifosxdroid.components.NavigationConstants
Expand Down Expand Up @@ -109,24 +111,28 @@ fun AndroidClientApp() {
painter = painterResource(id = R.drawable.ic_dp_placeholder),
contentDescription = null
)
Text(text = "Mifos", color = Color.White,
Text(
text = "Mifos", color = Color.White,
style = TextStyle(
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
fontStyle = FontStyle.Normal
))
)
)
Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "Offline Mode", color = Color.White,
Text(
text = "Offline Mode", color = Color.White,
style = TextStyle(
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
fontStyle = FontStyle.Normal
))
)
)
Switch(
checked = offline,
onCheckedChange = {
Expand All @@ -140,14 +146,16 @@ fun AndroidClientApp() {
navigationDrawerTabs.forEachIndexed { index, item ->
NavigationDrawerItem(
label = {
Text(text = item.title,
Text(
text = item.title,
style = TextStyle(
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
fontStyle = FontStyle.Normal
),
color = Black,)
},
color = Black,
)
},
selected = index == selectedItemIndex,
onClick = {
selectedItemIndex = index
Expand Down Expand Up @@ -186,7 +194,7 @@ fun AndroidClientApp() {
}
}
},
gesturesEnabled = true
gesturesEnabled = isNavScreen
) {
Scaffold(
topBar = {
Expand Down Expand Up @@ -216,7 +224,8 @@ fun AndroidClientApp() {
contentDescription = null
)
}
}
},
colors = TopAppBarDefaults.topAppBarColors(White)
)
}
},
Expand All @@ -240,7 +249,8 @@ fun AndroidClientApp() {
}
}
}
}
},
containerColor = White
) { paddingValues ->
Navigation(navController = navController, padding = paddingValues)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ fun Navigation(
clientListScreen = { }
)

// clientListScreen(
// paddingValues = padding,
// createNewClient = {},
// syncClicked = {},
// onClientSelect = {
// navController.navigateClientDetailsScreen(it)
// }
// )

centerListScreen(
paddingValues = padding,
createNewCenter = {},
Expand Down

0 comments on commit 8c98f04

Please sign in to comment.