Skip to content

Commit

Permalink
Merge pull request #403 from Assocify-Team/sab/budgetPermission
Browse files Browse the repository at this point in the history
Permission for budget and balance
  • Loading branch information
sarahbadr17 authored Jun 2, 2024
2 parents d3770ba + b808fb3 commit a06b6d5
Showing 1 changed file with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import com.github.se.assocify.model.entities.RoleType
import com.github.se.assocify.navigation.Destination
import com.github.se.assocify.navigation.MAIN_TABS_LIST
import com.github.se.assocify.navigation.NavigationActions
Expand Down Expand Up @@ -50,7 +51,7 @@ fun TreasuryScreen(navActions: NavigationActions, treasuryViewModel: TreasuryVie
val receiptListViewModel: ReceiptListViewModel = treasuryViewModel.receiptListViewModel

val treasuryState by treasuryViewModel.uiState.collectAsState()
val accountingState by accountingViewModel.uiState.collectAsState()
val receiptState by receiptListViewModel.uiState.collectAsState()
val pagerState = rememberPagerState(pageCount = { TreasuryPageIndex.entries.size })

Scaffold(
Expand Down Expand Up @@ -99,20 +100,25 @@ fun TreasuryScreen(navActions: NavigationActions, treasuryViewModel: TreasuryVie
},
contentWindowInsets = WindowInsets(20.dp, 0.dp, 20.dp, 0.dp)) { innerPadding ->
Column(modifier = Modifier.padding(innerPadding).fillMaxSize()) {
InnerTabRow(
tabList = TreasuryPageIndex.entries,
pagerState = pagerState,
switchTab = { tab -> treasuryViewModel.switchTab(tab) })
if (receiptState.userCurrentRole.type != RoleType.TREASURY &&
receiptState.userCurrentRole.type != RoleType.PRESIDENCY) {
ReceiptListScreen(viewModel = receiptListViewModel)
} else {
InnerTabRow(
tabList = TreasuryPageIndex.entries,
pagerState = pagerState,
switchTab = { tab -> treasuryViewModel.switchTab(tab) })

when (pagerState.currentPage) {
TreasuryPageIndex.Receipts.ordinal -> {}
TreasuryPageIndex.Budget.ordinal -> {
AccountingFilterBar(accountingViewModel)
AddSubcategoryDialog(accountingViewModel)
}
TreasuryPageIndex.Balance.ordinal -> {
AccountingFilterBar(accountingViewModel)
AddSubcategoryDialog(accountingViewModel)
when (pagerState.currentPage) {
TreasuryPageIndex.Receipts.ordinal -> {}
TreasuryPageIndex.Budget.ordinal -> {
AccountingFilterBar(accountingViewModel)
AddSubcategoryDialog(accountingViewModel)
}
TreasuryPageIndex.Balance.ordinal -> {
AccountingFilterBar(accountingViewModel)
AddSubcategoryDialog(accountingViewModel)
}
}
}

Expand Down

0 comments on commit a06b6d5

Please sign in to comment.