mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 21:37:49 -05:00
allow create in model select and fixed some stuff
This commit is contained in:
@@ -84,12 +84,11 @@ const meal_plan_grid = computed(() => {
|
||||
|
||||
for (const x of Array(4).keys()) {
|
||||
let grid_day_date = DateTime.now().plus({days: x})
|
||||
console.log('going trough days ', x, grid_day_date)
|
||||
grid.push({
|
||||
date: grid_day_date,
|
||||
create_default_date: grid_day_date.toISODate(), // improve meal plan edit modal to do formatting itself and accept dates
|
||||
date_label: grid_day_date.toLocaleString(DateTime.DATE_MED),
|
||||
plan_entries: useMealPlanStore().plan_list.filter((m: MealPlan) => ((DateTime.fromJSDate(m.fromDate).startOf('day') <= grid_day_date.startOf('day')) && (DateTime.fromJSDate((m.toDate != undefined) ? m.toDate : m.fromDate).startOf('day') >= grid_day_date.startOf('day')))),
|
||||
plan_entries: useMealPlanStore().planList.filter((m: MealPlan) => ((DateTime.fromJSDate(m.fromDate).startOf('day') <= grid_day_date.startOf('day')) && (DateTime.fromJSDate((m.toDate != undefined) ? m.toDate : m.fromDate).startOf('day') >= grid_day_date.startOf('day')))),
|
||||
} as MealPlanGridItem)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,17 +49,26 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// ID of message timeout currently running
|
||||
const timeoutId = ref(-1)
|
||||
// currently visible message
|
||||
const visibleMessage = ref({} as Message)
|
||||
// visible state binding of snackbar
|
||||
const showSnackbar = ref(false)
|
||||
|
||||
/**
|
||||
* subscribe to mutation of the snackbarQueue to detect new messages being added
|
||||
*/
|
||||
useMessageStore().$subscribe((mutation, state) => {
|
||||
if ('snackbarQueue' in state && mutation.events.type == 'add') {
|
||||
processQueue()
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* process snackbar queue
|
||||
* show oldest message for desired time and remove it afterwards
|
||||
*/
|
||||
function processQueue() {
|
||||
if (timeoutId.value == -1 && useMessageStore().snackbarQueue.length > 0) {
|
||||
visibleMessage.value = useMessageStore().snackbarQueue[0]
|
||||
@@ -72,6 +81,10 @@ function processQueue() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* after item timeout has been reached remove it from the list
|
||||
* and restart processing the queue to check for new items
|
||||
*/
|
||||
function removeItem() {
|
||||
showSnackbar.value = false
|
||||
clearTimeout(timeoutId.value)
|
||||
|
||||
Reference in New Issue
Block a user