217 files
This commit is contained in:
1 parent
d43a63ad29
commit
7b5e46e702
217 files changed
+15978
-3912
No files matched your search
+34
-34
@@ -1,56 +1,56 @@
|
||||
import{a as f}from"./chunk-Q7DQUCT7.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-X7OW5OLQ.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`
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
import{a as v}from"./chunk-TF44IC56.js";import{a as u,b as o,d as h,e as b,f as y,g as l,h as g,i as r,k as m,t as p}from"./chunk-RLJYCMAK.js";import{a as n}from"./chunk-KRBXISES.js";var x=80,s=class extends b{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(),m(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),a=parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(a)&&a>=0&&(i.budget_yearly=a),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),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,a=this._status;if(!a)return o`<ha-card><div class="loading">${r("loading",t)||"Loading\u2026"}</div></ha-card>`;let i=a.currency_symbol||g,_=a.alert_threshold_pct??x,f=[{label:r("budget_monthly",t)||"Monthly",spent:a.monthly_spent||0,budget:a.monthly_budget||0},{label:r("budget_yearly",t)||"Yearly",spent:a.yearly_spent||0,budget:a.yearly_budget||0}];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>
|
||||
<span>${this._config.title||r("settings_budget",t)||"Budget"}</span>
|
||||
</div>
|
||||
<span class="currency">${r}</span>
|
||||
<span class="currency">${i}</span>
|
||||
</div>
|
||||
|
||||
${this._error?o`<div class="error">${this._error}</div>`:b}
|
||||
${this._error?o`<div class="error">${this._error}</div>`:h}
|
||||
|
||||
<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>
|
||||
${f.map(e=>{if(!(e.budget>0))return o`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${e.label}</label>
|
||||
<span class="track-numbers ok">${e.spent.toFixed(0)} ${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let d=Math.min(100,Math.max(0,e.spent/e.budget*100)),c=d>=100?"danger":d>=_?"warning":"ok";return o`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${e.label}</label>
|
||||
<span class="track-numbers ${c}">
|
||||
${e.spent.toFixed(0)} / ${e.budget.toFixed(0)} ${i}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${c}" 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>
|
||||
<label>${r("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>
|
||||
@input=${e=>{this._localMonthly=e.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${a("budget_yearly_set",t)||"Set yearly"}</label>
|
||||
<label>${r("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>
|
||||
@input=${e=>{this._localYearly=e.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,20 +59,20 @@ import{a as f}from"./chunk-Q7DQUCT7.js";import{a as h,b as o,d as b,e as m,f as
|
||||
@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"}
|
||||
${this._dirty?r("save",t)||"Save":r("saved",t)||"Saved"}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_advanced",t)||"Currency, alerts\u2026"}
|
||||
${r("budget_advanced",t)||"Currency, alerts\u2026"}
|
||||
</button>
|
||||
</div>
|
||||
`:o`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_open_panel",t)||"Open in panel"}
|
||||
${r("budget_open_panel",t)||"Open in panel"}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[f,h`
|
||||
`}};s.styles=[v,u`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
@@ -122,4 +122,4 @@ import{a as f}from"./chunk-Q7DQUCT7.js";import{a as h,b as o,d as b,e as m,f as
|
||||
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};
|
||||
`],n([y({attribute:!1})],s.prototype,"hass",2),n([l()],s.prototype,"_config",2),n([l()],s.prototype,"_status",2),n([l()],s.prototype,"_busy",2),n([l()],s.prototype,"_error",2),n([l()],s.prototype,"_localMonthly",2),n([l()],s.prototype,"_localYearly",2),n([l()],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
@@ -1 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var t=(a,r,c,o)=>{for(var e=o>1?void 0:o?l(r,c):r,i=a.length-1,d;i>=0;i--)(d=a[i])&&(e=(o?d(r,c,e):d(e))||e);return o&&e&&s(r,c,e),e};var m={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},v={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"};export{t as a,m as b,v as c};
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
var L=globalThis,M=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),ae=new WeakMap,$=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(M&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ae.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ae.set(t,e))}return e}toString(){return this.cssText}},ne=o=>new $(typeof o=="string"?o:o+"",void 0,W),U=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,a,n)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new $(t,o,W)},ie=(o,e)=>{if(M)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),a=L.litNonce;a!==void 0&&r.setAttribute("nonce",a),r.textContent=t.cssText,o.appendChild(r)}},G=M?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ne(t)})(o):o;var{is:Te,defineProperty:Ne,getOwnPropertyDescriptor:je,getOwnPropertyNames:Pe,getOwnPropertySymbols:Re,getPrototypeOf:ze}=Object,q=globalThis,se=q.trustedTypes,Oe=se?se.emptyScript:"",De=q.reactiveElementPolyfillSupport,E=(o,e)=>o,C={toAttribute(o,e){switch(e){case Boolean:o=o?Oe:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},H=(o,e)=>!Te(o,e),le={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:H};Symbol.metadata??=Symbol("metadata"),q.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=le){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),a=this.getPropertyDescriptor(e,r,t);a!==void 0&&Ne(this.prototype,e,a)}}static getPropertyDescriptor(e,t,r){let{get:a,set:n}=je(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??le}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,r=[...Pe(t),...Re(t)];for(let a of r)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,a]of t)this.elementProperties.set(r,a)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let a=this._$Eu(t,r);a!==void 0&&this._$Eh.set(a,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let a of r)t.unshift(G(a))}else e!==void 0&&t.push(G(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:C).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(a):this.setAttribute(a,n),thLine truncated
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
var L=globalThis,M=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,W=Symbol(),ae=new WeakMap,$=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==W)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(M&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ae.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ae.set(t,e))}return e}toString(){return this.cssText}},ne=o=>new $(typeof o=="string"?o:o+"",void 0,W),U=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,a,n)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new $(t,o,W)},ie=(o,e)=>{if(M)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),a=L.litNonce;a!==void 0&&r.setAttribute("nonce",a),r.textContent=t.cssText,o.appendChild(r)}},G=M?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ne(t)})(o):o;var{is:Te,defineProperty:je,getOwnPropertyDescriptor:Ne,getOwnPropertyNames:Pe,getOwnPropertySymbols:Re,getPrototypeOf:ze}=Object,q=globalThis,se=q.trustedTypes,Oe=se?se.emptyScript:"",De=q.reactiveElementPolyfillSupport,E=(o,e)=>o,C={toAttribute(o,e){switch(e){case Boolean:o=o?Oe:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},H=(o,e)=>!Te(o,e),le={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:H};Symbol.metadata??=Symbol("metadata"),q.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=le){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),a=this.getPropertyDescriptor(e,r,t);a!==void 0&&je(this.prototype,e,a)}}static getPropertyDescriptor(e,t,r){let{get:a,set:n}=Ne(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??le}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,r=[...Pe(t),...Re(t)];for(let a of r)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,a]of t)this.elementProperties.set(r,a)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let a=this._$Eu(t,r);a!==void 0&&this._$Eh.set(a,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let a of r)t.unshift(G(a))}else e!==void 0&&t.push(G(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:C).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(a):this.setAttribute(a,n),thLine truncated
|
||||
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pe=/-->/g,_e=/>/g,b=RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,he=/"/g,be=/^(?:script|style|textarea|title)$/i,te=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),ot=te(1),rt=te(2),at=te(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ge=new WeakMap,y=v.createTreeWalker(v,129);function ye(o,e){if(!ee(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return de!==void 0?de.createHTML(e):e}var Ue=(o,e)=>{let t=o.length-1,r=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=o[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=pe:_[1]!==void 0?i=_e:_[2]!==void 0?(be.test(_[2])&&(a=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=a??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?he:ue):i===he||i===ue?i=b:i===pe||i===_e?i=T:(i=b,a=void 0);let m=i===b&&o[l+1].startsWith("/>")?" ":"";n+=i===T?s+Le:c>=0?(r.push(d),s.slice(0,c)+me+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[ye(o,n+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},P=class o{constructor({strings:e,_$litType$:t},r){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[d,_]=Ue(e,t);if(this.el=o.createElement(d,r),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=y.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(me)){let h=_[i++],m=a.getAttribute(c).split(f),D=/([.?@])?(.*)/.exec(h);s.push({type:1,index:n,name:D[2],strings:m,ctor:D[1]==="."?K:D[1]==="?"?Y:D[1]==="@"?J:S}),a.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(be.test(a.tagName)){let c=a.textContent.split(f),h=c.length-1;if(h>0){a.textContent=I?I.emptyScript:"";for(let m=0;m<h;m++)a.append(c[m],N()),y.nextNode(),s.push({type:2,index:++n});a.append(c[h],N())}}}else if(a.nodeType===8)if(a.data===fe)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:n}),c+=f.length-1}n++}}static createElement(e,t){let r=v.createElement("template");return r.innerHTML=e,r}};function k(o,e,t=o,r){if(e===x)return e;let a=r!==void 0?t._$Co?.[r]:t._$Cl,n=j(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=a:t._$Cl=a),a!==void 0&&(e=k(o,a._$AS(o,e.values),a,r)),e}var Q=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,a=(e?.creationScope??v).importNode(t,!0);y.currentNode=a;let n=y.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new R(n,n.nextSibling,this,e):s.type===1?d=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(d=new Z(n,this,e)),this._$AV.push(d),s=r[++l]}i!==s?.index&&(n=y.nextNode(),i++)}return y.currentNode=v,a}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},R=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,a){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),j(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Me(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=P.createElement(ye(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new Q(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=ge.get(e.strings);return t===void 0&&ge.set(e.strings,t=new P(e)),t}k(e){ee(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,a=0;for(let n of e)a===t.length?t.push(r=new o(this.O(N()),this.O(N()),this,this.options)):r=t[a],r._$AI(n),a++;a<t.length&&(this._$AR(r&&r._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=ce(e).nextSibling;ce(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,a,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thisLine truncated
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,he=/"/g,be=/^(?:script|style|textarea|title)$/i,te=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),ot=te(1),rt=te(2),at=te(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ge=new WeakMap,y=v.createTreeWalker(v,129);function ye(o,e){if(!ee(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return de!==void 0?de.createHTML(e):e}var Ue=(o,e)=>{let t=o.length-1,r=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=o[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=pe:_[1]!==void 0?i=_e:_[2]!==void 0?(be.test(_[2])&&(a=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=a??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?he:ue):i===he||i===ue?i=b:i===pe||i===_e?i=T:(i=b,a=void 0);let m=i===b&&o[l+1].startsWith("/>")?" ":"";n+=i===T?s+Le:c>=0?(r.push(d),s.slice(0,c)+me+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[ye(o,n+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},P=class o{constructor({strings:e,_$litType$:t},r){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[d,_]=Ue(e,t);if(this.el=o.createElement(d,r),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=y.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(me)){let h=_[i++],m=a.getAttribute(c).split(f),D=/([.?@])?(.*)/.exec(h);s.push({type:1,index:n,name:D[2],strings:m,ctor:D[1]==="."?K:D[1]==="?"?Y:D[1]==="@"?J:S}),a.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(be.test(a.tagName)){let c=a.textContent.split(f),h=c.length-1;if(h>0){a.textContent=I?I.emptyScript:"";for(let m=0;m<h;m++)a.append(c[m],j()),y.nextNode(),s.push({type:2,index:++n});a.append(c[h],j())}}}else if(a.nodeType===8)if(a.data===fe)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:n}),c+=f.length-1}n++}}static createElement(e,t){let r=v.createElement("template");return r.innerHTML=e,r}};function k(o,e,t=o,r){if(e===x)return e;let a=r!==void 0?t._$Co?.[r]:t._$Cl,n=N(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=a:t._$Cl=a),a!==void 0&&(e=k(o,a._$AS(o,e.values),a,r)),e}var Q=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,a=(e?.creationScope??v).importNode(t,!0);y.currentNode=a;let n=y.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new R(n,n.nextSibling,this,e):s.type===1?d=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(d=new Z(n,this,e)),this._$AV.push(d),s=r[++l]}i!==s?.index&&(n=y.nextNode(),i++)}return y.currentNode=v,a}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},R=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,a){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),N(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Me(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=P.createElement(ye(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new Q(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=ge.get(e.strings);return t===void 0&&ge.set(e.strings,t=new P(e)),t}k(e){ee(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,a=0;for(let n of e)a===t.length?t.push(r=new o(this.O(j()),this.O(j()),this,this.options)):r=t[a],r._$AI(n),a++;a<t.length&&(this._$AR(r&&r._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=ce(e).nextSibling;ce(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,a,n){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thisLine truncated
|
||||
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-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -1178,7 +1179,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-value { font-size: 20px; }
|
||||
}
|
||||
`;var Ke={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"};function Ye(o,e){let t=Ke[o];if(!t)return o;let r=u(t,e);return r&&r!==t?r:o}function Je(o){let t=o.match(/data\['([^']+)'\]/)?.[1],r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function so(o,e,t){if(t=t??u("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,a=r.message||r.error?.message||"";if(!a)return t;let n=Je(a),i=n.field?Ye(n.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",n.param??"");switch(n.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return a||t}}export{U as a,ot as b,rt as c,p as d,A as e,xe as f,vt as g,Yt as h,u as i,Jt as j,Zt as k,ke as l,Xt as m,Ae as n,eo as o,to as p,oo as q,ro as r,so as s};
|
||||
`;var Ke={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"};function Ye(o,e){let t=Ke[o];if(!t)return o;let r=u(t,e);return r&&r!==t?r:o}function Je(o){let t=o.match(/data\['([^']+)'\]/)?.[1],r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function so(o,e,t){if(t=t??u("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,a=r.message||r.error?.message||"";if(!a)return t;let n=Je(a),i=n.field?Ye(n.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",n.param??"");switch(n.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return a||t}}export{U as a,ot as b,rt as c,p as d,A as e,xe as f,vt as g,Yt as h,u as i,Jt as j,Zt as k,ke as l,Xt as m,Se as n,Ae as o,eo as p,to as q,oo as r,ro as s,so as t};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import{a as r}from"./chunk-X7OW5OLQ.js";var a=r`
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
import{a as r}from"./chunk-RLJYCMAK.js";var a=r`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
+191
-130
@@ -1,4 +1,5 @@
|
||||
import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l as q,m as et,n as Y,o as it,p as st,q as rt,r as at,s as I}from"./chunk-X7OW5OLQ.js";import{a as r,b as V}from"./chunk-PEGRBZWY.js";var T=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(t){let e=t.target.value;this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e}}))}render(){return a`
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as et,k as it,l as M,m as st,n as rt,o as J,p as at,q as nt,r as ot,s as lt,t as I}from"./chunk-RLJYCMAK.js";import{a as r,b as W}from"./chunk-KRBXISES.js";var T=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(t){let e=t.target.value;this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e}}))}render(){return a`
|
||||
<label class="field">
|
||||
${this.label?a`<span class="label">${this.label}${this.required?a`<span class="req">*</span>`:c}</span>`:c}
|
||||
<input
|
||||
@@ -191,15 +192,15 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,r([g({attribute:!1})],x.prototype,"hass",2),r([g({attribute:!1})],x.prototype,"objects",2),r([l()],x.prototype,"_open",2),r([l()],x.prototype,"_loading",2),r([l()],x.prototype,"_error",2),r([l()],x.prototype,"_name",2),r([l()],x.prototype,"_manufacturer",2),r([l()],x.prototype,"_model",2),r([l()],x.prototype,"_serialNumber",2),r([l()],x.prototype,"_areaId",2),r([l()],x.prototype,"_installationDate",2),r([l()],x.prototype,"_warrantyExpiry",2),r([l()],x.prototype,"_documentationUrl",2),r([l()],x.prototype,"_notes",2),r([l()],x.prototype,"_haDeviceId",2),r([l()],x.prototype,"_parentEntryId",2),r([l()],x.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",x);var W=class{constructor(d){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=d}updateHass(d){this.hass=d}async getUsers(d=!1){let t=Date.now();if(!d&&this.usersCache&&t-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=e.users,this.cacheTimestamp=t,this.usersCache}catch(e){return console.error("Failed to fetch users:",e),this.usersCache||[]}}async assignUser(d,t,e){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:d,task_id:t,user_id:e})}async getTasksByUser(d){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:d})).tasks}getUserName(d){return!d||!this.usersCache?null:this.usersCache.find(e=>e.id===d)?.name||null}getUser(d){return!d||!this.usersCache?null:this.usersCache.find(t=>t.id===d)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(d){return d?d===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};var wt=["cleaning","inspection","replacement","calibration","service","reading","custom"],Et=["low","normal","high"],It=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Z=["weekdays","nth_weekday","day_of_month"],nt=["threshold","counter","state_change","runtime"],Tt=[...nt,"compound"];function At(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}var Lt=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"]);function St(o){return{entityIds:(o.entity_ids||(o.entity_id?[o.entity_id]:[])).join(", "),type:o.type||"threshold",above:o.trigger_above?.toString()??"",below:o.trigger_below?.toString()??"",forMinutes:o.trigger_for_minutes?.toString()??"0",targetValue:o.trigger_target_value?.toString()??"",deltaMode:o.trigger_delta_mode||!1,fromState:o.trigger_from_state||"",toState:o.trigger_to_state||"",targetChanges:o.trigger_target_changes?.toString()??"",runtimeHours:o.trigger_runtime_hours?.toString()??"",onStates:(o.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(o).filter(([t])=>!Lt.has(t)&&!t.startsWith("_")))}}function Ht(o){let d=o.entityIds.split(",").map(e=>e.trim()).filter(Boolean);if(d.length===0)return null;let t={...o.carry||{},entity_id:d[0],entity_ids:d,type:o.type};if(o.type==="threshold"){let e=parseFloat(o.above);isNaN(e)||(t.trigger_above=e);let i=parseFloat(o.below);isNaN(i)||(t.trigger_below=i);let n=parseInt(o.forMinutes,10);isNaN(n)||(t.trigger_for_minutes=n)}else if(o.type==="counter"){let e=parseFloat(o.targetValue);isNaN(e)||(t.trigger_target_value=e),t.trigger_delta_mode=o.deltaMode}else if(o.type==="state_change"){o.fromState&&(t.trigger_from_state=o.fromState),o.toState&&(t.trigger_to_state=o.toState);let e=parseInt(o.targetChanges,10);isNaN(e)||(t.trigger_target_changes=e)}else if(o.type==="runtime"){let e=parseFloat(o.runtimeHours);isNaN(e)||(t.trigger_runtime_hours=e);let i=(o.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(t.trigger_on_states=i)}return t}function Ct(o){return Array.from({length:7},(d,t)=>Y(t,o,"short"))}function Pt(o){let d=new Intl.DateTimeFormat(o||"en",{month:"short"});return Array.from({length:12},(t,e)=>d.format(new Date(2021,e,1)))}var u=class u extends E{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=!
Line truncated
|
||||
`),this._scheduleTime=e.schedule_time||"";let h=e.on_complete_action;if(h&&h.service){this._actionService=h.service;let _=h.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=h.data&&typeof h.data=="object"?{...h.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=e.quick_complete_defaults;this._qcNotes=p?.notes||"",this._qcCost=p?.cost!=null?String(p.cost):"",this._qcDuration=p?.duration!=null?String(p.duration):"",this._qcFeedback=p?.feedback||"";let m=e.adaptive_config||{};if(this._environmentalEntity=m.environmental_entity||"",this._environmentalAttribute=m.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,e.trigger_config){let _=e.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=e.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(St)):(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 W(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(t){console.error("Failed to load users:",t),this._availableUsers=[]}}_toggleAssignee(t){this._assigneePool=this._assigneePool.includes(t)?this._assigneePool.filter(e=>e!==t):[...this._assigneePool,t]}async _testAction(){let t=this._actionService.trim();if(!t||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(t)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[e,i]=t.split(".");if(!this.hass?.services?.[e]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${t}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actio
Line truncated
|
||||
`,r([g({attribute:!1})],x.prototype,"hass",2),r([g({attribute:!1})],x.prototype,"objects",2),r([l()],x.prototype,"_open",2),r([l()],x.prototype,"_loading",2),r([l()],x.prototype,"_error",2),r([l()],x.prototype,"_name",2),r([l()],x.prototype,"_manufacturer",2),r([l()],x.prototype,"_model",2),r([l()],x.prototype,"_serialNumber",2),r([l()],x.prototype,"_areaId",2),r([l()],x.prototype,"_installationDate",2),r([l()],x.prototype,"_warrantyExpiry",2),r([l()],x.prototype,"_documentationUrl",2),r([l()],x.prototype,"_notes",2),r([l()],x.prototype,"_haDeviceId",2),r([l()],x.prototype,"_parentEntryId",2),r([l()],x.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",x);var B=class{constructor(d){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=d}updateHass(d){this.hass=d}async getUsers(d=!1){let t=Date.now();if(!d&&this.usersCache&&t-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=e.users,this.cacheTimestamp=t,this.usersCache}catch(e){return console.error("Failed to fetch users:",e),this.usersCache||[]}}async assignUser(d,t,e){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:d,task_id:t,user_id:e})}async getTasksByUser(d){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:d})).tasks}getUserName(d){return!d||!this.usersCache?null:this.usersCache.find(e=>e.id===d)?.name||null}getUser(d){return!d||!this.usersCache?null:this.usersCache.find(t=>t.id===d)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(d){return d?d===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function U(o){return`${o.entry_id??""}\0${o.part_id}`}var dt=["notes","cost","duration","photo","user"],K={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var Lt=["cleaning","inspection","replacement","calibration","service","reading","custom"],At=["low","normal","high"],St=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Q=["weekdays","nth_weekday","day_of_month"],ct=["threshold","counter","state_change","runtime"],Ct=[...ct,"compound"];function Pt(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}var Ht=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"]);function Rt(o){return{entityIds:(o.entity_ids||(o.entity_id?[o.entity_id]:[])).join(", "),type:o.type||"threshold",above:o.trigger_above?.toString()??"",below:o.trigger_below?.toString()??"",forMinutes:o.trigger_for_minutes?.toString()??"0",targetValue:o.trigger_target_value?.toString()??"",deltaMode:o.trigger_delta_mode||!1,fromState:o.trigger_from_state||"",toState:o.trigger_to_state||"",targetChanges:o.trigger_target_changes?.toString()??"",runtimeHours:o.trigger_runtime_hours?.toString()??"",onStates:(o.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(o).filter(([t])=>!Ht.has(t)&&!t.startsWith("_")))}}function qt(o){let d=o.entityIds.split(",").map(e=>e.trim()).filter(Boolean);if(d.length===0)return null;let t={...o.carry||{},entity_id:d[0],entity_ids:d,type:o.type};if(o.type==="threshold"){let e=parseFloat(o.above);isNaN(e)||(t.trigger_above=e);let i=parseFloat(o.below);isNaN(i)||(t.trigger_below=i);let n=parseInt(o.forMinutes,10);isNaN(n)||(t.trigger_for_minutes=n)}else if(o.type==="counter"){let e=parseFloat(o.targetValue);isNaN(e)||(t.trigger_target_value=e),t.trigger_delta_mode=o.deltaMode}else if(o.type==="state_change"){o.fromState&&(t.trigger_from_state=o.fromState),o.toState&&(t.trigger_to_state=o.toState);let e=parseInt(o.targetChanges,10);isNaN(e)||(t.trigger_target_changes=e)}else if(o.type==="runtime"){let e=parseFloat(o.runtimeHours);isNaN(e)||(t.trigger_runtime_hours=e);let i=(o.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);i.length>0&&(t.trigger_on_states=i)}return t}function Ft(o){return Array.from({length:7},(d,t)=>J(t,o,"short"))}function Mt(o){let d=new Intl.DateTimeFormat(o||"en",{month:"short"});return Array.from({length:12},(t,e)=>d.format(new Date(2021,e,1)))}var _=class _ extends E{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];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
Line truncated
|
||||
`),this._requiredCompletion=[...e.required_completion_fields||[]],this._scheduleTime=e.schedule_time||"";let u=e.on_complete_action;if(u&&u.service){this._actionService=u.service;let h=u.target?.entity_id;this._actionTargetEntity=Array.isArray(h)?h[0]||"":h||"",this._actionData=u.data&&typeof u.data=="object"?{...u.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let p=e.quick_complete_defaults;this._qcNotes=p?.notes||"",this._qcCost=p?.cost!=null?String(p.cost):"",this._qcDuration=p?.duration!=null?String(p.duration):"",this._qcFeedback=p?.feedback||"";let m=e.adaptive_config||{};if(this._environmentalEntity=m.environmental_entity||"",this._environmentalAttribute=m.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,e.trigger_config){let h=e.trigger_config;this._triggerEntityId=h.entity_id||h.entity_ids&&h.entity_ids[0]||"",this._triggerEntityIds=h.entity_ids||(h.entity_id?[h.entity_id]:[]),this._triggerEntityLogic=h.entity_logic||"any",this._triggerAttribute=h.attribute||"",this._triggerType=h.type||"threshold",this._triggerAbove=h.trigger_above?.toString()||"",this._triggerBelow=h.trigger_below?.toString()||"",this._triggerForMinutes=h.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=h.trigger_target_value?.toString()||"",this._triggerDeltaMode=h.trigger_delta_mode||!1,this._triggerBaselineValue=h.trigger_baseline_value?.toString()||"",this._liveBaselineValue=e.trigger_baseline_value??null,this._autoCompleteOnRecovery=h.auto_complete_on_recovery||!1,this._triggerFromState=h.trigger_from_state||"",this._triggerToState=h.trigger_to_state||"",this._triggerTargetChanges=h.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=h.trigger_runtime_hours?.toString()||"",this._triggerOnStates=(h.trigger_on_states||[]).join(", "),h.type==="compound"?(this._compoundLogic=h.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(h.conditions||[]).map(Rt)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),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._requiredCompletion=[],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 B(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(t){console.error("Failed to load users:",t),this._availableUsers=[]}}_toggleAssignee(t){this._assigneePool=this._assigneePool.includes(t)?this._assigneePool.filter(e=>e!==t):[...this._assigneePool,t]}async _testAction(){let t=this._actionService.trim();if(!t||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(t)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[e,i]=t.split(".");if(!this.hass?.services?.[e]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${t}" is not registLine truncated
|
||||
<details class="ca-section">
|
||||
<summary>${s("on_complete_action_title",t)}</summary>
|
||||
<p class="field-help">${s("on_complete_action_desc",t)}</p>
|
||||
<ha-service-picker
|
||||
.hass=${this.hass}
|
||||
.value=${this._actionService}
|
||||
@value-changed=${i=>{this._actionService=i.detail.value||"";let n=this._serviceSchema();if(n){let h=new Set(n.map(p=>p.name));this._actionData=Object.fromEntries(Object.entries(this._actionData).filter(([p])=>h.has(p)))}}}
|
||||
@value-changed=${i=>{this._actionService=i.detail.value||"";let n=this._serviceSchema();if(n){let u=new Set(n.map(p=>p.name));this._actionData=Object.fromEntries(Object.entries(this._actionData).filter(([p])=>u.has(p)))}}}
|
||||
></ha-service-picker>
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
@@ -268,8 +269,28 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<option value="not_needed">${s("quick_complete_defaults_feedback_not_needed",t)}</option>
|
||||
</select>
|
||||
</details>
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=t.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=t.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(t){if(!t||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:t});this._entityDomain=e.domain||"",this._suggestedAttributes=e.suggested_attributes||[],this._availableAttributes=e.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let t={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},e=this._earliestCompletionDays.trim();if(t.earliest_completion_days=e===""?null:Math.max(0,parseInt(e,10)||0),this._taskId&&(t.task_id=this._taskId),this._scheduleType==="one_time"?(t.due_date=this._dueDate||null,t.interval_days=null):Z.includes(this._scheduleType)?(t.schedule={...this._buildSchedule(),...this._recurrenceExtras()},t.interval_days=null,this._taskId&&(t.due_date=null)):(this._taskId&&(t.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(t.interval_days=parseInt(this._intervalDays,10),t.interval_unit=this._intervalUnit,t.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(t.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(t.interval_days=null,t.interval_anchor="completion")),t.notes=this._notes||null,t.documentation_url=this._documentationUrl||null,t.custom_icon=this._customIcon||null,t.priority=this._priority,t.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),t.enabled=this._enabled,t.last_performed=this._lastPerformed||null,t.nfc_tag_id=this._nfcTagId||null,t.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(t.consumes_parts=Object.entries(this._consumesParts).map(([p,m])=>({part_id:p,quantity:m}))),t.responsible_user_id=this._responsibleUserId,t.assignee_pool=this._assigneePool,t.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(Ht).filter(m=>m!==null);if(p.length>0){let m={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(m.auto_complete_on_recovery=!0),t.trigger_config=m}else this._taskId&&(t.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],m={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(m.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(m.auto_complete_on_recovery=!0),p.length>1&&(m.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let _=parseFloat(this._triggerAbove);isNaN(_)||(m.trigger_above=_)}if(this._triggerBelow){let _=parseFloat(this._triggerBelow);isNaN(_)||(m.trigger_below=_)}if(this._triggerForMinutes){let _=parseInt(this._triggerForMinutes,10);isNaN(_)||(m.trigger_for_minutes=_)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let _=parseFloat(this._triggerTargetValue);isNaN(_)||(m.trigger_target_value=_)}if(m.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let _=parseFloat(this._triggerBaselineValue);!isNaN(_)&&_>=0&&(m.trigger_baseline_value=_)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(m.trigger_from_state=this._triggerFromState),this._triggerToState&&(m.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let _=parseInt(this._triggerTargetChanges,10);isNaN(_)||(m.trigger_target_changes=_)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let v=parseFloat(this._triggerRuntimeHours);isNaN(v)||(m.trigger_runtime_hours=v)}let _=this._triggerOnStates.split(",").map(v=>v.trim()).filter(Boolean);_.length>0&&(m.trigger_on_states=_)}t.trigger_config=m}else this._taskId&&(t.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();t.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
|
||||
`).map(m=>m.trim()).filter(Boolean).slice(0,100);t.checklist=p.length?p:null}if(this.completionActionsEnabled){let p=this._actionService.trim();if(p&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(p)){let b={service:p},y=this._actionTargetEntity.trim();y&&(b.target={entity_id:y});let $=this._buildActionData();Object.keys($).length>0&&(b.data=$),t.on_complete_action=b}else t.on_complete_action=null;let m={};this._qcNotes.trim()&&(m.notes=this._qcNotes.trim());let _=parseFloat(this._qcCost);!isNaN(_)&&_>=0&&(m.cost=_);let v=parseInt(this._qcDuration,10);!isNaN(v)&&v>=0&&(m.duration=v),this._qcFeedback&&(m.feedback=this._qcFeedback),t.quick_complete_defaults=Object.keys(m).length?m:null}let i=await this.hass.connection.sendMessagePromise(t),n=this._taskId||i?.task_id,h=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&h)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(t){this._error=I(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return c;let t=this._lang,e=this._triggerType==="compound";return a`
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=t.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadForeignPools(){if(this._foreignOwners=[],!!this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._foreignOwners=(t.objects||[]).filter(e=>e.entry_id!==this._entryId&&(e.parts||[]).length>0).map(e=>({entry_id:e.entry_id,name:e.object?.name||e.entry_id,parts:e.parts||[]})).sort((e,i)=>e.name.localeCompare(i.name))}catch{this._foreignOwners=[]}}async _loadTags(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=t.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(t){if(!t||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:t});this._entityDomain=e.domain||"",this._suggestedAttributes=e.suggested_attributes||[],this._availableAttributes=e.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}get _hasForeignPick(){return Object.values(this._consumesParts).some(t=>!!t.entry_id)}_renderConsumesRow(t,e){let i=U({part_id:t.id,entry_id:e}),n=this._consumesParts[i],u=e?{part_id:t.id,quantity:1,entry_id:e}:{part_id:t.id,quantity:1};return a`
|
||||
<div class="consumes-row">
|
||||
<label class="consumes-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${n!==void 0}
|
||||
@change=${p=>{let m={...this._consumesParts};p.target.checked?m[i]=m[i]||u:delete m[i],this._consumesParts=m}}
|
||||
/>
|
||||
<span>${t.name}${t.unit?` (${t.unit})`:""}</span>
|
||||
</label>
|
||||
${n!==void 0?a`<input
|
||||
class="consumes-qty"
|
||||
type="number"
|
||||
min="0.01"
|
||||
max="999"
|
||||
step="0.01"
|
||||
.value=${String(n.quantity)}
|
||||
@input=${p=>{let m=parseFloat(p.target.value);this._consumesParts={...this._consumesParts,[i]:{...u,quantity:Number.isFinite(m)&&m>=.01?m:1}}}}
|
||||
/>`:c}
|
||||
</div>
|
||||
`}_toggleRequired(t,e){let i=new Set(this._requiredCompletion);e?i.add(t):i.delete(t),this._requiredCompletion=[...i]}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let t={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:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},e=this._earliestCompletionDays.trim();if(t.earliest_completion_days=e===""?null:Math.max(0,parseInt(e,10)||0),this._taskId&&(t.task_id=this._taskId),this._scheduleType==="one_time"?(t.due_date=this._dueDate||null,t.interval_days=null):Q.includes(this._scheduleType)?(t.schedule={...this._buildSchedule(),...this._recurrenceExtras()},t.interval_days=null,this._taskId&&(t.due_date=null)):(this._taskId&&(t.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(t.interval_days=parseInt(this._intervalDays,10),t.interval_unit=this._intervalUnit,t.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(t.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(t.interval_days=null,t.interval_anchor="completion")),t.notes=this._notes||null,t.documentation_url=this._documentationUrl||null,t.custom_icon=this._customIcon||null,t.priority=this._priority,t.labels=this._labels.split(",").map(p=>p.trim()).filter(Boolean),t.enabled=this._enabled,t.last_performed=this._lastPerformed||null,t.nfc_tag_id=this._nfcTagId||null,t.reading_unit=this._readingUnit.trim()||null,(this.parts.length||this._foreignOwners.length)&&(t.consumes_parts=Object.values(this._consumesParts).map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})),t.responsible_user_id=this._responsibleUserId,t.assignee_pool=this._assigneePool,t.required_completion_fields=this._requiredCompletion,t.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let p=this._compoundConditions.map(qt).filter(m=>m!==null);if(p.length>0){let m={type:"compound",compound_logic:this._compoundLogic,conditions:p};this._autoCompleteOnRecovery&&(m.auto_complete_on_recovery=!0),t.trigger_config=m}else this._taskId&&(t.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let p=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],m={entity_id:p[0],entity_ids:p,type:this._triggerType};if(this._triggerAttribute&&(m.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(m.auto_complete_on_recovery=!0),p.length>1&&(m.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let h=parseFloat(this._triggerAbove);isNaN(h)||(m.trigger_above=h)}if(this._triggerBelow){let h=parseFloat(this._triggerBelow);isNaN(h)||(m.trigger_below=h)}if(this._triggerForMinutes){let h=parseInt(this._triggerForMinutes,10);isNaN(h)||(m.trigger_for_minutes=h)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let h=parseFloat(this._triggerTargetValue);isNaN(h)||(m.trigger_target_value=h)}if(m.trigger_delta_mode=this._triggerDeltaMode,this._triggerDeltaMode&&this._triggerBaselineValue){let h=parseFloat(this._triggerBaselineValue);!isNaN(h)&&h>=0&&(m.trigger_baseline_value=h)}}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(m.trigger_from_state=this._triggerFromState),this._triggerToState&&(m.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let h=parseInt(this._triggerTargetChanges,10);isNaN(h)||(m.trigger_target_changes=h)}}else if(this._triggerType==="runtime"){if(this._triggerRuntimeHours){let v=parseFloat(this._triggerRuntimeHours);isNaN(v)||(m.trigger_runtime_hours=v)}let h=this._triggerOnStates.split(",").map(v=>v.trim()).filter(Boolean);h.length>0&&(m.trigger_on_states=h)}t.trigger_config=m}else this._taskId&&(t.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let p=this._scheduleTime.trim();t.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(p)?p:null}if(this.checklistsEnabled){let p=this._checklistText.split(`
|
||||
`).map(m=>m.trim()).filter(Boolean).slice(0,100);t.checklist=p.length?p:null}if(this.completionActionsEnabled){let p=this._actionService.trim();if(p&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(p)){let b={service:p},y=this._actionTargetEntity.trim();y&&(b.target={entity_id:y});let $=this._buildActionData();Object.keys($).length>0&&(b.data=$),t.on_complete_action=b}else t.on_complete_action=null;let m={};this._qcNotes.trim()&&(m.notes=this._qcNotes.trim());let h=parseFloat(this._qcCost);!isNaN(h)&&h>=0&&(m.cost=h);let v=parseInt(this._qcDuration,10);!isNaN(v)&&v>=0&&(m.duration=v),this._qcFeedback&&(m.feedback=this._qcFeedback),t.quick_complete_defaults=Object.keys(m).length?m:null}let i=await this.hass.connection.sendMessagePromise(t),n=this._taskId||i?.task_id,u=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&u)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(t){this._error=I(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return c;let t=this._lang,e=this._triggerType==="compound";return a`
|
||||
<h3>${s("trigger_configuration",t)}</h3>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",t)}</label>
|
||||
@@ -277,14 +298,14 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
.value=${this._triggerType}
|
||||
@change=${i=>this._triggerType=i.target.value}
|
||||
>
|
||||
${Tt.map(i=>a`<option value=${i} ?selected=${i===this._triggerType}>${s(i,t)}</option>`)}
|
||||
${Ct.map(i=>a`<option value=${i} ?selected=${i===this._triggerType}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${e?this._renderCompoundEditor():a`
|
||||
<ms-textfield
|
||||
label="${s("entity_id",t)} (${s("comma_separated",t)})"
|
||||
.value=${this._triggerEntityIds.length>0?this._triggerEntityIds.join(", "):this._triggerEntityId}
|
||||
@input=${i=>{let h=i.target.value.split(",").map(p=>p.trim()).filter(Boolean);this._triggerEntityId=h[0]||"",this._triggerEntityIds=h,h[0]&&this._fetchEntityAttributes(h[0])}}
|
||||
@input=${i=>{let u=i.target.value.split(",").map(p=>p.trim()).filter(Boolean);this._triggerEntityId=u[0]||"",this._triggerEntityIds=u,u[0]&&this._fetchEntityAttributes(u[0])}}
|
||||
></ms-textfield>
|
||||
${this._triggerEntityIds.length>1?a`
|
||||
<div class="select-row">
|
||||
@@ -336,7 +357,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
@input=${i=>this._intervalDays=i.target.value}
|
||||
></ms-textfield>
|
||||
${this._intervalDays?this._renderUnitSelect():c}
|
||||
`}_patchCondition(t,e){this._compoundConditions=this._compoundConditions.map((i,n)=>n===t?{...i,...e}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,At()]}_removeCondition(t){this._compoundConditions=this._compoundConditions.filter((e,i)=>i!==t)}_renderCompoundEditor(){let t=this._lang;return a`
|
||||
`}_patchCondition(t,e){this._compoundConditions=this._compoundConditions.map((i,n)=>n===t?{...i,...e}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Pt()]}_removeCondition(t){this._compoundConditions=this._compoundConditions.filter((e,i)=>i!==t)}_renderCompoundEditor(){let t=this._lang;return a`
|
||||
<div class="select-row">
|
||||
<label>${s("compound_logic",t)}</label>
|
||||
<select
|
||||
@@ -366,15 +387,15 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<ms-textfield
|
||||
label="${s("entity_id",i)} (${s("comma_separated",i)})"
|
||||
.value=${t.entityIds}
|
||||
@input=${h=>this._patchCondition(e,{entityIds:h.target.value})}
|
||||
@input=${u=>this._patchCondition(e,{entityIds:u.target.value})}
|
||||
></ms-textfield>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",i)}</label>
|
||||
<select
|
||||
.value=${t.type}
|
||||
@change=${h=>this._patchCondition(e,{type:h.target.value})}
|
||||
@change=${u=>this._patchCondition(e,{type:u.target.value})}
|
||||
>
|
||||
${nt.map(h=>a`<option value=${h} ?selected=${h===t.type}>${s(h,i)}</option>`)}
|
||||
${ct.map(u=>a`<option value=${u} ?selected=${u===t.type}>${s(u,i)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(t,e)}
|
||||
@@ -415,20 +436,20 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
>
|
||||
${["days","weeks","months","years"].map(e=>a`<option value=${e} ?selected=${e===this._intervalUnit}>${s("unit_"+e,t)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(t){this._weekdays=this._weekdays.includes(t)?this._weekdays.filter(e=>e!==t):[...this._weekdays,t]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(Z.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let t=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!t||t<=0?null:{kind:"interval",every:t,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(t){super.updated?.(t);for(let e of t.keys())if(u._PREVIEW_RELEVANT.has(String(e))){this._schedulePreviewRefresh();return}}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let t=this._open?this._previewScheduleDict():null;if(!t){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let e=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:t,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(e!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return c;let t=this._lang,e=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((h,p)=>{let m=new Date(`${h}T12:00:00`).getDay();return`${Y(m===0?6:m-1,t,"short")} ${q(h,t)}${p===0?e:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?a`<div class="field-help">${s("schedule_preview_ontime",t)}</div>`:c;return a`
|
||||
</div>`}_toggleWeekday(t){this._weekdays=this._weekdays.includes(t)?this._weekdays.filter(e=>e!==t):[...this._weekdays,t]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(Q.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let t=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!t||t<=0?null:{kind:"interval",every:t,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(t){super.updated?.(t);for(let e of t.keys())if(_._PREVIEW_RELEVANT.has(String(e))){this._schedulePreviewRefresh();return}}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let t=this._open?this._previewScheduleDict():null;if(!t){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let e=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:t,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(e!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return c;let t=this._lang,e=this.scheduleTimeEnabled&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((u,p)=>{let m=new Date(`${u}T12:00:00`).getDay();return`${J(m===0?6:m-1,t,"short")} ${M(u,t)}${p===0?e:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?a`<div class="field-help">${s("schedule_preview_ontime",t)}</div>`:c;return a`
|
||||
<div class="trigger-live-hint schedule-preview">
|
||||
${s("schedule_preview_title",t)}: ${i}${this._schedulePreviewEnded?a` <span class="field-help">${s("schedule_preview_ends",t)}</span>`:c}
|
||||
${n}
|
||||
</div>
|
||||
`}_buildSchedule(){let t=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 t({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return t({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let e={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(e.business=!0),t(e)}_recurrenceExtras(){let t={};if(this._seasonMonths.length&&(t.season_months=[...this._seasonMonths].sort((e,i)=>e-i)),this._endsMode==="count"){let e=parseInt(this._endsCount,10);e>=1&&(t.ends={count:e})}else this._endsMode==="until"&&this._endsUntil&&(t.ends={until:this._endsUntil});return t}_toggleSeasonMonth(t){this._seasonMonths=this._seasonMonths.includes(t)?this._seasonMonths.filter(e=>e!==t):[...this._seasonMonths,t]}_renderRecurrenceExtras(){let t=this._lang;if(!(this._scheduleType==="time_based"||Z.includes(this._scheduleType)))return c;let i=Pt(t);return a`
|
||||
`}_buildSchedule(){let t=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 t({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return t({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let e={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(e.business=!0),t(e)}_recurrenceExtras(){let t={};if(this._seasonMonths.length&&(t.season_months=[...this._seasonMonths].sort((e,i)=>e-i)),this._endsMode==="count"){let e=parseInt(this._endsCount,10);e>=1&&(t.ends={count:e})}else this._endsMode==="until"&&this._endsUntil&&(t.ends={until:this._endsUntil});return t}_toggleSeasonMonth(t){this._seasonMonths=this._seasonMonths.includes(t)?this._seasonMonths.filter(e=>e!==t):[...this._seasonMonths,t]}_renderRecurrenceExtras(){let t=this._lang;if(!(this._scheduleType==="time_based"||Q.includes(this._scheduleType)))return c;let i=Mt(t);return a`
|
||||
<label class="field-label">${s("season_window_label",t)}</label>
|
||||
<div class="field-help">${s("season_window_hint",t)}</div>
|
||||
<div class="weekday-chips season-chips">
|
||||
${i.map((n,h)=>a`
|
||||
${i.map((n,u)=>a`
|
||||
<button
|
||||
type="button"
|
||||
class="season-chip ${this._seasonMonths.includes(h+1)?"selected":""}"
|
||||
@click=${()=>this._toggleSeasonMonth(h+1)}
|
||||
class="season-chip ${this._seasonMonths.includes(u+1)?"selected":""}"
|
||||
@click=${()=>this._toggleSeasonMonth(u+1)}
|
||||
>${n}</button>`)}
|
||||
</div>
|
||||
|
||||
@@ -455,7 +476,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
.value=${this._endsUntil}
|
||||
@input=${n=>this._endsUntil=n.target.value}
|
||||
></ms-textfield>`:c}
|
||||
`}_renderCalendarFields(){let t=this._lang,e=Ct(t);if(this._scheduleType==="weekdays")return a`
|
||||
`}_renderCalendarFields(){let t=this._lang,e=Ft(t);if(this._scheduleType==="weekdays")return a`
|
||||
<label class="field-label">${s("recurrence_on_days",t)}</label>
|
||||
<div class="weekday-chips">
|
||||
${e.map((i,n)=>a`
|
||||
@@ -469,13 +490,13 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<div class="select-row">
|
||||
<label>${s("recurrence_occurrence",t)}</label>
|
||||
<select .value=${this._nth} @change=${n=>this._nth=n.target.value}>
|
||||
${i.map(([n,h])=>a`<option value=${n} ?selected=${n===this._nth}>${h}</option>`)}
|
||||
${i.map(([n,u])=>a`<option value=${n} ?selected=${n===this._nth}>${u}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="select-row">
|
||||
<label>${s("recurrence_weekday",t)}</label>
|
||||
<select .value=${this._nthWeekday} @change=${n=>this._nthWeekday=n.target.value}>
|
||||
${e.map((n,h)=>a`<option value=${String(h)} ?selected=${String(h)===this._nthWeekday}>${n}</option>`)}
|
||||
${e.map((n,u)=>a`<option value=${String(u)} ?selected=${String(u)===this._nthWeekday}>${n}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderCalOffsetField()}`}return this._scheduleType==="day_of_month"?a`
|
||||
@@ -507,7 +528,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
max="15"
|
||||
.value=${this._calOffset}
|
||||
@input=${e=>this._calOffset=e.target.value}
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return c;let t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return c;let e=this.hass.states[t];if(!e)return c;let i=this._lang,n=e.attributes?.unit_of_measurement,h=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?e.attributes?.[this._triggerAttribute]:e.state,m=typeof p=="number"?p:parseFloat(String(p)),_=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(m),v=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),b=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),$=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN($))return c;_&&b.push(s("trigger_hint_now",i).replace("{value}",v(m)+h)),isNaN(y)||b.push(s("trigger_hint_above",i).replace("{target}",v(y)+h)),isNaN($)||b.push(s("trigger_hint_below",i).replace("{target}",v($)+h))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return c;this._triggerDeltaMode?this._taskId?b.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+h)):_?b.push(s("trigger_hint_counter_delta",i).replace("{value}",v(m)+h).replace("{due}",v(m+y)+h).replace("{target}",v(y)+h)):b.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+h)):(_&&b.push(s("trigger_hint_now",i).replace("{value}",v(m)+h)),b.push(s("trigger_hint_counter_abs",i).replace("{target}",v(y)+h)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return c;b.push(s("trigger_hint_runtime",i).replace("{hours}",v(y))),b.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,$=this._triggerToState.trim();b.push(($?s("trigger_hint_state_change_to",i).replace("{state}",$):s("trigger_hint_state_change",i)).replace("{count}",String(y))),b.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}return b.length?a`<div class="trigger-live-hint">${b.join(" ")}</div>`:c}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?a`
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return c;let t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return c;let e=this.hass.states[t];if(!e)return c;let i=this._lang,n=e.attributes?.unit_of_measurement,u=typeof n=="string"&&n?` ${n}`:"",p=this._triggerAttribute?e.attributes?.[this._triggerAttribute]:e.state,m=typeof p=="number"?p:parseFloat(String(p)),h=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(m),v=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),b=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),$=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN($))return c;h&&b.push(s("trigger_hint_now",i).replace("{value}",v(m)+u)),isNaN(y)||b.push(s("trigger_hint_above",i).replace("{target}",v(y)+u)),isNaN($)||b.push(s("trigger_hint_below",i).replace("{target}",v($)+u))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return c;this._triggerDeltaMode?this._taskId?b.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+u)):h?b.push(s("trigger_hint_counter_delta",i).replace("{value}",v(m)+u).replace("{due}",v(m+y)+u).replace("{target}",v(y)+u)):b.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+u)):(h&&b.push(s("trigger_hint_now",i).replace("{value}",v(m)+u)),b.push(s("trigger_hint_counter_abs",i).replace("{target}",v(y)+u)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return c;b.push(s("trigger_hint_runtime",i).replace("{hours}",v(y))),b.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,$=this._triggerToState.trim();b.push(($?s("trigger_hint_state_change_to",i).replace("{state}",$):s("trigger_hint_state_change",i)).replace("{count}",String(y))),b.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}return b.length?a`<div class="trigger-live-hint">${b.join(" ")}</div>`:c}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?a`
|
||||
<ms-textfield
|
||||
label="${s("trigger_above",t)}"
|
||||
type="number"
|
||||
@@ -604,7 +625,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<label>${s("object",t)}</label>
|
||||
<select
|
||||
.value=${this._entryId}
|
||||
@change=${i=>{this._entryId=i.target.value,this._consumesParts={},this._loadParts()}}
|
||||
@change=${i=>{this._entryId=i.target.value,this._consumesParts={},this._loadParts(),this._loadForeignPools()}}
|
||||
>
|
||||
${this._objectChoices.map(i=>a`<option value=${i.entry_id} ?selected=${i.entry_id===this._entryId}>${i.name}</option>`)}
|
||||
</select>
|
||||
@@ -622,7 +643,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
.value=${this._type}
|
||||
@change=${i=>this._type=i.target.value}
|
||||
>
|
||||
${wt.map(i=>a`<option value=${i} ?selected=${i===this._type}>${s(i,t)}</option>`)}
|
||||
${Lt.map(i=>a`<option value=${i} ?selected=${i===this._type}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?a`
|
||||
@@ -634,30 +655,20 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<div class="field-help">${s("reading_unit_help",t)}</div>
|
||||
`:c}
|
||||
${this._partsLoadFailed?a`<div class="field-help parts-load-failed">${s("parts_load_failed",t)}</div>`:c}
|
||||
${this.parts.length?a`
|
||||
${this.parts.length||this._foreignOwners.length?a`
|
||||
<div class="field">
|
||||
<label>${s("consumes_parts_label",t)}</label>
|
||||
${this.parts.map(i=>{let n=this._consumesParts[i.id];return a`
|
||||
<div class="consumes-row">
|
||||
<label class="consumes-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${n!==void 0}
|
||||
@change=${h=>{let p={...this._consumesParts};h.target.checked?p[i.id]=p[i.id]||1:delete p[i.id],this._consumesParts=p}}
|
||||
/>
|
||||
<span>${i.name}${i.unit?` (${i.unit})`:""}</span>
|
||||
</label>
|
||||
${n!==void 0?a`<input
|
||||
class="consumes-qty"
|
||||
type="number"
|
||||
min="0.01"
|
||||
max="999"
|
||||
step="0.01"
|
||||
.value=${String(n)}
|
||||
@input=${h=>{let p=parseFloat(h.target.value);this._consumesParts={...this._consumesParts,[i.id]:Number.isFinite(p)&&p>=.01?p:1}}}
|
||||
/>`:c}
|
||||
</div>
|
||||
`})}
|
||||
${this.parts.map(i=>this._renderConsumesRow(i))}
|
||||
${this._foreignOwners.length?a`
|
||||
<details class="shared-pools" ?open=${this._hasForeignPick}>
|
||||
<summary>${s("shared_parts_other_objects",t)}</summary>
|
||||
<div class="field-help">${s("shared_parts_help",t)}</div>
|
||||
${this._foreignOwners.map(i=>a`
|
||||
<div class="shared-pool-owner">${i.name}</div>
|
||||
${i.parts.map(n=>this._renderConsumesRow(n,i.entry_id))}
|
||||
`)}
|
||||
</details>
|
||||
`:c}
|
||||
</div>
|
||||
`:c}
|
||||
<div class="select-row">
|
||||
@@ -666,7 +677,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
.value=${this._priority}
|
||||
@change=${i=>this._priority=i.target.value}
|
||||
>
|
||||
${Et.map(i=>a`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,t)}</option>`)}
|
||||
${At.map(i=>a`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -685,7 +696,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
.value=${this._scheduleType}
|
||||
@change=${i=>this._scheduleType=i.target.value}
|
||||
>
|
||||
${It.map(i=>a`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,t)}</option>`)}
|
||||
${St.map(i=>a`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?a`
|
||||
@@ -730,6 +741,8 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
<ms-textfield
|
||||
label="${s("warning_days",t)}"
|
||||
type="number"
|
||||
min="0"
|
||||
max="365"
|
||||
.value=${this._warningDays}
|
||||
@input=${i=>this._warningDays=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -752,6 +765,19 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
></textarea>
|
||||
<div class="field-help">${s("checklist_help",t)}</div>
|
||||
`:c}
|
||||
<h3>${s("require_on_completion",t)}</h3>
|
||||
<div class="required-completion">
|
||||
${dt.map(i=>a`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${this._requiredCompletion.includes(i)}
|
||||
@change=${n=>this._toggleRequired(i,n.target.checked)}
|
||||
/>
|
||||
<span>${s(K[i],t)}</span>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
<ms-textfield
|
||||
label="${s("last_performed_optional",t)}"
|
||||
type="date"
|
||||
@@ -874,7 +900,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};u._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),u.styles=w`
|
||||
`}};_._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),_.styles=w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -984,6 +1010,24 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
background: var(--card-background-color);
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
/* #111: other objects' pools sit behind a disclosure so the object's OWN
|
||||
parts stay the primary list; each group is headed by the owning object's
|
||||
name, so which pool a checkbox means is never a guess. */
|
||||
.shared-pools {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.shared-pools > summary {
|
||||
cursor: pointer;
|
||||
padding: 2px 0;
|
||||
font-size: 13px;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.shared-pool-owner {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.field-help {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
@@ -1129,7 +1173,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,r([g({attribute:!1})],u.prototype,"hass",2),r([g({type:Boolean,attribute:"checklists-enabled"})],u.prototype,"checklistsEnabled",2),r([g({type:Boolean,attribute:"schedule-time-enabled"})],u.prototype,"scheduleTimeEnabled",2),r([g({type:Boolean,attribute:"completion-actions-enabled"})],u.prototype,"completionActionsEnabled",2),r([g({type:Number,attribute:"default-warning-days"})],u.prototype,"defaultWarningDays",2),r([l()],u.prototype,"parts",2),r([l()],u.prototype,"_open",2),r([l()],u.prototype,"_loading",2),r([l()],u.prototype,"_error",2),r([l()],u.prototype,"_entryId",2),r([l()],u.prototype,"_taskId",2),r([l()],u.prototype,"_objectChoices",2),r([l()],u.prototype,"_name",2),r([l()],u.prototype,"_type",2),r([l()],u.prototype,"_scheduleType",2),r([l()],u.prototype,"_intervalDays",2),r([l()],u.prototype,"_intervalUnit",2),r([l()],u.prototype,"_dueDate",2),r([l()],u.prototype,"_warningDays",2),r([l()],u.prototype,"_earliestCompletionDays",2),r([l()],u.prototype,"_intervalAnchor",2),r([l()],u.prototype,"_weekdays",2),r([l()],u.prototype,"_nth",2),r([l()],u.prototype,"_nthWeekday",2),r([l()],u.prototype,"_domDay",2),r([l()],u.prototype,"_domLastDay",2),r([l()],u.prototype,"_domBusiness",2),r([l()],u.prototype,"_calOffset",2),r([l()],u.prototype,"_seasonMonths",2),r([l()],u.prototype,"_endsMode",2),r([l()],u.prototype,"_endsCount",2),r([l()],u.prototype,"_endsUntil",2),r([l()],u.prototype,"_schedulePreview",2),r([l()],u.prototype,"_schedulePreviewEnded",2),r([l()],u.prototype,"_notes",2),r([l()],u.prototype,"_documentationUrl",2),r([l()],u.prototype,"_customIcon",2),r([l()],u.prototype,"_priority",2),r([l()],u.prototype,"_labels",2),r([l()],u.prototype,"_enabled",2),r([l()],u.prototype,"_triggerEntityId",2),r([l()],u.prototype,"_triggerEntityIds",2),r([l()],u.prototype,"_triggerEntityLogic",2),r([l()],u.prototype,"_triggerAttribute",2),r([l()],u.prototype,"_triggerType",2),r([l()],u.prototype,"_triggerAbove",2),r([l()],u.prototype,"_triggerBelow",2),r([l()],u.prototype,"_triggerForMinutes",2),r([l()],u.prototype,"_triggerTargetValue",2),r([l()],u.prototype,"_triggerDeltaMode",2),r([l()],u.prototype,"_triggerBaselineValue",2),r([l()],u.prototype,"_liveBaselineValue",2),r([l()],u.prototype,"_autoCompleteOnRecovery",2),r([l()],u.prototype,"_triggerFromState",2),r([l()],u.prototype,"_triggerToState",2),r([l()],u.prototype,"_triggerTargetChanges",2),r([l()],u.prototype,"_triggerRuntimeHours",2),r([l()],u.prototype,"_triggerOnStates",2),r([l()],u.prototype,"_compoundLogic",2),r([l()],u.prototype,"_compoundConditions",2),r([l()],u.prototype,"_suggestedAttributes",2),r([l()],u.prototype,"_availableAttributes",2),r([l()],u.prototype,"_entityDomain",2),r([l()],u.prototype,"_lastPerformed",2),r([l()],u.prototype,"_nfcTagId",2),r([l()],u.prototype,"_readingUnit",2),r([l()],u.prototype,"_consumesParts",2),r([l()],u.prototype,"_partsLoadFailed",2),r([l()],u.prototype,"_availableTags",2),r([l()],u.prototype,"_responsibleUserId",2),r([l()],u.prototype,"_assigneePool",2),r([l()],u.prototype,"_rotationStrategy",2),r([l()],u.prototype,"_availableUsers",2),r([l()],u.prototype,"_checklistText",2),r([l()],u.prototype,"_scheduleTime",2),r([l()],u.prototype,"_actionService",2),r([l()],u.prototype,"_actionTargetEntity",2),r([l()],u.prototype,"_actionData",2),r([l()],u.prototype,"_actionDataJsonFallback",2),r([l()],u.prototype,"_actionTesting",2),r([l()],u.prototype,"_actionTestResult",2),r([l()],u.prototype,"_actionTestError",2),r([l()],u.prototype,"_qcNotes",2),r([l()],u.prototype,"_qcCost",2),r([l()],u.prototype,"_qcDuration",2),r([l()],u.prototype,"_qcFeedback",2),r([l()],u.prototype,"_environmentalEntity",2),r([l()],u.prototype,"_environmentalAttribute",2);var J=u;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",J);var f=class extends E{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(t=>[t.part_id,t.quantity])))}_toggleCheck(t){let e=String(t);this._checklistState={...this._checklistState,[e]:!this._checklistState[e]}}_setFeedback(t){this._feedback=t}async _onPhotoInput(t){let e=t.target,i=e.files?.[0];if(e.value="",!!i){this._photoUploading=!0,this._error=
Line truncated
|
||||
`,r([g({attribute:!1})],_.prototype,"hass",2),r([g({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),r([g({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),r([g({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),r([g({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),r([l()],_.prototype,"parts",2),r([l()],_.prototype,"_foreignOwners",2),r([l()],_.prototype,"_open",2),r([l()],_.prototype,"_loading",2),r([l()],_.prototype,"_error",2),r([l()],_.prototype,"_entryId",2),r([l()],_.prototype,"_taskId",2),r([l()],_.prototype,"_objectChoices",2),r([l()],_.prototype,"_name",2),r([l()],_.prototype,"_type",2),r([l()],_.prototype,"_scheduleType",2),r([l()],_.prototype,"_intervalDays",2),r([l()],_.prototype,"_intervalUnit",2),r([l()],_.prototype,"_dueDate",2),r([l()],_.prototype,"_warningDays",2),r([l()],_.prototype,"_earliestCompletionDays",2),r([l()],_.prototype,"_intervalAnchor",2),r([l()],_.prototype,"_weekdays",2),r([l()],_.prototype,"_nth",2),r([l()],_.prototype,"_nthWeekday",2),r([l()],_.prototype,"_domDay",2),r([l()],_.prototype,"_domLastDay",2),r([l()],_.prototype,"_domBusiness",2),r([l()],_.prototype,"_calOffset",2),r([l()],_.prototype,"_seasonMonths",2),r([l()],_.prototype,"_endsMode",2),r([l()],_.prototype,"_endsCount",2),r([l()],_.prototype,"_endsUntil",2),r([l()],_.prototype,"_schedulePreview",2),r([l()],_.prototype,"_schedulePreviewEnded",2),r([l()],_.prototype,"_notes",2),r([l()],_.prototype,"_documentationUrl",2),r([l()],_.prototype,"_customIcon",2),r([l()],_.prototype,"_priority",2),r([l()],_.prototype,"_labels",2),r([l()],_.prototype,"_enabled",2),r([l()],_.prototype,"_triggerEntityId",2),r([l()],_.prototype,"_triggerEntityIds",2),r([l()],_.prototype,"_triggerEntityLogic",2),r([l()],_.prototype,"_triggerAttribute",2),r([l()],_.prototype,"_triggerType",2),r([l()],_.prototype,"_triggerAbove",2),r([l()],_.prototype,"_triggerBelow",2),r([l()],_.prototype,"_triggerForMinutes",2),r([l()],_.prototype,"_triggerTargetValue",2),r([l()],_.prototype,"_triggerDeltaMode",2),r([l()],_.prototype,"_triggerBaselineValue",2),r([l()],_.prototype,"_liveBaselineValue",2),r([l()],_.prototype,"_autoCompleteOnRecovery",2),r([l()],_.prototype,"_triggerFromState",2),r([l()],_.prototype,"_triggerToState",2),r([l()],_.prototype,"_triggerTargetChanges",2),r([l()],_.prototype,"_triggerRuntimeHours",2),r([l()],_.prototype,"_triggerOnStates",2),r([l()],_.prototype,"_compoundLogic",2),r([l()],_.prototype,"_compoundConditions",2),r([l()],_.prototype,"_suggestedAttributes",2),r([l()],_.prototype,"_availableAttributes",2),r([l()],_.prototype,"_entityDomain",2),r([l()],_.prototype,"_lastPerformed",2),r([l()],_.prototype,"_nfcTagId",2),r([l()],_.prototype,"_readingUnit",2),r([l()],_.prototype,"_consumesParts",2),r([l()],_.prototype,"_partsLoadFailed",2),r([l()],_.prototype,"_availableTags",2),r([l()],_.prototype,"_responsibleUserId",2),r([l()],_.prototype,"_assigneePool",2),r([l()],_.prototype,"_rotationStrategy",2),r([l()],_.prototype,"_availableUsers",2),r([l()],_.prototype,"_checklistText",2),r([l()],_.prototype,"_requiredCompletion",2),r([l()],_.prototype,"_scheduleTime",2),r([l()],_.prototype,"_actionService",2),r([l()],_.prototype,"_actionTargetEntity",2),r([l()],_.prototype,"_actionData",2),r([l()],_.prototype,"_actionDataJsonFallback",2),r([l()],_.prototype,"_actionTesting",2),r([l()],_.prototype,"_actionTestResult",2),r([l()],_.prototype,"_actionTestError",2),r([l()],_.prototype,"_qcNotes",2),r([l()],_.prototype,"_qcCost",2),r([l()],_.prototype,"_qcDuration",2),r([l()],_.prototype,"_qcFeedback",2),r([l()],_.prototype,"_environmentalEntity",2),r([l()],_.prototype,"_environmentalAttribute",2);var X=_;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",X);var f=class extends E{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.requiredFields=[];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(t=>[U(t),{...t}])))}_toggleCheck(t){let e=String(t);this._checklistState={...this._checklistState,[e]:!this._checklistState[e]}}_setFeedback(t){this._feedback=t}async _on
Line truncated
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${s("complete_title",t)}${this.taskName}</div>
|
||||
<div class="content">
|
||||
@@ -1154,15 +1198,17 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
</label>`:c}
|
||||
${this.parts.length?a`<div class="used-parts">
|
||||
<span class="field-label">${s("complete_parts_used",t)}</span>
|
||||
${this.parts.map(e=>{let i=this._usedParts[e.id],n=i!==void 0;return a`<div class="used-part-row">
|
||||
${this.parts.map(e=>{let i=U({part_id:e.id,entry_id:e.entry_id}),n=this._usedParts[i],u=n!==void 0,p=e.entry_id?{part_id:e.id,quantity:1,entry_id:e.entry_id}:{part_id:e.id,quantity:1};return a`<div class="used-part-row">
|
||||
<label class="used-part-check">
|
||||
<input type="checkbox" .checked=${n}
|
||||
@change=${h=>{let p={...this._usedParts};h.target.checked?p[e.id]=p[e.id]||1:delete p[e.id],this._usedParts=p}} />
|
||||
<span>${e.name}${e.stock!==null&&e.stock!==void 0?` (${e.stock}${e.unit?" "+e.unit:""})`:""}</span>
|
||||
<input type="checkbox" .checked=${u}
|
||||
@change=${m=>{let h={...this._usedParts};m.target.checked?h[i]=h[i]||p:delete h[i],this._usedParts=h}} />
|
||||
<span
|
||||
>${e.name}${e.owner_name?a`<span class="used-part-owner"> (${e.owner_name})</span>`:c}${e.stock!==null&&e.stock!==void 0?` (${e.stock}${e.unit?" "+e.unit:""})`:""}</span
|
||||
>
|
||||
</label>
|
||||
${n?a`<input class="used-part-qty" type="number" min="0.01" max="999" step="0.01"
|
||||
.value=${String(i)}
|
||||
@input=${h=>{let p=parseFloat(h.target.value);this._usedParts={...this._usedParts,[e.id]:Number.isFinite(p)&&p>=.01?p:1}}} />`:c}
|
||||
${u?a`<input class="used-part-qty" type="number" min="0.01" max="999" step="0.01"
|
||||
.value=${String(n.quantity)}
|
||||
@input=${m=>{let h=parseFloat(m.target.value);this._usedParts={...this._usedParts,[i]:{...p,quantity:Number.isFinite(h)&&h>=.01?h:1}}}} />`:c}
|
||||
</div>`})}
|
||||
</div>`:this.consumesInfo.length?a`<div class="consumes-hint">
|
||||
${this.consumesInfo.map(e=>a`<div>${e}</div>`)}
|
||||
@@ -1181,25 +1227,25 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
only sees the title + Cancel/Complete buttons — the original
|
||||
bug report. Native inputs always render. -->
|
||||
<label class="field">
|
||||
<span class="field-label">${s("notes_optional",t)}</span>
|
||||
<span class="field-label">${s("notes_optional",t)}${this._req("notes")}</span>
|
||||
<input type="text" class="field-input"
|
||||
.value=${this._notes}
|
||||
@input=${e=>this._notes=e.target.value} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">${s("cost_optional",t)}</span>
|
||||
<span class="field-label">${s("cost_optional",t)}${this._req("cost")}</span>
|
||||
<input type="number" step="0.01" min="0" class="field-input"
|
||||
.value=${this._cost}
|
||||
@input=${e=>this._cost=e.target.value} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">${s("duration_minutes",t)}</span>
|
||||
<span class="field-label">${s("duration_minutes",t)}${this._req("duration")}</span>
|
||||
<input type="number" step="0.01" min="0" class="field-input"
|
||||
.value=${this._duration}
|
||||
@input=${e=>this._duration=e.target.value} />
|
||||
</label>
|
||||
<div class="field">
|
||||
<span class="field-label">${s("completion_photo_optional",t)}</span>
|
||||
<span class="field-label">${s("completion_photo_optional",t)}${this._req("photo")}</span>
|
||||
${this._photoPreview?a`
|
||||
<div class="photo-preview">
|
||||
<img src=${this._photoPreview} alt="" />
|
||||
@@ -1240,13 +1286,19 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
</ha-button>
|
||||
<ha-button
|
||||
@click=${this._complete}
|
||||
.disabled=${this._loading}
|
||||
.disabled=${this._loading||this._missingRequired.length>0}
|
||||
title=${this._missingRequired.length?this._missingRequired.map(e=>s("err_required",t).replace("{field}",s(K[e]??e,t))).join(" \xB7 "):""}
|
||||
>
|
||||
${this._loading?s("completing",t):s("complete",t)}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};f.styles=[rt,w`
|
||||
`}};f.styles=[ot,w`
|
||||
.req-mark {
|
||||
color: var(--error-color, #f44336);
|
||||
margin-left: 2px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1279,6 +1331,9 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
font-size: 13px; cursor: pointer;
|
||||
}
|
||||
.used-part-check input { cursor: pointer; }
|
||||
/* #111: whose stock this row draws on. Muted but never omitted — an
|
||||
unlabelled foreign pool is indistinguishable from an own part. */
|
||||
.used-part-owner { color: var(--secondary-text-color); }
|
||||
.used-part-qty {
|
||||
width: 76px; padding: 4px 6px; border-radius: 4px; font: inherit; font-size: 13px;
|
||||
border: 1px solid var(--divider-color);
|
||||
@@ -1390,7 +1445,7 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],r([g({attribute:!1})],f.prototype,"hass",2),r([g()],f.prototype,"entryId",2),r([g()],f.prototype,"taskId",2),r([g()],f.prototype,"taskName",2),r([g()],f.prototype,"lang",2),r([g({type:Array})],f.prototype,"checklist",2),r([g({type:Boolean})],f.prototype,"adaptiveEnabled",2),r([g()],f.prototype,"taskType",2),r([g()],f.prototype,"readingUnit",2),r([g({attribute:!1})],f.prototype,"restockDefault",2),r([g({attribute:!1})],f.prototype,"parts",2),r([g({attribute:!1})],f.prototype,"consumesParts",2),r([g({type:Array})],f.prototype,"consumesInfo",2),r([l()],f.prototype,"_open",2),r([l()],f.prototype,"_notes",2),r([l()],f.prototype,"_cost",2),r([l()],f.prototype,"_duration",2),r([l()],f.prototype,"_loading",2),r([l()],f.prototype,"_error",2),r([l()],f.prototype,"_checklistState",2),r([l()],f.prototype,"_feedback",2),r([l()],f.prototype,"_photoDocId",2),r([l()],f.prototype,"_photoPreview",2),r([l()],f.prototype,"_photoUploading",2),r([l()],f.prototype,"_readingValue",2),r([l()],f.prototype,"_restockQty",2),r([l()],f.prototype,"_usedParts",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",f);var R=class extends E{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(t){this._draft={...t},this._originalSnapshot={...t},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(t,e){this._draft&&(this._draft={...this._draft,[t]:e})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let t={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&&(t.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(t.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(t.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(t.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(t.completed_by=this._draft.completed_by),Object.keys(t).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(t),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=I(t,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return c;let t=this._lang,e=this._draft;return a`
|
||||
`],r([g({attribute:!1})],f.prototype,"hass",2),r([g()],f.prototype,"entryId",2),r([g()],f.prototype,"taskId",2),r([g()],f.prototype,"taskName",2),r([g()],f.prototype,"lang",2),r([g({type:Array})],f.prototype,"checklist",2),r([g({type:Boolean})],f.prototype,"adaptiveEnabled",2),r([g()],f.prototype,"taskType",2),r([g()],f.prototype,"readingUnit",2),r([g({attribute:!1})],f.prototype,"restockDefault",2),r([g({attribute:!1})],f.prototype,"parts",2),r([g({attribute:!1})],f.prototype,"consumesParts",2),r([g({type:Array})],f.prototype,"consumesInfo",2),r([g({type:Array})],f.prototype,"requiredFields",2),r([l()],f.prototype,"_open",2),r([l()],f.prototype,"_notes",2),r([l()],f.prototype,"_cost",2),r([l()],f.prototype,"_duration",2),r([l()],f.prototype,"_loading",2),r([l()],f.prototype,"_error",2),r([l()],f.prototype,"_checklistState",2),r([l()],f.prototype,"_feedback",2),r([l()],f.prototype,"_photoDocId",2),r([l()],f.prototype,"_photoPreview",2),r([l()],f.prototype,"_photoUploading",2),r([l()],f.prototype,"_readingValue",2),r([l()],f.prototype,"_restockQty",2),r([l()],f.prototype,"_usedParts",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",f);var R=class extends E{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(t){this._draft={...t},this._originalSnapshot={...t},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(t,e){this._draft&&(this._draft={...this._draft,[t]:e})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let t={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&&(t.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(t.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(t.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(t.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(t.completed_by=this._draft.completed_by),Object.keys(t).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(t),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=I(t,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return c;let t=this._lang,e=this._draft;return a`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
<h2>${s("history_edit_title",t)||"Edit history entry"}</h2>
|
||||
@@ -1497,15 +1552,21 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
background: rgba(211,47,47,0.1);
|
||||
border-radius: 6px;
|
||||
}
|
||||
`,r([g({attribute:!1})],R.prototype,"hass",2),r([l()],R.prototype,"_open",2),r([l()],R.prototype,"_saving",2),r([l()],R.prototype,"_error",2),r([l()],R.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function U(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ot(o){return!o.startsWith("data:image/svg+xml,")&&!o.startsWith("data:image/png;base64,")?"":U(o)}function Rt(o){return o.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var A=class extends E{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(t,e){this._entryId=t,this._taskId=null,this._objectName=e,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(t,e,i,n){this._entryId=t,this._taskId=e,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 t=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let e={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(e.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...e,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...e,action:"complete"}));let n=await Promise.all(i);if(t!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(e){if(t!==this._generateSeq)return;let i=e?.code,n=e?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{t===this._generateSeq&&(this._loading=!1)}}_setUrlMode(t){this._urlMode!==t&&(this._urlMode=t,this._generate())}_print(){if(!this._viewResult)return;let t=this._viewResult,e=t.label.task_name?`${t.label.object_name} \u2014 ${t.label.task_name}`:t.label.object_name,i=[t.label.manufacturer,t.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let h=this.lang||"en",p=U(e),m=U(i),_=!!this._completeResult,v=U(s("qr_action_view",h)),b=U(s("qr_action_complete",h));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`,r([g({attribute:!1})],R.prototype,"hass",2),r([l()],R.prototype,"_open",2),r([l()],R.prototype,"_saving",2),r([l()],R.prototype,"_error",2),r([l()],R.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function j(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pt(o){return!o.startsWith("data:image/svg+xml,")&&!o.startsWith("data:image/png;base64,")?"":j(o)}function Nt(o){return o.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var L=class extends E{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(t,e){this._entryId=t,this._taskId=null,this._objectName=e,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(t,e,i,n){this._entryId=t,this._taskId=e,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 t=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let e={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(e.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...e,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...e,action:"complete"}));let n=await Promise.all(i);if(t!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(e){if(t!==this._generateSeq)return;let i=e?.code,n=e?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{t===this._generateSeq&&(this._loading=!1)}}_setUrlMode(t){this._urlMode!==t&&(this._urlMode=t,this._generate())}_print(){if(!this._viewResult)return;let t=this._viewResult,e=t.label.task_name?`${t.label.object_name} \u2014 ${t.label.task_name}`:t.label.object_name,i=[t.label.manufacturer,t.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let u=this.lang||"en",p=j(e),m=j(i),h=!!this._completeResult,v=j(s("qr_action_view",u)),b=j(s("qr_action_complete",u));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>${p}</title>
|
||||
<style>
|
||||
body{font-family:sans-serif;text-align:center;padding:20px}
|
||||
/* Printable sheet \u2014 must not inherit the phone's dark theme. The QR images
|
||||
carry their own white quiet zone and stay scannable either way, but the
|
||||
labels below are explicit dark greys and would vanish on a WebView's dark
|
||||
canvas. Same reasoning as helpers/report.ts. */
|
||||
:root{color-scheme:light}
|
||||
body{font-family:sans-serif;text-align:center;padding:20px;background:#fff;color:#1a1a1a}
|
||||
h2{margin:0 0 4px}
|
||||
.sub{color:#666;font-size:14px;margin-bottom:16px}
|
||||
.qr-row{display:flex;justify-content:center;gap:24px;margin:12px 0}
|
||||
.qr-col{display:flex;flex-direction:column;align-items:center;gap:6px}
|
||||
.qr-col img{width:${_?"200px":"280px"}}
|
||||
.qr-col img{width:${h?"200px":"280px"}}
|
||||
.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}
|
||||
</style></head><body>
|
||||
@@ -1513,17 +1574,17 @@ import{a as w,b as a,c as z,d as c,e as E,f as g,g as l,i as s,j as Q,k as tt,l
|
||||
${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${ot(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<img src="${pt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${v}</div>
|
||||
</div>
|
||||
${_?`<div class="qr-col">
|
||||
<img src="${ot(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
${h?`<div class="qr-col">
|
||||
<img src="${pt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${b}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${U(this._viewResult.url)}</div>
|
||||
<div class="url">${j(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),n.document.close()}_downloadSvg(t,e){let i=decodeURIComponent(t.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),h=URL.createObjectURL(n),p=document.createElement("a");p.href=h;let m=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;p.download=`qr-${Rt(m)}-${e}.svg`,p.click(),URL.revokeObjectURL(h)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return a``;let t=this.lang||this.hass?.language||"en",e=this._taskName?`${s("qr_code",t)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",t)}: ${this._objectName}`,i=!!this._viewResult;return a`
|
||||
</body></html>`),n.document.close()}_downloadSvg(t,e){let i=decodeURIComponent(t.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),u=URL.createObjectURL(n),p=document.createElement("a");p.href=u;let m=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;p.download=`qr-${Nt(m)}-${e}.svg`,p.click(),URL.revokeObjectURL(u)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return a``;let t=this.lang||this.hass?.language||"en",e=this._taskName?`${s("qr_code",t)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",t)}: ${this._objectName}`,i=!!this._viewResult;return a`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${e}</div>
|
||||
<div class="content">
|
||||
@@ -1584,7 +1645,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};A.styles=w`
|
||||
`}};L.styles=w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1702,51 +1763,51 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,r([g({attribute:!1})],A.prototype,"hass",2),r([g()],A.prototype,"lang",2),r([l()],A.prototype,"_open",2),r([l()],A.prototype,"_loading",2),r([l()],A.prototype,"_error",2),r([l()],A.prototype,"_viewResult",2),r([l()],A.prototype,"_completeResult",2),r([l()],A.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",A);function lt(o,d){let t=o.interval_analysis,e=t?.weibull_beta,i=t?.weibull_eta;if(e==null||i==null||i<=0)return c;let n=o.interval_days??0,h=o.suggested_interval??n;return a`
|
||||
`,r([g({attribute:!1})],L.prototype,"hass",2),r([g()],L.prototype,"lang",2),r([l()],L.prototype,"_open",2),r([l()],L.prototype,"_loading",2),r([l()],L.prototype,"_error",2),r([l()],L.prototype,"_viewResult",2),r([l()],L.prototype,"_completeResult",2),r([l()],L.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",L);function ht(o,d){let t=o.interval_analysis,e=t?.weibull_beta,i=t?.weibull_eta;if(e==null||i==null||i<=0)return c;let n=o.interval_days??0,u=o.suggested_interval??n;return a`
|
||||
<div class="weibull-section">
|
||||
<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>
|
||||
${s("weibull_reliability_curve",d)}
|
||||
${Ft(e,d)}
|
||||
${zt(e,d)}
|
||||
</div>
|
||||
${Mt(e,i,n,h,d)}
|
||||
${qt(t,d)}
|
||||
${t?.confidence_interval_low!=null?Nt(t,o,d):c}
|
||||
${Ut(e,i,n,u,d)}
|
||||
${jt(t,d)}
|
||||
${t?.confidence_interval_low!=null?Ot(t,o,d):c}
|
||||
</div>
|
||||
`}function Ft(o,d){let t,e,i;return o<.8?(t="early_failures",e="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):o<=1.2?(t="random_failures",e="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):o<=3.5?(t="wear_out",e="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(t="highly_predictable",e="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),a`
|
||||
`}function zt(o,d){let t,e,i;return o<.8?(t="early_failures",e="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):o<=1.2?(t="random_failures",e="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):o<=3.5?(t="wear_out",e="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(t="highly_predictable",e="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),a`
|
||||
<span class="beta-badge ${t}">
|
||||
<ha-svg-icon path="${e}"></ha-svg-icon>
|
||||
${s(i,d)} (\u03B2=${o.toFixed(2)})
|
||||
</span>
|
||||
`}function Mt(o,d,t,e,i){let $=Math.max(t,e,d,1)*1.3,C=50,P=[];for(let L=0;L<=C;L++){let S=L/C*$,$t=1-Math.exp(-Math.pow(S/d,o)),xt=32+S/$*260,kt=136-$t*128;P.push([xt,kt])}let j=P.map(([L,S])=>`${L.toFixed(1)},${S.toFixed(1)}`).join(" "),K="M32,136 "+P.map(([L,S])=>`L${L.toFixed(1)},${S.toFixed(1)}`).join(" ")+` L${P[C][0].toFixed(1)},136 Z`,N=32+t/$*260,D=1-Math.exp(-Math.pow(t/d,o)),O=136-D*128,bt=((1-D)*100).toFixed(0),X=32+e/$*260,yt=[0,.25,.5,.75,1];return a`
|
||||
`}function Ut(o,d,t,e,i){let $=Math.max(t,e,d,1)*1.3,P=50,H=[];for(let A=0;A<=P;A++){let S=A/P*$,Et=1-Math.exp(-Math.pow(S/d,o)),It=32+S/$*260,Tt=136-Et*128;H.push([It,Tt])}let O=H.map(([A,S])=>`${A.toFixed(1)},${S.toFixed(1)}`).join(" "),Z="M32,136 "+H.map(([A,S])=>`L${A.toFixed(1)},${S.toFixed(1)}`).join(" ")+` L${H[P][0].toFixed(1)},136 Z`,N=32+t/$*260,D=1-Math.exp(-Math.pow(t/d,o)),V=136-D*128,kt=((1-D)*100).toFixed(0),tt=32+e/$*260,wt=[0,.25,.5,.75,1];return a`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",i)}">
|
||||
${yt.map(L=>{let S=136-L*128;return z`
|
||||
${wt.map(A=>{let S=136-A*128;return z`
|
||||
<line x1="${32}" y1="${S.toFixed(1)}" x2="${292}" y2="${S.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${L===.5?"4,3":c}" />
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${A===.5?"4,3":c}" />
|
||||
<text x="${28}" y="${(S+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(L*100).toFixed(0)}%</text>
|
||||
font-size="8" text-anchor="end">${(A*100).toFixed(0)}%</text>
|
||||
`})}
|
||||
|
||||
<text x="${32}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">0</text>
|
||||
<text x="${324/2}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round($/2)}</text>
|
||||
<text x="${292}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round($)}</text>
|
||||
|
||||
<path d="${K}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<polyline points="${j}" fill="none"
|
||||
<path d="${Z}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<polyline points="${O}" fill="none"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="2" />
|
||||
|
||||
${t>0?z`
|
||||
<line x1="${N.toFixed(1)}" y1="${8}" x2="${N.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
<circle cx="${N.toFixed(1)}" cy="${O.toFixed(1)}" r="3"
|
||||
<circle cx="${N.toFixed(1)}" cy="${V.toFixed(1)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${(N+4).toFixed(1)}" y="${(O-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${bt}%</text>
|
||||
<text x="${(N+4).toFixed(1)}" y="${(V-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${kt}%</text>
|
||||
`:c}
|
||||
|
||||
${e>0&&e!==t?z`
|
||||
<line x1="${X.toFixed(1)}" y1="${8}" x2="${X.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
<line x1="${tt.toFixed(1)}" y1="${8}" x2="${tt.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:c}
|
||||
|
||||
@@ -1761,7 +1822,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
${t>0?a`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${s("current_interval_marker",i)}</span>`:c}
|
||||
${e>0&&e!==t?a`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",i)}</span>`:c}
|
||||
</div>
|
||||
`}function qt(o,d){return a`
|
||||
`}function jt(o,d){return a`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("characteristic_life",d)}</span>
|
||||
@@ -1774,7 +1835,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
`:c}
|
||||
</div>
|
||||
`}function Nt(o,d,t){let e=o.confidence_interval_low,i=o.confidence_interval_high,n=d.suggested_interval??d.interval_days??0,h=d.interval_days??0,p=Math.max(0,e-5),_=i+5-p,v=(e-p)/_*100,b=(i-e)/_*100,y=(n-p)/_*100,$=h>0?(h-p)/_*100:-1;return a`
|
||||
`}function Ot(o,d,t){let e=o.confidence_interval_low,i=o.confidence_interval_high,n=d.suggested_interval??d.interval_days??0,u=d.interval_days??0,p=Math.max(0,e-5),h=i+5-p,v=(e-p)/h*100,b=(i-e)/h*100,y=(n-p)/h*100,$=u>0?(u-p)/h*100:-1;return a`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",t)}: ${n} ${s("days",t)} (${e}\u2013${i})
|
||||
@@ -1789,7 +1850,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<span class="confidence-text high">${s("confidence_aggressive",t)} (${i}${s("days",t).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function dt(o,d,t){let e=o.degradation_trend!=null&&o.degradation_trend!=="insufficient_data",i=o.days_until_threshold!=null,n=o.environmental_factor!=null&&o.environmental_factor!==1;if(!e&&!i&&!n)return c;let h=o.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":o.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 a`
|
||||
`}function ut(o,d,t){let e=o.degradation_trend!=null&&o.degradation_trend!=="insufficient_data",i=o.days_until_threshold!=null,n=o.environmental_factor!=null&&o.environmental_factor!==1;if(!e&&!i&&!n)return c;let u=o.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":o.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 a`
|
||||
<div class="prediction-section">
|
||||
${o.sensor_prediction_urgency?a`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -1804,7 +1865,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="prediction-grid">
|
||||
${e?a`
|
||||
<div class="prediction-item">
|
||||
<ha-svg-icon path="${h}"></ha-svg-icon>
|
||||
<ha-svg-icon path="${u}"></ha-svg-icon>
|
||||
<span class="prediction-label">${s("degradation_trend",d)}</span>
|
||||
<span class="prediction-value ${o.degradation_trend}">${s("trend_"+o.degradation_trend,d)}</span>
|
||||
${o.degradation_rate!=null?a`<span class="prediction-rate">${o.degradation_rate>0?"+":""}${Math.abs(o.degradation_rate)>=10?Math.round(o.degradation_rate).toLocaleString():o.degradation_rate.toFixed(1)} ${o.trigger_entity_info?.unit_of_measurement||""}/${s("day_short",d)}</span>`:c}
|
||||
@@ -1815,7 +1876,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<ha-svg-icon path="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z"></ha-svg-icon>
|
||||
<span class="prediction-label">${s("days_until_threshold",d)}</span>
|
||||
<span class="prediction-value prediction-days${o.days_until_threshold===0?" exceeded":o.sensor_prediction_urgency?" urgent":""}">${o.days_until_threshold===0?s("threshold_exceeded",d):"~"+Math.round(o.days_until_threshold)+" "+s("days",d)}</span>
|
||||
${o.threshold_prediction_date?a`<span class="prediction-date">${q(o.threshold_prediction_date,d)}</span>`:c}
|
||||
${o.threshold_prediction_date?a`<span class="prediction-date">${M(o.threshold_prediction_date,d)}</span>`:c}
|
||||
${o.threshold_prediction_confidence?a`<span class="confidence-dot ${o.threshold_prediction_confidence}"></span>`:c}
|
||||
</div>
|
||||
`:c}
|
||||
@@ -1824,12 +1885,12 @@ ${m?`<div class="sub">${m}</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>
|
||||
<span class="prediction-label">${s("environmental_adjustment",d)}</span>
|
||||
<span class="prediction-value">${o.environmental_factor.toFixed(2)}x</span>
|
||||
${o.environmental_entity?a`<span class="prediction-entity entity-link" @click=${p=>st(p,o.environmental_entity)}>${o.environmental_entity}</span>`:c}
|
||||
${o.environmental_entity?a`<span class="prediction-entity entity-link" @click=${p=>nt(p,o.environmental_entity)}>${o.environmental_entity}</span>`:c}
|
||||
</div>
|
||||
`:c}
|
||||
</div>
|
||||
</div>
|
||||
`}function ct(o,d,t,e){let i=Math.max(o||1,d);return a`
|
||||
`}function _t(o,d,t,e){let i=Math.max(o||1,d);return a`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -1847,13 +1908,13 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
style="width: ${Math.min(d/i*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var pt=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function ht(o,d,t){if(!t.seasonal||!o.seasonal_factor||o.seasonal_factor===1)return c;let e=pt.map(p=>s(p,d)),i=new Date().getMonth(),n=o.seasonal_factors||o.interval_analysis?.seasonal_factors||null,h=n&&n.length===12?n:e.map((p,m)=>{let _=o.seasonal_factor||1,v=Math.sin((m-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,_+v))});return a`
|
||||
`}var mt=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function gt(o,d,t){if(!t.seasonal||!o.seasonal_factor||o.seasonal_factor===1)return c;let e=mt.map(p=>s(p,d)),i=new Date().getMonth(),n=o.seasonal_factors||o.interval_analysis?.seasonal_factors||null,u=n&&n.length===12?n:e.map((p,m)=>{let h=o.seasonal_factor||1,v=Math.sin((m-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,h+v))});return a`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",d)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
${h.map((p,m)=>{let _=p*40,v=p<.9?"low":p>1.1?"high":"normal";return a`
|
||||
${u.map((p,m)=>{let h=p*40,v=p<.9?"low":p>1.1?"high":"normal";return a`
|
||||
<div class="seasonal-bar ${v} ${m===i?"current":""}"
|
||||
style="height: ${_}px"
|
||||
style="height: ${h}px"
|
||||
title="${e[m]}: ${p.toFixed(2)}x">
|
||||
</div>
|
||||
`})}
|
||||
@@ -1864,30 +1925,30 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${s("longer",d)||"L\xE4nger"}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function ut(o,d){return zt(o,d)}function zt(o,d){let t=o.seasonal_factors??o.interval_analysis?.seasonal_factors;if(!t||t.length!==12)return c;let e=o.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,h=100,p=8,_=h-p-4,v=Math.max(...t,1.5),b=n/12,y=b*.65,$=p+_-1/v*_;return a`
|
||||
`}function vt(o,d){return Dt(o,d)}function Dt(o,d){let t=o.seasonal_factors??o.interval_analysis?.seasonal_factors;if(!t||t.length!==12)return c;let e=o.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,u=100,p=8,h=u-p-4,v=Math.max(...t,1.5),b=n/12,y=b*.65,$=p+h-1/v*h;return a`
|
||||
<div class="seasonal-chart">
|
||||
<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>
|
||||
${s("seasonal_chart_title",d)}
|
||||
${e?a`<span class="source-tag">${e==="learned"?s("seasonal_learned",d):s("seasonal_manual",d)}</span>`:c}
|
||||
</div>
|
||||
<svg viewBox="0 0 ${n} ${h}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",d)}">
|
||||
<svg viewBox="0 0 ${n} ${u}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",d)}">
|
||||
<line x1="0" y1="${$.toFixed(1)}" x2="${n}" y2="${$.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||
${t.map((C,P)=>{let j=C/v*_,K=P*b+(b-y)/2,N=p+_-j,D=P===i,O=C<1?"var(--success-color, #4caf50)":C>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return z`
|
||||
<rect x="${K.toFixed(1)}" y="${N.toFixed(1)}"
|
||||
width="${y.toFixed(1)}" height="${j.toFixed(1)}"
|
||||
fill="${O}" opacity="${D?1:.5}" rx="2" />
|
||||
${t.map((P,H)=>{let O=P/v*h,Z=H*b+(b-y)/2,N=p+h-O,D=H===i,V=P<1?"var(--success-color, #4caf50)":P>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return z`
|
||||
<rect x="${Z.toFixed(1)}" y="${N.toFixed(1)}"
|
||||
width="${y.toFixed(1)}" height="${O.toFixed(1)}"
|
||||
fill="${V}" opacity="${D?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${pt.map((C,P)=>a`<span class="seasonal-label ${P===i?"active-month":""}">${s(C,d)}</span>`)}
|
||||
${mt.map((P,H)=>a`<span class="seasonal-label ${H===i?"active-month":""}">${s(P,d)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var k=class extends E{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(t,e){this._entryId=t,this._taskId=e,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 t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let e=(t.tasks||[]).find(i=>i.id===this._taskId);this._task=e??null}catch(t){this._error=I(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(e){return this._error=I(e,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-XJHMLPL4.js").then(({openCompleteDialog:t})=>{t({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||import("./dialog-mount-XJHMLPL4.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-XJHMLPL4.js").then(({openQrDialog:t})=>{t({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 t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))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 t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),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=s("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 t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${t.recommended_interval}d (${t.data_points} pts)`:s("reanalyze_insufficient_data",this._lang)||"Not enough data",await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(t){this._error=I(t,this._lang)}finally{this._busy=!1}}}_onEditHistoryEntry(
Line truncated
|
||||
`}var k=class extends E{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(t,e){this._entryId=t,this._taskId=e,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 t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let e=(t.tasks||[]).find(i=>i.id===this._taskId);this._task=e??null}catch(t){this._error=I(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(e){return this._error=I(e,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-UUGV3XIE.js").then(({openCompleteDialog:t})=>{t({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||import("./dialog-mount-UUGV3XIE.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-UUGV3XIE.js").then(({openQrDialog:t})=>{t({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 t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))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 t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),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=s("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 t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${rt(t.recommended_interval,"days",this._lang)} (${t.data_points} pts)`:s("reanalyze_insufficient_data",this._lang)||"Not enough data",await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(t){this._error=I(t,this._lang)}finally{this._busy=!1}}
Line truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",e)}</h4>
|
||||
${ct(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",e)}
|
||||
${_t(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",e)}
|
||||
<div class="recommendation-actions">
|
||||
<button class="btn primary"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
@@ -1901,20 +1962,20 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`}_renderAdaptive(t){let e=this._lang,i=this._features.adaptive&&t.suggested_interval&&t.suggested_interval!==t.interval_days,n=t.degradation_trend!=null&&t.degradation_trend!=="insufficient_data"||t.days_until_threshold!=null||t.environmental_factor!=null&&t.environmental_factor!==1,h=this._features.adaptive&&t.interval_analysis?.weibull_beta!=null&&t.interval_analysis?.weibull_eta!=null,p=this._features.seasonal&&t.seasonal_factor&&t.seasonal_factor!==1;return!i&&!n&&!h&&!p?a`<div class="adaptive-empty">
|
||||
`}_renderAdaptive(t){let e=this._lang,i=this._features.adaptive&&t.suggested_interval&&t.suggested_interval!==t.interval_days,n=t.degradation_trend!=null&&t.degradation_trend!=="insufficient_data"||t.days_until_threshold!=null||t.environmental_factor!=null&&t.environmental_factor!==1,u=this._features.adaptive&&t.interval_analysis?.weibull_beta!=null&&t.interval_analysis?.weibull_eta!=null,p=this._features.seasonal&&t.seasonal_factor&&t.seasonal_factor!==1;return!i&&!n&&!u&&!p?a`<div class="adaptive-empty">
|
||||
${s("adaptive_no_data",e)||"Not enough completion history yet for adaptive analysis."}
|
||||
</div>`:a`
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?a`<div class="toast">${this._toast}</div>`:c}
|
||||
${i?this._renderRecommendation(t):c}
|
||||
${n?dt(t,e,this._features):c}
|
||||
${h?lt(t,e):c}
|
||||
${n?ut(t,e,this._features):c}
|
||||
${u?ht(t,e):c}
|
||||
${p?a`
|
||||
${ht(t,e,this._features)}
|
||||
${t.seasonal_factors?.length===12||t.interval_analysis?.seasonal_factors?.length===12?ut(t,e):c}
|
||||
${gt(t,e,this._features)}
|
||||
${t.seasonal_factors?.length===12||t.interval_analysis?.seasonal_factors?.length===12?vt(t,e):c}
|
||||
`:c}
|
||||
</div>
|
||||
`}_renderDetails(t){let e=this._lang,i=t.history||[],n=i.filter(m=>m.type==="completed"),h=n.reduce((m,_)=>m+(typeof _.cost=="number"?_.cost:0),0),p=(()=>{let m=n.map(_=>typeof _.duration=="number"?_.duration:null).filter(_=>_!=null);return m.length?Math.round(m.reduce((_,v)=>_+v,0)/m.length):null})();return a`
|
||||
`}_renderDetails(t){let e=this._lang,i=t.history||[],n=i.filter(m=>m.type==="completed"),u=n.reduce((m,h)=>m+(typeof h.cost=="number"?h.cost:0),0),p=(()=>{let m=n.map(h=>typeof h.duration=="number"?h.duration:null).filter(h=>h!=null);return m.length?Math.round(m.reduce((h,v)=>h+v,0)/m.length):null})();return a`
|
||||
<div class="details">
|
||||
<div class="stats-grid">
|
||||
<div class="stat">
|
||||
@@ -1923,7 +1984,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("total_cost",e)||"Total cost"}</span>
|
||||
<span class="stat-value">${h.toFixed(2)}</span>
|
||||
<span class="stat-value">${u.toFixed(2)}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("avg_duration",e)||"Avg duration"}</span>
|
||||
@@ -1936,12 +1997,12 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
${i.length===0?a`<div class="history-empty">${s("history_empty",e)||"No history yet."}</div>`:a`
|
||||
<div class="history-list">
|
||||
${[...i].reverse().slice(0,20).map(m=>{let _=["completed","reset","skipped"].includes(m.type);return a`
|
||||
${[...i].reverse().slice(0,20).map(m=>{let h=["completed","reset","skipped"].includes(m.type);return a`
|
||||
<div class="history-entry">
|
||||
<div class="history-line">
|
||||
<span class="history-type type-${m.type}">${s(m.type,e)}</span>
|
||||
<span class="history-date">${et(m.timestamp,e)}</span>
|
||||
${_?a`<button class="history-edit"
|
||||
<span class="history-date">${st(m.timestamp,e)}</span>
|
||||
${h?a`<button class="history-edit"
|
||||
title="${s("history_edit_button",e)||"Edit"}"
|
||||
@click=${()=>this._onEditHistoryEntry(m)}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
@@ -1964,16 +2025,16 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
${e?a`
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="status-dot" style="background: ${V[e.status]||"#ccc"}"></span>
|
||||
<span class="status-dot" style="background: ${W[e.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${e.name}</span>
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-XJHMLPL4.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-UUGV3XIE.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${e.next_due?a`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${q(e.next_due,t)}</span>`:c}
|
||||
${e.last_performed?a`<span><strong>${s("last_performed",t)||"Last"}:</strong> ${q(e.last_performed,t)}</span>`:c}
|
||||
${e.schedule?.kind&&!["manual","one_time"].includes(e.schedule.kind)||e.interval_days!=null?a`<span><strong>${s("interval",t)||"Interval"}:</strong> ${it(e,t)}</span>`:c}
|
||||
${e.next_due?a`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${M(e.next_due,t)}</span>`:c}
|
||||
${e.last_performed?a`<span><strong>${s("last_performed",t)||"Last"}:</strong> ${M(e.last_performed,t)}</span>`:c}
|
||||
${e.schedule?.kind&&!["manual","one_time"].includes(e.schedule.kind)||e.interval_days!=null?a`<span><strong>${s("interval",t)||"Interval"}:</strong> ${at(e,t)}</span>`:c}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2065,7 +2126,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
`}
|
||||
`:a`<div class="loading">${s("loading",t)||"Loading\u2026"}</div>`}
|
||||
</div>
|
||||
`}};k.styles=[at,w`
|
||||
`}};k.styles=[lt,w`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
@@ -2245,7 +2306,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],r([g({attribute:!1})],k.prototype,"hass",2),r([l()],k.prototype,"_open",2),r([l()],k.prototype,"_entryId",2),r([l()],k.prototype,"_taskId",2),r([l()],k.prototype,"_task",2),r([l()],k.prototype,"_objectName",2),r([l()],k.prototype,"_busy",2),r([l()],k.prototype,"_error",2),r([l()],k.prototype,"_showSkip",2),r([l()],k.prototype,"_showReset",2),r([l()],k.prototype,"_showDetails",2),r([l()],k.prototype,"_showAdaptive",2),r([l()],k.prototype,"_skipReason",2),r([l()],k.prototype,"_resetDate",2),r([l()],k.prototype,"_features",2),r([l()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function _t(o){return!!o&&/^https?:\/\//i.test(o)}var H=class extends E{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(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=I(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-XJHMLPL4.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-XJHMLPL4.js").then(({openCreateTaskDialog:t})=>{t(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){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(e){this._error=I(e,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let e=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(e))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"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(e){this._error=I(e,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-XJHMLPL4.js").then(({openTaskQuickActions:e})=>{e(this._entryId,t)})}render(){if(!this._open)return c;let t=this._lang,e=this._data,i=e?.object,n=e?.tasks||[],h=this.hass?.user?.is_admin??!0;return a`
|
||||
`],r([g({attribute:!1})],k.prototype,"hass",2),r([l()],k.prototype,"_open",2),r([l()],k.prototype,"_entryId",2),r([l()],k.prototype,"_taskId",2),r([l()],k.prototype,"_task",2),r([l()],k.prototype,"_objectName",2),r([l()],k.prototype,"_busy",2),r([l()],k.prototype,"_error",2),r([l()],k.prototype,"_showSkip",2),r([l()],k.prototype,"_showReset",2),r([l()],k.prototype,"_showDetails",2),r([l()],k.prototype,"_showAdaptive",2),r([l()],k.prototype,"_skipReason",2),r([l()],k.prototype,"_resetDate",2),r([l()],k.prototype,"_features",2),r([l()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function ft(o){return!!o&&/^https?:\/\//i.test(o)}var C=class extends E{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(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=I(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-UUGV3XIE.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-UUGV3XIE.js").then(({openCreateTaskDialog:t})=>{t(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){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(e){this._error=I(e,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let e=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(e))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"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(e){this._error=I(e,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-UUGV3XIE.js").then(({openTaskQuickActions:e})=>{e(this._entryId,t)})}render(){if(!this._open)return c;let t=this._lang,e=this._data,i=e?.object,n=e?.tasks||[],u=this.hass?.user?.is_admin??!0;return a`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${e&&i?a`
|
||||
@@ -2265,7 +2326,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="task-list">
|
||||
${n.map(p=>a`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(p.id)}>
|
||||
<span class="status-dot" style="background: ${V[p.status]||"#ccc"}"></span>
|
||||
<span class="status-dot" style="background: ${W[p.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${p.name}</span>
|
||||
<span class="task-status">${s(p.status||"ok",t)}</span>
|
||||
</div>
|
||||
@@ -2281,7 +2342,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
`:c}
|
||||
|
||||
${h?a`
|
||||
${u?a`
|
||||
<div class="actions">
|
||||
<button class="btn primary" @click=${this._onAddTask} ?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
@@ -2305,14 +2366,14 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
`}_renderMetaRow(t){let e=this._lang,i=[];return t.area_id&&i.push([s("area",e),t.area_id]),t.manufacturer&&i.push([s("manufacturer",e),t.manufacturer]),t.model&&i.push([s("model",e),t.model]),t.serial_number&&i.push([s("serial_number_label",e),t.serial_number]),t.installation_date&&i.push([s("installed",e),t.installation_date]),t.warranty_expiry&&i.push([s("warranty",e),t.warranty_expiry]),t.documentation_url&&i.push([s("documentation_url_label",e),t.documentation_url]),i.length===0?c:a`
|
||||
<div class="meta">
|
||||
${i.map(([n,h])=>a`
|
||||
${i.map(([n,u])=>a`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${_t(h)?a`<a href="${h}" target="_blank" rel="noopener noreferrer">${h}</a>`:h}</span>
|
||||
<span class="meta-value">${ft(u)?a`<a href="${u}" target="_blank" rel="noopener noreferrer">${u}</a>`:u}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
`}};H.styles=w`
|
||||
`}};C.styles=w`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
|
||||
@@ -2371,4 +2432,4 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
.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; }
|
||||
`,r([g({attribute:!1})],H.prototype,"hass",2),r([l()],H.prototype,"_open",2),r([l()],H.prototype,"_entryId",2),r([l()],H.prototype,"_data",2),r([l()],H.prototype,"_busy",2),r([l()],H.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",H);var gt="maintenance-object-dialog",vt="maintenance-task-dialog",Ut="maintenance-history-edit-dialog",jt="maintenance-complete-dialog",Dt="maintenance-qr-dialog",Ot="maintenance-task-quick-actions-dialog",Vt="maintenance-object-quick-actions-dialog";function G(){return document.querySelector("home-assistant")?.hass}function F(o){let d=document.body.querySelector(o);return d||(d=document.createElement(o),document.body.appendChild(d)),d}function M(o){let d=G();if(!d)return!1;o.hass=d;let t=d.language||"en";return Q(t)||tt(t).then(()=>{o.requestUpdate?.()}),!0}var mt={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},B=null;function ft(o){return B||(B=o.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(d=>({features:d.features??mt.features,defaultWarningDays:d.general?.default_warning_days??7})).catch(()=>mt),B)}function hi(){let o=F(gt);return M(o)?(o.openCreate(),!0):!1}function ui(o,d){let t=F(gt);return M(t)?(t.openEdit(o,d),!0):!1}function _i(){let o=F(vt);if(!M(o))return!1;let d=G();return d?((async()=>{let t=await ft(d),e=o;e.checklistsEnabled=t.features.checklists,e.scheduleTimeEnabled=t.features.schedule_time,e.completionActionsEnabled=t.features.completion_actions,e.defaultWarningDays=t.defaultWarningDays,e.openCreate()})(),!0):!1}function mi(o,d){let t=F(vt);if(!M(t))return!1;let e=G();return e?((async()=>{try{let[i,n]=await Promise.all([e.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:o}),ft(e)]),h=(i.tasks||[]).find(m=>m.id===d);if(!h){console.warn(`openEditTaskDialog: task ${d} not found in entry ${o}`);return}let p=t;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(o,h)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function gi(o){let d=F(Ut);return M(d)?(d.openEdit(o),!0):!1}function vi(o){let d=F(jt);return M(d)?(d.entryId=o.entry_id,d.taskId=o.task_id,d.taskName=o.task_name,d.checklist=o.checklist??[],d.adaptiveEnabled=!!o.adaptive_enabled,d.lang=G()?.language||"en",d.open(),!0):!1}function fi(o){let d=F(Dt);return M(d)?(d.openForTask(o.entry_id,o.task_id,o.object_name,o.task_name),!0):!1}function bi(o,d){let t=F(Ot);return M(t)?(t.openFor(o,d),!0):!1}function yi(o){let d=F(Vt);return M(d)?(d.openFor(o),!0):!1}export{vi as openCompleteDialog,hi as openCreateObjectDialog,_i as openCreateTaskDialog,ui as openEditObjectDialog,mi as openEditTaskDialog,gi as openHistoryEditDialog,yi as openObjectQuickActions,fi as openQrDialog,bi as openTaskQuickActions};
|
||||
`,r([g({attribute:!1})],C.prototype,"hass",2),r([l()],C.prototype,"_open",2),r([l()],C.prototype,"_entryId",2),r([l()],C.prototype,"_data",2),r([l()],C.prototype,"_busy",2),r([l()],C.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",C);var yt="maintenance-object-dialog",$t="maintenance-task-dialog",Vt="maintenance-history-edit-dialog",Wt="maintenance-complete-dialog",Bt="maintenance-qr-dialog",Kt="maintenance-task-quick-actions-dialog",Gt="maintenance-object-quick-actions-dialog";function Y(){return document.querySelector("home-assistant")?.hass}function q(o){let d=document.body.querySelector(o);return d||(d=document.createElement(o),document.body.appendChild(d)),d}function F(o){let d=Y();if(!d)return!1;o.hass=d;let t=d.language||"en";return et(t)||it(t).then(()=>{o.requestUpdate?.()}),!0}var bt={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},G=null;function xt(o){return G||(G=o.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(d=>({features:d.features??bt.features,defaultWarningDays:d.general?.default_warning_days??7})).catch(()=>bt),G)}function ki(){let o=q(yt);return F(o)?(o.openCreate(),!0):!1}function wi(o,d){let t=q(yt);return F(t)?(t.openEdit(o,d),!0):!1}function Ei(){let o=q($t);if(!F(o))return!1;let d=Y();return d?((async()=>{let t=await xt(d),e=o;e.checklistsEnabled=t.features.checklists,e.scheduleTimeEnabled=t.features.schedule_time,e.completionActionsEnabled=t.features.completion_actions,e.defaultWarningDays=t.defaultWarningDays,e.openCreate()})(),!0):!1}function Ii(o,d){let t=q($t);if(!F(t))return!1;let e=Y();return e?((async()=>{try{let[i,n]=await Promise.all([e.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:o}),xt(e)]),u=(i.tasks||[]).find(m=>m.id===d);if(!u){console.warn(`openEditTaskDialog: task ${d} not found in entry ${o}`);return}let p=t;p.checklistsEnabled=n.features.checklists,p.scheduleTimeEnabled=n.features.schedule_time,p.completionActionsEnabled=n.features.completion_actions,p.defaultWarningDays=n.defaultWarningDays,await p.openEdit(o,u)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function Ti(o){let d=q(Vt);return F(d)?(d.openEdit(o),!0):!1}function Li(o){let d=q(Wt);return F(d)?(d.entryId=o.entry_id,d.taskId=o.task_id,d.taskName=o.task_name,d.checklist=o.checklist??[],d.adaptiveEnabled=!!o.adaptive_enabled,d.requiredFields=o.required_completion_fields??[],d.lang=Y()?.language||"en",d.open(),!0):!1}function Ai(o){let d=q(Bt);return F(d)?(d.openForTask(o.entry_id,o.task_id,o.object_name,o.task_name),!0):!1}function Si(o,d){let t=q(Kt);return F(t)?(t.openFor(o,d),!0):!1}function Ci(o){let d=q(Gt);return F(d)?(d.openFor(o),!0):!1}export{Li as openCompleteDialog,ki as openCreateObjectDialog,Ei as openCreateTaskDialog,wi as openEditObjectDialog,Ii as openEditTaskDialog,Ti as openHistoryEditDialog,Ci as openObjectQuickActions,Ai as openQrDialog,Si as openTaskQuickActions};
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import{a as m}from"./chunk-Q7DQUCT7.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-X7OW5OLQ.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`
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
import{a as m}from"./chunk-TF44IC56.js";import{a as u,b as s,d as l,e as h,f as g,g as o,i,k as _,t as p}from"./chunk-RLJYCMAK.js";import{a}from"./chunk-KRBXISES.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">
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import{a as m}from"./chunk-Q7DQUCT7.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-X7OW5OLQ.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`
|
||||
/*! maintenance_supporter frontend 2.44.1 */
|
||||
import{a as m}from"./chunk-TF44IC56.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,t as l}from"./chunk-RLJYCMAK.js";import{a as i}from"./chunk-KRBXISES.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">
|
||||
Reference in new issue
Block a user