mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 05:25:26 +02:00
Bug/general fixes (#450)
* Fix asset link * remove unused var * fix no meal-plan returned * cleanup redundant code * Fix dates off in UI * quick set dark/light mode * user image fixes Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
785ab184af
commit
22d9309112
16 changed files with 218 additions and 16352 deletions
|
@ -67,12 +67,13 @@
|
|||
</v-card-text>
|
||||
<v-row align="center" justify="end">
|
||||
<v-card-actions class="mr-5">
|
||||
<v-btn color="success" @click="random" v-if="planDays.length > 0" text>
|
||||
<TheButton edit @click="random" v-if="planDays.length > 0" text>
|
||||
<template v-slot:icon>
|
||||
mdi-dice-multiple
|
||||
</template>
|
||||
{{ $t("general.random") }}
|
||||
</v-btn>
|
||||
<v-btn color="success" @click="save" text :disabled="planDays.length == 0">
|
||||
{{ $t("general.save") }}
|
||||
</v-btn>
|
||||
</TheButton>
|
||||
<TheButton create @click="save" :disabled="planDays.length == 0" />
|
||||
</v-card-actions>
|
||||
</v-row>
|
||||
</v-card>
|
||||
|
@ -105,6 +106,9 @@ export default {
|
|||
},
|
||||
|
||||
watch: {
|
||||
startDate(val) {
|
||||
console.log(val);
|
||||
},
|
||||
dateDif() {
|
||||
this.planDays = [];
|
||||
for (let i = 0; i < this.dateDif; i++) {
|
||||
|
@ -132,22 +136,19 @@ export default {
|
|||
return this.$store.getters.getCurrentGroup;
|
||||
},
|
||||
actualStartDate() {
|
||||
return Date.parse(this.startDate);
|
||||
if (!this.startDate) return null;
|
||||
return Date.parse(this.startDate.replaceAll("-", "/"));
|
||||
},
|
||||
actualEndDate() {
|
||||
return Date.parse(this.endDate);
|
||||
if (!this.endDate) return null;
|
||||
return Date.parse(this.endDate.replaceAll("-", "/"));
|
||||
},
|
||||
dateDif() {
|
||||
let startDate = new Date(this.startDate);
|
||||
let endDate = new Date(this.endDate);
|
||||
console.log(startDate, endDate);
|
||||
|
||||
let dateDif = (endDate - startDate) / (1000 * 3600 * 24) + 1;
|
||||
|
||||
if (!this.actualEndDate || !this.actualStartDate) return null;
|
||||
let dateDif = (this.actualEndDate - this.actualStartDate) / (1000 * 3600 * 24) + 1;
|
||||
if (dateDif < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return dateDif;
|
||||
},
|
||||
startComputedDateFormatted() {
|
||||
|
@ -179,22 +180,17 @@ export default {
|
|||
},
|
||||
random() {
|
||||
this.usedRecipes = [1];
|
||||
this.planDays.forEach((element, index) => {
|
||||
this.planDays.forEach((_, index) => {
|
||||
let recipe = this.getRandom(this.filteredRecipes);
|
||||
this.planDays[index]["meals"][0]["slug"] = recipe.slug;
|
||||
this.planDays[index]["meals"][0]["name"] = recipe.name;
|
||||
this.usedRecipes.push(recipe);
|
||||
});
|
||||
},
|
||||
processTime(index) {
|
||||
let dateText = new Date(this.actualStartDate.valueOf() + 1000 * 3600 * 24 * index);
|
||||
return dateText;
|
||||
},
|
||||
getDate(index) {
|
||||
const dateObj = this.processTime(index);
|
||||
const dateObj = new Date(this.actualStartDate.valueOf() + 1000 * 3600 * 24 * index);
|
||||
return utils.getDateAsPythonDate(dateObj);
|
||||
},
|
||||
|
||||
async save() {
|
||||
const mealBody = {
|
||||
group: this.groupSettings.name,
|
||||
|
@ -209,7 +205,6 @@ export default {
|
|||
this.endDate = null;
|
||||
}
|
||||
},
|
||||
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
|
@ -227,12 +222,9 @@ export default {
|
|||
const nextEndDate = new Date(nextMonday);
|
||||
nextEndDate.setDate(nextEndDate.getDate() + 4);
|
||||
|
||||
this.startDate = nextMonday.toISOString().substr(0, 10);
|
||||
|
||||
this.endDate = nextEndDate.toISOString().substr(0, 10);
|
||||
this.startDate = utils.getDateAsPythonDate(nextMonday);
|
||||
this.endDate = utils.getDateAsPythonDate(nextEndDate);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue