mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-25 08:09:41 +02:00
feat: Shopping List Editor Improvements (#3178)
* modify new item factory to default to zero qty and use last isFood value * automatically set the label of an item when choosing a food * fix when switching to a food with no label * removed trivial type annotation * more lint * removed debug log
This commit is contained in:
parent
a7775ea7ef
commit
ea7005e822
2 changed files with 16 additions and 6 deletions
|
@ -644,15 +644,15 @@ export default defineComponent({
|
|||
// Create New Item
|
||||
|
||||
const createEditorOpen = ref(false);
|
||||
const createListItemData = ref<ShoppingListItemCreate>(ingredientResetFactory());
|
||||
const createListItemData = ref<ShoppingListItemCreate>(listItemFactory());
|
||||
|
||||
function ingredientResetFactory(): ShoppingListItemCreate {
|
||||
function listItemFactory(isFood = false): ShoppingListItemCreate {
|
||||
return {
|
||||
shoppingListId: id,
|
||||
checked: false,
|
||||
position: shoppingList.value?.listItems?.length || 1,
|
||||
isFood: false,
|
||||
quantity: 1,
|
||||
isFood,
|
||||
quantity: 0,
|
||||
note: "",
|
||||
labelId: undefined,
|
||||
unitId: undefined,
|
||||
|
@ -675,7 +675,7 @@ export default defineComponent({
|
|||
loadingCounter.value -= 1;
|
||||
|
||||
if (data) {
|
||||
createListItemData.value = ingredientResetFactory();
|
||||
createListItemData.value = listItemFactory(createListItemData.value.isFood || false);
|
||||
createEditorOpen.value = false;
|
||||
refresh();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue