This commit is contained in:
vabene1111
2023-01-03 23:12:00 +01:00
parent 56252a707a
commit 6176eeb024
13 changed files with 1209 additions and 985 deletions

View File

@ -15,6 +15,7 @@
<file-input v-if="visibleCondition(f, 'file')" :label="f.label" :value="f.value" :field="f.field" @change="storeValue" />
<small-text v-if="visibleCondition(f, 'smalltext')" :value="f.value" />
<date-input v-if="visibleCondition(f, 'date')" :label="f.label" :value="f.value" :field="f.field" :help="showHelp && f.help" :subtitle="f.subtitle" />
<number-input v-if="visibleCondition(f, 'number')" :label="f.label" :value="f.value" :field="f.field" :placeholder="f.placeholder" :help="showHelp && f.help" :subtitle="f.subtitle" />
</div>
<template v-slot:modal-footer>
<div class="row w-100">
@ -49,10 +50,11 @@ import ChoiceInput from "@/components/Modals/ChoiceInput"
import FileInput from "@/components/Modals/FileInput"
import SmallText from "@/components/Modals/SmallText"
import HelpBadge from "@/components/Badges/Help"
import NumberInput from "@/components/Modals/NumberInput.vue";
export default {
name: "GenericModalForm",
components: { FileInput, CheckboxInput, LookupInput, TextInput, EmojiInput, ChoiceInput, SmallText, HelpBadge,DateInput },
components: { FileInput, CheckboxInput, LookupInput, TextInput, EmojiInput, ChoiceInput, SmallText, HelpBadge,DateInput, NumberInput },
mixins: [ApiMixin, ToastMixin],
props: {
model: { required: true, type: Object },

View File

@ -0,0 +1,37 @@
<template>
<div>
<b-form-group v-bind:label="label" class="mb-3">
<b-form-input v-model="new_value" type="number" :placeholder="placeholder"></b-form-input>
<em v-if="help" class="small text-muted">{{ help }}</em>
<small v-if="subtitle" class="text-muted">{{ subtitle }}</small>
</b-form-group>
</div>
</template>
<script>
export default {
name: "TextInput",
props: {
field: { type: String, default: "You Forgot To Set Field Name" },
label: { type: String, default: "Text Field" },
value: { type: String, default: "" },
placeholder: { type: Number, default: 0 },
help: { type: String, default: undefined },
subtitle: { type: String, default: undefined },
},
data() {
return {
new_value: undefined,
}
},
mounted() {
this.new_value = this.value
},
watch: {
new_value: function () {
this.$root.$emit("change", this.field, this.new_value)
},
},
methods: {},
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -137,6 +137,12 @@ export interface Automation {
* @memberof Automation
*/
param_3?: string | null;
/**
*
* @type {number}
* @memberof Automation
*/
order?: number;
/**
*
* @type {boolean}
@ -158,7 +164,9 @@ export interface Automation {
export enum AutomationTypeEnum {
FoodAlias = 'FOOD_ALIAS',
UnitAlias = 'UNIT_ALIAS',
KeywordAlias = 'KEYWORD_ALIAS'
KeywordAlias = 'KEYWORD_ALIAS',
DescriptionReplace = 'DESCRIPTION_REPLACE',
InstructionReplace = 'INSTRUCTION_REPLACE'
}
/**
@ -431,6 +439,12 @@ export interface Food {
* @memberof Food
*/
name: string;
/**
*
* @type {string}
* @memberof Food
*/
plural_name?: string | null;
/**
*
* @type {string}
@ -655,6 +669,12 @@ export interface FoodSubstitute {
* @memberof FoodSubstitute
*/
name: string;
/**
*
* @type {string}
* @memberof FoodSubstitute
*/
plural_name?: string | null;
}
/**
*
@ -848,10 +868,10 @@ export interface Ingredient {
food: IngredientFood | null;
/**
*
* @type {FoodSupermarketCategory}
* @type {IngredientUnit}
* @memberof Ingredient
*/
unit: FoodSupermarketCategory | null;
unit: IngredientUnit | null;
/**
*
* @type {string}
@ -894,6 +914,18 @@ export interface Ingredient {
* @memberof Ingredient
*/
used_in_recipes?: string;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
always_use_plural_unit?: boolean;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
always_use_plural_food?: boolean;
}
/**
*
@ -913,6 +945,12 @@ export interface IngredientFood {
* @memberof IngredientFood
*/
name: string;
/**
*
* @type {string}
* @memberof IngredientFood
*/
plural_name?: string | null;
/**
*
* @type {string}
@ -1004,6 +1042,37 @@ export interface IngredientFood {
*/
child_inherit_fields?: Array<FoodInheritFields> | null;
}
/**
*
* @export
* @interface IngredientUnit
*/
export interface IngredientUnit {
/**
*
* @type {number}
* @memberof IngredientUnit
*/
id?: number;
/**
*
* @type {string}
* @memberof IngredientUnit
*/
name: string;
/**
*
* @type {string}
* @memberof IngredientUnit
*/
plural_name?: string | null;
/**
*
* @type {string}
* @memberof IngredientUnit
*/
description?: string | null;
}
/**
*
* @export
@ -1746,13 +1815,13 @@ export interface MealPlanRecipe {
* @type {string}
* @memberof MealPlanRecipe
*/
rating?: string;
rating?: string | null;
/**
*
* @type {string}
* @memberof MealPlanRecipe
*/
last_cooked?: string;
last_cooked?: string | null;
/**
*
* @type {string}
@ -1953,13 +2022,13 @@ export interface Recipe {
* @type {string}
* @memberof Recipe
*/
rating?: string;
rating?: string | null;
/**
*
* @type {string}
* @memberof Recipe
*/
last_cooked?: string;
last_cooked?: string | null;
/**
*
* @type {boolean}
@ -2166,10 +2235,10 @@ export interface RecipeIngredients {
food: IngredientFood | null;
/**
*
* @type {FoodSupermarketCategory}
* @type {IngredientUnit}
* @memberof RecipeIngredients
*/
unit: FoodSupermarketCategory | null;
unit: IngredientUnit | null;
/**
*
* @type {string}
@ -2212,6 +2281,18 @@ export interface RecipeIngredients {
* @memberof RecipeIngredients
*/
used_in_recipes?: string;
/**
*
* @type {boolean}
* @memberof RecipeIngredients
*/
always_use_plural_unit?: boolean;
/**
*
* @type {boolean}
* @memberof RecipeIngredients
*/
always_use_plural_food?: boolean;
}
/**
*
@ -2412,13 +2493,13 @@ export interface RecipeOverview {
* @type {string}
* @memberof RecipeOverview
*/
rating?: string;
rating?: string | null;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
last_cooked?: string;
last_cooked?: string | null;
/**
*
* @type {string}
@ -2703,10 +2784,10 @@ export interface ShoppingListEntries {
food: IngredientFood | null;
/**
*
* @type {FoodSupermarketCategory}
* @type {IngredientUnit}
* @memberof ShoppingListEntries
*/
unit?: FoodSupermarketCategory | null;
unit?: IngredientUnit | null;
/**
*
* @type {number}
@ -2794,10 +2875,10 @@ export interface ShoppingListEntry {
food: IngredientFood | null;
/**
*
* @type {FoodSupermarketCategory}
* @type {IngredientUnit}
* @memberof ShoppingListEntry
*/
unit?: FoodSupermarketCategory | null;
unit?: IngredientUnit | null;
/**
*
* @type {number}
@ -3191,41 +3272,16 @@ export interface Space {
file_size_mb?: string;
/**
*
* @type {SpaceImage}
* @type {RecipeFile}
* @memberof Space
*/
image?: SpaceImage;
}
/**
*
* @export
* @interface SpaceImage
*/
export interface SpaceImage {
image?: RecipeFile | null;
/**
*
* @type {number}
* @memberof SpaceImage
* @type {boolean}
* @memberof Space
*/
id?: number;
/**
*
* @type {string}
* @memberof SpaceImage
*/
name: string;
/**
*
* @type {string}
* @memberof SpaceImage
*/
file_download?: string;
/**
*
* @type {string}
* @memberof SpaceImage
*/
preview?: string;
use_plural?: boolean;
}
/**
*
@ -3563,6 +3619,12 @@ export interface Unit {
* @memberof Unit
*/
name: string;
/**
*
* @type {string}
* @memberof Unit
*/
plural_name?: string | null;
/**
*
* @type {string}

View File

@ -717,4 +717,10 @@ export const formFunctions = {
form.fields.filter((x) => x.field === "inherit_fields")[0].value = getUserPreference("food_inherit_default")
return form
},
AutomationOrderDefault: function (form) {
if (form.fields.filter((x) => x.field === "order")[0].value === undefined) {
form.fields.filter((x) => x.field === "order")[0].value = 1000
}
return form
},
}