121 files
This commit is contained in:
1 parent
e36b8a1a22
commit
13cb612f61
121 files changed
+248
-4150
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -211,6 +211,14 @@ export class MaintenanceSupporterCardEditor extends LitElement {
|
|||||||
></ha-switch>
|
></ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
|
|
||||||
|
<ha-formfield label="${t("responsible_user", L)}">
|
||||||
|
<ha-switch
|
||||||
|
.checked=${this._config.show_assignee !== false}
|
||||||
|
@change=${(e: Event) =>
|
||||||
|
this._valueChanged("show_assignee", (e.target as HTMLInputElement).checked)}
|
||||||
|
></ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
|
||||||
<ha-formfield label="${t("card_compact", L)}">
|
<ha-formfield label="${t("card_compact", L)}">
|
||||||
<ha-switch
|
<ha-switch
|
||||||
.checked=${this._config.compact || false}
|
.checked=${this._config.compact || false}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import type {
|
|||||||
SavedView,
|
SavedView,
|
||||||
SavedViewFilters,
|
SavedViewFilters,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
import { UserService } from "./user-service";
|
||||||
import "./maintenance-card-editor";
|
import "./maintenance-card-editor";
|
||||||
import "./components/complete-dialog";
|
import "./components/complete-dialog";
|
||||||
import {
|
import {
|
||||||
@@ -33,6 +34,11 @@ export class MaintenanceSupporterCard extends LitElement {
|
|||||||
@state() private _stats: StatisticsResponse | null = null;
|
@state() private _stats: StatisticsResponse | null = null;
|
||||||
@state() private _unsub: (() => void) | null = null;
|
@state() private _unsub: (() => void) | null = null;
|
||||||
@state() private _viewFilters: SavedViewFilters | null = null;
|
@state() private _viewFilters: SavedViewFilters | null = null;
|
||||||
|
/** id → display name for the assignee badge. Empty until users/list
|
||||||
|
* resolves; the badge stays hidden rather than showing a raw uuid. */
|
||||||
|
@state() private _userNames: Record<string, string> = {};
|
||||||
|
private _userService: UserService | null = null;
|
||||||
|
private _userNamesLoaded = false;
|
||||||
|
|
||||||
private get _lang(): string {
|
private get _lang(): string {
|
||||||
return this.hass?.language || "en";
|
return this.hass?.language || "en";
|
||||||
@@ -95,6 +101,19 @@ export class MaintenanceSupporterCard extends LitElement {
|
|||||||
if (lang && !isLocaleLoaded(lang)) {
|
if (lang && !isLocaleLoaded(lang)) {
|
||||||
ensureLocale(lang).then(() => this.requestUpdate());
|
ensureLocale(lang).then(() => this.requestUpdate());
|
||||||
}
|
}
|
||||||
|
// Assignee names: resolved once, only when the config allows it AND some
|
||||||
|
// task actually carries a responsible user. The condition is checked
|
||||||
|
// synchronously here — an unconditional call whose promise triggered a
|
||||||
|
// re-render looped the element forever. Assigning `_userNames` (@state)
|
||||||
|
// is what re-renders once the list arrives.
|
||||||
|
if (
|
||||||
|
this.hass &&
|
||||||
|
!this._userNamesLoaded &&
|
||||||
|
this._config.show_assignee !== false &&
|
||||||
|
this._objects.some((o) => o.tasks.some((tk) => tk.responsible_user_id))
|
||||||
|
) {
|
||||||
|
this._loadUserNames();
|
||||||
|
}
|
||||||
if (changedProps.has("hass") && this.hass) {
|
if (changedProps.has("hass") && this.hass) {
|
||||||
if (!this._dataLoaded) {
|
if (!this._dataLoaded) {
|
||||||
this._dataLoaded = true;
|
this._dataLoaded = true;
|
||||||
@@ -127,6 +146,35 @@ export class MaintenanceSupporterCard extends LitElement {
|
|||||||
await this._loadViewFilters();
|
await this._loadViewFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Resolve display names for the assignee badge (best-effort).
|
||||||
|
*
|
||||||
|
* `users/list` is a READ-tier command, so the household members this card
|
||||||
|
* is built for can call it without admin rights. A failure (or a task
|
||||||
|
* whose user was deleted) leaves the name unresolved and the badge simply
|
||||||
|
* does not render — never a raw user id. */
|
||||||
|
/** Display name of the task's responsible user, or "" when the badge must
|
||||||
|
* stay hidden (feature off, nobody assigned, or the name not resolved).
|
||||||
|
* With a rotation this is whoever is up next — the pointer the engine
|
||||||
|
* advances on every completion. */
|
||||||
|
private _assigneeName(task: MaintenanceTask): string {
|
||||||
|
if (this._config.show_assignee === false) return "";
|
||||||
|
const id = task.responsible_user_id;
|
||||||
|
if (!id) return "";
|
||||||
|
return this._userNames[id] || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _loadUserNames(): Promise<void> {
|
||||||
|
this._userNamesLoaded = true;
|
||||||
|
if (!this._userService) this._userService = new UserService(this.hass);
|
||||||
|
else this._userService.updateHass(this.hass);
|
||||||
|
try {
|
||||||
|
const users = await this._userService.getUsers();
|
||||||
|
this._userNames = Object.fromEntries(users.map((u) => [u.id, u.name]));
|
||||||
|
} catch {
|
||||||
|
// leave whatever we had; the badge hides for unresolved ids
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Resolve the configured saved view's filters (best-effort). A missing or
|
/** Resolve the configured saved view's filters (best-effort). A missing or
|
||||||
* deleted view degrades to "no view filter" — same fallback semantics as
|
* deleted view degrades to "no view filter" — same fallback semantics as
|
||||||
* the backend's notification routing, never an inexplicably empty card. */
|
* the backend's notification routing, never an inexplicably empty card. */
|
||||||
@@ -322,7 +370,19 @@ export class MaintenanceSupporterCard extends LitElement {
|
|||||||
></ha-icon>`
|
></ha-icon>`
|
||||||
: nothing}
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
${!compact ? html`<div class="task-meta">${object_name} · ${t(task.type, L)}</div>` : nothing}
|
${!compact
|
||||||
|
? html`<div class="task-meta">
|
||||||
|
${object_name} · ${t(task.type, L)}${this._assigneeName(task)
|
||||||
|
? html` · <span class="assignee"
|
||||||
|
><ha-icon icon="mdi:account"></ha-icon>${this._assigneeName(task)}</span
|
||||||
|
>`
|
||||||
|
: nothing}
|
||||||
|
</div>`
|
||||||
|
: this._assigneeName(task)
|
||||||
|
? html`<div class="task-meta compact-assignee" title="${this._assigneeName(task)}">
|
||||||
|
<ha-icon icon="mdi:account"></ha-icon>${this._assigneeName(task)}
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
<div class="task-due">
|
<div class="task-due">
|
||||||
${task.days_until_due !== null && task.days_until_due !== undefined
|
${task.days_until_due !== null && task.days_until_due !== undefined
|
||||||
@@ -455,6 +515,24 @@ export class MaintenanceSupporterCard extends LitElement {
|
|||||||
.task-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.task-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.postponed-icon { --mdc-icon-size: 14px; color: var(--secondary-text-color); vertical-align: text-bottom; margin-inline-start: 4px; }
|
.postponed-icon { --mdc-icon-size: 14px; color: var(--secondary-text-color); vertical-align: text-bottom; margin-inline-start: 4px; }
|
||||||
.task-meta { font-size: 12px; color: var(--secondary-text-color); }
|
.task-meta { font-size: 12px; color: var(--secondary-text-color); }
|
||||||
|
.assignee, .compact-assignee {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.assignee ha-icon, .compact-assignee ha-icon {
|
||||||
|
--mdc-icon-size: 13px;
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
/* Compact rows have no meta line of their own — keep the name from
|
||||||
|
pushing the due column off a narrow phone card. */
|
||||||
|
.compact-assignee {
|
||||||
|
max-width: 11ch;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
.task-due { font-size: 13px; color: var(--secondary-text-color); min-width: 40px; text-align: right; }
|
.task-due { font-size: 13px; color: var(--secondary-text-color); min-width: 40px; text-align: right; }
|
||||||
.overdue-text { color: var(--error-color); font-weight: 500; }
|
.overdue-text { color: var(--error-color); font-weight: 500; }
|
||||||
|
|||||||
@@ -324,6 +324,10 @@ export interface CardConfig {
|
|||||||
filter_due_max_days?: number;
|
filter_due_max_days?: number;
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
show_actions?: boolean;
|
show_actions?: boolean;
|
||||||
|
// Whose turn is it (v2.43): show the task's responsible user on each row.
|
||||||
|
// Defaults to ON — with rotations the row is the only place a household
|
||||||
|
// sees who is up next. Rows without an assignee simply render nothing.
|
||||||
|
show_assignee?: boolean;
|
||||||
// Saved-view scope (v2.26): apply a saved view's task-selecting filters
|
// Saved-view scope (v2.26): apply a saved view's task-selecting filters
|
||||||
// (status / user / label) ON TOP of the card's own filters. The view's
|
// (status / user / label) ON TOP of the card's own filters. The view's
|
||||||
// sort/group dimensions are panel display state and are not applied here.
|
// sort/group dimensions are panel display state and are not applied here.
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
var ot=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var x=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var wi=(a,s)=>{for(var e in s)ot(a,e,{get:s[e],enumerable:!0})};var l=(a,s,e,t)=>{for(var i=t>1?void 0:t?$i(s,e):s,n=a.length-1,c;n>=0;n--)(c=a[n])&&(i=(t?c(s,e,i):c(i))||i);return t&&i&&ot(s,e,i),i};var $e,we,Me,lt,le,dt,A,ct,qe,Oe=x(()=>{$e=globalThis,we=$e.ShadowRoot&&($e.ShadyCSS===void 0||$e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Me=Symbol(),lt=new WeakMap,le=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Me)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(we&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=lt.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&<.set(e,s))}return s}toString(){return this.cssText}},dt=a=>new le(typeof a=="string"?a:a+"",void 0,Me),A=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new le(e,a,Me)},ct=(a,s)=>{if(we)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=$e.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},qe=we?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return dt(e)})(a):a});var ki,Ei,Ai,Si,Ti,Ci,ke,pt,Ii,Li,de,ce,Ee,ht,U,pe=x(()=>{Oe();Oe();({is:ki,defineProperty:Ei,getOwnPropertyDescriptor:Ai,getOwnPropertyNames:Si,getOwnPropertySymbols:Ti,getPrototypeOf:Ci}=Object),ke=globalThis,pt=ke.trustedTypes,Ii=pt?pt.emptyScript:"",Li=ke.reactiveElementPolyfillSupport,de=(a,s)=>a,ce={toAttribute(a,s){switch(s){case Boolean:a=a?Ii:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Ee=(a,s)=>!ki(a,s),ht={attribute:!0,type:String,converter:ce,reflect:!1,useDefault:!1,hasChanged:Ee};Symbol.metadata??=Symbol("metadata"),ke.litPropertyMetadata??=new WeakMap;U=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=ht){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&Ei(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=Ai(this.prototype,s)??{get(){return this[e]},set(c){this[e]=c}};return{get:i,set(c){let d=i?.call(this);n?.call(this,c),this.requestUpdate(s,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??ht}static _$Ei(){if(this.hasOwnProperty(de("elementProperties")))return;let s=Ci(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(de("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(de("properties"))){let e=this.properties,t=[...Si(e),...Ti(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(qe(i))}else s!==void 0&&e.push(qe(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ct(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
var lt=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var x=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var wi=(a,s)=>{for(var e in s)lt(a,e,{get:s[e],enumerable:!0})};var l=(a,s,e,t)=>{for(var i=t>1?void 0:t?$i(s,e):s,n=a.length-1,d;n>=0;n--)(d=a[n])&&(i=(t?d(s,e,i):d(i))||i);return t&&i&<(s,e,i),i};var we,ke,Me,ct,ce,dt,S,pt,Oe,qe=x(()=>{we=globalThis,ke=we.ShadowRoot&&(we.ShadyCSS===void 0||we.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Me=Symbol(),ct=new WeakMap,ce=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Me)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(ke&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=ct.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&ct.set(e,s))}return s}toString(){return this.cssText}},dt=a=>new ce(typeof a=="string"?a:a+"",void 0,Me),S=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new ce(e,a,Me)},pt=(a,s)=>{if(ke)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=we.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Oe=ke?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return dt(e)})(a):a});var ki,Ei,Si,Ai,Ti,Ci,Ee,ht,Ii,Li,de,pe,Se,ut,D,he=x(()=>{qe();qe();({is:ki,defineProperty:Ei,getOwnPropertyDescriptor:Si,getOwnPropertyNames:Ai,getOwnPropertySymbols:Ti,getPrototypeOf:Ci}=Object),Ee=globalThis,ht=Ee.trustedTypes,Ii=ht?ht.emptyScript:"",Li=Ee.reactiveElementPolyfillSupport,de=(a,s)=>a,pe={toAttribute(a,s){switch(s){case Boolean:a=a?Ii:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Se=(a,s)=>!ki(a,s),ut={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:Se};Symbol.metadata??=Symbol("metadata"),Ee.litPropertyMetadata??=new WeakMap;D=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=ut){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&Ei(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=Si(this.prototype,s)??{get(){return this[e]},set(d){this[e]=d}};return{get:i,set(d){let c=i?.call(this);n?.call(this,d),this.requestUpdate(s,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??ut}static _$Ei(){if(this.hasOwnProperty(de("elementProperties")))return;let s=Ci(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(de("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(de("properties"))){let e=this.properties,t=[...Ai(e),...Ti(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Oe(i))}else s!==void 0&&e.push(Oe(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pt(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
||||||
\f\r]`,he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gt=/-->/g,mt=/>/g,Y=RegExp(`>|${De}(?:([^\\s"'>=/]+)(${De}*=${De}*(?:[^
|
\f\r]`,ue=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mt=/-->/g,ft=/>/g,Y=RegExp(`>|${Ue}(?:([^\\s"'>=/]+)(${Ue}*=${Ue}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,vt=/"/g,$t=/^(?:script|style|textarea|title)$/i,Ye=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=Ye(1),ae=Ye(2),As=Ye(3),Q=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),bt=new WeakMap,J=Z.createTreeWalker(Z,129);Hi=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",c=he;for(let d=0;d<e;d++){let u=a[d],_,f,m=-1,y=0;for(;y<u.length&&(c.lastIndex=y,f=c.exec(u),f!==null);)y=c.lastIndex,c===he?f[1]==="!--"?c=gt:f[1]!==void 0?c=mt:f[2]!==void 0?($t.test(f[2])&&(i=RegExp("</"+f[2],"g")),c=Y):f[3]!==void 0&&(c=Y):c===Y?f[0]===">"?(c=i??he,m=-1):f[1]===void 0?m=-2:(m=c.lastIndex-f[2].length,_=f[1],c=f[3]===void 0?Y:f[3]==='"'?vt:ft):c===vt||c===ft?c=Y:c===gt||c===mt?c=he:(c=Y,i=void 0);let b=c===Y&&a[d+1].startsWith("/>")?" ":"";n+=c===he?u+Pi:m>=0?(t.push(_),u.slice(0,m)+yt+u.slice(m)+K+b):u+K+(m===-2?d:b)}return[wt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},ge=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,c=0,d=s.length-1,u=this.parts,[_,f]=Hi(s,e);if(this.el=a.createElement(_,t),J.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=J.nextNode())!==null&&u.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(yt)){let y=f[c++],b=i.getAttribute(m).split(K),E=/([.?@])?(.*)/.exec(y);u.push({type:1,index:n,name:E[2],strings:b,ctor:E[1]==="."?Fe:E[1]==="?"?Ve:E[1]==="@"?Be:re}),i.removeAttribute(m)}else m.startsWith(K)&&(u.push({type:6,index:n}),i.removeAttribute(m));if($t.test(i.tagName)){let m=i.textContent.split(K),y=m.length-1;if(y>0){i.textContent=Ae?Ae.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],ue()),J.nextNode(),u.push({type:2,index:++n});i.append(m[y],ue())}}}else if(i.nodeType===8)if(i.data===xt)u.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(K,m+1))!==-1;)u.push({type:7,index:n}),m+=K.length-1}n++}}static createElement(s,e){let t=Z.createElement("template");return t.innerHTML=s,t}};Ue=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??Z).importNode(e,!0);J.currentNode=i;let n=J.nextNode(),c=0,d=0,u=t[0];for(;u!==void 0;){if(c===u.index){let _;u.type===2?_=new me(n,n.nextSibling,this,s):u.type===1?_=new u.ctor(n,u.name,u.strings,this,s):u.type===6&&(_=new We(n,this,s)),this._$AV.push(_),u=t[++d]}c!==u?.index&&(n=J.nextNode(),c++)}return J.currentNode=Z,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},me=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=se(this,s,e),_e(s)?s===h||s==null||s===""?(this._$AH!==h&&this._$AR(),this._$AH=h):s!==this._$AH&&s!==Q&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Ri(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==h&&_e(this._$AH)?this._$AA.nextSibling.data=s:this.T(Z.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=ge.createElement(wt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Ue(i,this),c=n.u(this.options);n.p(e),this.T(c),this._$AH=n}}_$AC(s){let e=bt.get(s.strings);return e===void 0&&bt.set(s.strings,e=new ge(s)),e}k(s){Ke(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(ue()),this.O(ue()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=ut(s).nextSibling;ut(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},re=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(s,e=this,t,i){let n=this.strings,c=!1;if(n===void 0)s=se(this,s,e,0),c=!_e(s)||s!==this._$AH&&s!==Q,c&&(this._$AH=s);else{let d=s,u,_;for(s=n[0],u=0;u<n.length-1;u++)_=se(this,d[t+u],e,u),_===Q&&(_=this._$AH[u]),c||=!_e(_)||_!==this._$AH[u],_===h?s=h:s!==h&&(s+=(_??"")+n[u+1]),this._$AH[u]=_}c&&!i&&this.j(s)}j(s){s===h?this.element.removeAttribute(this.name):this.element.setAttribute(thLine truncated
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),vt=/'/g,bt=/"/g,wt=/^(?:script|style|textarea|title)$/i,Ye=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=Ye(1),ae=Ye(2),Ss=Ye(3),Q=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),yt=new WeakMap,J=Z.createTreeWalker(Z,129);Hi=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",d=ue;for(let c=0;c<e;c++){let u=a[c],_,f,m=-1,y=0;for(;y<u.length&&(d.lastIndex=y,f=d.exec(u),f!==null);)y=d.lastIndex,d===ue?f[1]==="!--"?d=mt:f[1]!==void 0?d=ft:f[2]!==void 0?(wt.test(f[2])&&(i=RegExp("</"+f[2],"g")),d=Y):f[3]!==void 0&&(d=Y):d===Y?f[0]===">"?(d=i??ue,m=-1):f[1]===void 0?m=-2:(m=d.lastIndex-f[2].length,_=f[1],d=f[3]===void 0?Y:f[3]==='"'?bt:vt):d===bt||d===vt?d=Y:d===mt||d===ft?d=ue:(d=Y,i=void 0);let b=d===Y&&a[c+1].startsWith("/>")?" ":"";n+=d===ue?u+Pi:m>=0?(t.push(_),u.slice(0,m)+xt+u.slice(m)+K+b):u+K+(m===-2?c:b)}return[kt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},me=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,d=0,c=s.length-1,u=this.parts,[_,f]=Hi(s,e);if(this.el=a.createElement(_,t),J.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=J.nextNode())!==null&&u.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(xt)){let y=f[d++],b=i.getAttribute(m).split(K),E=/([.?@])?(.*)/.exec(y);u.push({type:1,index:n,name:E[2],strings:b,ctor:E[1]==="."?Fe:E[1]==="?"?Ve:E[1]==="@"?Be:re}),i.removeAttribute(m)}else m.startsWith(K)&&(u.push({type:6,index:n}),i.removeAttribute(m));if(wt.test(i.tagName)){let m=i.textContent.split(K),y=m.length-1;if(y>0){i.textContent=Ae?Ae.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],_e()),J.nextNode(),u.push({type:2,index:++n});i.append(m[y],_e())}}}else if(i.nodeType===8)if(i.data===$t)u.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(K,m+1))!==-1;)u.push({type:7,index:n}),m+=K.length-1}n++}}static createElement(s,e){let t=Z.createElement("template");return t.innerHTML=s,t}};De=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??Z).importNode(e,!0);J.currentNode=i;let n=J.nextNode(),d=0,c=0,u=t[0];for(;u!==void 0;){if(d===u.index){let _;u.type===2?_=new fe(n,n.nextSibling,this,s):u.type===1?_=new u.ctor(n,u.name,u.strings,this,s):u.type===6&&(_=new We(n,this,s)),this._$AV.push(_),u=t[++c]}d!==u?.index&&(n=J.nextNode(),d++)}return J.currentNode=Z,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},fe=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=se(this,s,e),ge(s)?s===h||s==null||s===""?(this._$AH!==h&&this._$AR(),this._$AH=h):s!==this._$AH&&s!==Q&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Ri(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==h&&ge(this._$AH)?this._$AA.nextSibling.data=s:this.T(Z.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=me.createElement(kt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new De(i,this),d=n.u(this.options);n.p(e),this.T(d),this._$AH=n}}_$AC(s){let e=yt.get(s.strings);return e===void 0&&yt.set(s.strings,e=new me(s)),e}k(s){Ke(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(_e()),this.O(_e()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=_t(s).nextSibling;_t(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},re=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(s,e=this,t,i){let n=this.strings,d=!1;if(n===void 0)s=se(this,s,e,0),d=!ge(s)||s!==this._$AH&&s!==Q,d&&(this._$AH=s);else{let c=s,u,_;for(s=n[0],u=0;u<n.length-1;u++)_=se(this,c[t+u],e,u),_===Q&&(_=this._$AH[u]),d||=!ge(_)||_!==this._$AH[u],_===h?s=h:s!==h&&(s+=(_??"")+n[u+1]),this._$AH[u]=_}d&&!i&&this.j(s)}j(s){s===h?this.element.removeAttribute(this.name):this.element.setAttribute(thLine truncated
|
||||||
Replace seal
|
Replace seal
|
||||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||||
.field-input {
|
.field-input {
|
||||||
@@ -13,7 +13,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||||
`,Re=A`
|
`,He=S`
|
||||||
:host {
|
:host {
|
||||||
--maint-ok-color: var(--success-color, #4caf50);
|
--maint-ok-color: var(--success-color, #4caf50);
|
||||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||||
@@ -1178,7 +1178,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||||
.stat-value { font-size: 20px; }
|
.stat-value { font-size: 20px; }
|
||||||
}
|
}
|
||||||
`});function Wi(a,s){let e=Bi[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function Gi(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function L(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=Gi(i),c=n.field?Wi(n.field,s):"",d=u=>r(u,s).replace("{field}",c).replace("{n}",n.param??"");switch(n.rule){case"too_long":return d("err_too_long");case"too_short":return d("err_too_short");case"value_too_high":return d("err_value_too_high");case"value_too_low":return d("err_value_too_low");case"required":return d("err_required");case"wrong_type":return d("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return d("err_invalid_choice");case"invalid_value":return d("err_invalid_value");default:return i||e}}var Bi,te=x(()=>{"use strict";I();Bi={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var $,Xe=x(()=>{"use strict";C();N();I();te();$=class extends k{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.parts=[];this.consumesParts=[];this.consumesInfo=[];this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._restockQty="";this._usedParts={}}open(){this._open||(this._open=!0,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState={},this._feedback="needed",this._photoDocId="",this._photoPreview="",this._photoUploading=!1,this._readingValue="",this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._usedParts=Object.fromEntries(this.consumesParts.map(e=>[e.part_id,e.quantity])))}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _onPhotoInput(e){let t=e.target,i=t.files?.[0];if(t.value="",!!i){this._photoUploading=!0,this._error="";try{let n=new FormData;n.append("entry_id",this.entryId),n.append("tags","photo"),n.append("file",i,i.name);let c=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:n});if(!c.ok){this._error=c.status===413?r("doc_too_large",this.lang):r("doc_upload_failed",this.lang);return}let d=await c.json();d.id&&(this._photoDocId=d.id,this._photoPreview=URL.createObjectURL(i))}catch{this._error=r("doc_upload_failed",this.lang)}finally{this._photoUploading=!1}}}_removePhoto(){this._photoPreview&&URL.revokeObjectURL(this._photoPreview),this._photoDocId="",this._photoPreview=""}async _complete(){this._loading=!0,this._error="";try{let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId};if(this._notes&&(e.notes=this._notes),this._cost){let t=parseFloat(this._cost);!isNaN(t)&&t>=0&&(e.cost=t)}if(this._duration){let t=parseInt(this._duration,10);!isNaN(t)&&t>=0&&(e.duration=t)}if(this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photoDocId&&(e.photo_doc_id=this._photoDocId),
Line truncated
|
`});var oe,Xe=x(()=>{"use strict";oe=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Wi(a,s){let e=Bi[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function Gi(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function L(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=Gi(i),d=n.field?Wi(n.field,s):"",c=u=>r(u,s).replace("{field}",d).replace("{n}",n.param??"");switch(n.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var Bi,te=x(()=>{"use strict";I();Bi={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var $,et=x(()=>{"use strict";C();N();I();te();$=class extends k{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.parts=[];this.consumesParts=[];this.consumesInfo=[];this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._restockQty="";this._usedParts={}}open(){this._open||(this._open=!0,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState={},this._feedback="needed",this._photoDocId="",this._photoPreview="",this._photoUploading=!1,this._readingValue="",this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._usedParts=Object.fromEntries(this.consumesParts.map(e=>[e.part_id,e.quantity])))}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _onPhotoInput(e){let t=e.target,i=t.files?.[0];if(t.value="",!!i){this._photoUploading=!0,this._error="";try{let n=new Form
Line truncated
|
||||||
<ha-dialog open @closed=${this._close}>
|
<ha-dialog open @closed=${this._close}>
|
||||||
<div class="dialog-title">${r("complete_title",e)}${this.taskName}</div>
|
<div class="dialog-title">${r("complete_title",e)}${this.taskName}</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -1206,12 +1206,12 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
${this.parts.map(t=>{let i=this._usedParts[t.id],n=i!==void 0;return o`<div class="used-part-row">
|
${this.parts.map(t=>{let i=this._usedParts[t.id],n=i!==void 0;return o`<div class="used-part-row">
|
||||||
<label class="used-part-check">
|
<label class="used-part-check">
|
||||||
<input type="checkbox" .checked=${n}
|
<input type="checkbox" .checked=${n}
|
||||||
@change=${c=>{let d={...this._usedParts};c.target.checked?d[t.id]=d[t.id]||1:delete d[t.id],this._usedParts=d}} />
|
@change=${d=>{let c={...this._usedParts};d.target.checked?c[t.id]=c[t.id]||1:delete c[t.id],this._usedParts=c}} />
|
||||||
<span>${t.name}${t.stock!==null&&t.stock!==void 0?` (${t.stock}${t.unit?" "+t.unit:""})`:""}</span>
|
<span>${t.name}${t.stock!==null&&t.stock!==void 0?` (${t.stock}${t.unit?" "+t.unit:""})`:""}</span>
|
||||||
</label>
|
</label>
|
||||||
${n?o`<input class="used-part-qty" type="number" min="0.01" max="999" step="0.01"
|
${n?o`<input class="used-part-qty" type="number" min="0.01" max="999" step="0.01"
|
||||||
.value=${String(i)}
|
.value=${String(i)}
|
||||||
@input=${c=>{let d=parseFloat(c.target.value);this._usedParts={...this._usedParts,[t.id]:Number.isFinite(d)&&d>=.01?d:1}}} />`:h}
|
@input=${d=>{let c=parseFloat(d.target.value);this._usedParts={...this._usedParts,[t.id]:Number.isFinite(c)&&c>=.01?c:1}}} />`:h}
|
||||||
</div>`})}
|
</div>`})}
|
||||||
</div>`:this.consumesInfo.length?o`<div class="consumes-hint">
|
</div>`:this.consumesInfo.length?o`<div class="consumes-hint">
|
||||||
${this.consumesInfo.map(t=>o`<div>${t}</div>`)}
|
${this.consumesInfo.map(t=>o`<div>${t}</div>`)}
|
||||||
@@ -1295,7 +1295,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`}};$.styles=[Bt,A`
|
`}};$.styles=[Wt,S`
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@@ -1439,7 +1439,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
color: var(--text-primary-color, #fff);
|
color: var(--text-primary-color, #fff);
|
||||||
border-color: var(--primary-color);
|
border-color: var(--primary-color);
|
||||||
}
|
}
|
||||||
`],l([v({attribute:!1})],$.prototype,"hass",2),l([v()],$.prototype,"entryId",2),l([v()],$.prototype,"taskId",2),l([v()],$.prototype,"taskName",2),l([v()],$.prototype,"lang",2),l([v({type:Array})],$.prototype,"checklist",2),l([v({type:Boolean})],$.prototype,"adaptiveEnabled",2),l([v()],$.prototype,"taskType",2),l([v()],$.prototype,"readingUnit",2),l([v({attribute:!1})],$.prototype,"restockDefault",2),l([v({attribute:!1})],$.prototype,"parts",2),l([v({attribute:!1})],$.prototype,"consumesParts",2),l([v({type:Array})],$.prototype,"consumesInfo",2),l([p()],$.prototype,"_open",2),l([p()],$.prototype,"_notes",2),l([p()],$.prototype,"_cost",2),l([p()],$.prototype,"_duration",2),l([p()],$.prototype,"_loading",2),l([p()],$.prototype,"_error",2),l([p()],$.prototype,"_checklistState",2),l([p()],$.prototype,"_feedback",2),l([p()],$.prototype,"_photoDocId",2),l([p()],$.prototype,"_photoPreview",2),l([p()],$.prototype,"_photoUploading",2),l([p()],$.prototype,"_readingValue",2),l([p()],$.prototype,"_restockQty",2),l([p()],$.prototype,"_usedParts",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var R,et=x(()=>{"use strict";C();N();R=class extends k{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
`],l([v({attribute:!1})],$.prototype,"hass",2),l([v()],$.prototype,"entryId",2),l([v()],$.prototype,"taskId",2),l([v()],$.prototype,"taskName",2),l([v()],$.prototype,"lang",2),l([v({type:Array})],$.prototype,"checklist",2),l([v({type:Boolean})],$.prototype,"adaptiveEnabled",2),l([v()],$.prototype,"taskType",2),l([v()],$.prototype,"readingUnit",2),l([v({attribute:!1})],$.prototype,"restockDefault",2),l([v({attribute:!1})],$.prototype,"parts",2),l([v({attribute:!1})],$.prototype,"consumesParts",2),l([v({type:Array})],$.prototype,"consumesInfo",2),l([p()],$.prototype,"_open",2),l([p()],$.prototype,"_notes",2),l([p()],$.prototype,"_cost",2),l([p()],$.prototype,"_duration",2),l([p()],$.prototype,"_loading",2),l([p()],$.prototype,"_error",2),l([p()],$.prototype,"_checklistState",2),l([p()],$.prototype,"_feedback",2),l([p()],$.prototype,"_photoDocId",2),l([p()],$.prototype,"_photoPreview",2),l([p()],$.prototype,"_photoUploading",2),l([p()],$.prototype,"_readingValue",2),l([p()],$.prototype,"_restockQty",2),l([p()],$.prototype,"_usedParts",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var R,tt=x(()=>{"use strict";C();N();R=class extends k{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||||
<label class="field">
|
<label class="field">
|
||||||
${this.label?o`<span class="label">${this.label}${this.required?o`<span class="req">*</span>`:h}</span>`:h}
|
${this.label?o`<span class="label">${this.label}${this.required?o`<span class="req">*</span>`:h}</span>`:h}
|
||||||
<input
|
<input
|
||||||
@@ -1457,7 +1457,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
/>
|
/>
|
||||||
${this.helper?o`<span class="helper">${this.helper}</span>`:h}
|
${this.helper?o`<span class="helper">${this.helper}</span>`:h}
|
||||||
</label>
|
</label>
|
||||||
`}};R.styles=A`
|
`}};R.styles=S`
|
||||||
:host { display: block; }
|
:host { display: block; }
|
||||||
.field {
|
.field {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1491,7 +1491,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
`,l([v()],R.prototype,"label",2),l([v()],R.prototype,"value",2),l([v()],R.prototype,"placeholder",2),l([v()],R.prototype,"type",2),l([v({type:Boolean})],R.prototype,"required",2),l([v({type:Boolean})],R.prototype,"disabled",2),l([v()],R.prototype,"step",2),l([v()],R.prototype,"min",2),l([v()],R.prototype,"max",2),l([v()],R.prototype,"pattern",2),l([v()],R.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",R)});var S,Wt=x(()=>{"use strict";C();N();I();te();et();S=class extends k{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
`,l([v()],R.prototype,"label",2),l([v()],R.prototype,"value",2),l([v()],R.prototype,"placeholder",2),l([v()],R.prototype,"type",2),l([v({type:Boolean})],R.prototype,"required",2),l([v({type:Boolean})],R.prototype,"disabled",2),l([v()],R.prototype,"step",2),l([v()],R.prototype,"min",2),l([v()],R.prototype,"max",2),l([v()],R.prototype,"pattern",2),l([v()],R.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",R)});var A,Gt=x(()=>{"use strict";C();N();I();te();tt();A=class extends k{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
||||||
<ha-dialog open @closed=${this._close}>
|
<ha-dialog open @closed=${this._close}>
|
||||||
<div class="dialog-title">${t}</div>
|
<div class="dialog-title">${t}</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -1585,7 +1585,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`}};S.styles=A`
|
`}};A.styles=S`
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@@ -1632,15 +1632,15 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
color: var(--error-color, #f44336);
|
color: var(--error-color, #f44336);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
`,l([v({attribute:!1})],S.prototype,"hass",2),l([v({attribute:!1})],S.prototype,"objects",2),l([p()],S.prototype,"_open",2),l([p()],S.prototype,"_loading",2),l([p()],S.prototype,"_error",2),l([p()],S.prototype,"_name",2),l([p()],S.prototype,"_manufacturer",2),l([p()],S.prototype,"_model",2),l([p()],S.prototype,"_serialNumber",2),l([p()],S.prototype,"_areaId",2),l([p()],S.prototype,"_installationDate",2),l([p()],S.prototype,"_warrantyExpiry",2),l([p()],S.prototype,"_documentationUrl",2),l([p()],S.prototype,"_notes",2),l([p()],S.prototype,"_haDeviceId",2),l([p()],S.prototype,"_parentEntryId",2),l([p()],S.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",S)});var He,Gt=x(()=>{"use strict";He=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Qi(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function es(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!Xi.has(e)&&!e.startsWith("_")))}}function ts(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...a.carry||{},entity_id:s[0],entity_ids:s,type:a.type};if(a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function is(a){return Array.from({length:7},(s,e)=>be(e,a,"short"))}function ss(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var Ki,Yi,Ji,tt,Kt,Zi,Xi,g,it,Yt=x(()=>{"use strict";C();N();I();Gt();te();et();Ki=["cleaning","inspection","replacement","calibration","service","reading","custom"],Yi=["low","normal","high"],Ji=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],tt=["weekdays","nth_weekday","day_of_month"],Kt=["threshold","counter","state_change","runtime"],Zi=[...Kt,"compound"];Xi=new Set(["entity_id","entity_ids","type","trigger_above","trigger_below","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);g=class g extends k{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor=
Line truncated
|
`,l([v({attribute:!1})],A.prototype,"hass",2),l([v({attribute:!1})],A.prototype,"objects",2),l([p()],A.prototype,"_open",2),l([p()],A.prototype,"_loading",2),l([p()],A.prototype,"_error",2),l([p()],A.prototype,"_name",2),l([p()],A.prototype,"_manufacturer",2),l([p()],A.prototype,"_model",2),l([p()],A.prototype,"_serialNumber",2),l([p()],A.prototype,"_areaId",2),l([p()],A.prototype,"_installationDate",2),l([p()],A.prototype,"_warrantyExpiry",2),l([p()],A.prototype,"_documentationUrl",2),l([p()],A.prototype,"_notes",2),l([p()],A.prototype,"_haDeviceId",2),l([p()],A.prototype,"_parentEntryId",2),l([p()],A.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",A)});function Qi(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function es(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??"",onStates:(a.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(a).filter(([e])=>!Xi.has(e)&&!e.startsWith("_")))}}function ts(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={...a.carry||{},entity_id:s[0],entity_ids:s,type:a.type};if(a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function is(a){return Array.from({length:7},(s,e)=>ye(e,a,"short"))}function ss(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var Ki,Yi,Ji,it,Kt,Zi,Xi,g,st,Yt=x(()=>{"use strict";C();N();I();Xe();te();tt();Ki=["cleaning","inspection","replacement","calibration","service","reading","custom"],Yi=["low","normal","high"],Ji=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],it=["weekdays","nth_weekday","day_of_month"],Kt=["threshold","counter","state_change","runtime"],Zi=[...Kt,"compound"];Xi=new Set(["entity_id","entity_ids","type","trigger_above","trigger_below","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);g=class g extends k{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._triggerBaselineValue="";this._liveBaselineValue=null;this._autoCompleteOnRecovery=!1;this._triggerFromState="";this._triggerToState="";this._triggerTargetChanges="";this._triggerRuntimeHours="";this._triggerOnStates="";this._compoundLogic="AND";this._compoundConditions=[];this._suggestedAttributes=[];this._availableAttributes=[];this._entityDomain="";this._lastPerformed="";this._nfcTagId="";this._readingUnit="";this._consumesParts={};this._partsLoadFailed=!1;this._avail
Line truncated
|
||||||
`),this._scheduleTime=t.schedule_time||"";let c=t.on_complete_action;if(c&&c.service){this._actionService=c.service;let _=c.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=c.data&&typeof c.data=="object"?{...c.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let d=t.quick_complete_defaults;this._qcNotes=d?.notes||"",this._qcCost=d?.cost!=null?String(d.cost):"",this._qcDuration=d?.duration!=null?String(d.duration):"",this._qcFeedback=d?.feedback||"";let u=t.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=_.entity_id||_.entity_ids&&_.entity_ids[0]||"",this._triggerEntityIds=_.entity_ids||(_.entity_id?[_.entity_id]:[]),this._triggerEntityLogic=_.entity_logic||"any",this._triggerAttribute=_.attribute||"",this._triggerType=_.type||"threshold",this._triggerAbove=_.trigger_above?.toString()||"",this._triggerBelow=_.trigger_below?.toString()||"",this._triggerForMinutes=_.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=_.trigger_target_value?.toString()||"",this._triggerDeltaMode=_.trigger_delta_mode||!1,this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerFromState=_.trigger_from_state||"",this._triggerToState=_.trigger_to_state||"",this._triggerTargetChanges=_.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=_.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(_.trigger_on_states||[]).join(", "),_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(es)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new He(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._acti
Line truncated
|
`),this._scheduleTime=t.schedule_time||"";let d=t.on_complete_action;if(d&&d.service){this._actionService=d.service;let _=d.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=d.data&&typeof d.data=="object"?{...d.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.feedback||"";let u=t.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let _=t.trigger_config;this._triggerEntityId=_.entity_id||_.entity_ids&&_.entity_ids[0]||"",this._triggerEntityIds=_.entity_ids||(_.entity_id?[_.entity_id]:[]),this._triggerEntityLogic=_.entity_logic||"any",this._triggerAttribute=_.attribute||"",this._triggerType=_.type||"threshold",this._triggerAbove=_.trigger_above?.toString()||"",this._triggerBelow=_.trigger_below?.toString()||"",this._triggerForMinutes=_.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=_.trigger_target_value?.toString()||"",this._triggerDeltaMode=_.trigger_delta_mode||!1,this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerFromState=_.trigger_from_state||"",this._triggerToState=_.trigger_to_state||"",this._triggerTargetChanges=_.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=_.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(_.trigger_on_states||[]).join(", "),_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(es)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new oe(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._acti
Line truncated
|
||||||
<details class="ca-section">
|
<details class="ca-section">
|
||||||
<summary>${r("on_complete_action_title",e)}</summary>
|
<summary>${r("on_complete_action_title",e)}</summary>
|
||||||
<p class="field-help">${r("on_complete_action_desc",e)}</p>
|
<p class="field-help">${r("on_complete_action_desc",e)}</p>
|
||||||
<ha-service-picker
|
<ha-service-picker
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${this._actionService}
|
.value=${this._actionService}
|
||||||
@value-changed=${i=>{this._actionService=i.detail.value||"";let n=this._serviceSchema();if(n){let c=new Set(n.map(d=>d.name));this._actionData=Object.fromEntries(Object.entries(this._actionData).filter(([d])=>c.has(d)))}}}
|
@value-changed=${i=>{this._actionService=i.detail.value||"";let n=this._serviceSchema();if(n){let d=new Set(n.map(c=>c.name));this._actionData=Object.fromEntries(Object.entries(this._actionData).filter(([c])=>d.has(c)))}}}
|
||||||
></ha-service-picker>
|
></ha-service-picker>
|
||||||
<ha-form
|
<ha-form
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@@ -1709,8 +1709,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
<option value="not_needed">${r("quick_complete_defaults_feedback_not_needed",e)}</option>
|
<option value="not_needed">${r("quick_complete_defaults_feedback_not_needed",e)}</option>
|
||||||
</select>
|
</select>
|
||||||
</details>
|
</details>
|
||||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):tt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(d=>d.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([d,u])=>({part_id:d,quantity:u}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let d=this._compoundConditions.map(ts).filter(u=>u!==null);if(d.length>0){let u={type:"compound",compound_logic:this._compoundLogic,conditions:d};this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),e.trigger_config=u}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let d=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],u={entity_id:d[0],entity_ids:d,type:this._triggerType};if(this._triggerAttribute&&(u.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),d.length>1&&(u.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let _=parseFloat(this._triggerAbove);isNaN(_)||(u.trigger_above=_)}if(this._triggerBelow){let _=parseFloat(this._triggerBelow);isNaN(_)||(u.trigger_below=_)}if(this._triggerForMinutes){let _=parseInt(this._triggerForMinutes,10);isNaN(_)||(u.trigger_for_minutes=_)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let _=parseFloat(this._triggerTargetValue);isNaN(_)||(u.trigger_target_value=_)}if(u.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let _=parseFloat(this._triggerBaselineValue);!isNaN(_)&&_>=0&&(u.trigger_baseline_value=_)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(u.trigger_from_state=this._triggerFromState),this._triggerToState&&(u.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let _=parseInt(this._triggerTargetChanges,10);isNaN(_)||(u.trigger_target_changes=_)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let f=parseFloat(this._triggerRuntimeHours);isNaN(f)||(u.trigger_runtime_hours=f)}let _=this._triggerOnStates.split(",").map(f=>f.trim()).filter(Boolean);_.length>0&&(u.trigger_on_states=_)}e.trigger_config=u}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let d=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(d)?d:null}if(this.checklistsEnabled){let d=this._checklistText.split(`
|
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):it.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([c,u])=>({part_id:c,quantity:u}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(ts).filter(u=>u!==null);if(c.length>0){let u={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),e.trigger_config=u}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],u={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(u.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(u.auto_complete_on_recovery=!0),c.length>1&&(u.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let _=parseFloat(this._triggerAbove);isNaN(_)||(u.trigger_above=_)}if(this._triggerBelow){let _=parseFloat(this._triggerBelow);isNaN(_)||(u.trigger_below=_)}if(this._triggerForMinutes){let _=parseInt(this._triggerForMinutes,10);isNaN(_)||(u.trigger_for_minutes=_)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let _=parseFloat(this._triggerTargetValue);isNaN(_)||(u.trigger_target_value=_)}if(u.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let _=parseFloat(this._triggerBaselineValue);!isNaN(_)&&_>=0&&(u.trigger_baseline_value=_)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(u.trigger_from_state=this._triggerFromState),this._triggerToState&&(u.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let _=parseInt(this._triggerTargetChanges,10);isNaN(_)||(u.trigger_target_changes=_)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let f=parseFloat(this._triggerRuntimeHours);isNaN(f)||(u.trigger_runtime_hours=f)}let _=this._triggerOnStates.split(",").map(f=>f.trim()).filter(Boolean);_.length>0&&(u.trigger_on_states=_)}e.trigger_config=u}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||||
`).map(u=>u.trim()).filter(Boolean).slice(0,100);e.checklist=d.length?d:null}if(this.completionActionsEnabled){let d=this._actionService.trim();if(d&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(d)){let m={service:d},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let u={};this._qcNotes.trim()&&(u.notes=this._qcNotes.trim());let _=parseFloat(this._qcCost);!isNaN(_)&&_>=0&&(u.cost=_);let f=parseInt(this._qcDuration,10);!isNaN(f)&&f>=0&&(u.duration=f),this._qcFeedback&&(u.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(u).length?u:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,c=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&c)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,t=this._triggerType==="compound";return o`
|
`).map(u=>u.trim()).filter(Boolean).slice(0,100);e.checklist=c.length?c:null}if(this.completionActionsEnabled){let c=this._actionService.trim();if(c&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(c)){let m={service:c},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let u={};this._qcNotes.trim()&&(u.notes=this._qcNotes.trim());let _=parseFloat(this._qcCost);!isNaN(_)&&_>=0&&(u.cost=_);let f=parseInt(this._qcDuration,10);!isNaN(f)&&f>=0&&(u.duration=f),this._qcFeedback&&(u.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(u).length?u:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,d=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&d)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,t=this._triggerType==="compound";return o`
|
||||||
<h3>${r("trigger_configuration",e)}</h3>
|
<h3>${r("trigger_configuration",e)}</h3>
|
||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
<label>${r("trigger_type",e)}</label>
|
<label>${r("trigger_type",e)}</label>
|
||||||
@@ -1725,7 +1725,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
<ms-textfield
|
<ms-textfield
|
||||||
label="${r("entity_id",e)} (${r("comma_separated",e)})"
|
label="${r("entity_id",e)} (${r("comma_separated",e)})"
|
||||||
.value=${this._triggerEntityIds.length>0?this._triggerEntityIds.join(", "):this._triggerEntityId}
|
.value=${this._triggerEntityIds.length>0?this._triggerEntityIds.join(", "):this._triggerEntityId}
|
||||||
@input=${i=>{let c=i.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._triggerEntityId=c[0]||"",this._triggerEntityIds=c,c[0]&&this._fetchEntityAttributes(c[0])}}
|
@input=${i=>{let d=i.target.value.split(",").map(c=>c.trim()).filter(Boolean);this._triggerEntityId=d[0]||"",this._triggerEntityIds=d,d[0]&&this._fetchEntityAttributes(d[0])}}
|
||||||
></ms-textfield>
|
></ms-textfield>
|
||||||
${this._triggerEntityIds.length>1?o`
|
${this._triggerEntityIds.length>1?o`
|
||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
@@ -1807,15 +1807,15 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
<ms-textfield
|
<ms-textfield
|
||||||
label="${r("entity_id",i)} (${r("comma_separated",i)})"
|
label="${r("entity_id",i)} (${r("comma_separated",i)})"
|
||||||
.value=${e.entityIds}
|
.value=${e.entityIds}
|
||||||
@input=${c=>this._patchCondition(t,{entityIds:c.target.value})}
|
@input=${d=>this._patchCondition(t,{entityIds:d.target.value})}
|
||||||
></ms-textfield>
|
></ms-textfield>
|
||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
<label>${r("trigger_type",i)}</label>
|
<label>${r("trigger_type",i)}</label>
|
||||||
<select
|
<select
|
||||||
.value=${e.type}
|
.value=${e.type}
|
||||||
@change=${c=>this._patchCondition(t,{type:c.target.value})}
|
@change=${d=>this._patchCondition(t,{type:d.target.value})}
|
||||||
>
|
>
|
||||||
${Kt.map(c=>o`<option value=${c} ?selected=${c===e.type}>${r(c,i)}</option>`)}
|
${Kt.map(d=>o`<option value=${d} ?selected=${d===e.type}>${r(d,i)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
${this._renderConditionTypeFields(e,t)}
|
${this._renderConditionTypeFields(e,t)}
|
||||||
@@ -1856,20 +1856,20 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
>
|
>
|
||||||
${["days","weeks","months","years"].map(t=>o`<option value=${t} ?selected=${t===this._intervalUnit}>${r("unit_"+t,e)}</option>`)}
|
${["days","weeks","months","years"].map(t=>o`<option value=${t} ?selected=${t===this._intervalUnit}>${r("unit_"+t,e)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(tt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e);for(let t of e.keys())if(g._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((c,d)=>{let u=new Date(`${c}T12:00:00`).getDay();return`${be(u===0?6:u-1,e,"short")} ${F(c,e)}${d===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?o`<div class="field-help">${r("schedule_preview_ontime",e)}</div>`:h;return o`
|
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(it.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e);for(let t of e.keys())if(g._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((d,c)=>{let u=new Date(`${d}T12:00:00`).getDay();return`${ye(u===0?6:u-1,e,"short")} ${F(d,e)}${c===0?t:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?o`<div class="field-help">${r("schedule_preview_ontime",e)}</div>`:h;return o`
|
||||||
<div class="trigger-live-hint schedule-preview">
|
<div class="trigger-live-hint schedule-preview">
|
||||||
${r("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?o` <span class="field-help">${r("schedule_preview_ends",e)}</span>`:h}
|
${r("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?o` <span class="field-help">${r("schedule_preview_ends",e)}</span>`:h}
|
||||||
${n}
|
${n}
|
||||||
</div>
|
</div>
|
||||||
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||tt.includes(this._scheduleType)))return h;let i=ss(e);return o`
|
`}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||it.includes(this._scheduleType)))return h;let i=ss(e);return o`
|
||||||
<label class="field-label">${r("season_window_label",e)}</label>
|
<label class="field-label">${r("season_window_label",e)}</label>
|
||||||
<div class="field-help">${r("season_window_hint",e)}</div>
|
<div class="field-help">${r("season_window_hint",e)}</div>
|
||||||
<div class="weekday-chips season-chips">
|
<div class="weekday-chips season-chips">
|
||||||
${i.map((n,c)=>o`
|
${i.map((n,d)=>o`
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="season-chip ${this._seasonMonths.includes(c+1)?"selected":""}"
|
class="season-chip ${this._seasonMonths.includes(d+1)?"selected":""}"
|
||||||
@click=${()=>this._toggleSeasonMonth(c+1)}
|
@click=${()=>this._toggleSeasonMonth(d+1)}
|
||||||
>${n}</button>`)}
|
>${n}</button>`)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1910,13 +1910,13 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
<label>${r("recurrence_occurrence",e)}</label>
|
<label>${r("recurrence_occurrence",e)}</label>
|
||||||
<select .value=${this._nth} @change=${n=>this._nth=n.target.value}>
|
<select .value=${this._nth} @change=${n=>this._nth=n.target.value}>
|
||||||
${i.map(([n,c])=>o`<option value=${n} ?selected=${n===this._nth}>${c}</option>`)}
|
${i.map(([n,d])=>o`<option value=${n} ?selected=${n===this._nth}>${d}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
<label>${r("recurrence_weekday",e)}</label>
|
<label>${r("recurrence_weekday",e)}</label>
|
||||||
<select .value=${this._nthWeekday} @change=${n=>this._nthWeekday=n.target.value}>
|
<select .value=${this._nthWeekday} @change=${n=>this._nthWeekday=n.target.value}>
|
||||||
${t.map((n,c)=>o`<option value=${String(c)} ?selected=${String(c)===this._nthWeekday}>${n}</option>`)}
|
${t.map((n,d)=>o`<option value=${String(d)} ?selected=${String(d)===this._nthWeekday}>${n}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
${this._renderCalOffsetField()}`}return this._scheduleType==="day_of_month"?o`
|
${this._renderCalOffsetField()}`}return this._scheduleType==="day_of_month"?o`
|
||||||
@@ -1948,7 +1948,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
max="15"
|
max="15"
|
||||||
.value=${this._calOffset}
|
.value=${this._calOffset}
|
||||||
@input=${t=>this._calOffset=t.target.value}
|
@input=${t=>this._calOffset=t.target.value}
|
||||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,c=typeof n=="string"&&n?` ${n}`:"",d=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,u=typeof d=="number"?d:parseFloat(String(d)),_=d!=="unknown"&&d!=="unavailable"&&d!=null&&!isNaN(u),f=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;_&&m.push(r("trigger_hint_now",i).replace("{value}",f(u)+c)),isNaN(y)||m.push(r("trigger_hint_above",i).replace("{target}",f(y)+c)),isNaN(b)||m.push(r("trigger_hint_below",i).replace("{target}",f(b)+c))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+c)):_?m.push(r("trigger_hint_counter_delta",i).replace("{value}",f(u)+c).replace("{due}",f(u+y)+c).replace("{target}",f(y)+c)):m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+c)):(_&&m.push(r("trigger_hint_now",i).replace("{value}",f(u)+c)),m.push(r("trigger_hint_counter_abs",i).replace("{target}",f(y)+c)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(r("trigger_hint_runtime",i).replace("{hours}",f(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?r("trigger_hint_state_change_to",i).replace("{state}",b):r("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?o`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?o`
|
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,d=typeof n=="string"&&n?` ${n}`:"",c=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,u=typeof c=="number"?c:parseFloat(String(c)),_=c!=="unknown"&&c!=="unavailable"&&c!=null&&!isNaN(u),f=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;_&&m.push(r("trigger_hint_now",i).replace("{value}",f(u)+d)),isNaN(y)||m.push(r("trigger_hint_above",i).replace("{target}",f(y)+d)),isNaN(b)||m.push(r("trigger_hint_below",i).replace("{target}",f(b)+d))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+d)):_?m.push(r("trigger_hint_counter_delta",i).replace("{value}",f(u)+d).replace("{due}",f(u+y)+d).replace("{target}",f(y)+d)):m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+d)):(_&&m.push(r("trigger_hint_now",i).replace("{value}",f(u)+d)),m.push(r("trigger_hint_counter_abs",i).replace("{target}",f(y)+d)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(r("trigger_hint_runtime",i).replace("{hours}",f(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?r("trigger_hint_state_change_to",i).replace("{state}",b):r("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?o`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?o`
|
||||||
<ms-textfield
|
<ms-textfield
|
||||||
label="${r("trigger_above",e)}"
|
label="${r("trigger_above",e)}"
|
||||||
type="number"
|
type="number"
|
||||||
@@ -2084,7 +2084,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
.checked=${n!==void 0}
|
.checked=${n!==void 0}
|
||||||
@change=${c=>{let d={...this._consumesParts};c.target.checked?d[i.id]=d[i.id]||1:delete d[i.id],this._consumesParts=d}}
|
@change=${d=>{let c={...this._consumesParts};d.target.checked?c[i.id]=c[i.id]||1:delete c[i.id],this._consumesParts=c}}
|
||||||
/>
|
/>
|
||||||
<span>${i.name}${i.unit?` (${i.unit})`:""}</span>
|
<span>${i.name}${i.unit?` (${i.unit})`:""}</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -2095,7 +2095,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
max="999"
|
max="999"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
.value=${String(n)}
|
.value=${String(n)}
|
||||||
@input=${c=>{let d=parseFloat(c.target.value);this._consumesParts={...this._consumesParts,[i.id]:Number.isFinite(d)&&d>=.01?d:1}}}
|
@input=${d=>{let c=parseFloat(d.target.value);this._consumesParts={...this._consumesParts,[i.id]:Number.isFinite(c)&&c>=.01?c:1}}}
|
||||||
/>`:h}
|
/>`:h}
|
||||||
</div>
|
</div>
|
||||||
`})}
|
`})}
|
||||||
@@ -2315,7 +2315,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`}};g._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),g.styles=A`
|
`}};g._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),g.styles=S`
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@@ -2570,7 +2570,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
`,l([v({attribute:!1})],g.prototype,"hass",2),l([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),l([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),l([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),l([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),l([p()],g.prototype,"parts",2),l([p()],g.prototype,"_open",2),l([p()],g.prototype,"_loading",2),l([p()],g.prototype,"_error",2),l([p()],g.prototype,"_entryId",2),l([p()],g.prototype,"_taskId",2),l([p()],g.prototype,"_objectChoices",2),l([p()],g.prototype,"_name",2),l([p()],g.prototype,"_type",2),l([p()],g.prototype,"_scheduleType",2),l([p()],g.prototype,"_intervalDays",2),l([p()],g.prototype,"_intervalUnit",2),l([p()],g.prototype,"_dueDate",2),l([p()],g.prototype,"_warningDays",2),l([p()],g.prototype,"_earliestCompletionDays",2),l([p()],g.prototype,"_intervalAnchor",2),l([p()],g.prototype,"_weekdays",2),l([p()],g.prototype,"_nth",2),l([p()],g.prototype,"_nthWeekday",2),l([p()],g.prototype,"_domDay",2),l([p()],g.prototype,"_domLastDay",2),l([p()],g.prototype,"_domBusiness",2),l([p()],g.prototype,"_calOffset",2),l([p()],g.prototype,"_seasonMonths",2),l([p()],g.prototype,"_endsMode",2),l([p()],g.prototype,"_endsCount",2),l([p()],g.prototype,"_endsUntil",2),l([p()],g.prototype,"_schedulePreview",2),l([p()],g.prototype,"_schedulePreviewEnded",2),l([p()],g.prototype,"_notes",2),l([p()],g.prototype,"_documentationUrl",2),l([p()],g.prototype,"_customIcon",2),l([p()],g.prototype,"_priority",2),l([p()],g.prototype,"_labels",2),l([p()],g.prototype,"_enabled",2),l([p()],g.prototype,"_triggerEntityId",2),l([p()],g.prototype,"_triggerEntityIds",2),l([p()],g.prototype,"_triggerEntityLogic",2),l([p()],g.prototype,"_triggerAttribute",2),l([p()],g.prototype,"_triggerType",2),l([p()],g.prototype,"_triggerAbove",2),l([p()],g.prototype,"_triggerBelow",2),l([p()],g.prototype,"_triggerForMinutes",2),l([p()],g.prototype,"_triggerTargetValue",2),l([p()],g.prototype,"_triggerDeltaMode",2),l([p()],g.prototype,"_triggerBaselineValue",2),l([p()],g.prototype,"_liveBaselineValue",2),l([p()],g.prototype,"_autoCompleteOnRecovery",2),l([p()],g.prototype,"_triggerFromState",2),l([p()],g.prototype,"_triggerToState",2),l([p()],g.prototype,"_triggerTargetChanges",2),l([p()],g.prototype,"_triggerRuntimeHours",2),l([p()],g.prototype,"_triggerOnStates",2),l([p()],g.prototype,"_compoundLogic",2),l([p()],g.prototype,"_compoundConditions",2),l([p()],g.prototype,"_suggestedAttributes",2),l([p()],g.prototype,"_availableAttributes",2),l([p()],g.prototype,"_entityDomain",2),l([p()],g.prototype,"_lastPerformed",2),l([p()],g.prototype,"_nfcTagId",2),l([p()],g.prototype,"_readingUnit",2),l([p()],g.prototype,"_consumesParts",2),l([p()],g.prototype,"_partsLoadFailed",2),l([p()],g.prototype,"_availableTags",2),l([p()],g.prototype,"_responsibleUserId",2),l([p()],g.prototype,"_assigneePool",2),l([p()],g.prototype,"_rotationStrategy",2),l([p()],g.prototype,"_availableUsers",2),l([p()],g.prototype,"_checklistText",2),l([p()],g.prototype,"_scheduleTime",2),l([p()],g.prototype,"_actionService",2),l([p()],g.prototype,"_actionTargetEntity",2),l([p()],g.prototype,"_actionData",2),l([p()],g.prototype,"_actionDataJsonFallback",2),l([p()],g.prototype,"_actionTesting",2),l([p()],g.prototype,"_actionTestResult",2),l([p()],g.prototype,"_actionTestError",2),l([p()],g.prototype,"_qcNotes",2),l([p()],g.prototype,"_qcCost",2),l([p()],g.prototype,"_qcDuration",2),l([p()],g.prototype,"_qcFeedback",2),l([p()],g.prototype,"_environmentalEntity",2),l([p()],g.prototype,"_environmentalAttribute",2);it=g;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",it)});var V,Jt=x(()=>{"use strict";C();N();I();te();V=class extends k{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys
Line truncated
|
`,l([v({attribute:!1})],g.prototype,"hass",2),l([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),l([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),l([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),l([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),l([p()],g.prototype,"parts",2),l([p()],g.prototype,"_open",2),l([p()],g.prototype,"_loading",2),l([p()],g.prototype,"_error",2),l([p()],g.prototype,"_entryId",2),l([p()],g.prototype,"_taskId",2),l([p()],g.prototype,"_objectChoices",2),l([p()],g.prototype,"_name",2),l([p()],g.prototype,"_type",2),l([p()],g.prototype,"_scheduleType",2),l([p()],g.prototype,"_intervalDays",2),l([p()],g.prototype,"_intervalUnit",2),l([p()],g.prototype,"_dueDate",2),l([p()],g.prototype,"_warningDays",2),l([p()],g.prototype,"_earliestCompletionDays",2),l([p()],g.prototype,"_intervalAnchor",2),l([p()],g.prototype,"_weekdays",2),l([p()],g.prototype,"_nth",2),l([p()],g.prototype,"_nthWeekday",2),l([p()],g.prototype,"_domDay",2),l([p()],g.prototype,"_domLastDay",2),l([p()],g.prototype,"_domBusiness",2),l([p()],g.prototype,"_calOffset",2),l([p()],g.prototype,"_seasonMonths",2),l([p()],g.prototype,"_endsMode",2),l([p()],g.prototype,"_endsCount",2),l([p()],g.prototype,"_endsUntil",2),l([p()],g.prototype,"_schedulePreview",2),l([p()],g.prototype,"_schedulePreviewEnded",2),l([p()],g.prototype,"_notes",2),l([p()],g.prototype,"_documentationUrl",2),l([p()],g.prototype,"_customIcon",2),l([p()],g.prototype,"_priority",2),l([p()],g.prototype,"_labels",2),l([p()],g.prototype,"_enabled",2),l([p()],g.prototype,"_triggerEntityId",2),l([p()],g.prototype,"_triggerEntityIds",2),l([p()],g.prototype,"_triggerEntityLogic",2),l([p()],g.prototype,"_triggerAttribute",2),l([p()],g.prototype,"_triggerType",2),l([p()],g.prototype,"_triggerAbove",2),l([p()],g.prototype,"_triggerBelow",2),l([p()],g.prototype,"_triggerForMinutes",2),l([p()],g.prototype,"_triggerTargetValue",2),l([p()],g.prototype,"_triggerDeltaMode",2),l([p()],g.prototype,"_triggerBaselineValue",2),l([p()],g.prototype,"_liveBaselineValue",2),l([p()],g.prototype,"_autoCompleteOnRecovery",2),l([p()],g.prototype,"_triggerFromState",2),l([p()],g.prototype,"_triggerToState",2),l([p()],g.prototype,"_triggerTargetChanges",2),l([p()],g.prototype,"_triggerRuntimeHours",2),l([p()],g.prototype,"_triggerOnStates",2),l([p()],g.prototype,"_compoundLogic",2),l([p()],g.prototype,"_compoundConditions",2),l([p()],g.prototype,"_suggestedAttributes",2),l([p()],g.prototype,"_availableAttributes",2),l([p()],g.prototype,"_entityDomain",2),l([p()],g.prototype,"_lastPerformed",2),l([p()],g.prototype,"_nfcTagId",2),l([p()],g.prototype,"_readingUnit",2),l([p()],g.prototype,"_consumesParts",2),l([p()],g.prototype,"_partsLoadFailed",2),l([p()],g.prototype,"_availableTags",2),l([p()],g.prototype,"_responsibleUserId",2),l([p()],g.prototype,"_assigneePool",2),l([p()],g.prototype,"_rotationStrategy",2),l([p()],g.prototype,"_availableUsers",2),l([p()],g.prototype,"_checklistText",2),l([p()],g.prototype,"_scheduleTime",2),l([p()],g.prototype,"_actionService",2),l([p()],g.prototype,"_actionTargetEntity",2),l([p()],g.prototype,"_actionData",2),l([p()],g.prototype,"_actionDataJsonFallback",2),l([p()],g.prototype,"_actionTesting",2),l([p()],g.prototype,"_actionTestResult",2),l([p()],g.prototype,"_actionTestError",2),l([p()],g.prototype,"_qcNotes",2),l([p()],g.prototype,"_qcCost",2),l([p()],g.prototype,"_qcDuration",2),l([p()],g.prototype,"_qcFeedback",2),l([p()],g.prototype,"_environmentalEntity",2),l([p()],g.prototype,"_environmentalAttribute",2);st=g;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",st)});var V,Jt=x(()=>{"use strict";C();N();I();te();V=class extends k{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys
Line truncated
|
||||||
<div class="backdrop" @click=${this.close}></div>
|
<div class="backdrop" @click=${this.close}></div>
|
||||||
<div class="dialog" role="dialog" aria-modal="true">
|
<div class="dialog" role="dialog" aria-modal="true">
|
||||||
<h2>${r("history_edit_title",e)||"Edit history entry"}</h2>
|
<h2>${r("history_edit_title",e)||"Edit history entry"}</h2>
|
||||||
@@ -2615,7 +2615,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}};V.styles=A`
|
`}};V.styles=S`
|
||||||
:host { display: contents; }
|
:host { display: contents; }
|
||||||
.backdrop {
|
.backdrop {
|
||||||
position: fixed; inset: 0;
|
position: fixed; inset: 0;
|
||||||
@@ -2677,8 +2677,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
background: rgba(211,47,47,0.1);
|
background: rgba(211,47,47,0.1);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
`,l([v({attribute:!1})],V.prototype,"hass",2),l([p()],V.prototype,"_open",2),l([p()],V.prototype,"_saving",2),l([p()],V.prototype,"_error",2),l([p()],V.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",V)});function oe(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Zt(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":oe(a)}function rs(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var H,Qt=x(()=>{"use strict";C();N();I();H=class extends k{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let c=this.lang||"en",d=oe(t),u=oe(i),_=!!this._completeResult,f=oe(r("qr_action_view",c)),m=oe(r("qr_action_complete",c));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
`,l([v({attribute:!1})],V.prototype,"hass",2),l([p()],V.prototype,"_open",2),l([p()],V.prototype,"_saving",2),l([p()],V.prototype,"_error",2),l([p()],V.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",V)});function le(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Zt(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":le(a)}function rs(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var H,Qt=x(()=>{"use strict";C();N();I();H=class extends k{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let d=this.lang||"en",c=le(t),u=le(i),_=!!this._completeResult,f=le(r("qr_action_view",d)),m=le(r("qr_action_complete",d));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||||
<title>${d}</title>
|
<title>${c}</title>
|
||||||
<style>
|
<style>
|
||||||
body{font-family:sans-serif;text-align:center;padding:20px}
|
body{font-family:sans-serif;text-align:center;padding:20px}
|
||||||
h2{margin:0 0 4px}
|
h2{margin:0 0 4px}
|
||||||
@@ -2689,7 +2689,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
|||||||
.qr-label{font-size:13px;font-weight:500;color:#333}
|
.qr-label{font-size:13px;font-weight:500;color:#333}
|
||||||
.url{font-size:10px;color:#999;word-break:break-all;margin-top:8px;max-width:480px}
|
.url{font-size:10px;color:#999;word-break:break-all;margin-top:8px;max-width:480px}
|
||||||
</style></head><body>
|
</style></head><body>
|
||||||
<h2>${d}</h2>
|
<h2>${c}</h2>
|
||||||
${u?`<div class="sub">${u}</div>`:""}
|
${u?`<div class="sub">${u}</div>`:""}
|
||||||
<div class="qr-row">
|
<div class="qr-row">
|
||||||
<div class="qr-col">
|
<div class="qr-col">
|
||||||
@@ -2701,9 +2701,9 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div class="qr-label">${m}</div>
|
<div class="qr-label">${m}</div>
|
||||||
</div>`:""}
|
</div>`:""}
|
||||||
</div>
|
</div>
|
||||||
<div class="url">${oe(this._viewResult.url)}</div>
|
<div class="url">${le(this._viewResult.url)}</div>
|
||||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||||
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),c=URL.createObjectURL(n),d=document.createElement("a");d.href=c;let u=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;d.download=`qr-${rs(u)}-${t}.svg`,d.click(),URL.revokeObjectURL(c)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),d=URL.createObjectURL(n),c=document.createElement("a");c.href=d;let u=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${rs(u)}-${t}.svg`,c.click(),URL.revokeObjectURL(d)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||||
<ha-dialog open @closed=${this._close}>
|
<ha-dialog open @closed=${this._close}>
|
||||||
<div class="dialog-title">${t}</div>
|
<div class="dialog-title">${t}</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -2764,7 +2764,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`}};H.styles=A`
|
`}};H.styles=S`
|
||||||
.dialog-title {
|
.dialog-title {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@@ -2882,14 +2882,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
color: var(--text-primary-color, #fff);
|
color: var(--text-primary-color, #fff);
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
`,l([v({attribute:!1})],H.prototype,"hass",2),l([v()],H.prototype,"lang",2),l([p()],H.prototype,"_open",2),l([p()],H.prototype,"_loading",2),l([p()],H.prototype,"_error",2),l([p()],H.prototype,"_viewResult",2),l([p()],H.prototype,"_completeResult",2),l([p()],H.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",H)});function Xt(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,c=a.suggested_interval??n;return o`
|
`,l([v({attribute:!1})],H.prototype,"hass",2),l([v()],H.prototype,"lang",2),l([p()],H.prototype,"_open",2),l([p()],H.prototype,"_loading",2),l([p()],H.prototype,"_error",2),l([p()],H.prototype,"_viewResult",2),l([p()],H.prototype,"_completeResult",2),l([p()],H.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",H)});function Xt(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,d=a.suggested_interval??n;return o`
|
||||||
<div class="weibull-section">
|
<div class="weibull-section">
|
||||||
<div class="weibull-title">
|
<div class="weibull-title">
|
||||||
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
|
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
|
||||||
${r("weibull_reliability_curve",s)}
|
${r("weibull_reliability_curve",s)}
|
||||||
${as(t,s)}
|
${as(t,s)}
|
||||||
</div>
|
</div>
|
||||||
${ns(t,i,n,c,s)}
|
${ns(t,i,n,d,s)}
|
||||||
${os(e,s)}
|
${os(e,s)}
|
||||||
${e?.confidence_interval_low!=null?ls(e,a,s):h}
|
${e?.confidence_interval_low!=null?ls(e,a,s):h}
|
||||||
</div>
|
</div>
|
||||||
@@ -2898,13 +2898,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<ha-svg-icon path="${t}"></ha-svg-icon>
|
<ha-svg-icon path="${t}"></ha-svg-icon>
|
||||||
${r(i,s)} (\u03B2=${a.toFixed(2)})
|
${r(i,s)} (\u03B2=${a.toFixed(2)})
|
||||||
</span>
|
</span>
|
||||||
`}function ns(a,s,e,t,i){let b=Math.max(e,t,s,1)*1.3,E=50,w=[];for(let j=0;j<=E;j++){let z=j/E*b,bi=1-Math.exp(-Math.pow(z/s,a)),yi=32+z/b*260,xi=136-bi*128;w.push([yi,xi])}let P=w.map(([j,z])=>`${j.toFixed(1)},${z.toFixed(1)}`).join(" "),ze="M32,136 "+w.map(([j,z])=>`L${j.toFixed(1)},${z.toFixed(1)}`).join(" ")+` L${w[E][0].toFixed(1)},136 Z`,ie=32+e/b*260,ye=1-Math.exp(-Math.pow(e/s,a)),xe=136-ye*128,fi=((1-ye)*100).toFixed(0),nt=32+t/b*260,vi=[0,.25,.5,.75,1];return o`
|
`}function ns(a,s,e,t,i){let b=Math.max(e,t,s,1)*1.3,E=50,w=[];for(let j=0;j<=E;j++){let M=j/E*b,bi=1-Math.exp(-Math.pow(M/s,a)),yi=32+M/b*260,xi=136-bi*128;w.push([yi,xi])}let P=w.map(([j,M])=>`${j.toFixed(1)},${M.toFixed(1)}`).join(" "),ze="M32,136 "+w.map(([j,M])=>`L${j.toFixed(1)},${M.toFixed(1)}`).join(" ")+` L${w[E][0].toFixed(1)},136 Z`,ie=32+e/b*260,xe=1-Math.exp(-Math.pow(e/s,a)),$e=136-xe*128,fi=((1-xe)*100).toFixed(0),ot=32+t/b*260,vi=[0,.25,.5,.75,1];return o`
|
||||||
<div class="weibull-chart">
|
<div class="weibull-chart">
|
||||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_weibull",i)}">
|
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_weibull",i)}">
|
||||||
${vi.map(j=>{let z=136-j*128;return ae`
|
${vi.map(j=>{let M=136-j*128;return ae`
|
||||||
<line x1="${32}" y1="${z.toFixed(1)}" x2="${292}" y2="${z.toFixed(1)}"
|
<line x1="${32}" y1="${M.toFixed(1)}" x2="${292}" y2="${M.toFixed(1)}"
|
||||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${j===.5?"4,3":h}" />
|
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${j===.5?"4,3":h}" />
|
||||||
<text x="${28}" y="${(z+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
<text x="${28}" y="${(M+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||||
font-size="8" text-anchor="end">${(j*100).toFixed(0)}%</text>
|
font-size="8" text-anchor="end">${(j*100).toFixed(0)}%</text>
|
||||||
`})}
|
`})}
|
||||||
|
|
||||||
@@ -2919,14 +2919,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
${e>0?ae`
|
${e>0?ae`
|
||||||
<line x1="${ie.toFixed(1)}" y1="${8}" x2="${ie.toFixed(1)}" y2="${136 .toFixed(1)}"
|
<line x1="${ie.toFixed(1)}" y1="${8}" x2="${ie.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||||
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||||
<circle cx="${ie.toFixed(1)}" cy="${xe.toFixed(1)}" r="3"
|
<circle cx="${ie.toFixed(1)}" cy="${$e.toFixed(1)}" r="3"
|
||||||
fill="var(--primary-color, #03a9f4)" />
|
fill="var(--primary-color, #03a9f4)" />
|
||||||
<text x="${(ie+4).toFixed(1)}" y="${(xe-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
<text x="${(ie+4).toFixed(1)}" y="${($e-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||||
font-size="9" font-weight="600">R=${fi}%</text>
|
font-size="9" font-weight="600">R=${fi}%</text>
|
||||||
`:h}
|
`:h}
|
||||||
|
|
||||||
${t>0&&t!==e?ae`
|
${t>0&&t!==e?ae`
|
||||||
<line x1="${nt.toFixed(1)}" y1="${8}" x2="${nt.toFixed(1)}" y2="${136 .toFixed(1)}"
|
<line x1="${ot.toFixed(1)}" y1="${8}" x2="${ot.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||||
`:h}
|
`:h}
|
||||||
|
|
||||||
@@ -2954,7 +2954,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</div>
|
</div>
|
||||||
`:h}
|
`:h}
|
||||||
</div>
|
</div>
|
||||||
`}function ls(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,c=s.interval_days??0,d=Math.max(0,t-5),_=i+5-d,f=(t-d)/_*100,m=(i-t)/_*100,y=(n-d)/_*100,b=c>0?(c-d)/_*100:-1;return o`
|
`}function ls(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,d=s.interval_days??0,c=Math.max(0,t-5),_=i+5-c,f=(t-c)/_*100,m=(i-t)/_*100,y=(n-c)/_*100,b=d>0?(d-c)/_*100:-1;return o`
|
||||||
<div class="confidence-range">
|
<div class="confidence-range">
|
||||||
<div class="confidence-range-title">
|
<div class="confidence-range-title">
|
||||||
${r("confidence_interval",e)}: ${n} ${r("days",e)} (${t}\u2013${i})
|
${r("confidence_interval",e)}: ${n} ${r("days",e)} (${t}\u2013${i})
|
||||||
@@ -2969,7 +2969,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<span class="confidence-text high">${r("confidence_aggressive",e)} (${i}${r("days",e).charAt(0)})</span>
|
<span class="confidence-text high">${r("confidence_aggressive",e)} (${i}${r("days",e).charAt(0)})</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}var ei=x(()=>{"use strict";C();I()});function ti(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let c=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
`}var ei=x(()=>{"use strict";C();I()});function ti(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let d=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||||
<div class="prediction-section">
|
<div class="prediction-section">
|
||||||
${a.sensor_prediction_urgency?o`
|
${a.sensor_prediction_urgency?o`
|
||||||
<div class="prediction-urgency-banner">
|
<div class="prediction-urgency-banner">
|
||||||
@@ -2984,7 +2984,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div class="prediction-grid">
|
<div class="prediction-grid">
|
||||||
${t?o`
|
${t?o`
|
||||||
<div class="prediction-item">
|
<div class="prediction-item">
|
||||||
<ha-svg-icon path="${c}"></ha-svg-icon>
|
<ha-svg-icon path="${d}"></ha-svg-icon>
|
||||||
<span class="prediction-label">${r("degradation_trend",s)}</span>
|
<span class="prediction-label">${r("degradation_trend",s)}</span>
|
||||||
<span class="prediction-value ${a.degradation_trend}">${r("trend_"+a.degradation_trend,s)}</span>
|
<span class="prediction-value ${a.degradation_trend}">${r("trend_"+a.degradation_trend,s)}</span>
|
||||||
${a.degradation_rate!=null?o`<span class="prediction-rate">${a.degradation_rate>0?"+":""}${Math.abs(a.degradation_rate)>=10?Math.round(a.degradation_rate).toLocaleString():a.degradation_rate.toFixed(1)} ${a.trigger_entity_info?.unit_of_measurement||""}/${r("day_short",s)}</span>`:h}
|
${a.degradation_rate!=null?o`<span class="prediction-rate">${a.degradation_rate>0?"+":""}${Math.abs(a.degradation_rate)>=10?Math.round(a.degradation_rate).toLocaleString():a.degradation_rate.toFixed(1)} ${a.trigger_entity_info?.unit_of_measurement||""}/${r("day_short",s)}</span>`:h}
|
||||||
@@ -3004,7 +3004,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<ha-svg-icon path="M15,13V5A3,3 0 0,0 12,2A3,3 0 0,0 9,5V13A5,5 0 0,0 7,17A5,5 0 0,0 12,22A5,5 0 0,0 17,17A5,5 0 0,0 15,13M12,4A1,1 0 0,1 13,5V8H11V5A1,1 0 0,1 12,4Z"></ha-svg-icon>
|
<ha-svg-icon path="M15,13V5A3,3 0 0,0 12,2A3,3 0 0,0 9,5V13A5,5 0 0,0 7,17A5,5 0 0,0 12,22A5,5 0 0,0 17,17A5,5 0 0,0 15,13M12,4A1,1 0 0,1 13,5V8H11V5A1,1 0 0,1 12,4Z"></ha-svg-icon>
|
||||||
<span class="prediction-label">${r("environmental_adjustment",s)}</span>
|
<span class="prediction-label">${r("environmental_adjustment",s)}</span>
|
||||||
<span class="prediction-value">${a.environmental_factor.toFixed(2)}x</span>
|
<span class="prediction-value">${a.environmental_factor.toFixed(2)}x</span>
|
||||||
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${d=>Vt(d,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
|
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${c=>Bt(c,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
|
||||||
</div>
|
</div>
|
||||||
`:h}
|
`:h}
|
||||||
</div>
|
</div>
|
||||||
@@ -3027,14 +3027,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
style="width: ${Math.min(s/i*100,100)}%"></div>
|
style="width: ${Math.min(s/i*100,100)}%"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}var ri=x(()=>{"use strict";C();I()});function ni(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=ai.map(d=>r(d,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,c=n&&n.length===12?n:t.map((d,u)=>{let _=a.seasonal_factor||1,f=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+f))});return o`
|
`}var ri=x(()=>{"use strict";C();I()});function ni(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=ai.map(c=>r(c,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,d=n&&n.length===12?n:t.map((c,u)=>{let _=a.seasonal_factor||1,f=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+f))});return o`
|
||||||
<div class="seasonal-card-compact">
|
<div class="seasonal-card-compact">
|
||||||
<h4>${r("seasonal_awareness",s)}</h4>
|
<h4>${r("seasonal_awareness",s)}</h4>
|
||||||
<div class="seasonal-mini-chart">
|
<div class="seasonal-mini-chart">
|
||||||
${c.map((d,u)=>{let _=d*40,f=d<.9?"low":d>1.1?"high":"normal";return o`
|
${d.map((c,u)=>{let _=c*40,f=c<.9?"low":c>1.1?"high":"normal";return o`
|
||||||
<div class="seasonal-bar ${f} ${u===i?"current":""}"
|
<div class="seasonal-bar ${f} ${u===i?"current":""}"
|
||||||
style="height: ${_}px"
|
style="height: ${_}px"
|
||||||
title="${t[u]}: ${d.toFixed(2)}x">
|
title="${t[u]}: ${c.toFixed(2)}x">
|
||||||
</div>
|
</div>
|
||||||
`})}
|
`})}
|
||||||
</div>
|
</div>
|
||||||
@@ -3044,27 +3044,27 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<span class="legend-item"><span class="dot high"></span> ${r("longer",s)||"L\xE4nger"}</span>
|
<span class="legend-item"><span class="dot high"></span> ${r("longer",s)||"L\xE4nger"}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}function oi(a,s){return ds(a,s)}function ds(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,c=100,d=8,_=c-d-4,f=Math.max(...e,1.5),m=n/12,y=m*.65,b=d+_-1/f*_;return o`
|
`}function oi(a,s){return cs(a,s)}function cs(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,d=100,c=8,_=d-c-4,f=Math.max(...e,1.5),m=n/12,y=m*.65,b=c+_-1/f*_;return o`
|
||||||
<div class="seasonal-chart">
|
<div class="seasonal-chart">
|
||||||
<div class="seasonal-chart-title">
|
<div class="seasonal-chart-title">
|
||||||
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
||||||
${r("seasonal_chart_title",s)}
|
${r("seasonal_chart_title",s)}
|
||||||
${t?o`<span class="source-tag">${t==="learned"?r("seasonal_learned",s):r("seasonal_manual",s)}</span>`:h}
|
${t?o`<span class="source-tag">${t==="learned"?r("seasonal_learned",s):r("seasonal_manual",s)}</span>`:h}
|
||||||
</div>
|
</div>
|
||||||
<svg viewBox="0 0 ${n} ${c}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_seasonal",s)}">
|
<svg viewBox="0 0 ${n} ${d}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_seasonal",s)}">
|
||||||
<line x1="0" y1="${b.toFixed(1)}" x2="${n}" y2="${b.toFixed(1)}"
|
<line x1="0" y1="${b.toFixed(1)}" x2="${n}" y2="${b.toFixed(1)}"
|
||||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||||
${e.map((E,w)=>{let P=E/f*_,ze=w*m+(m-y)/2,ie=d+_-P,ye=w===i,xe=E<1?"var(--success-color, #4caf50)":E>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return ae`
|
${e.map((E,w)=>{let P=E/f*_,ze=w*m+(m-y)/2,ie=c+_-P,xe=w===i,$e=E<1?"var(--success-color, #4caf50)":E>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return ae`
|
||||||
<rect x="${ze.toFixed(1)}" y="${ie.toFixed(1)}"
|
<rect x="${ze.toFixed(1)}" y="${ie.toFixed(1)}"
|
||||||
width="${y.toFixed(1)}" height="${P.toFixed(1)}"
|
width="${y.toFixed(1)}" height="${P.toFixed(1)}"
|
||||||
fill="${xe}" opacity="${ye?1:.5}" rx="2" />
|
fill="${$e}" opacity="${xe?1:.5}" rx="2" />
|
||||||
`})}
|
`})}
|
||||||
</svg>
|
</svg>
|
||||||
<div class="seasonal-labels">
|
<div class="seasonal-labels">
|
||||||
${ai.map((E,w)=>o`<span class="seasonal-label ${w===i?"active-month":""}">${r(E,s)}</span>`)}
|
${ai.map((E,w)=>o`<span class="seasonal-label ${w===i?"active-month":""}">${r(E,s)}</span>`)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}var ai,li=x(()=>{"use strict";C();I();ai=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var T,di=x(()=>{"use strict";C();N();I();te();ei();ii();ri();li();T=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=L(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=L(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),B)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(q(),B)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),B)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${e.recoLine truncated
|
`}var ai,li=x(()=>{"use strict";C();I();ai=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var T,ci=x(()=>{"use strict";C();N();I();te();ei();ii();ri();li();T=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=L(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=L(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),B)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(q(),B)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),B)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${e.recoLine truncated
|
||||||
<div class="recommendation-card">
|
<div class="recommendation-card">
|
||||||
<h4>${r("suggested_interval",t)}</h4>
|
<h4>${r("suggested_interval",t)}</h4>
|
||||||
${si(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
${si(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
||||||
@@ -3081,20 +3081,20 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`}_renderAdaptive(e){let t=this._lang,i=this._features.adaptive&&e.suggested_interval&&e.suggested_interval!==e.interval_days,n=e.degradation_trend!=null&&e.degradation_trend!=="insufficient_data"||e.days_until_threshold!=null||e.environmental_factor!=null&&e.environmental_factor!==1,c=this._features.adaptive&&e.interval_analysis?.weibull_beta!=null&&e.interval_analysis?.weibull_eta!=null,d=this._features.seasonal&&e.seasonal_factor&&e.seasonal_factor!==1;return!i&&!n&&!c&&!d?o`<div class="adaptive-empty">
|
`}_renderAdaptive(e){let t=this._lang,i=this._features.adaptive&&e.suggested_interval&&e.suggested_interval!==e.interval_days,n=e.degradation_trend!=null&&e.degradation_trend!=="insufficient_data"||e.days_until_threshold!=null||e.environmental_factor!=null&&e.environmental_factor!==1,d=this._features.adaptive&&e.interval_analysis?.weibull_beta!=null&&e.interval_analysis?.weibull_eta!=null,c=this._features.seasonal&&e.seasonal_factor&&e.seasonal_factor!==1;return!i&&!n&&!d&&!c?o`<div class="adaptive-empty">
|
||||||
${r("adaptive_no_data",t)||"Not enough completion history yet for adaptive analysis."}
|
${r("adaptive_no_data",t)||"Not enough completion history yet for adaptive analysis."}
|
||||||
</div>`:o`
|
</div>`:o`
|
||||||
<div class="adaptive-stack">
|
<div class="adaptive-stack">
|
||||||
${this._toast?o`<div class="toast">${this._toast}</div>`:h}
|
${this._toast?o`<div class="toast">${this._toast}</div>`:h}
|
||||||
${i?this._renderRecommendation(e):h}
|
${i?this._renderRecommendation(e):h}
|
||||||
${n?ti(e,t,this._features):h}
|
${n?ti(e,t,this._features):h}
|
||||||
${c?Xt(e,t):h}
|
${d?Xt(e,t):h}
|
||||||
${d?o`
|
${c?o`
|
||||||
${ni(e,t,this._features)}
|
${ni(e,t,this._features)}
|
||||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?oi(e,t):h}
|
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?oi(e,t):h}
|
||||||
`:h}
|
`:h}
|
||||||
</div>
|
</div>
|
||||||
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(u=>u.type==="completed"),c=n.reduce((u,_)=>u+(typeof _.cost=="number"?_.cost:0),0),d=(()=>{let u=n.map(_=>typeof _.duration=="number"?_.duration:null).filter(_=>_!=null);return u.length?Math.round(u.reduce((_,f)=>_+f,0)/u.length):null})();return o`
|
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(u=>u.type==="completed"),d=n.reduce((u,_)=>u+(typeof _.cost=="number"?_.cost:0),0),c=(()=>{let u=n.map(_=>typeof _.duration=="number"?_.duration:null).filter(_=>_!=null);return u.length?Math.round(u.reduce((_,f)=>_+f,0)/u.length):null})();return o`
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="stats-grid">
|
<div class="stats-grid">
|
||||||
<div class="stat">
|
<div class="stat">
|
||||||
@@ -3103,11 +3103,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</div>
|
</div>
|
||||||
<div class="stat">
|
<div class="stat">
|
||||||
<span class="stat-label">${r("total_cost",t)||"Total cost"}</span>
|
<span class="stat-label">${r("total_cost",t)||"Total cost"}</span>
|
||||||
<span class="stat-value">${c.toFixed(2)}</span>
|
<span class="stat-value">${d.toFixed(2)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat">
|
<div class="stat">
|
||||||
<span class="stat-label">${r("avg_duration",t)||"Avg duration"}</span>
|
<span class="stat-label">${r("avg_duration",t)||"Avg duration"}</span>
|
||||||
<span class="stat-value">${d!=null?`${d}m`:"\u2014"}</span>
|
<span class="stat-value">${c!=null?`${c}m`:"\u2014"}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="history-header">
|
<div class="history-header">
|
||||||
@@ -3120,7 +3120,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div class="history-entry">
|
<div class="history-entry">
|
||||||
<div class="history-line">
|
<div class="history-line">
|
||||||
<span class="history-type type-${u.type}">${r(u.type,t)}</span>
|
<span class="history-type type-${u.type}">${r(u.type,t)}</span>
|
||||||
<span class="history-date">${Ut(u.timestamp,t)}</span>
|
<span class="history-date">${Ft(u.timestamp,t)}</span>
|
||||||
${_?o`<button class="history-edit"
|
${_?o`<button class="history-edit"
|
||||||
title="${r("history_edit_button",t)||"Edit"}"
|
title="${r("history_edit_button",t)||"Edit"}"
|
||||||
@click=${()=>this._onEditHistoryEntry(u)}>
|
@click=${()=>this._onEditHistoryEntry(u)}>
|
||||||
@@ -3153,7 +3153,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div class="quick-info">
|
<div class="quick-info">
|
||||||
${t.next_due?o`<span><strong>${r("next_due",e)||"Next due"}:</strong> ${F(t.next_due,e)}</span>`:h}
|
${t.next_due?o`<span><strong>${r("next_due",e)||"Next due"}:</strong> ${F(t.next_due,e)}</span>`:h}
|
||||||
${t.last_performed?o`<span><strong>${r("last_performed",e)||"Last"}:</strong> ${F(t.last_performed,e)}</span>`:h}
|
${t.last_performed?o`<span><strong>${r("last_performed",e)||"Last"}:</strong> ${F(t.last_performed,e)}</span>`:h}
|
||||||
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${Ft(t,e)}</span>`:h}
|
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${Vt(t,e)}</span>`:h}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -3245,7 +3245,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
`}
|
`}
|
||||||
`:o`<div class="loading">${r("loading",e)||"Loading\u2026"}</div>`}
|
`:o`<div class="loading">${r("loading",e)||"Loading\u2026"}</div>`}
|
||||||
</div>
|
</div>
|
||||||
`}};T.styles=[Re,A`
|
`}};T.styles=[He,S`
|
||||||
:host { display: contents; }
|
:host { display: contents; }
|
||||||
.backdrop {
|
.backdrop {
|
||||||
position: fixed; inset: 0; z-index: 100;
|
position: fixed; inset: 0; z-index: 100;
|
||||||
@@ -3425,7 +3425,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||||
`],l([v({attribute:!1})],T.prototype,"hass",2),l([p()],T.prototype,"_open",2),l([p()],T.prototype,"_entryId",2),l([p()],T.prototype,"_taskId",2),l([p()],T.prototype,"_task",2),l([p()],T.prototype,"_objectName",2),l([p()],T.prototype,"_busy",2),l([p()],T.prototype,"_error",2),l([p()],T.prototype,"_showSkip",2),l([p()],T.prototype,"_showReset",2),l([p()],T.prototype,"_showDetails",2),l([p()],T.prototype,"_showAdaptive",2),l([p()],T.prototype,"_skipReason",2),l([p()],T.prototype,"_resetDate",2),l([p()],T.prototype,"_features",2),l([p()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function ci(a){return!!a&&/^https?:\/\//i.test(a)}var pi=x(()=>{"use strict"});var O,hi=x(()=>{"use strict";C();pi();N();I();te();O=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=L(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(q(),B)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(q(),B)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(q(),B)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],c=this.hass?.user?.is_admin??!0;return o`
|
`],l([v({attribute:!1})],T.prototype,"hass",2),l([p()],T.prototype,"_open",2),l([p()],T.prototype,"_entryId",2),l([p()],T.prototype,"_taskId",2),l([p()],T.prototype,"_task",2),l([p()],T.prototype,"_objectName",2),l([p()],T.prototype,"_busy",2),l([p()],T.prototype,"_error",2),l([p()],T.prototype,"_showSkip",2),l([p()],T.prototype,"_showReset",2),l([p()],T.prototype,"_showDetails",2),l([p()],T.prototype,"_showAdaptive",2),l([p()],T.prototype,"_skipReason",2),l([p()],T.prototype,"_resetDate",2),l([p()],T.prototype,"_features",2),l([p()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function di(a){return!!a&&/^https?:\/\//i.test(a)}var pi=x(()=>{"use strict"});var U,hi=x(()=>{"use strict";C();pi();N();I();te();U=class extends k{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=L(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(q(),B)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(q(),B)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(q(),B)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],d=this.hass?.user?.is_admin??!0;return o`
|
||||||
<div class="backdrop" @click=${this.close}></div>
|
<div class="backdrop" @click=${this.close}></div>
|
||||||
<div class="dialog" role="dialog" aria-modal="true">
|
<div class="dialog" role="dialog" aria-modal="true">
|
||||||
${t&&i?o`
|
${t&&i?o`
|
||||||
@@ -3443,11 +3443,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</div>
|
</div>
|
||||||
${n.length===0?o`<div class="empty">${r("no_tasks",e)||"No tasks yet."}</div>`:o`
|
${n.length===0?o`<div class="empty">${r("no_tasks",e)||"No tasks yet."}</div>`:o`
|
||||||
<div class="task-list">
|
<div class="task-list">
|
||||||
${n.map(d=>o`
|
${n.map(c=>o`
|
||||||
<div class="task-row" @click=${()=>this._onTaskClick(d.id)}>
|
<div class="task-row" @click=${()=>this._onTaskClick(c.id)}>
|
||||||
<span class="status-dot" style="background: ${X[d.status]||"#ccc"}"></span>
|
<span class="status-dot" style="background: ${X[c.status]||"#ccc"}"></span>
|
||||||
<span class="task-name">${d.name}</span>
|
<span class="task-name">${c.name}</span>
|
||||||
<span class="task-status">${r(d.status||"ok",e)}</span>
|
<span class="task-status">${r(c.status||"ok",e)}</span>
|
||||||
</div>
|
</div>
|
||||||
`)}
|
`)}
|
||||||
</div>
|
</div>
|
||||||
@@ -3461,7 +3461,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</div>
|
</div>
|
||||||
`:h}
|
`:h}
|
||||||
|
|
||||||
${c?o`
|
${d?o`
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="btn primary" @click=${this._onAddTask} ?disabled=${this._busy}>
|
<button class="btn primary" @click=${this._onAddTask} ?disabled=${this._busy}>
|
||||||
<ha-icon icon="mdi:plus"></ha-icon>
|
<ha-icon icon="mdi:plus"></ha-icon>
|
||||||
@@ -3485,14 +3485,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
</div>
|
</div>
|
||||||
`}_renderMetaRow(e){let t=this._lang,i=[];return e.area_id&&i.push([r("area",t),e.area_id]),e.manufacturer&&i.push([r("manufacturer",t),e.manufacturer]),e.model&&i.push([r("model",t),e.model]),e.serial_number&&i.push([r("serial_number_label",t),e.serial_number]),e.installation_date&&i.push([r("installed",t),e.installation_date]),e.warranty_expiry&&i.push([r("warranty",t),e.warranty_expiry]),e.documentation_url&&i.push([r("documentation_url_label",t),e.documentation_url]),i.length===0?h:o`
|
`}_renderMetaRow(e){let t=this._lang,i=[];return e.area_id&&i.push([r("area",t),e.area_id]),e.manufacturer&&i.push([r("manufacturer",t),e.manufacturer]),e.model&&i.push([r("model",t),e.model]),e.serial_number&&i.push([r("serial_number_label",t),e.serial_number]),e.installation_date&&i.push([r("installed",t),e.installation_date]),e.warranty_expiry&&i.push([r("warranty",t),e.warranty_expiry]),e.documentation_url&&i.push([r("documentation_url_label",t),e.documentation_url]),i.length===0?h:o`
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
${i.map(([n,c])=>o`
|
${i.map(([n,d])=>o`
|
||||||
<div class="meta-item">
|
<div class="meta-item">
|
||||||
<span class="meta-label">${n}</span>
|
<span class="meta-label">${n}</span>
|
||||||
<span class="meta-value">${ci(c)?o`<a href="${c}" target="_blank" rel="noopener noreferrer">${c}</a>`:c}</span>
|
<span class="meta-value">${di(d)?o`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</span>
|
||||||
</div>
|
</div>
|
||||||
`)}
|
`)}
|
||||||
</div>
|
</div>
|
||||||
`}};O.styles=A`
|
`}};U.styles=S`
|
||||||
:host { display: contents; }
|
:host { display: contents; }
|
||||||
.backdrop {
|
.backdrop {
|
||||||
position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
|
position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
|
||||||
@@ -3551,24 +3551,24 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||||
.loading { padding: 24px; text-align: center; color: var(--secondary-text-color); }
|
.loading { padding: 24px; text-align: center; color: var(--secondary-text-color); }
|
||||||
.error { padding: 8px; border-radius: 6px; background: rgba(211,47,47,0.1); color: var(--error-color); font-size: 13px; }
|
.error { padding: 8px; border-radius: 6px; background: rgba(211,47,47,0.1); color: var(--error-color); font-size: 13px; }
|
||||||
`,l([v({attribute:!1})],O.prototype,"hass",2),l([p()],O.prototype,"_open",2),l([p()],O.prototype,"_entryId",2),l([p()],O.prototype,"_data",2),l([p()],O.prototype,"_busy",2),l([p()],O.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",O)});var B={};wi(B,{openCompleteDialog:()=>vs,openCreateObjectDialog:()=>st,openCreateTaskDialog:()=>rt,openEditObjectDialog:()=>gs,openEditTaskDialog:()=>ms,openHistoryEditDialog:()=>fs,openObjectQuickActions:()=>ys,openQrDialog:()=>bs,openTaskQuickActions:()=>at});function Ne(){return document.querySelector("home-assistant")?.hass}function W(a){let s=document.body.querySelector(a);return s||(s=document.createElement(a),document.body.appendChild(s)),s}function G(a){let s=Ne();if(!s)return!1;a.hass=s;let e=s.language||"en";return Le(e)||Pe(e).then(()=>{a.requestUpdate?.()}),!0}function mi(a){return je||(je=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??ui.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>ui),je)}function st(){let a=W(_i);return G(a)?(a.openCreate(),!0):!1}function gs(a,s){let e=W(_i);return G(e)?(e.openEdit(a,s),!0):!1}function rt(){let a=W(gi);if(!G(a))return!1;let s=Ne();return s?((async()=>{let e=await mi(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function ms(a,s){let e=W(gi);if(!G(e))return!1;let t=Ne();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),mi(t)]),c=(i.tasks||[]).find(u=>u.id===s);if(!c){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let d=e;d.checklistsEnabled=n.features.checklists,d.scheduleTimeEnabled=n.features.schedule_time,d.completionActionsEnabled=n.features.completion_actions,d.defaultWarningDays=n.defaultWarningDays,await d.openEdit(a,c)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function fs(a){let s=W(cs);return G(s)?(s.openEdit(a),!0):!1}function vs(a){let s=W(ps);return G(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.lang=Ne()?.language||"en",s.open(),!0):!1}function bs(a){let s=W(hs);return G(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function at(a,s){let e=W(us);return G(e)?(e.openFor(a,s),!0):!1}function ys(a){let s=W(_s);return G(s)?(s.openFor(a),!0):!1}var _i,gi,cs,ps,hs,us,_s,ui,je,q=x(()=>{"use strict";Wt();Yt();Xe();Jt();Qt();di();hi();I();_i="maintenance-object-dialog",gi="maintenance-task-dialog",cs="maintenance-history-edit-dialog",ps="maintenance-complete-dialog",hs="maintenance-qr-dialog",us="maintenance-task-quick-actions-dialog",_s="maintenance-object-quick-actions-dialog";ui={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},je=null});C();N();I();C();N();I();var Vi=["overdue","triggered","due_soon","ok"],M=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntitiesChanged=e=>{this._valueChanged("entity_ids",e.detail.value||[])}}get _lang(){return this.hass?.language||"en"}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._objectsLoaded&&(this._objectsLoaded=!0,this._loadObjects())}async _loadObjects(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._objects=e.objects||[],this._loadError=!1}catch{this._objects=[],this._loadError=!0}this._loadingObjects=!1;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e.views||[]}catch{this._views=[]}}_valueChanged(e,t){let i={...this._config,[e]:t};(Array.isArray(t)&&t.length===0||t==="")&&delete i[e],this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i}}))}_toggleStatus(e,t){let i=new Set(this._config.filter_status||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_status",[...i])}_toggleObject(e,t){let i=new Set(this._config.filter_objects||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_objects",[...i])}render(){let e=this._lang,t=new Set(this._config.filter_status||[]),i=new Set(this._config.filter_objects||[]),n=[...this._objects].map(d=>d.object.name).sort((d,u)=>d.localeCompare(u)),c=[];for(let d of this._objects)for(let u of d.tasks)u.sensor_entity_id&&c.push(u.sensor_entity_id),u.binary_sensor_entity_id&&c.push(u.binary_sensor_entity_id);return o`
|
`,l([v({attribute:!1})],U.prototype,"hass",2),l([p()],U.prototype,"_open",2),l([p()],U.prototype,"_entryId",2),l([p()],U.prototype,"_data",2),l([p()],U.prototype,"_busy",2),l([p()],U.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",U)});var B={};wi(B,{openCompleteDialog:()=>vs,openCreateObjectDialog:()=>rt,openCreateTaskDialog:()=>at,openEditObjectDialog:()=>gs,openEditTaskDialog:()=>ms,openHistoryEditDialog:()=>fs,openObjectQuickActions:()=>ys,openQrDialog:()=>bs,openTaskQuickActions:()=>nt});function Ne(){return document.querySelector("home-assistant")?.hass}function W(a){let s=document.body.querySelector(a);return s||(s=document.createElement(a),document.body.appendChild(s)),s}function G(a){let s=Ne();if(!s)return!1;a.hass=s;let e=s.language||"en";return Pe(e)||Re(e).then(()=>{a.requestUpdate?.()}),!0}function mi(a){return je||(je=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??ui.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>ui),je)}function rt(){let a=W(_i);return G(a)?(a.openCreate(),!0):!1}function gs(a,s){let e=W(_i);return G(e)?(e.openEdit(a,s),!0):!1}function at(){let a=W(gi);if(!G(a))return!1;let s=Ne();return s?((async()=>{let e=await mi(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function ms(a,s){let e=W(gi);if(!G(e))return!1;let t=Ne();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),mi(t)]),d=(i.tasks||[]).find(u=>u.id===s);if(!d){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let c=e;c.checklistsEnabled=n.features.checklists,c.scheduleTimeEnabled=n.features.schedule_time,c.completionActionsEnabled=n.features.completion_actions,c.defaultWarningDays=n.defaultWarningDays,await c.openEdit(a,d)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function fs(a){let s=W(ds);return G(s)?(s.openEdit(a),!0):!1}function vs(a){let s=W(ps);return G(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.lang=Ne()?.language||"en",s.open(),!0):!1}function bs(a){let s=W(hs);return G(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function nt(a,s){let e=W(us);return G(e)?(e.openFor(a,s),!0):!1}function ys(a){let s=W(_s);return G(s)?(s.openFor(a),!0):!1}var _i,gi,ds,ps,hs,us,_s,ui,je,q=x(()=>{"use strict";Gt();Yt();et();Jt();Qt();ci();hi();I();_i="maintenance-object-dialog",gi="maintenance-task-dialog",ds="maintenance-history-edit-dialog",ps="maintenance-complete-dialog",hs="maintenance-qr-dialog",us="maintenance-task-quick-actions-dialog",_s="maintenance-object-quick-actions-dialog";ui={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},je=null});C();N();I();Xe();C();N();I();var Vi=["overdue","triggered","due_soon","ok"],O=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntitiesChanged=e=>{this._valueChanged("entity_ids",e.detail.value||[])}}get _lang(){return this.hass?.language||"en"}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._objectsLoaded&&(this._objectsLoaded=!0,this._loadObjects())}async _loadObjects(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._objects=e.objects||[],this._loadError=!1}catch{this._objects=[],this._loadError=!0}this._loadingObjects=!1;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e.views||[]}catch{this._views=[]}}_valueChanged(e,t){let i={...this._config,[e]:t};(Array.isArray(t)&&t.length===0||t==="")&&delete i[e],this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i}}))}_toggleStatus(e,t){let i=new Set(this._config.filter_status||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_status",[...i])}_toggleObject(e,t){let i=new Set(this._config.filter_objects||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_objects",[...i])}render(){let e=this._lang,t=new Set(this._config.filter_status||[]),i=new Set(this._config.filter_objects||[]),n=[...this._objects].map(c=>c.object.name).sort((c,u)=>c.localeCompare(u)),d=[];for(let c of this._objects)for(let u of c.tasks)u.sensor_entity_id&&d.push(u.sensor_entity_id),u.binary_sensor_entity_id&&d.push(u.binary_sensor_entity_id);return o`
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
label="${r("card_title",e)}"
|
label="${r("card_title",e)}"
|
||||||
.value=${this._config.title||""}
|
.value=${this._config.title||""}
|
||||||
@input=${d=>this._valueChanged("title",d.target.value)}
|
@input=${c=>this._valueChanged("title",c.target.value)}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
|
|
||||||
<!-- Status filter (chip row) -->
|
<!-- Status filter (chip row) -->
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="field-label">${r("card_filter_status",e)}</div>
|
<div class="field-label">${r("card_filter_status",e)}</div>
|
||||||
<div class="chip-row">
|
<div class="chip-row">
|
||||||
${Vi.map(d=>o`
|
${Vi.map(c=>o`
|
||||||
<label class="chip ${t.has(d)?"active":""}">
|
<label class="chip ${t.has(c)?"active":""}">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
.checked=${t.has(d)}
|
.checked=${t.has(c)}
|
||||||
@change=${u=>this._toggleStatus(d,u.target.checked)} />
|
@change=${u=>this._toggleStatus(c,u.target.checked)} />
|
||||||
${r(d,e)}
|
${r(c,e)}
|
||||||
</label>
|
</label>
|
||||||
`)}
|
`)}
|
||||||
</div>
|
</div>
|
||||||
@@ -3580,12 +3580,12 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div class="field-label">${r("card_filter_objects",e)}</div>
|
<div class="field-label">${r("card_filter_objects",e)}</div>
|
||||||
${this._loadingObjects?o`<div class="field-help">${r("card_loading_objects",e)}</div>`:this._loadError?o`<div class="field-help error-text">${r("card_load_error",e)}</div>`:n.length===0?o`<div class="field-help">${r("no_objects",e)}</div>`:o`
|
${this._loadingObjects?o`<div class="field-help">${r("card_loading_objects",e)}</div>`:this._loadError?o`<div class="field-help error-text">${r("card_load_error",e)}</div>`:n.length===0?o`<div class="field-help">${r("no_objects",e)}</div>`:o`
|
||||||
<div class="object-list">
|
<div class="object-list">
|
||||||
${n.map(d=>o`
|
${n.map(c=>o`
|
||||||
<label class="object-row">
|
<label class="object-row">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
.checked=${i.has(d)}
|
.checked=${i.has(c)}
|
||||||
@change=${u=>this._toggleObject(d,u.target.checked)} />
|
@change=${u=>this._toggleObject(c,u.target.checked)} />
|
||||||
<span>${d}</span>
|
<span>${c}</span>
|
||||||
</label>
|
</label>
|
||||||
`)}
|
`)}
|
||||||
</div>
|
</div>
|
||||||
@@ -3602,7 +3602,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${this._config.entity_ids||[]}
|
.value=${this._config.entity_ids||[]}
|
||||||
.includeDomains=${["sensor","binary_sensor"]}
|
.includeDomains=${["sensor","binary_sensor"]}
|
||||||
.includeEntities=${c}
|
.includeEntities=${d}
|
||||||
@value-changed=${this._onEntitiesChanged}
|
@value-changed=${this._onEntitiesChanged}
|
||||||
></ha-entities-picker>
|
></ha-entities-picker>
|
||||||
<div class="field-help">${r("card_filter_entities_help",e)}</div>
|
<div class="field-help">${r("card_filter_entities_help",e)}</div>
|
||||||
@@ -3617,13 +3617,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<select
|
<select
|
||||||
class="view-select"
|
class="view-select"
|
||||||
.value=${this._config.view_id||""}
|
.value=${this._config.view_id||""}
|
||||||
@change=${d=>this._valueChanged("view_id",d.target.value)}
|
@change=${c=>this._valueChanged("view_id",c.target.value)}
|
||||||
>
|
>
|
||||||
<option value="" ?selected=${!this._config.view_id}>
|
<option value="" ?selected=${!this._config.view_id}>
|
||||||
${r("card_saved_view_none",e)}
|
${r("card_saved_view_none",e)}
|
||||||
</option>
|
</option>
|
||||||
${this._views.map(d=>o`<option value=${d.id} ?selected=${this._config.view_id===d.id}>
|
${this._views.map(c=>o`<option value=${c.id} ?selected=${this._config.view_id===c.id}>
|
||||||
${d.name}
|
${c.name}
|
||||||
</option>`)}
|
</option>`)}
|
||||||
</select>
|
</select>
|
||||||
<div class="field-help">${r("card_saved_view_help",e)}</div>
|
<div class="field-help">${r("card_saved_view_help",e)}</div>
|
||||||
@@ -3633,21 +3633,28 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<ha-formfield label="${r("card_show_header",e)}">
|
<ha-formfield label="${r("card_show_header",e)}">
|
||||||
<ha-switch
|
<ha-switch
|
||||||
.checked=${this._config.show_header!==!1}
|
.checked=${this._config.show_header!==!1}
|
||||||
@change=${d=>this._valueChanged("show_header",d.target.checked)}
|
@change=${c=>this._valueChanged("show_header",c.target.checked)}
|
||||||
></ha-switch>
|
></ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
|
|
||||||
<ha-formfield label="${r("card_show_actions",e)}">
|
<ha-formfield label="${r("card_show_actions",e)}">
|
||||||
<ha-switch
|
<ha-switch
|
||||||
.checked=${this._config.show_actions!==!1}
|
.checked=${this._config.show_actions!==!1}
|
||||||
@change=${d=>this._valueChanged("show_actions",d.target.checked)}
|
@change=${c=>this._valueChanged("show_actions",c.target.checked)}
|
||||||
|
></ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
|
||||||
|
<ha-formfield label="${r("responsible_user",e)}">
|
||||||
|
<ha-switch
|
||||||
|
.checked=${this._config.show_assignee!==!1}
|
||||||
|
@change=${c=>this._valueChanged("show_assignee",c.target.checked)}
|
||||||
></ha-switch>
|
></ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
|
|
||||||
<ha-formfield label="${r("card_compact",e)}">
|
<ha-formfield label="${r("card_compact",e)}">
|
||||||
<ha-switch
|
<ha-switch
|
||||||
.checked=${this._config.compact||!1}
|
.checked=${this._config.compact||!1}
|
||||||
@change=${d=>this._valueChanged("compact",d.target.checked)}
|
@change=${c=>this._valueChanged("compact",c.target.checked)}
|
||||||
></ha-switch>
|
></ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
|
|
||||||
@@ -3655,11 +3662,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
label="${r("card_max_items",e)}"
|
label="${r("card_max_items",e)}"
|
||||||
type="number"
|
type="number"
|
||||||
.value=${String(this._config.max_items||0)}
|
.value=${String(this._config.max_items||0)}
|
||||||
@input=${d=>this._valueChanged("max_items",parseInt(d.target.value,10)||0)}
|
@input=${c=>this._valueChanged("max_items",parseInt(c.target.value,10)||0)}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
${h}
|
${h}
|
||||||
</div>
|
</div>
|
||||||
`}};M.styles=A`
|
`}};O.styles=S`
|
||||||
.editor {
|
.editor {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -3738,7 +3745,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
max-width: 320px;
|
max-width: 320px;
|
||||||
}
|
}
|
||||||
`,l([v({attribute:!1})],M.prototype,"hass",2),l([p()],M.prototype,"_config",2),l([p()],M.prototype,"_objects",2),l([p()],M.prototype,"_loadingObjects",2),l([p()],M.prototype,"_loadError",2),l([p()],M.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",M);Xe();q();var D=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&Ot(this.hass?.locale);let t=this.hass?.language;if(t&&!Le(t)&&Pe(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}await this._loadViewFilters()}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:c,filter_due_max_days:d,max_items:u}=this._config,_=n?.length?new Set(n):null,f=c!==void 0||d!==void 0,m=this._viewFilters,y=m?.user_id==="current_user"?this.hass.user?.id??null:m?.user_id??null;for(let E of this._objects)if(!(i?.length&&!i.includes(E.object.name))){for(let w of E.tasks)if(!w.is_done&&!(w.archived||E.object.archived)&&!(t?.length&&!t.includes(w.status))&&!(_&&!(w.sensor_entity_id&&_.has(w.sensor_entity_id)||w.binary_sensor_entity_id&&_.has(w.binary_sensor_entity_id)))){if(f){let P=w.days_until_due;if(P==null||c!==void 0&&P<c||d!==void 0&&P>d)continue}m&&(m.status&&w.status!==m.status||m.label&&!(w.labels||[]).includes(m.label)||y&&w.responsible_user_id!==y)||e.push({entry_id:E.entry_id,object_name:E.object.name,task:w})}}let b={overdue:0,triggered:1,due_soon:2,ok:3};return e.sort((E,w)=>{let P=(b[E.task.status]??9)-(b[w.task.status]??9);return P!==0?P:(E.task.days_until_due??1/0)-(w.task.days_until_due??1/0)}),u&&u>0?e.slice(0,u):e}_openTaskDetail(e,t){at(e,t)}render(){let e=this._lang,t=this._config.title||r("maintenance",e),i=this._config.show_header!==!1,n=this._config.show_actions!==!1,c=this._config.compact||!1,d=this._flatTasks,u=this._stats;return o`
|
`,l([v({attribute:!1})],O.prototype,"hass",2),l([p()],O.prototype,"_config",2),l([p()],O.prototype,"_objects",2),l([p()],O.prototype,"_loadingObjects",2),l([p()],O.prototype,"_loadError",2),l([p()],O.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",O);et();q();var z=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._userNames={};this._userService=null;this._userNamesLoaded=!1;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&Ut(this.hass?.locale);let t=this.hass?.language;if(t&&!Pe(t)&&Re(t).then(()=>this.requestUpdate()),this.hass&&!this._userNamesLoaded&&this._config.show_assignee!==!1&&this._objects.some(i=>i.tasks.some(n=>n.responsible_user_id))&&this._loadUserNames(),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}await this._loadViewFilters()}_assigneeName(e){if(this._config.show_assignee===!1)return"";let t=e.responsible_user_id;return t&&this._userNames[t]||""}async _loadUserNames(){this._userNamesLoaded=!0,this._userService?this._userService.updateHass(this.hass):this._userService=new oe(this.hass);try{let e=await this._userService.getUsers();this._userNames=Object.fromEntries(e.map(t=>[t.id,t.name]))}catch{}}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:d,filter_due_max_days:c,max_items:u}=this._config,_=n?.length?new Set(n):null,f=d!==void 0||c!==void 0,m=this._viewFilters,y=m?.user_id==="current_user"?this.hass.user?.id??null:m?.user_id??null;for(let E of this._objects)if(!(i?.length&&!i.includes(E.object.name))){for(let w of E.tasks)if(!w.is_done&&!(w.archived||E.object.archived)&&!(t?.length&&!t.includes(w.status))&&!(_&&!(w.sensor_entity_id&&_.has(w.sensor_entity_id)||w.binary_sensor_entity_id&&_.has(w.binary_sensor_entity_id)))){if(f){let P=w.days_until_due;if(P==null||d!==void 0&&P<d||c!==void 0&&P>c)continue}m&&(m.status&&w.status!==m.status||m.label&&!(w.labels||[]).includes(m.label)||y&&w.responsible_user_id!==y)||e.push({entry_id:E.entry_id,object_name:E.object.name,task:w})}}let b={overdue:0,triggered:1,due_soon:2,ok:3};return e.sort((E,w)=>{let P=(b[E.task.status]??9)-(b[w.task.status]??9);return P!==0?P:(E.task.days_until_due??1/0)-(w.task.days_until_due??1/0)}),u&&u>0?e.slice(0,u):e}_openTaskDetail(e,t){nt(e,t)}render(){let e=this._lang,t=this._config.title||r("maintenance",e),i=this._config.show_header!==!1,n=this._config.show_actions!==!1,d=this._config.compact||!1,c=this._flatTasks,u=this._stats;return o`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h1>${t}</h1>
|
<h1>${t}</h1>
|
||||||
@@ -3754,21 +3761,21 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<mwc-icon-button
|
<mwc-icon-button
|
||||||
class="hdr-add"
|
class="hdr-add"
|
||||||
title="${r("new_object",e)}"
|
title="${r("new_object",e)}"
|
||||||
@click=${()=>st()}
|
@click=${()=>rt()}
|
||||||
>
|
>
|
||||||
<ha-icon icon="mdi:plus-box"></ha-icon>
|
<ha-icon icon="mdi:plus-box"></ha-icon>
|
||||||
</mwc-icon-button>
|
</mwc-icon-button>
|
||||||
<mwc-icon-button
|
<mwc-icon-button
|
||||||
class="hdr-add"
|
class="hdr-add"
|
||||||
title="${r("add_task",e)}"
|
title="${r("add_task",e)}"
|
||||||
@click=${()=>rt()}
|
@click=${()=>at()}
|
||||||
>
|
>
|
||||||
<ha-icon icon="mdi:playlist-plus"></ha-icon>
|
<ha-icon icon="mdi:playlist-plus"></ha-icon>
|
||||||
</mwc-icon-button>
|
</mwc-icon-button>
|
||||||
`:h}
|
`:h}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${d.length===0?this._objects.some(_=>_.tasks.length>0)?o`<div class="empty-card">
|
${c.length===0?this._objects.some(_=>_.tasks.length>0)?o`<div class="empty-card">
|
||||||
<!-- (#86) tasks exist but none match the filter (default:
|
<!-- (#86) tasks exist but none match the filter (default:
|
||||||
actionable-only) — "all caught up", NOT "no tasks yet". -->
|
actionable-only) — "all caught up", NOT "no tasks yet". -->
|
||||||
<div class="all-caught-up">✓ ${r("card_all_caught_up",e)}</div>
|
<div class="all-caught-up">✓ ${r("card_all_caught_up",e)}</div>
|
||||||
@@ -3776,8 +3783,8 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
<div>${r("card_no_tasks_title",e)}</div>
|
<div>${r("card_no_tasks_title",e)}</div>
|
||||||
<a class="empty-link" href="/maintenance-supporter">${r("card_no_tasks_cta",e)}</a>
|
<a class="empty-link" href="/maintenance-supporter">${r("card_no_tasks_cta",e)}</a>
|
||||||
</div>`:o`
|
</div>`:o`
|
||||||
<div class="task-list ${c?"compact":""}">
|
<div class="task-list ${d?"compact":""}">
|
||||||
${d.map(({entry_id:_,object_name:f,task:m})=>o`
|
${c.map(({entry_id:_,object_name:f,task:m})=>o`
|
||||||
<div class="task-item clickable"
|
<div class="task-item clickable"
|
||||||
@click=${()=>this._openTaskDetail(_,m.id)}
|
@click=${()=>this._openTaskDetail(_,m.id)}
|
||||||
title="${r("open_task",e)||"Open task"}">
|
title="${r("open_task",e)||"Open task"}">
|
||||||
@@ -3791,7 +3798,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
title="${r("postponed",e)||"Postponed"}"
|
title="${r("postponed",e)||"Postponed"}"
|
||||||
></ha-icon>`:h}
|
></ha-icon>`:h}
|
||||||
</div>
|
</div>
|
||||||
${c?h:o`<div class="task-meta">${f} · ${r(m.type,e)}</div>`}
|
${d?this._assigneeName(m)?o`<div class="task-meta compact-assignee" title="${this._assigneeName(m)}">
|
||||||
|
<ha-icon icon="mdi:account"></ha-icon>${this._assigneeName(m)}
|
||||||
|
</div>`:h:o`<div class="task-meta">
|
||||||
|
${f} · ${r(m.type,e)}${this._assigneeName(m)?o` · <span class="assignee"
|
||||||
|
><ha-icon icon="mdi:account"></ha-icon>${this._assigneeName(m)}</span
|
||||||
|
>`:h}
|
||||||
|
</div>`}
|
||||||
</div>
|
</div>
|
||||||
<div class="task-due">
|
<div class="task-due">
|
||||||
${m.days_until_due!==null&&m.days_until_due!==void 0?m.days_until_due<0?o`<span class="overdue-text">${Math.abs(m.days_until_due)}${e.startsWith("de")?"T":"d"}</span>`:m.days_until_due===0?r("today",e):`${m.days_until_due}${e.startsWith("de")?"T":"d"}`:m.trigger_active?"\u26A1":"\u2014"}
|
${m.days_until_due!==null&&m.days_until_due!==void 0?m.days_until_due<0?o`<span class="overdue-text">${Math.abs(m.days_until_due)}${e.startsWith("de")?"T":"d"}</span>`:m.days_until_due===0?r("today",e):`${m.days_until_due}${e.startsWith("de")?"T":"d"}`:m.trigger_active?"\u26A1":"\u2014"}
|
||||||
@@ -3814,7 +3827,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@task-completed=${this._onCompleted}
|
@task-completed=${this._onCompleted}
|
||||||
></maintenance-complete-dialog>
|
></maintenance-complete-dialog>
|
||||||
`}};D.styles=[Re,A`
|
`}};z.styles=[He,S`
|
||||||
ha-card { overflow: hidden; }
|
ha-card { overflow: hidden; }
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
@@ -3889,6 +3902,24 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
.task-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.task-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.postponed-icon { --mdc-icon-size: 14px; color: var(--secondary-text-color); vertical-align: text-bottom; margin-inline-start: 4px; }
|
.postponed-icon { --mdc-icon-size: 14px; color: var(--secondary-text-color); vertical-align: text-bottom; margin-inline-start: 4px; }
|
||||||
.task-meta { font-size: 12px; color: var(--secondary-text-color); }
|
.task-meta { font-size: 12px; color: var(--secondary-text-color); }
|
||||||
|
.assignee, .compact-assignee {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.assignee ha-icon, .compact-assignee ha-icon {
|
||||||
|
--mdc-icon-size: 13px;
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
/* Compact rows have no meta line of their own — keep the name from
|
||||||
|
pushing the due column off a narrow phone card. */
|
||||||
|
.compact-assignee {
|
||||||
|
max-width: 11ch;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
.task-due { font-size: 13px; color: var(--secondary-text-color); min-width: 40px; text-align: right; }
|
.task-due { font-size: 13px; color: var(--secondary-text-color); min-width: 40px; text-align: right; }
|
||||||
.overdue-text { color: var(--error-color); font-weight: 500; }
|
.overdue-text { color: var(--error-color); font-weight: 500; }
|
||||||
@@ -3898,7 +3929,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
|||||||
--mdc-icon-size: 18px;
|
--mdc-icon-size: 18px;
|
||||||
color: var(--primary-color);
|
color: var(--primary-color);
|
||||||
}
|
}
|
||||||
`],l([v({attribute:!1})],D.prototype,"hass",2),l([p()],D.prototype,"_config",2),l([p()],D.prototype,"_objects",2),l([p()],D.prototype,"_stats",2),l([p()],D.prototype,"_unsub",2),l([p()],D.prototype,"_viewFilters",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",D);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{D as MaintenanceSupporterCard};
|
`],l([v({attribute:!1})],z.prototype,"hass",2),l([p()],z.prototype,"_config",2),l([p()],z.prototype,"_objects",2),l([p()],z.prototype,"_stats",2),l([p()],z.prototype,"_unsub",2),l([p()],z.prototype,"_viewFilters",2),l([p()],z.prototype,"_userNames",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",z);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{z as MaintenanceSupporterCard};
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
var is=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var d=(n,r,e,t)=>{for(var i=t>1?void 0:t?ss(r,e):r,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&is(r,e,i),i};var ot=globalThis,lt=ot.ShadowRoot&&(ot.ShadyCSS===void 0||ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,It=Symbol(),ti=new WeakMap,Ne=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==It)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(lt&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=ti.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&ti.set(e,r))}return r}toString(){return this.cssText}},ii=n=>new Ne(typeof n=="string"?n:n+"",void 0,It),j=(n,...r)=>{let e=n.length===1?n[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[a+1],n[0]);return new Ne(e,n,It)},si=(n,r)=>{if(lt)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=ot.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,n.appendChild(t)}},Lt=lt?n=>n:n=>n instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return ii(e)})(n):n;var{is:as,defineProperty:rs,getOwnPropertyDescriptor:ns,getOwnPropertyNames:os,getOwnPropertySymbols:ls,getPrototypeOf:cs}=Object,ct=globalThis,ai=ct.trustedTypes,ds=ai?ai.emptyScript:"",ps=ct.reactiveElementPolyfillSupport,Fe=(n,r)=>n,Ue={toAttribute(n,r){switch(r){case Boolean:n=n?ds:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,r){let e=n;switch(r){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},dt=(n,r)=>!as(n,r),ri={attribute:!0,type:String,converter:Ue,reflect:!1,useDefault:!1,hasChanged:dt};Symbol.metadata??=Symbol("metadata"),ct.litPropertyMetadata??=new WeakMap;var ve=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=ri){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&rs(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=ns(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);a?.call(this,l),this.requestUpdate(r,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??ri}static _$Ei(){if(this.hasOwnProperty(Fe("elementProperties")))return;let r=cs(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fe("properties"))){let e=this.properties,t=[...os(e),...ls(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Lt(i))}else r!==void 0&&e.push(Lt(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return si(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.construcLine truncated
|
var is=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var d=(n,r,e,t)=>{for(var i=t>1?void 0:t?ss(r,e):r,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&is(r,e,i),i};var ot=globalThis,lt=ot.ShadowRoot&&(ot.ShadyCSS===void 0||ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,It=Symbol(),ti=new WeakMap,Ne=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==It)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(lt&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=ti.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&ti.set(e,r))}return r}toString(){return this.cssText}},ii=n=>new Ne(typeof n=="string"?n:n+"",void 0,It),j=(n,...r)=>{let e=n.length===1?n[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[a+1],n[0]);return new Ne(e,n,It)},si=(n,r)=>{if(lt)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=ot.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,n.appendChild(t)}},Lt=lt?n=>n:n=>n instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return ii(e)})(n):n;var{is:as,defineProperty:rs,getOwnPropertyDescriptor:ns,getOwnPropertyNames:os,getOwnPropertySymbols:ls,getPrototypeOf:cs}=Object,ct=globalThis,ai=ct.trustedTypes,ds=ai?ai.emptyScript:"",ps=ct.reactiveElementPolyfillSupport,Fe=(n,r)=>n,Ue={toAttribute(n,r){switch(r){case Boolean:n=n?ds:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,r){let e=n;switch(r){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},dt=(n,r)=>!as(n,r),ri={attribute:!0,type:String,converter:Ue,reflect:!1,useDefault:!1,hasChanged:dt};Symbol.metadata??=Symbol("metadata"),ct.litPropertyMetadata??=new WeakMap;var ve=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=ri){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&rs(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=ns(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);a?.call(this,l),this.requestUpdate(r,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??ri}static _$Ei(){if(this.hasOwnProperty(Fe("elementProperties")))return;let r=cs(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fe("properties"))){let e=this.properties,t=[...os(e),...ls(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Lt(i))}else r!==void 0&&e.push(Lt(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return si(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.construcLine truncated
|
||||||
\f\r]`,Be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,ci=/>/g,Ee=RegExp(`>|${Pt}(?:([^\\s"'>=/]+)(${Pt}*=${Pt}*(?:[^
|
\f\r]`,Be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,ci=/>/g,Ee=RegExp(`>|${Pt}(?:([^\\s"'>=/]+)(${Pt}*=${Pt}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),di=/'/g,pi=/"/g,gi=/^(?:script|style|textarea|title)$/i,Ut=n=>(r,...e)=>({_$litType$:n,strings:r,values:e}),o=Ut(1),O=Ut(2),La=Ut(3),be=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),hi=new WeakMap,Te=Se.createTreeWalker(Se,129);function mi(n,r){if(!Ft(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return oi!==void 0?oi.createHTML(r):r}var _s=(n,r)=>{let e=n.length-1,t=[],i,a=r===2?"<svg>":r===3?"<math>":"",l=Be;for(let c=0;c<e;c++){let p=n[c],u,g,m=-1,v=0;for(;v<p.length&&(l.lastIndex=v,g=l.exec(p),g!==null);)v=l.lastIndex,l===Be?g[1]==="!--"?l=li:g[1]!==void 0?l=ci:g[2]!==void 0?(gi.test(g[2])&&(i=RegExp("</"+g[2],"g")),l=Ee):g[3]!==void 0&&(l=Ee):l===Ee?g[0]===">"?(l=i??Be,m=-1):g[1]===void 0?m=-2:(m=l.lastIndex-g[2].length,u=g[1],l=g[3]===void 0?Ee:g[3]==='"'?pi:di):l===pi||l===di?l=Ee:l===li||l===ci?l=Be:(l=Ee,i=void 0);let b=l===Ee&&n[c+1].startsWith("/>")?" ":"";a+=l===Be?p+hs:m>=0?(t.push(u),p.slice(0,m)+ui+p.slice(m)+we+b):p+we+(m===-2?c:b)}return[mi(n,a+(n[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ke=class n{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,c=r.length-1,p=this.parts,[u,g]=_s(r,e);if(this.el=n.createElement(u,t),Te.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Te.nextNode())!==null&&p.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(ui)){let v=g[l++],b=i.getAttribute(m).split(we),$=/([.?@])?(.*)/.exec(v);p.push({type:1,index:a,name:$[2],strings:b,ctor:$[1]==="."?Ht:$[1]==="?"?Ot:$[1]==="@"?Dt:Le}),i.removeAttribute(m)}else m.startsWith(we)&&(p.push({type:6,index:a}),i.removeAttribute(m));if(gi.test(i.tagName)){let m=i.textContent.split(we),v=m.length-1;if(v>0){i.textContent=pt?pt.emptyScript:"";for(let b=0;b<v;b++)i.append(m[b],Ve()),Te.nextNode(),p.push({type:2,index:++a});i.append(m[v],Ve())}}}else if(i.nodeType===8)if(i.data===_i)p.push({type:2,index:a});else{let m=-1;for(;(m=i.data.indexOf(we,m+1))!==-1;)p.push({type:7,index:a}),m+=we.length-1}a++}}static createElement(r,e){let t=Se.createElement("template");return t.innerHTML=r,t}};function Ie(n,r,e=n,t){if(r===be)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=We(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(n),i._$AT(n,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ie(n,i._$AS(n,r.values),i,t)),r}var zt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Se).importNode(e,!0);Te.currentNode=i;let a=Te.nextNode(),l=0,c=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new Ye(a,a.nextSibling,this,r):p.type===1?u=new p.ctor(a,p.name,p.strings,this,r):p.type===6&&(u=new qt(a,this,r)),this._$AV.push(u),p=t[++c]}l!==p?.index&&(a=Te.nextNode(),l++)}return Te.currentNode=Se,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Ye=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ie(this,r,e),We(r)?r===h||r==null||r===""?(this._$AH!==h&&this._$AR(),this._$AH=h):r!==this._$AH&&r!==be&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):us(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==h&&We(this._$AH)?this._$AA.nextSibling.data=r:this.T(Se.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ke.createElement(mi(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new zt(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(r){let e=hi.get(r.strings);return e===void 0&&hi.set(r.strings,e=new Ke(r)),e}k(r){Ft(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of r)i===e.length?e.push(t=new n(this.O(Ve()),this.O(Ve()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=ni(r).nextSibling;ni(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._Line truncated
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),di=/'/g,pi=/"/g,gi=/^(?:script|style|textarea|title)$/i,Ut=n=>(r,...e)=>({_$litType$:n,strings:r,values:e}),o=Ut(1),O=Ut(2),La=Ut(3),be=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),hi=new WeakMap,Te=Se.createTreeWalker(Se,129);function mi(n,r){if(!Ft(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return oi!==void 0?oi.createHTML(r):r}var _s=(n,r)=>{let e=n.length-1,t=[],i,a=r===2?"<svg>":r===3?"<math>":"",l=Be;for(let c=0;c<e;c++){let p=n[c],u,g,m=-1,v=0;for(;v<p.length&&(l.lastIndex=v,g=l.exec(p),g!==null);)v=l.lastIndex,l===Be?g[1]==="!--"?l=li:g[1]!==void 0?l=ci:g[2]!==void 0?(gi.test(g[2])&&(i=RegExp("</"+g[2],"g")),l=Ee):g[3]!==void 0&&(l=Ee):l===Ee?g[0]===">"?(l=i??Be,m=-1):g[1]===void 0?m=-2:(m=l.lastIndex-g[2].length,u=g[1],l=g[3]===void 0?Ee:g[3]==='"'?pi:di):l===pi||l===di?l=Ee:l===li||l===ci?l=Be:(l=Ee,i=void 0);let b=l===Ee&&n[c+1].startsWith("/>")?" ":"";a+=l===Be?p+hs:m>=0?(t.push(u),p.slice(0,m)+ui+p.slice(m)+we+b):p+we+(m===-2?c:b)}return[mi(n,a+(n[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ke=class n{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,c=r.length-1,p=this.parts,[u,g]=_s(r,e);if(this.el=n.createElement(u,t),Te.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Te.nextNode())!==null&&p.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(ui)){let v=g[l++],b=i.getAttribute(m).split(we),$=/([.?@])?(.*)/.exec(v);p.push({type:1,index:a,name:$[2],strings:b,ctor:$[1]==="."?Ht:$[1]==="?"?Ot:$[1]==="@"?Dt:Le}),i.removeAttribute(m)}else m.startsWith(we)&&(p.push({type:6,index:a}),i.removeAttribute(m));if(gi.test(i.tagName)){let m=i.textContent.split(we),v=m.length-1;if(v>0){i.textContent=pt?pt.emptyScript:"";for(let b=0;b<v;b++)i.append(m[b],Ve()),Te.nextNode(),p.push({type:2,index:++a});i.append(m[v],Ve())}}}else if(i.nodeType===8)if(i.data===_i)p.push({type:2,index:a});else{let m=-1;for(;(m=i.data.indexOf(we,m+1))!==-1;)p.push({type:7,index:a}),m+=we.length-1}a++}}static createElement(r,e){let t=Se.createElement("template");return t.innerHTML=r,t}};function Ie(n,r,e=n,t){if(r===be)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=We(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(n),i._$AT(n,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ie(n,i._$AS(n,r.values),i,t)),r}var zt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Se).importNode(e,!0);Te.currentNode=i;let a=Te.nextNode(),l=0,c=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new Ye(a,a.nextSibling,this,r):p.type===1?u=new p.ctor(a,p.name,p.strings,this,r):p.type===6&&(u=new qt(a,this,r)),this._$AV.push(u),p=t[++c]}l!==p?.index&&(a=Te.nextNode(),l++)}return Te.currentNode=Se,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Ye=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ie(this,r,e),We(r)?r===h||r==null||r===""?(this._$AH!==h&&this._$AR(),this._$AH=h):r!==this._$AH&&r!==be&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):us(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==h&&We(this._$AH)?this._$AA.nextSibling.data=r:this.T(Se.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ke.createElement(mi(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new zt(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(r){let e=hi.get(r.strings);return e===void 0&&hi.set(r.strings,e=new Ke(r)),e}k(r){Ft(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of r)i===e.length?e.push(t=new n(this.O(Ve()),this.O(Ve()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=ni(r).nextSibling;ni(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._Line truncated
|
||||||
Replace seal
|
Replace seal
|
||||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||||
|
|||||||
-125
@@ -1,125 +0,0 @@
|
|||||||
import{a as f}from"./chunk-MJ4XKOCC.js";import{a as h,b as o,d as b,e as m,f as g,g as n,h as _,i as a,k as v,s as p}from"./chunk-UJYDYB7M.js";import{a as i}from"./chunk-PEGRBZWY.js";var s=class extends m{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=parseFloat(this._localMonthly),e=parseFloat(this._localYearly),r={};!isNaN(t)&&t>=0&&(r.budget_monthly=t),!isNaN(e)&&e>=0&&(r.budget_yearly=e),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:r}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._status;if(!e)return o`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=e.currency_symbol||_,l=e.monthly_budget?Math.min(100,(e.monthly_spent||0)/e.monthly_budget*100):0,d=e.yearly_budget?Math.min(100,(e.yearly_spent||0)/e.yearly_budget*100):0,u=l>=100?"danger":l>=80?"warning":"ok",y=d>=100?"danger":d>=80?"warning":"ok";return o`
|
|
||||||
<ha-card>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="header">
|
|
||||||
<div class="title">
|
|
||||||
<span class="emoji">💰</span>
|
|
||||||
<span>${this._config.title||a("settings_budget",t)||"Budget"}</span>
|
|
||||||
</div>
|
|
||||||
<span class="currency">${r}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${this._error?o`<div class="error">${this._error}</div>`:b}
|
|
||||||
|
|
||||||
<div class="track">
|
|
||||||
<div class="track-label-row">
|
|
||||||
<label>${a("budget_monthly",t)||"Monthly"}</label>
|
|
||||||
<span class="track-numbers ${u}">
|
|
||||||
${(e.monthly_spent||0).toFixed(0)} / ${(e.monthly_budget||0).toFixed(0)} ${r}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="bar"><div class="bar-fill ${u}" style="width:${l}%"></div></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="track">
|
|
||||||
<div class="track-label-row">
|
|
||||||
<label>${a("budget_yearly",t)||"Yearly"}</label>
|
|
||||||
<span class="track-numbers ${y}">
|
|
||||||
${(e.yearly_spent||0).toFixed(0)} / ${(e.yearly_budget||0).toFixed(0)} ${r}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="bar"><div class="bar-fill ${y}" style="width:${d}%"></div></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${this._isAdmin?o`
|
|
||||||
<div class="inputs-row">
|
|
||||||
<div class="input-field">
|
|
||||||
<label>${a("budget_monthly_set",t)||"Set monthly"}</label>
|
|
||||||
<div class="input-wrap">
|
|
||||||
<input type="number" min="0" step="1"
|
|
||||||
.value=${this._localMonthly}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${c=>{this._localMonthly=c.target.value,this._dirty=!0}} />
|
|
||||||
<span class="input-suffix">${r}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="input-field">
|
|
||||||
<label>${a("budget_yearly_set",t)||"Set yearly"}</label>
|
|
||||||
<div class="input-wrap">
|
|
||||||
<input type="number" min="0" step="1"
|
|
||||||
.value=${this._localYearly}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${c=>{this._localYearly=c.target.value,this._dirty=!0}} />
|
|
||||||
<span class="input-suffix">${r}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
|
||||||
@click=${this._save}
|
|
||||||
?disabled=${this._busy||!this._dirty}>
|
|
||||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
|
||||||
${this._dirty?a("save",t)||"Save":a("saved",t)||"Saved"}
|
|
||||||
</button>
|
|
||||||
<button class="btn link" @click=${this._onDeepLink}>
|
|
||||||
${a("budget_advanced",t)||"Currency, alerts\u2026"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`:o`
|
|
||||||
<button class="btn link" @click=${this._onDeepLink}>
|
|
||||||
${a("budget_open_panel",t)||"Open in panel"}
|
|
||||||
</button>
|
|
||||||
`}
|
|
||||||
</div>
|
|
||||||
</ha-card>
|
|
||||||
`}};s.styles=[f,h`
|
|
||||||
.currency {
|
|
||||||
font-size: 14px; font-weight: 600;
|
|
||||||
color: var(--secondary-text-color);
|
|
||||||
background: var(--secondary-background-color);
|
|
||||||
padding: 2px 10px; border-radius: 999px;
|
|
||||||
}
|
|
||||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
|
||||||
.track-label-row {
|
|
||||||
display: flex; align-items: center; justify-content: space-between;
|
|
||||||
}
|
|
||||||
.track-label-row label {
|
|
||||||
font-size: 12px; color: var(--secondary-text-color);
|
|
||||||
text-transform: uppercase; letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
|
||||||
.track-numbers.ok { color: var(--primary-text-color); }
|
|
||||||
.track-numbers.warning { color: #ff9800; }
|
|
||||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
|
||||||
.bar {
|
|
||||||
height: 6px; background: var(--secondary-background-color);
|
|
||||||
border-radius: 3px; overflow: hidden;
|
|
||||||
}
|
|
||||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
|
||||||
.bar-fill.ok { background: var(--primary-color); }
|
|
||||||
.bar-fill.warning { background: #ff9800; }
|
|
||||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
|
||||||
.inputs-row {
|
|
||||||
display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
|
|
||||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
|
||||||
}
|
|
||||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
|
||||||
.input-field label {
|
|
||||||
font-size: 11px; color: var(--secondary-text-color);
|
|
||||||
text-transform: uppercase; letter-spacing: 0.3px;
|
|
||||||
}
|
|
||||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
|
||||||
.input-wrap input {
|
|
||||||
flex: 1; padding: 6px 32px 6px 8px; font-size: 13px;
|
|
||||||
background: var(--secondary-background-color, #2c2c2c);
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
.input-suffix {
|
|
||||||
position: absolute; right: 8px;
|
|
||||||
color: var(--secondary-text-color); font-size: 13px;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.actions { display: flex; gap: 8px; align-items: center; }
|
|
||||||
`],i([g({attribute:!1})],s.prototype,"hass",2),i([n()],s.prototype,"_config",2),i([n()],s.prototype,"_status",2),i([n()],s.prototype,"_busy",2),i([n()],s.prototype,"_error",2),i([n()],s.prototype,"_localMonthly",2),i([n()],s.prototype,"_localYearly",2),i([n()],s.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",s);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Inline monthly + yearly budget editor",preview:!1});export{s as MaintenanceBudgetSectionCard};
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import{a as r}from"./chunk-UJYDYB7M.js";var a=r`
|
|
||||||
ha-card { overflow: hidden; }
|
|
||||||
.card-content {
|
|
||||||
padding: 16px;
|
|
||||||
display: flex; flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
.header {
|
|
||||||
display: flex; align-items: center; justify-content: space-between;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
display: flex; align-items: center; gap: 8px;
|
|
||||||
font-size: 16px; font-weight: 500;
|
|
||||||
}
|
|
||||||
.emoji { font-size: 20px; }
|
|
||||||
|
|
||||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
|
||||||
.btn {
|
|
||||||
padding: 6px 12px; font-size: 13px;
|
|
||||||
border-radius: 6px; cursor: pointer;
|
|
||||||
border: 1px solid var(--divider-color);
|
|
||||||
background: var(--secondary-background-color, transparent);
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
font-weight: 500;
|
|
||||||
display: inline-flex; align-items: center; gap: 4px;
|
|
||||||
}
|
|
||||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
|
||||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
|
||||||
.btn.primary {
|
|
||||||
background: var(--primary-color);
|
|
||||||
color: var(--text-primary-color, white);
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
}
|
|
||||||
.btn.primary[disabled] { opacity: 0.6; }
|
|
||||||
.btn.muted {
|
|
||||||
background: transparent;
|
|
||||||
color: var(--secondary-text-color);
|
|
||||||
border-style: dashed;
|
|
||||||
}
|
|
||||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
|
||||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
|
||||||
.btn.link {
|
|
||||||
background: transparent; border: none; padding: 6px 4px;
|
|
||||||
color: var(--primary-color); margin-left: auto;
|
|
||||||
}
|
|
||||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
|
||||||
|
|
||||||
/* Error + loading states */
|
|
||||||
.error {
|
|
||||||
padding: 8px; border-radius: 6px;
|
|
||||||
background: rgba(211, 47, 47, 0.1);
|
|
||||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
|
||||||
}
|
|
||||||
.loading {
|
|
||||||
padding: 24px; text-align: center;
|
|
||||||
color: var(--secondary-text-color);
|
|
||||||
}
|
|
||||||
`;export{a};
|
|
||||||
File diff suppressed because it is too large.
Load diff
-2374
File diff suppressed because it is too large.
Load diff
-136
@@ -1,136 +0,0 @@
|
|||||||
import{a as m}from"./chunk-MJ4XKOCC.js";import{a as u,b as s,d as l,e as h,f as g,g as o,i,k as _,s as p}from"./chunk-UJYDYB7M.js";import{a}from"./chunk-PEGRBZWY.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),_(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
|
||||||
<ha-card>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="header">
|
|
||||||
<div class="title">
|
|
||||||
<span class="emoji">🏷️</span>
|
|
||||||
<span>${this._config.title||i("groups",t)||"Groups"}</span>
|
|
||||||
<span class="count">${r.length}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${this._error?s`<div class="error">${this._error}</div>`:l}
|
|
||||||
|
|
||||||
${r.length===0?s`<div class="empty">${i("groups_empty",t)||"No groups yet."}</div>`:s`
|
|
||||||
<div class="group-list">
|
|
||||||
${r.map(n=>{let d=this._groups[n],v=d.task_refs?.length??0,b=this._editingId===n;return s`
|
|
||||||
<div class="group-row">
|
|
||||||
${b?s`
|
|
||||||
<input class="edit-input" type="text"
|
|
||||||
.value=${this._editingName}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${c=>{this._editingName=c.target.value}}
|
|
||||||
@keydown=${c=>this._onKeyDown(c,this._saveEdit.bind(this))} />
|
|
||||||
<button class="btn small primary"
|
|
||||||
@click=${this._saveEdit}
|
|
||||||
?disabled=${this._busy||!this._editingName.trim()}>
|
|
||||||
${i("save",t)||"Save"}
|
|
||||||
</button>
|
|
||||||
<button class="btn small"
|
|
||||||
@click=${()=>{this._editingId=null}}>
|
|
||||||
${i("cancel",t)||"Cancel"}
|
|
||||||
</button>
|
|
||||||
`:s`
|
|
||||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
|
||||||
<span class="task-count">${v}</span>
|
|
||||||
${this._isAdmin?s`
|
|
||||||
<button class="icon-btn"
|
|
||||||
title="${i("edit",t)||"Edit"}"
|
|
||||||
@click=${()=>this._startEdit(n)}
|
|
||||||
?disabled=${this._busy}>
|
|
||||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
|
||||||
</button>
|
|
||||||
<button class="icon-btn danger"
|
|
||||||
title="${i("delete",t)||"Delete"}"
|
|
||||||
@click=${()=>this._deleteGroup(n,d.name||"Unnamed")}
|
|
||||||
?disabled=${this._busy}>
|
|
||||||
<ha-icon icon="mdi:delete"></ha-icon>
|
|
||||||
</button>
|
|
||||||
`:l}
|
|
||||||
`}
|
|
||||||
</div>
|
|
||||||
`})}
|
|
||||||
</div>
|
|
||||||
`}
|
|
||||||
|
|
||||||
${this._isAdmin?s`
|
|
||||||
<div class="add-row">
|
|
||||||
<input type="text"
|
|
||||||
placeholder="${i("group_new_placeholder",t)||"Add group\u2026"}"
|
|
||||||
.value=${this._newName}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${n=>{this._newName=n.target.value}}
|
|
||||||
@keydown=${n=>this._onKeyDown(n,this._addGroup.bind(this))} />
|
|
||||||
<button class="btn primary"
|
|
||||||
@click=${this._addGroup}
|
|
||||||
?disabled=${this._busy||!this._newName.trim()}>
|
|
||||||
<ha-icon icon="mdi:plus"></ha-icon>
|
|
||||||
${i("add",t)||"Add"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<button class="btn link" @click=${this._onDeepLink}>
|
|
||||||
${i("groups_manage_tasks",t)||"Manage task assignments\u2026"}
|
|
||||||
</button>
|
|
||||||
`:s`
|
|
||||||
<button class="btn link" @click=${this._onDeepLink}>
|
|
||||||
${i("groups_open_panel",t)||"Open in panel"}
|
|
||||||
</button>
|
|
||||||
`}
|
|
||||||
</div>
|
|
||||||
</ha-card>
|
|
||||||
`}};e.styles=[m,u`
|
|
||||||
.count {
|
|
||||||
font-size: 12px; color: var(--secondary-text-color);
|
|
||||||
background: var(--secondary-background-color);
|
|
||||||
padding: 2px 8px; border-radius: 999px;
|
|
||||||
}
|
|
||||||
.empty {
|
|
||||||
padding: 16px; text-align: center;
|
|
||||||
color: var(--secondary-text-color); font-style: italic;
|
|
||||||
}
|
|
||||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
|
||||||
.group-row {
|
|
||||||
display: flex; align-items: center; gap: 8px;
|
|
||||||
padding: 6px 8px; border-radius: 6px;
|
|
||||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
|
||||||
}
|
|
||||||
.group-name { flex: 1; font-size: 14px; }
|
|
||||||
.task-count {
|
|
||||||
font-size: 11px; color: var(--secondary-text-color);
|
|
||||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
|
||||||
padding: 1px 8px; border-radius: 999px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.edit-input {
|
|
||||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
|
||||||
background: var(--card-background-color, #1c1c1c);
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
.icon-btn {
|
|
||||||
background: transparent; border: none; cursor: pointer;
|
|
||||||
color: var(--secondary-text-color); padding: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.icon-btn:hover {
|
|
||||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
}
|
|
||||||
.icon-btn.danger:hover { color: var(--error-color); }
|
|
||||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
|
||||||
.add-row {
|
|
||||||
display: flex; gap: 6px;
|
|
||||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
|
||||||
}
|
|
||||||
.add-row input {
|
|
||||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
|
||||||
background: var(--secondary-background-color, #2c2c2c);
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
/* Card-specific overrides on the shared .btn */
|
|
||||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
|
||||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
|
||||||
`],a([g({attribute:!1})],e.prototype,"hass",2),a([o()],e.prototype,"_config",2),a([o()],e.prototype,"_groups",2),a([o()],e.prototype,"_loaded",2),a([o()],e.prototype,"_busy",2),a([o()],e.prototype,"_error",2),a([o()],e.prototype,"_newName",2),a([o()],e.prototype,"_editingId",2),a([o()],e.prototype,"_editingName",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Inline group CRUD",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
|
||||||
-121
@@ -1,121 +0,0 @@
|
|||||||
import{a as m}from"./chunk-MJ4XKOCC.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,k as f,s as l}from"./chunk-UJYDYB7M.js";import{a as i}from"./chunk-PEGRBZWY.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),f(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,b=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",g=p?"active":d?"scheduled":"inactive";return n`
|
|
||||||
<ha-card>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="header">
|
|
||||||
<div class="title">
|
|
||||||
<span class="emoji">🏖️</span>
|
|
||||||
<span>${this._config.title||e("vacation_mode",t)||"Vacation mode"}</span>
|
|
||||||
</div>
|
|
||||||
<span class="status-pill ${g}">${b}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${this._error?n`<div class="error">${this._error}</div>`:c}
|
|
||||||
|
|
||||||
${this._isAdmin?n`
|
|
||||||
<div class="row toggle-row">
|
|
||||||
<label>${e("enable",t)||"Enable"}</label>
|
|
||||||
<ha-switch
|
|
||||||
.checked=${d}
|
|
||||||
.disabled=${this._busy}
|
|
||||||
@change=${o=>this._toggleEnabled(o.target.checked)}
|
|
||||||
></ha-switch>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dates-row">
|
|
||||||
<div class="date-field">
|
|
||||||
<label>${e("vacation_start",t)||"Start"}</label>
|
|
||||||
<input type="date" .value=${this._localStart}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${o=>{this._localStart=o.target.value,this._dirty=!0}} />
|
|
||||||
</div>
|
|
||||||
<div class="date-field">
|
|
||||||
<label>${e("vacation_end",t)||"End"}</label>
|
|
||||||
<input type="date" .value=${this._localEnd}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${o=>{this._localEnd=o.target.value,this._dirty=!0}} />
|
|
||||||
</div>
|
|
||||||
<div class="date-field buffer">
|
|
||||||
<label>${e("vacation_buffer",t)||"Buffer days"}</label>
|
|
||||||
<input type="number" min="0" max="14"
|
|
||||||
.value=${String(this._localBuffer)}
|
|
||||||
?disabled=${this._busy}
|
|
||||||
@input=${o=>{this._localBuffer=parseInt(o.target.value,10)||0,this._dirty=!0}} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
|
||||||
@click=${this._save}
|
|
||||||
?disabled=${this._busy||!this._dirty}>
|
|
||||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
|
||||||
${this._dirty?e("save",t)||"Save":e("saved",t)||"Saved"}
|
|
||||||
</button>
|
|
||||||
${p?n`<button class="btn"
|
|
||||||
@click=${this._endNow}
|
|
||||||
?disabled=${this._busy}>
|
|
||||||
${e("vacation_end_now",t)||"End now"}
|
|
||||||
</button>`:c}
|
|
||||||
${u>0?n`<button class="btn link"
|
|
||||||
@click=${this._onDeepLink}>
|
|
||||||
${u} ${e("vacation_exempt_count",t)||"exempt"}…
|
|
||||||
</button>`:n`<button class="btn link"
|
|
||||||
@click=${this._onDeepLink}>
|
|
||||||
${e("vacation_advanced",t)||"Advanced\u2026"}
|
|
||||||
</button>`}
|
|
||||||
</div>
|
|
||||||
`:n`
|
|
||||||
<div class="readonly">
|
|
||||||
${d&&s.start&&s.end?n`<div>${s.start} → ${s.end}</div>`:c}
|
|
||||||
<button class="btn link" @click=${this._onDeepLink}>
|
|
||||||
${e("vacation_open_panel",t)||"Open in panel"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`}
|
|
||||||
</div>
|
|
||||||
</ha-card>
|
|
||||||
`}};a.styles=[m,h`
|
|
||||||
.status-pill {
|
|
||||||
font-size: 11px; font-weight: 600;
|
|
||||||
padding: 3px 8px; border-radius: 999px;
|
|
||||||
text-transform: uppercase; letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
.status-pill.active {
|
|
||||||
background: rgba(76, 175, 80, 0.15);
|
|
||||||
color: #4caf50;
|
|
||||||
}
|
|
||||||
.status-pill.scheduled {
|
|
||||||
background: rgba(255, 152, 0, 0.15);
|
|
||||||
color: #ff9800;
|
|
||||||
}
|
|
||||||
.status-pill.inactive {
|
|
||||||
background: rgba(158, 158, 158, 0.15);
|
|
||||||
color: var(--secondary-text-color);
|
|
||||||
}
|
|
||||||
.row.toggle-row {
|
|
||||||
display: flex; align-items: center; justify-content: space-between;
|
|
||||||
}
|
|
||||||
.row.toggle-row label {
|
|
||||||
font-size: 14px; color: var(--primary-text-color);
|
|
||||||
}
|
|
||||||
.dates-row {
|
|
||||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
|
||||||
}
|
|
||||||
.date-field.buffer label { white-space: nowrap; }
|
|
||||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
|
||||||
.date-field label {
|
|
||||||
font-size: 11px; color: var(--secondary-text-color);
|
|
||||||
text-transform: uppercase; letter-spacing: 0.3px;
|
|
||||||
}
|
|
||||||
.date-field input {
|
|
||||||
padding: 6px 8px; font-size: 13px;
|
|
||||||
background: var(--secondary-background-color, #2c2c2c);
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
||||||
.actions {
|
|
||||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
|
||||||
`],i([v({attribute:!1})],a.prototype,"hass",2),i([r()],a.prototype,"_config",2),i([r()],a.prototype,"_state",2),i([r()],a.prototype,"_busy",2),i([r()],a.prototype,"_error",2),i([r()],a.prototype,"_localStart",2),i([r()],a.prototype,"_localEnd",2),i([r()],a.prototype,"_localBuffer",2),i([r()],a.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",a);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Inline vacation mode toggle + dates",preview:!1});export{a as MaintenanceVacationSectionCard};
|
|
||||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -22,5 +22,5 @@
|
|||||||
"requirements": [
|
"requirements": [
|
||||||
"pypdf>=4.3.0"
|
"pypdf>=4.3.0"
|
||||||
],
|
],
|
||||||
"version": "2.42.1"
|
"version": "2.43.0"
|
||||||
}
|
}
|
||||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -507,6 +507,12 @@ class MaintenanceDaysUntilDueSensor(MaintenanceEntity, SensorEntity):
|
|||||||
the task is due (negative once overdue), which is what gauge and
|
the task is due (negative once overdue), which is what gauge and
|
||||||
progress-bar cards need; the status sensor only carries this as an
|
progress-bar cards need; the status sensor only carries this as an
|
||||||
attribute. Manual, archived and trigger-only tasks read unknown.
|
attribute. Manual, archived and trigger-only tasks read unknown.
|
||||||
|
|
||||||
|
Its entity_id is pinned language-independently (same reasoning as the
|
||||||
|
global summary sensors): with ``has_entity_name`` the slug would
|
||||||
|
otherwise derive from the TRANSLATED entity name, so a German install
|
||||||
|
would get ``..._tage_bis_faellig`` and the documented gauge recipe would
|
||||||
|
only work in English. The friendly name stays localized.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_attr_translation_key = "days_until_due"
|
_attr_translation_key = "days_until_due"
|
||||||
@@ -528,6 +534,14 @@ class MaintenanceDaysUntilDueSensor(MaintenanceEntity, SensorEntity):
|
|||||||
object_slug = slugify_object_name(obj_data.get("name", "unknown"))
|
object_slug = slugify_object_name(obj_data.get("name", "unknown"))
|
||||||
self._attr_unique_id = f"maintenance_supporter_{object_slug}_{task_id}_days_until_due"
|
self._attr_unique_id = f"maintenance_supporter_{object_slug}_{task_id}_days_until_due"
|
||||||
self._attr_translation_placeholders = {"task_name": task_data.get("name", "")}
|
self._attr_translation_placeholders = {"task_name": task_data.get("name", "")}
|
||||||
|
# Pin the documented, language-independent entity_id. Only NEW entities
|
||||||
|
# are affected — an already-registered one keeps its registry id.
|
||||||
|
task_slug = task_data.get("entity_slug") or slugify_object_name(task_data.get("name", task_id))
|
||||||
|
self.entity_id = async_generate_entity_id(
|
||||||
|
ENTITY_ID_FORMAT,
|
||||||
|
f"{object_slug}_{task_slug}_days_until_due",
|
||||||
|
hass=coordinator.hass,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> int | None:
|
def native_value(self) -> int | None:
|
||||||
|
|||||||
BIN
Binary file not shown.
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user