Skip to content

Commit

Permalink
use backend preparation in front
Browse files Browse the repository at this point in the history
  • Loading branch information
Perrine Letellier committed Aug 26, 2024
1 parent 758c0e3 commit 4a2107a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
1 change: 1 addition & 0 deletions api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
path("conditions/", views.ConditionListView.as_view(), name="condition_list"),
path("effects/", views.EffectListView.as_view(), name="effect_list"),
path("galenic-formulations/", views.GalenicFormulationListView.as_view(), name="galenic_formulation_list"),
path("preparations/", views.PreparationListView.as_view(), name="preparation_list"),
path("units/", views.UnitListView.as_view(), name="unit_list"),
# Authentication
path("login/", views.LoginView.as_view(), name="login"),
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/stores/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const useRootStore = defineStore("root", () => {
const conditions = ref(null)
const effects = ref(null)
const galenicFormulations = ref(null)
const preparations = ref(null)
const plantParts = ref(null)
const units = ref(null)

Expand Down Expand Up @@ -52,6 +53,10 @@ export const useRootStore = defineStore("root", () => {
const { data } = await useFetch("/api/v1/galenic-formulations/").json()
galenicFormulations.value = otherFieldsAtTheEnd(data.value)
}
const fetchPreparations = async () => {
const { data } = await useFetch("/api/v1/preparations/").json()
preparations.value = otherFieldsAtTheEnd(data.value)
}
const fetchPlantParts = async () => {
const { data } = await useFetch("/api/v1/plant-parts/").json()
plantParts.value = data.value
Expand All @@ -66,6 +71,7 @@ export const useRootStore = defineStore("root", () => {
fetchPopulations()
fetchPlantParts()
fetchGalenicFormulations()
fetchPreparations()
fetchUnits()
}
return {
Expand All @@ -80,6 +86,7 @@ export const useRootStore = defineStore("root", () => {
fetchConditions,
fetchEffects,
fetchGalenicFormulations,
fetchPreparations,
fetchDeclarationFieldsData,
fetchPlantParts,
fetchUnits,
Expand All @@ -88,6 +95,7 @@ export const useRootStore = defineStore("root", () => {
conditions,
effects,
galenicFormulations,
preparations,
units,
}
})
32 changes: 1 addition & 31 deletions frontend/src/views/ProducerFormPage/ElementCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<DsfrInputGroup class="max-w-sm">
<DsfrSelect
label="Préparation"
:options="preparations"
:options="store.preparations"
v-model="model.preparation"
defaultUnselectedText=""
:required="true"
Expand Down Expand Up @@ -131,34 +131,4 @@ const showFields = computed(() => {
return true
return false
})
// TODO: vérifier qu'on ait ces infos en base ou accepter de les avoir en front only
const preparations = [
"Alcoolature",
"Autre extrait fluide",
"Autre extrait sec",
"Autre macérât",
"Baume",
"Distillation",
"Extrait au CO2 supercritique",
"Extrait fluide alcoolique",
"Extrait fluide aqueux",
"Extrait fluide hydroalcoolique",
"Extrait fluide hydroglycériné",
"Extrait mou",
"Extrait sec alcoolique",
"Extrait sec aqueux",
"Extrait sec hydroalcoolique",
"Extrait sec hydroglycériné",
"Hydrolât (eau florale)",
"Macérât alcoolique",
"Macérât aqueux",
"Macérât huileux",
"Macérât hydroalcoolique",
"Macérât hydroglycériné",
"Oléorésine et gomme-oléorésine",
"Poudre (de plantes séchées ou broyées)",
"Pression à froid",
"Teinture",
]
</script>

0 comments on commit 4a2107a

Please sign in to comment.