@@ -352,6 +359,7 @@
+
@@ -442,6 +450,7 @@ import "bootstrap-vue/dist/bootstrap-vue.css"
import ContextMenu from "@/components/ContextMenu/ContextMenu"
import ContextMenuItem from "@/components/ContextMenu/ContextMenuItem"
import ShoppingLineItem from "@/components/ShoppingLineItem"
+import DownloadPDF from "@/components/Buttons/DownloadPDF"
import GenericMultiselect from "@/components/GenericMultiselect"
import GenericPill from "@/components/GenericPill"
import LookupInput from "@/components/Modals/LookupInput"
@@ -456,7 +465,7 @@ Vue.use(BootstrapVue)
export default {
name: "ShoppingListView",
mixins: [ApiMixin],
- components: { ContextMenu, ContextMenuItem, ShoppingLineItem, GenericMultiselect, GenericPill, draggable, LookupInput },
+ components: { ContextMenu, ContextMenuItem, ShoppingLineItem, GenericMultiselect, GenericPill, draggable, LookupInput, DownloadPDF },
data() {
return {
@@ -644,9 +653,8 @@ export default {
},
methods: {
// this.genericAPI inherited from ApiMixin
- test(e) {
- this.new_item.unit = e
- console.log(e, this.new_item, this.formUnit)
+ download(type) {
+ console.log("you just downloaded", type)
},
addItem() {
let api = new ApiApiFactory()
diff --git a/vue/src/components/Buttons/DownloadPDF.vue b/vue/src/components/Buttons/DownloadPDF.vue
new file mode 100644
index 00000000..9d547561
--- /dev/null
+++ b/vue/src/components/Buttons/DownloadPDF.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
diff --git a/vue/src/components/ShoppingLineItem.vue b/vue/src/components/ShoppingLineItem.vue
index 30a3a5d1..68830d26 100644
--- a/vue/src/components/ShoppingLineItem.vue
+++ b/vue/src/components/ShoppingLineItem.vue
@@ -6,8 +6,8 @@
-
-
+
+
-
+
{{ showDetails ? "Hide" : "Show" }} Details
@@ -44,7 +44,7 @@
aria-expanded="false"
type="button"
class="btn btn-link btn-sm m-0 p-0"
- style="text-overflow: ellipsis;"
+ style="text-overflow: ellipsis"
@click.stop="openRecipeCard($event, e)"
@mouseover="openRecipeCard($event, e)"
>
@@ -59,8 +59,8 @@
-
-
+
+
-
+
@@ -138,7 +138,7 @@ export default {
}
},
computed: {
- formatAmount: function() {
+ formatAmount: function () {
let amount = {}
this.entries.forEach((entry) => {
let unit = entry?.unit?.name ?? "----"
@@ -152,26 +152,26 @@ export default {
})
return amount
},
- formatCategory: function() {
+ formatCategory: function () {
return this.formatOneCategory(this.entries[0]) || this.$t("Undefined")
},
- formatChecked: function() {
+ formatChecked: function () {
return this.entries.map((x) => x.checked).every((x) => x === true)
},
- formatHint: function() {
+ formatHint: function () {
if (this.groupby == "recipe") {
return this.formatCategory
} else {
return this.formatRecipe
}
},
- formatFood: function() {
+ formatFood: function () {
return this.formatOneFood(this.entries[0])
},
- formatUnit: function() {
+ formatUnit: function () {
return this.formatOneUnit(this.entries[0])
},
- formatRecipe: function() {
+ formatRecipe: function () {
if (this.entries?.length == 1) {
return this.formatOneMealPlan(this.entries[0]) || ""
} else {
@@ -179,7 +179,7 @@ export default {
return [this.formatOneMealPlan(mealplan_name?.[0]), this.$t("CountMore", { count: this.entries?.length - 1 })].join(" ")
}
},
- formatNotes: function() {
+ formatNotes: function () {
if (this.entries?.length == 1) {
return this.formatOneNote(this.entries[0]) || ""
}
@@ -193,49 +193,49 @@ export default {
methods: {
// this.genericAPI inherited from ApiMixin
- formatDate: function(datetime) {
+ formatDate: function (datetime) {
if (!datetime) {
return
}
return Intl.DateTimeFormat(window.navigator.language, { dateStyle: "short", timeStyle: "short" }).format(Date.parse(datetime))
},
- formatOneAmount: function(item) {
+ formatOneAmount: function (item) {
return item?.amount ?? 1
},
- formatOneUnit: function(item) {
+ formatOneUnit: function (item) {
return item?.unit?.name ?? ""
},
- formatOneCategory: function(item) {
+ formatOneCategory: function (item) {
return item?.food?.supermarket_category?.name
},
- formatOneCompletedAt: function(item) {
+ formatOneCompletedAt: function (item) {
if (!item.completed_at) {
return ""
}
return [this.$t("Completed"), "@", this.formatDate(item.completed_at)].join(" ")
},
- formatOneFood: function(item) {
+ formatOneFood: function (item) {
return item.food.name
},
- formatOneChecked: function(item) {
+ formatOneChecked: function (item) {
return item.checked
},
- formatOneMealPlan: function(item) {
+ formatOneMealPlan: function (item) {
return item?.recipe_mealplan?.name
},
- formatOneRecipe: function(item) {
+ formatOneRecipe: function (item) {
return item?.recipe_mealplan?.recipe_name
},
- formatOneNote: function(item) {
+ formatOneNote: function (item) {
if (!item) {
item = this.entries[0]
}
return [item?.recipe_mealplan?.mealplan_note, item?.ingredient_note].filter(String)
},
- formatOneCreatedBy: function(item) {
+ formatOneCreatedBy: function (item) {
return [item?.created_by.username, "@", this.formatDate(item.created_at)].join(" ")
},
- openRecipeCard: function(e, item) {
+ openRecipeCard: function (e, item) {
this.genericAPI(this.Models.RECIPE, this.Actions.FETCH, { id: item.recipe_mealplan.recipe }).then((result) => {
let recipe = result.data
recipe.steps = undefined
@@ -243,7 +243,7 @@ export default {
this.$refs.recipe_card.open(e, recipe)
})
},
- updateChecked: function(e, item) {
+ updateChecked: function (e, item) {
if (!item) {
let update = { entries: this.entries.map((x) => x.id), checked: !this.formatChecked }
this.$emit("update-checkbox", update)
diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json
index facd5ed8..80bba4da 100644
--- a/vue/src/locales/en.json
+++ b/vue/src/locales/en.json
@@ -270,5 +270,6 @@
"New_Cookbook": "New cookbook",
"Hide_Keyword": "Hide keywords",
"Clear": "Clear",
- "create_shopping_new": "NEW: Add to Shopping List"
+ "create_shopping_new": "NEW: Add to Shopping List",
+ "download_pdf": "Download PDF"
}