fixed some exports
This commit is contained in:
parent
c118dca2c0
commit
5842022d0a
@ -16,13 +16,13 @@
|
|||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="downloadShoppingLink">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="downloadShoppingLink">
|
||||||
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
||||||
icon="far fa-file-pdf"/>
|
icon="far fa-file-pdf"/>
|
||||||
<DownloadCSV :items="csvData" :delim="user_preference_store.user_settings.csv_delim"
|
<DownloadCSV :items="shopping_list_store.get_flat_entries" :delim="user_preference_store.user_settings.csv_delim"
|
||||||
name="shopping.csv"
|
name="shopping.csv"
|
||||||
:label="$t('download_csv')" icon="fas fa-file-csv"/>
|
:label="$t('download_csv')" icon="fas fa-file-csv"/>
|
||||||
<CopyToClipboard :items="csvData" :settings="user_preference_store.user_settings"
|
<CopyToClipboard :items="shopping_list_store.get_flat_entries" :settings="user_preference_store.user_settings"
|
||||||
:label="$t('copy_to_clipboard')"
|
:label="$t('copy_to_clipboard')"
|
||||||
icon="fas fa-clipboard-list"/>
|
icon="fas fa-clipboard-list"/>
|
||||||
<CopyToClipboard :items="csvData" :settings="user_preference_store.user_settings" format="table"
|
<CopyToClipboard :items="shopping_list_store.get_flat_entries" :settings="user_preference_store.user_settings" format="table"
|
||||||
:label="$t('copy_markdown_table')" icon="fab fa-markdown"/>
|
:label="$t('copy_markdown_table')" icon="fab fa-markdown"/>
|
||||||
</div>
|
</div>
|
||||||
</b-button>
|
</b-button>
|
||||||
@ -442,12 +442,12 @@
|
|||||||
|
|
||||||
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
||||||
icon="far fa-file-pdf fa-fw"/>
|
icon="far fa-file-pdf fa-fw"/>
|
||||||
<DownloadCSV :items="csvData" :delim="user_preference_store.user_settings.csv_delim" name="shopping.csv"
|
<DownloadCSV :items="shopping_list_store.get_flat_entries" :delim="user_preference_store.user_settings.csv_delim" name="shopping.csv"
|
||||||
:label="$t('download_csv')" icon="fas fa-file-csv fa-fw"/>
|
:label="$t('download_csv')" icon="fas fa-file-csv fa-fw"/>
|
||||||
<CopyToClipboard :items="csvData" :settings="user_preference_store.user_settings"
|
<CopyToClipboard :items="shopping_list_store.get_flat_entries" :settings="user_preference_store.user_settings"
|
||||||
:label="$t('copy_to_clipboard')"
|
:label="$t('copy_to_clipboard')"
|
||||||
icon="fas fa-clipboard-list fa-fw"/>
|
icon="fas fa-clipboard-list fa-fw"/>
|
||||||
<CopyToClipboard :items="csvData" :settings="user_preference_store.user_settings" format="table"
|
<CopyToClipboard :items="shopping_list_store.get_flat_entries" :settings="user_preference_store.user_settings" format="table"
|
||||||
:label="$t('copy_markdown_table')" icon="fab fa-markdown fa-fw"/>
|
:label="$t('copy_markdown_table')" icon="fab fa-markdown fa-fw"/>
|
||||||
|
|
||||||
|
|
||||||
@ -521,12 +521,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
csvData() {
|
|
||||||
// return this.items.map((x) => {
|
|
||||||
// return {amount: x.amount, unit: x.unit?.name ?? "", food: x.food?.name ?? ""}
|
|
||||||
// })
|
|
||||||
return []
|
|
||||||
},
|
|
||||||
editingSupermarket() {
|
editingSupermarket() {
|
||||||
return this.shopping_list_store.supermarkets.filter((el) => {
|
return this.shopping_list_store.supermarkets.filter((el) => {
|
||||||
return el.editing
|
return el.editing
|
||||||
@ -605,27 +599,6 @@ export default {
|
|||||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err)
|
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onHand: function (item) {
|
|
||||||
let api = new ApiApiFactory()
|
|
||||||
let food = {
|
|
||||||
id: item?.[0]?.food.id ?? item?.food?.id,
|
|
||||||
food_onhand: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateFood(food, "food_onhand")
|
|
||||||
.then((result) => {
|
|
||||||
let entries = this.items.filter((x) => x.food.id == food.id).map((x) => x.id)
|
|
||||||
this.items = this.items.filter((x) => x.food.id !== food.id)
|
|
||||||
return entries
|
|
||||||
})
|
|
||||||
.then((entries) => {
|
|
||||||
entries.forEach((x) => {
|
|
||||||
api.destroyShoppingListEntry(x).then((result) => {
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* change number of servings of a shopping list recipe
|
* change number of servings of a shopping list recipe
|
||||||
* backend handles scaling of associated entries
|
* backend handles scaling of associated entries
|
||||||
|
@ -125,6 +125,22 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
|
|||||||
|
|
||||||
return ordered_structure
|
return ordered_structure
|
||||||
},
|
},
|
||||||
|
get_flat_entries: function () {
|
||||||
|
//{amount: x.amount, unit: x.unit?.name ?? "", food: x.food?.name ?? ""}
|
||||||
|
let items = []
|
||||||
|
for (let i in this.get_entries_by_group) {
|
||||||
|
for (let f in this.get_entries_by_group[i]['foods']) {
|
||||||
|
for (let e in this.get_entries_by_group[i]['foods'][f]['entries']) {
|
||||||
|
items.push({
|
||||||
|
amount: this.get_entries_by_group[i]['foods'][f]['entries'][e].amount,
|
||||||
|
unit: this.get_entries_by_group[i]['foods'][f]['entries'][e].unit?.name ?? '',
|
||||||
|
food: this.get_entries_by_group[i]['foods'][f]['entries'][e].food?.name ?? '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* list of options available for grouping entry display
|
* list of options available for grouping entry display
|
||||||
* @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]}
|
* @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]}
|
||||||
|
Loading…
Reference in New Issue
Block a user