diff --git a/grocy-chores-card.js b/grocy-chores-card.js index 78cc368..af23166 100644 --- a/grocy-chores-card.js +++ b/grocy-chores-card.js @@ -3,6 +3,19 @@ import {DateTime} from "luxon"; import style from './style.js'; class GrocyChoresCard extends LitElement { + + async loadCustomCreateTaskElements() { + if(!customElements.get("ha-date-input") || !customElements.get("ha-textfield")) { + const cardHelpers = await window.loadCardHelpers(); + if(!customElements.get("ha-date-input")) { + await cardHelpers.importMoreInfoControl("date"); + } + if(!customElements.get("ha-textfield")) { + await cardHelpers.importMoreInfoControl("text"); + } + } + } + static get styles() { return style; } @@ -178,6 +191,10 @@ class GrocyChoresCard extends LitElement { } this.config = config; this._processItems(); + if(this.config.show_create_task) { + this.loadCustomCreateTaskElements(); + } + } render() { @@ -374,20 +391,18 @@ class GrocyChoresCard extends LitElement { this._addTask()}> - - - + + - + .locale=${this._hass.locale} + .label=${this._translate("Optional due date")} + .value="${this._taskDueDateInputFormat()}"> + ` }