Skip to content

Commit dad5e5e

Browse files
E211439AE211439A
E211439A
authored and
E211439A
committed
Merge remote-tracking branch 'origin/AddPrescription-View' into AddPrescription-View
2 parents d039429 + dd692bd commit dad5e5e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

app/src/main/java/fr/medicapp/medicapp/ui/navigation/PrescriptionNavGraph.kt

+10-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import androidx.activity.result.contract.ActivityResultContracts
1010
import androidx.annotation.RequiresApi
1111
import androidx.compose.foundation.layout.Box
1212
import androidx.compose.foundation.layout.Column
13+
import androidx.compose.foundation.layout.Spacer
1314
import androidx.compose.foundation.layout.fillMaxSize
15+
import androidx.compose.foundation.layout.height
16+
import androidx.compose.material3.CircularProgressIndicator
1417
import androidx.compose.material3.LinearProgressIndicator
1518
import androidx.compose.material3.Text
1619
import androidx.compose.runtime.Composable
@@ -22,6 +25,7 @@ import androidx.compose.runtime.setValue
2225
import androidx.compose.ui.Alignment
2326
import androidx.compose.ui.Modifier
2427
import androidx.compose.ui.platform.LocalContext
28+
import androidx.compose.ui.unit.dp
2529
import androidx.core.content.FileProvider
2630
import androidx.lifecycle.ViewModel
2731
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -313,7 +317,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
313317
onResult = { success: Boolean ->
314318
hasImage = success
315319

316-
if (imageUri != null) {
320+
if (imageUri != null && success) {
317321
loading.value = true
318322
val prescriptionAI = PrescriptionAI.getInstance(context)
319323
val prediction = prescriptionAI.analyse(
@@ -334,7 +338,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
334338
"DrugQuantity" -> treatment.posology += " $word"
335339
"DrugForm" -> treatment.posology += " $word"
336340
"DrugFrequency" -> treatment.posology += " $word"
337-
"DrugDuration" -> treatment.posology += " $word"
341+
"DrugDuration" -> treatment.renew += " $word"
338342
}
339343
}
340344

@@ -344,7 +348,7 @@ fun NavGraphBuilder.prescriptionNavGraph(
344348
"DrugQuantity" -> treatment.posology += " $word"
345349
"DrugForm" -> treatment.posology += " $word"
346350
"DrugFrequency" -> treatment.posology += " $word"
347-
"DrugDuration" -> treatment.posology += " $word"
351+
"DrugDuration" -> treatment.renew += " $word"
348352
}
349353
}
350354
}
@@ -367,6 +371,9 @@ fun NavGraphBuilder.prescriptionNavGraph(
367371
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
368372
Column(horizontalAlignment = Alignment.CenterHorizontally) {
369373
Text(text = "Traitement de l'ordonnance en cours...")
374+
375+
Spacer(modifier = Modifier.height(10.dp))
376+
370377
LinearProgressIndicator()
371378
}
372379
}

0 commit comments

Comments
 (0)