1
+ <template >
2
+ <div >
3
+ <SelectButton v-model =" locale" :options =" ['fa', 'en']" aria-labelledby =" lang" class =" select-lang" />
4
+ <div style =" user-select : text ; margin : 20px 0 0 0 " >
5
+ <div v-if =" requiredCalories > 0" >
6
+ <span >{{ $t('dailyRequiredCalories') }}: {{ numberWithCommas(requiredCalories) }} {{ $t('kcl') }}</span >
7
+ </div >
8
+
9
+ <div v-if =" requiredPortion[0] > 0" >
10
+ <span >{{ $t('dailyRequiredPortions') }}: {{ numberWithCommas(requiredPortion[0]) }} {{ $t('to') }} {{ numberWithCommas(requiredPortion[1]) }} {{ $t('gram') }}</span >
11
+ </div >
12
+
13
+ <br />
14
+
15
+ <div v-for =" (meal, index) in meals" >
16
+ {{ meal.mealName }} =>
17
+ <span v-for =" (food, iFood) in meal.foods" >
18
+ <span >
19
+ {{ foods.find(i => i.fdc_id == food.fdc_id)?.[`name_${locale}`] }}
20
+ </span >
21
+ <span > ({{ numberWithCommas(food.amount) }} {{ $t('gram') }}) </span >
22
+ <span v-if =" iFood !== meal.foods.length-1" > - </span >
23
+ </span >
24
+ </div >
25
+
26
+ <br />
27
+
28
+
29
+ <div >
30
+ <div v-if =" totalNutrients.energy >0" >{{ $t('total') }} {{ $t('energy') }}: {{numberWithCommas(totalNutrients.energy)}} {{ $t('kcl') }}</div >
31
+ <div v-if =" totalNutrients.portion >0" >{{ $t('total') }} {{ $t('portion') }}: {{numberWithCommas(totalNutrients.portion)}} {{ $t('gram') }}</div >
32
+ <div v-if =" totalNutrients.carbohydrate >0" >{{ $t('total') }} {{ $t('carbohydrate') }}: {{numberWithCommas(totalNutrients.carbohydrate)}} {{ $t('gram') }}</div >
33
+ <div v-if =" totalNutrients.sugar >0" >{{ $t('total') }} {{ $t('sugar') }}: {{numberWithCommas(totalNutrients.sugar)}} {{ $t('gram') }}</div >
34
+ <div v-if =" totalNutrients.fiber >0" >{{ $t('total') }} {{ $t('fiber') }}: {{numberWithCommas(totalNutrients.fiber)}} {{ $t('gram') }}</div >
35
+ </div >
36
+
37
+
38
+ </div >
39
+ </div >
40
+ </template >
41
+
42
+ <script setup lang="ts">
43
+ import foods from " ~/consts/foods" ;
44
+
45
+ definePageMeta ({
46
+ layout: " empty"
47
+ })
48
+
49
+ const {locale} = useI18n ()
50
+ import {useNutrients } from " ~/composables/nutrients/useNutrients" ;
51
+ import {useTdee } from " ~/composables/tdee/useTdee" ;
52
+ import numberWithCommas from " ~/utils/numberWithCommas" ;
53
+
54
+ const {
55
+ meals,
56
+ totalNutrients
57
+ } = useNutrients ()
58
+ const {requiredCalories, requiredPortion} = useTdee ()
59
+
60
+ </script >
61
+
62
+ <style scoped lang="scss">
63
+
64
+ </style >
0 commit comments