Skip to content

Commit

Permalink
Major Admin funnctionalitites
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaailashsharma committed Nov 25, 2023
1 parent c4b2aa1 commit cda8ae4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fun CollectWasteInfo(
if (!isWithin) {
isDialogVisible = true
} else {
viewModel.beforeCollectedPath.value = viewModel.wastePhoto.value
navController.navigate(Screens.CollectedWasteSuccess.route)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ fun SuccessfullyCollected(
isWasteCollected = receiver == "Yes",
allWasteCollected = receiver2 == "Yes",
feedBack = feedback.text,
beforeCollectedPath = viewModel.beforeCollectedPath.value
)
viewModel.getCurrentLevel(
points = pointsEarned + calculatePointsEarned(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fun CommunitiesSection(

}) {
JetFirestore(path = {
collection("ProfileInfo")
collection("CollectedWastes")
}, onRealtimeCollectionFetch = { value, _ ->
profileList = value?.getListOfObjects()
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fun updateCollectedWasteToFirebase(
isWasteCollected: Boolean,
allWasteCollected: Boolean,
feedBack: String,
beforeCollectedPath: String? = null
) {
val wasteItem = CollectedWasteItem(
latitude,
Expand All @@ -113,12 +114,13 @@ fun updateCollectedWasteToFirebase(
address,
isWasteCollected,
allWasteCollected,
feedBack
feedBack,
beforeCollectedPath
)

val db = FirebaseFirestore.getInstance()
timeStamp.let {
db.collection("CollectedWastes").document(it.toString()).set(wasteItem)
db.collection("TempCollectedWastes").document(it.toString()).set(wasteItem)
.addOnSuccessListener {

Toast.makeText(context, "Waste Reported Successfully", Toast.LENGTH_SHORT).show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ data class CollectedWasteItem(
val isWasteCollected: Boolean,
val allWasteCollected: Boolean,
val feedBack: String,
val beforeCollectedPath: String? = null
) {
constructor() : this(
0.0,
Expand All @@ -56,6 +57,7 @@ data class CollectedWasteItem(
"",
false,
false,
"",
""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class LocationViewModel @Inject constructor(
var time = mutableStateOf("")
var tags = mutableStateOf(listOf<Tag>())
var wastePhoto = mutableStateOf("")
var beforeCollectedPath = mutableStateOf("")
var rewardImage = mutableStateOf("")
var rewardTitle = mutableStateOf("")
var rewardDescription = mutableStateOf("")
Expand Down

0 comments on commit cda8ae4

Please sign in to comment.