updated apps
This commit is contained in:
1 parent
6cc7212cef
commit
010e828e9c
797 files changed
+45153
-4246
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as f}from"./chunk-SHU63LHK.js";import{a as h,b as o,d as b,e as m,f as g,g as n,h as _,j as a,l as v,s as p}from"./chunk-GKOWV2CF.js";import{a as i}from"./chunk-LO2NM3CE.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`
|
||||
import{a as f}from"./chunk-ELFU7VML.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-K74DD3QA.js";import{a as i}from"./chunk-PEGRBZWY.js";var s=class extends m{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=parseFloat(this._localMonthly),e=parseFloat(this._localYearly),r={};!isNaN(t)&&t>=0&&(r.budget_monthly=t),!isNaN(e)&&e>=0&&(r.budget_yearly=e),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:r}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._status;if(!e)return o`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=e.currency_symbol||_,l=e.monthly_budget?Math.min(100,(e.monthly_spent||0)/e.monthly_budget*100):0,d=e.yearly_budget?Math.min(100,(e.yearly_spent||0)/e.yearly_budget*100):0,u=l>=100?"danger":l>=80?"warning":"ok",y=d>=100?"danger":d>=80?"warning":"ok";return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as r}from"./chunk-GKOWV2CF.js";var a=r`
|
||||
import{a as r}from"./chunk-K74DD3QA.js";var a=r`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
+25
-9
@@ -1,13 +1,26 @@
|
||||
var D=globalThis,L=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,F=Symbol(),re=new WeakMap,$=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==F)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(L&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=re.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&re.set(t,e))}return e}toString(){return this.cssText}},ne=r=>new $(typeof r=="string"?r:r+"",void 0,F),I=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((o,n,i)=>o+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[i+1],r[0]);return new $(t,r,F)},ie=(r,e)=>{if(L)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),n=D.litNonce;n!==void 0&&o.setAttribute("nonce",n),o.textContent=t.cssText,r.appendChild(o)}},B=L?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return ne(t)})(r):r;var{is:Ee,defineProperty:Ce,getOwnPropertyDescriptor:je,getOwnPropertyNames:Ne,getOwnPropertySymbols:Te,getPrototypeOf:Re}=Object,M=globalThis,ae=M.trustedTypes,ze=ae?ae.emptyScript:"",Pe=M.reactiveElementPolyfillSupport,E=(r,e)=>r,C={toAttribute(r,e){switch(e){case Boolean:r=r?ze:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},U=(r,e)=>!Ee(r,e),se={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:U};Symbol.metadata??=Symbol("metadata"),M.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=se){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 o=Symbol(),n=this.getPropertyDescriptor(e,o,t);n!==void 0&&Ce(this.prototype,e,n)}}static getPropertyDescriptor(e,t,o){let{get:n,set:i}=je(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:n,set(a){let l=n?.call(this);i?.call(this,a),this.requestUpdate(e,l,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=Re(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,o=[...Ne(t),...Te(t)];for(let n of o)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,n]of t)this.elementProperties.set(o,n)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let n=this._$Eu(t,o);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let o=new Set(e.flat(1/0).reverse());for(let n of o)t.unshift(B(n))}else e!==void 0&&t.push(B(e));return t}static _$Eu(e,t){let o=t.attribute;return o===!1?void 0:typeof o=="string"?o: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 o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);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,o){this._$AK(e,o)}_$ET(e,t){let o=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,o);if(n!==void 0&&o.reflect===!0){let i=(o.converter?.toAttribute!==void 0?o.converter:C).toAttribute(t,o.type);this._$Em=e,i==null?this.removeAttribute(n):this.setAttribute(n,i),thLine truncated
|
||||
\f\r]`,j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,de=/-->/g,pe=/>/g,b=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,_e=/"/g,fe=/^(?:script|style|textarea|title)$/i,X=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ze=X(1),Xe=X(2),et=X(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),he=new WeakMap,y=v.createTreeWalker(v,129);function be(r,e){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ce!==void 0?ce.createHTML(e):e}var Le=(r,e)=>{let t=r.length-1,o=[],n,i=e===2?"<svg>":e===3?"<math>":"",a=j;for(let l=0;l<t;l++){let s=r[l],d,u,c=-1,h=0;for(;h<s.length&&(a.lastIndex=h,u=a.exec(s),u!==null);)h=a.lastIndex,a===j?u[1]==="!--"?a=de:u[1]!==void 0?a=pe:u[2]!==void 0?(fe.test(u[2])&&(n=RegExp("</"+u[2],"g")),a=b):u[3]!==void 0&&(a=b):a===b?u[0]===">"?(a=n??j,c=-1):u[1]===void 0?c=-2:(c=a.lastIndex-u[2].length,d=u[1],a=u[3]===void 0?b:u[3]==='"'?_e:ue):a===_e||a===ue?a=b:a===de||a===pe?a=j:(a=b,n=void 0);let m=a===b&&r[l+1].startsWith("/>")?" ":"";i+=a===j?s+Oe:c>=0?(o.push(d),s.slice(0,c)+ge+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[be(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},R=class r{constructor({strings:e,_$litType$:t},o){let n;this.parts=[];let i=0,a=0,l=e.length-1,s=this.parts,[d,u]=Le(e,t);if(this.el=r.createElement(d,o),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=y.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(ge)){let h=u[a++],m=n.getAttribute(c).split(f),O=/([.?@])?(.*)/.exec(h);s.push({type:1,index:i,name:O[2],strings:m,ctor:O[1]==="."?V:O[1]==="?"?Q:O[1]==="@"?K:S}),n.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:i}),n.removeAttribute(c));if(fe.test(n.tagName)){let c=n.textContent.split(f),h=c.length-1;if(h>0){n.textContent=q?q.emptyScript:"";for(let m=0;m<h;m++)n.append(c[m],N()),y.nextNode(),s.push({type:2,index:++i});n.append(c[h],N())}}}else if(n.nodeType===8)if(n.data===me)s.push({type:2,index:i});else{let c=-1;for(;(c=n.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:i}),c+=f.length-1}i++}}static createElement(e,t){let o=v.createElement("template");return o.innerHTML=e,o}};function k(r,e,t=r,o){if(e===x)return e;let n=o!==void 0?t._$Co?.[o]:t._$Cl,i=T(e)?void 0:e._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),i===void 0?n=void 0:(n=new i(r),n._$AT(r,t,o)),o!==void 0?(t._$Co??=[])[o]=n:t._$Cl=n),n!==void 0&&(e=k(r,n._$AS(r,e.values),n,o)),e}var G=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:o}=this._$AD,n=(e?.creationScope??v).importNode(t,!0);y.currentNode=n;let i=y.nextNode(),a=0,l=0,s=o[0];for(;s!==void 0;){if(a===s.index){let d;s.type===2?d=new z(i,i.nextSibling,this,e):s.type===1?d=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(d=new J(i,this,e)),this._$AV.push(d),s=o[++l]}a!==s?.index&&(i=y.nextNode(),a++)}return y.currentNode=v,n}p(e){let t=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},z=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,n){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=n,this._$Cv=n?.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),T(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):De(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&&T(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:o}=e,n=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=R.createElement(be(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===n)this._$AH.p(t);else{let i=new G(n,this),a=i.u(this.options);i.p(t),this.T(a),this._$AH=i}}_$AC(e){let t=he.get(e.strings);return t===void 0&&he.set(e.strings,t=new R(e)),t}k(e){Z(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,n=0;for(let i of e)n===t.length?t.push(o=new r(this.O(N()),this.O(N()),this,this.options)):o=t[n],o._$AI(i),n++;n<t.length&&(this._$AR(o&&o._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=le(e).nextSibling;le(e).remove(),e=o}}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,o,n,i){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=Line truncated
|
||||
var L=globalThis,D=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,F=Symbol(),re=new WeakMap,$=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==F)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(D&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=re.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&re.set(t,e))}return e}toString(){return this.cssText}},ne=r=>new $(typeof r=="string"?r:r+"",void 0,F),M=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((o,n,a)=>o+(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.")})(n)+r[a+1],r[0]);return new $(t,r,F)},ae=(r,e)=>{if(D)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),n=L.litNonce;n!==void 0&&o.setAttribute("nonce",n),o.textContent=t.cssText,r.appendChild(o)}},B=D?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return ne(t)})(r):r;var{is:Ee,defineProperty:Ce,getOwnPropertyDescriptor:Te,getOwnPropertyNames:je,getOwnPropertySymbols:Ne,getPrototypeOf:Re}=Object,U=globalThis,ie=U.trustedTypes,ze=ie?ie.emptyScript:"",Pe=U.reactiveElementPolyfillSupport,E=(r,e)=>r,C={toAttribute(r,e){switch(e){case Boolean:r=r?ze:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},q=(r,e)=>!Ee(r,e),se={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:q};Symbol.metadata??=Symbol("metadata"),U.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=se){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 o=Symbol(),n=this.getPropertyDescriptor(e,o,t);n!==void 0&&Ce(this.prototype,e,n)}}static getPropertyDescriptor(e,t,o){let{get:n,set:a}=Te(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:n,set(i){let l=n?.call(this);a?.call(this,i),this.requestUpdate(e,l,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=Re(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,o=[...je(t),...Ne(t)];for(let n of o)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,n]of t)this.elementProperties.set(o,n)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let n=this._$Eu(t,o);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let o=new Set(e.flat(1/0).reverse());for(let n of o)t.unshift(B(n))}else e!==void 0&&t.push(B(e));return t}static _$Eu(e,t){let o=t.attribute;return o===!1?void 0:typeof o=="string"?o: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 o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ae(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,o){this._$AK(e,o)}_$ET(e,t){let o=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,o);if(n!==void 0&&o.reflect===!0){let a=(o.converter?.toAttribute!==void 0?o.converter:C).toAttribute(t,o.type);this._$Em=e,a==null?this.removeAttribute(n):this.setAttribute(n,a),thLine truncated
|
||||
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,de=/-->/g,pe=/>/g,b=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),_e=/'/g,ue=/"/g,fe=/^(?:script|style|textarea|title)$/i,X=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ze=X(1),Xe=X(2),et=X(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),he=new WeakMap,y=v.createTreeWalker(v,129);function be(r,e){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ce!==void 0?ce.createHTML(e):e}var De=(r,e)=>{let t=r.length-1,o=[],n,a=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=r[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=de:_[1]!==void 0?i=pe:_[2]!==void 0?(fe.test(_[2])&&(n=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=n??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?ue:_e):i===ue||i===_e?i=b:i===de||i===pe?i=T:(i=b,n=void 0);let m=i===b&&r[l+1].startsWith("/>")?" ":"";a+=i===T?s+Oe:c>=0?(o.push(d),s.slice(0,c)+ge+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[be(r,a+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},R=class r{constructor({strings:e,_$litType$:t},o){let n;this.parts=[];let a=0,i=0,l=e.length-1,s=this.parts,[d,_]=De(e,t);if(this.el=r.createElement(d,o),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=y.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(ge)){let h=_[i++],m=n.getAttribute(c).split(f),O=/([.?@])?(.*)/.exec(h);s.push({type:1,index:a,name:O[2],strings:m,ctor:O[1]==="."?V:O[1]==="?"?Q:O[1]==="@"?K:S}),n.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:a}),n.removeAttribute(c));if(fe.test(n.tagName)){let c=n.textContent.split(f),h=c.length-1;if(h>0){n.textContent=H?H.emptyScript:"";for(let m=0;m<h;m++)n.append(c[m],j()),y.nextNode(),s.push({type:2,index:++a});n.append(c[h],j())}}}else if(n.nodeType===8)if(n.data===me)s.push({type:2,index:a});else{let c=-1;for(;(c=n.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:a}),c+=f.length-1}a++}}static createElement(e,t){let o=v.createElement("template");return o.innerHTML=e,o}};function k(r,e,t=r,o){if(e===x)return e;let n=o!==void 0?t._$Co?.[o]:t._$Cl,a=N(e)?void 0:e._$litDirective$;return n?.constructor!==a&&(n?._$AO?.(!1),a===void 0?n=void 0:(n=new a(r),n._$AT(r,t,o)),o!==void 0?(t._$Co??=[])[o]=n:t._$Cl=n),n!==void 0&&(e=k(r,n._$AS(r,e.values),n,o)),e}var G=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:o}=this._$AD,n=(e?.creationScope??v).importNode(t,!0);y.currentNode=n;let a=y.nextNode(),i=0,l=0,s=o[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new z(a,a.nextSibling,this,e):s.type===1?d=new s.ctor(a,s.name,s.strings,this,e):s.type===6&&(d=new J(a,this,e)),this._$AV.push(d),s=o[++l]}i!==s?.index&&(a=y.nextNode(),i++)}return y.currentNode=v,n}p(e){let t=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},z=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,n){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=n,this._$Cv=n?.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):Le(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$:o}=e,n=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=R.createElement(be(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===n)this._$AH.p(t);else{let a=new G(n,this),i=a.u(this.options);a.p(t),this.T(i),this._$AH=a}}_$AC(e){let t=he.get(e.strings);return t===void 0&&he.set(e.strings,t=new R(e)),t}k(e){Z(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,n=0;for(let a of e)n===t.length?t.push(o=new r(this.O(j()),this.O(j()),this,this.options)):o=t[n],o._$AI(a),n++;n<t.length&&(this._$AR(o&&o._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=le(e).nextSibling;le(e).remove(),e=o}}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,o,n,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=Line 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 {
|
||||
padding: 8px 10px; font-size: 14px;
|
||||
background: var(--secondary-background-color, rgba(0,0,0,0.06));
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||
`,Xt=M`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
--maint-overdue-color: var(--error-color, #f44336);
|
||||
--maint-triggered-color: #ff5722;
|
||||
/* Theme-token first so it follows dark/custom themes (was a bare #ff5722,
|
||||
inconsistent with STATUS_COLORS.triggered which already tokenised it). */
|
||||
--maint-triggered-color: var(--deep-orange-color, #ff5722);
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
@@ -29,14 +42,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
/* Shape icon so status is not conveyed by colour alone (accessibility). */
|
||||
.status-badge ha-icon { --mdc-icon-size: 14px; margin-left: -1px; }
|
||||
|
||||
.status-badge.ok { background-color: var(--maint-ok-color); }
|
||||
.status-badge.due_soon { background-color: var(--maint-due-soon-color); }
|
||||
/* Light-background statuses (green/orange/grey) carry DARK text: white on
|
||||
them fails even the 3:1 WCAG UI-contrast floor (2.2–2.8:1), while the
|
||||
saturated statuses below keep white (≥3.1:1). Matches the calendar pills. */
|
||||
.status-badge.ok { background-color: var(--maint-ok-color); color: #000; }
|
||||
.status-badge.due_soon { background-color: var(--maint-due-soon-color); color: #000; }
|
||||
.status-badge.overdue { background-color: var(--maint-overdue-color); }
|
||||
.status-badge.triggered { background-color: var(--maint-triggered-color); }
|
||||
/* Completed one-time task ("done") — muted blue-grey. */
|
||||
.status-badge.done { background-color: var(--maint-done-color, #78909c); }
|
||||
/* v2.10.0: archived (retire-but-retain) — neutral grey, clearly inert. */
|
||||
.status-badge.archived { background-color: var(--disabled-color, #9e9e9e); }
|
||||
.status-badge.archived { background-color: var(--disabled-color, #9e9e9e); color: #000; }
|
||||
/* v2.20 (N3): paused — frozen but present, info blue. */
|
||||
.status-badge.paused { background-color: var(--info-color, #2196f3); }
|
||||
|
||||
@@ -1130,7 +1146,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.stat-item { min-width: 60px; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var We={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 Ge(r,e){let t=We[r];if(!t)return r;let o=_(t,e);return o&&o!==t?o:r}function Ve(r){let t=r.match(/data\['([^']+)'\]/)?.[1],o;return(o=r.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:o[1]}:(o=r.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:o[1]}:(o=r.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:o[1]}:(o=r.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:o[1]}:/required key not provided/.test(r)?{field:t,rule:"required"}:(o=r.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:o[1]}:/value must be one of/.test(r)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(r)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function eo(r,e,t){if(t=t??_("action_error",e),typeof r=="string")return r;if(typeof r!="object"||r===null)return t;let o=r,n=o.message||o.error?.message||"";if(!n)return t;let i=Ve(n),a=i.field?Ge(i.field,e):"",l=s=>_(s,e).replace("{field}",a).replace("{n}",i.param??"");switch(i.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}",i.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return n||t}}export{I as a,Ze as b,Xe as c,p as d,A as e,ve as f,mt as g,Bt as h,Wt as i,_ as j,Gt as k,Vt as l,we as m,Qt as n,Se as o,Kt as p,Jt as q,Yt as r,eo as s};
|
||||
`;var We={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 Ge(r,e){let t=We[r];if(!t)return r;let o=u(t,e);return o&&o!==t?o:r}function Ve(r){let t=r.match(/data\['([^']+)'\]/)?.[1],o;return(o=r.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:o[1]}:(o=r.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:o[1]}:(o=r.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:o[1]}:(o=r.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:o[1]}:/required key not provided/.test(r)?{field:t,rule:"required"}:(o=r.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:o[1]}:/value must be one of/.test(r)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(r)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function ro(r,e,t){if(t=t??u("action_error",e),typeof r=="string")return r;if(typeof r!="object"||r===null)return t;let o=r,n=o.message||o.error?.message||"";if(!n)return t;let a=Ve(n),i=a.field?Ge(a.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",a.param??"");switch(a.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}",a.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return n||t}}export{M as a,Ze as b,Xe as c,p as d,A as e,ve as f,mt as g,Gt as h,u as i,Vt as j,Qt as k,we as l,Kt as m,Se as n,Jt as o,Yt as p,Zt as q,Xt as r,ro as s};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
@@ -1 +0,0 @@
|
||||
var h=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=(g,b,d,c)=>{for(var a=c>1?void 0:c?i(b,d):b,e=g.length-1,f;e>=0;e--)(f=g[e])&&(a=(c?f(b,d,a):f(a))||a);return c&&a&&h(b,d,a),a};export{j as a};
|
||||
@@ -0,0 +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};
|
||||
+234
-175
@@ -1,4 +1,4 @@
|
||||
import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l as J,m as N,n as X,o as Q,p as tt,q as et,r as it,s as k}from"./chunk-GKOWV2CF.js";import{a}from"./chunk-LO2NM3CE.js";var E=class extends x{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 r`
|
||||
import{a as w,b as r,c as N,d as c,e as E,f as g,g as l,i as s,j as Z,k as J,l as U,m as X,n as Q,o as tt,p as et,q as it,r as st,s as I}from"./chunk-K74DD3QA.js";import{a,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 r`
|
||||
<label class="field">
|
||||
${this.label?r`<span class="label">${this.label}${this.required?r`<span class="req">*</span>`:c}</span>`:c}
|
||||
<input
|
||||
@@ -16,7 +16,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
/>
|
||||
${this.helper?r`<span class="helper">${this.helper}</span>`:c}
|
||||
</label>
|
||||
`}};E.styles=$`
|
||||
`}};T.styles=w`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
@@ -50,7 +50,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,a([g()],E.prototype,"label",2),a([g()],E.prototype,"value",2),a([g()],E.prototype,"placeholder",2),a([g()],E.prototype,"type",2),a([g({type:Boolean})],E.prototype,"required",2),a([g({type:Boolean})],E.prototype,"disabled",2),a([g()],E.prototype,"step",2),a([g()],E.prototype,"min",2),a([g()],E.prototype,"max",2),a([g()],E.prototype,"pattern",2),a([g()],E.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",E);var f=class extends x{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(t,e){this._entryId=t,this._name=e.name||"",this._manufacturer=e.manufacturer||"",this._model=e.model||"",this._serialNumber=e.serial_number||"",this._areaId=e.area_id||"",this._installationDate=e.installation_date||"",this._warrantyExpiry=e.warranty_expiry||"",this._documentationUrl=e.documentation_url||"",this._notes=e.notes||"",this._haDeviceId=e.ha_device_id||"",this._parentEntryId=e.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(t){this._error=k(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(t=>t.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return r``;let t=this._lang,e=this._entryId?s("edit_object",t):s("new_object",t);return r`
|
||||
`,a([g()],T.prototype,"label",2),a([g()],T.prototype,"value",2),a([g()],T.prototype,"placeholder",2),a([g()],T.prototype,"type",2),a([g({type:Boolean})],T.prototype,"required",2),a([g({type:Boolean})],T.prototype,"disabled",2),a([g()],T.prototype,"step",2),a([g()],T.prototype,"min",2),a([g()],T.prototype,"max",2),a([g()],T.prototype,"pattern",2),a([g()],T.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",T);var x=class extends E{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(t,e){this._entryId=t,this._name=e.name||"",this._manufacturer=e.manufacturer||"",this._model=e.model||"",this._serialNumber=e.serial_number||"",this._areaId=e.area_id||"",this._installationDate=e.installation_date||"",this._warrantyExpiry=e.warranty_expiry||"",this._documentationUrl=e.documentation_url||"",this._notes=e.notes||"",this._haDeviceId=e.ha_device_id||"",this._parentEntryId=e.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(t){this._error=I(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(t=>t.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return r``;let t=this._lang,e=this._entryId?s("edit_object",t):s("new_object",t);return r`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${e}</div>
|
||||
<div class="content">
|
||||
@@ -144,7 +144,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};f.styles=$`
|
||||
`}};x.styles=w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -191,22 +191,22 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,a([g({attribute:!1})],f.prototype,"hass",2),a([g({attribute:!1})],f.prototype,"objects",2),a([l()],f.prototype,"_open",2),a([l()],f.prototype,"_loading",2),a([l()],f.prototype,"_error",2),a([l()],f.prototype,"_name",2),a([l()],f.prototype,"_manufacturer",2),a([l()],f.prototype,"_model",2),a([l()],f.prototype,"_serialNumber",2),a([l()],f.prototype,"_areaId",2),a([l()],f.prototype,"_installationDate",2),a([l()],f.prototype,"_warrantyExpiry",2),a([l()],f.prototype,"_documentationUrl",2),a([l()],f.prototype,"_notes",2),a([l()],f.prototype,"_haDeviceId",2),a([l()],f.prototype,"_parentEntryId",2),a([l()],f.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",f);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 $t=["cleaning","inspection","replacement","calibration","service","reading","custom"],xt=["low","normal","high"],kt=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],st=["weekdays","nth_weekday","day_of_month"],at=["threshold","counter","state_change","runtime"],wt=[...at,"compound"];function Et(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function It(n){return{entityIds:(n.entity_ids||(n.entity_id?[n.entity_id]:[])).join(", "),type:n.type||"threshold",above:n.trigger_above?.toString()??"",below:n.trigger_below?.toString()??"",forMinutes:n.trigger_for_minutes?.toString()??"0",targetValue:n.trigger_target_value?.toString()??"",deltaMode:n.trigger_delta_mode||!1,fromState:n.trigger_from_state||"",toState:n.trigger_to_state||"",targetChanges:n.trigger_target_changes?.toString()??"",runtimeHours:n.trigger_runtime_hours?.toString()??""}}function Tt(n){let d=n.entityIds.split(",").map(e=>e.trim()).filter(Boolean);if(d.length===0)return null;let t={entity_id:d[0],entity_ids:d,type:n.type};if(n.type==="threshold"){let e=parseFloat(n.above);isNaN(e)||(t.trigger_above=e);let i=parseFloat(n.below);isNaN(i)||(t.trigger_below=i);let o=parseInt(n.forMinutes,10);isNaN(o)||(t.trigger_for_minutes=o)}else if(n.type==="counter"){let e=parseFloat(n.targetValue);isNaN(e)||(t.trigger_target_value=e),t.trigger_delta_mode=n.deltaMode}else if(n.type==="state_change"){n.fromState&&(t.trigger_from_state=n.fromState),n.toState&&(t.trigger_to_state=n.toState);let e=parseInt(n.targetChanges,10);isNaN(e)||(t.trigger_target_changes=e)}else if(n.type==="runtime"){let e=parseFloat(n.runtimeHours);isNaN(e)||(t.trigger_runtime_hours=e)}return t}function At(n){return Array.from({length:7},(d,t)=>Q(t,n,"short"))}function Lt(n){let d=new Intl.DateTimeFormat(n||"en",{month:"short"});return Array.from({length:12},(t,e)=>d.format(new Date(2021,e,1)))}var p=class extends x{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._autoCompleteOnRecovery=!1;this._t
Line truncated
|
||||
`),this._scheduleTime=e.schedule_time||"";let _=e.on_complete_action;if(_&&_.service){this._actionService=_.service;let u=_.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=_.data&&typeof _.data=="object"?{..._.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let h=e.quick_complete_defaults;this._qcNotes=h?.notes||"",this._qcCost=h?.cost!=null?String(h.cost):"",this._qcDuration=h?.duration!=null?String(h.duration):"",this._qcFeedback=h?.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 u=e.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(It)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags()]),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._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._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",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._actionTestResult="",this._actionTestError=""},8e3);return}let o=this._actionTargetEntity.trim();if(o){let _=o.split(".")[0];if(_!==e&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(e)){this._actionTestResult="error",this._actionTestError=`Service "${t}" only works on ${e}.* entities; entity "${o}" is in ${_}.* \u2Line truncated
|
||||
`,a([g({attribute:!1})],x.prototype,"hass",2),a([g({attribute:!1})],x.prototype,"objects",2),a([l()],x.prototype,"_open",2),a([l()],x.prototype,"_loading",2),a([l()],x.prototype,"_error",2),a([l()],x.prototype,"_name",2),a([l()],x.prototype,"_manufacturer",2),a([l()],x.prototype,"_model",2),a([l()],x.prototype,"_serialNumber",2),a([l()],x.prototype,"_areaId",2),a([l()],x.prototype,"_installationDate",2),a([l()],x.prototype,"_warrantyExpiry",2),a([l()],x.prototype,"_documentationUrl",2),a([l()],x.prototype,"_notes",2),a([l()],x.prototype,"_haDeviceId",2),a([l()],x.prototype,"_parentEntryId",2),a([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 kt=["cleaning","inspection","replacement","calibration","service","reading","custom"],wt=["low","normal","high"],Et=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],at=["weekdays","nth_weekday","day_of_month"],rt=["threshold","counter","state_change","runtime"],It=[...rt,"compound"];function Tt(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function At(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()??""}}function Lt(o){let d=o.entityIds.split(",").map(e=>e.trim()).filter(Boolean);if(d.length===0)return null;let t={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)}return t}function Ct(o){return Array.from({length:7},(d,t)=>Q(t,o,"short"))}function Ht(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._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._autoCompleteOnRecov
Line truncated
|
||||
`),this._scheduleTime=e.schedule_time||"";let h=e.on_complete_action;if(h&&h.service){this._actionService=h.service;let u=h.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",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 u=e.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(At)):(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._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",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._actionTestResult="",this._actionTestError=""},8e3);return}let n=this._actionTargetEntity.trim();if(n){let h=n.split(".")[0];if(h!==e&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(e)){this._actionTestResult="error",this._actionTestError=`Service "${t}" only works on ${e}.*Line 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 o=this._serviceSchema();if(o){let _=new Set(o.map(h=>h.name));this._actionData=Object.fromEntries(Object.entries(this._actionData).filter(([h])=>_.has(h)))}}}
|
||||
@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)))}}}
|
||||
></ha-service-picker>
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"target_entity",selector:{entity:{}}}]}
|
||||
.data=${{target_entity:this._actionTargetEntity}}
|
||||
.computeLabel=${()=>s("on_complete_action_target",t)}
|
||||
@value-changed=${i=>{let o=i.detail.value;this._actionTargetEntity=o.target_entity||""}}
|
||||
@value-changed=${i=>{let n=i.detail.value;this._actionTargetEntity=n.target_entity||""}}
|
||||
></ha-form>
|
||||
<p class="field-help ca-domain-hint">
|
||||
${s("on_complete_action_target_hint",t)}
|
||||
@@ -268,8 +268,8 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<option value="not_needed">${s("quick_complete_defaults_feedback_not_needed",t)}</option>
|
||||
</select>
|
||||
</details>
|
||||
`}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):st.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(h=>h.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,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 h=this._compoundConditions.map(Tt).filter(m=>m!==null);if(h.length>0){let m={type:"compound",compound_logic:this._compoundLogic,conditions:h};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 h=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],m={entity_id:h[0],entity_ids:h,type:this._triggerType};if(this._triggerAttribute&&(m.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(m.auto_complete_on_recovery=!0),h.length>1&&(m.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(m.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(m.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(m.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(m.trigger_target_value=u)}m.trigger_delta_mode=this._triggerDeltaMode}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 u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(m.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(m.trigger_runtime_hours=u)}t.trigger_config=m}else this._taskId&&(t.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let h=this._scheduleTime.trim();t.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(h)?h:null}if(this.checklistsEnabled){let h=this._checklistText.split(`
|
||||
`).map(m=>m.trim()).filter(Boolean).slice(0,100);t.checklist=h.length?h:null}if(this.completionActionsEnabled){let h=this._actionService.trim();if(h&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(h)){let I={service:h},F=this._actionTargetEntity.trim();F&&(I.target={entity_id:F});let w=this._buildActionData();Object.keys(w).length>0&&(I.data=w),t.on_complete_action=I}else t.on_complete_action=null;let m={};this._qcNotes.trim()&&(m.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(m.cost=u);let y=parseInt(this._qcDuration,10);!isNaN(y)&&y>=0&&(m.duration=y),this._qcFeedback&&(m.feedback=this._qcFeedback),t.quick_complete_defaults=Object.keys(m).length?m:null}let i=await this.hass.connection.sendMessagePromise(t),o=this._taskId||i?.task_id,_=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(o&&this._scheduleType==="sensor_based"&&_)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:o,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=k(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 r`
|
||||
`}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):at.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(Lt).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 u=parseFloat(this._triggerAbove);isNaN(u)||(m.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(m.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(m.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(m.trigger_target_value=u)}m.trigger_delta_mode=this._triggerDeltaMode}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 u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(m.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(m.trigger_runtime_hours=u)}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 f={service:p},b=this._actionTargetEntity.trim();b&&(f.target={entity_id:b});let $=this._buildActionData();Object.keys($).length>0&&(f.data=$),t.on_complete_action=f}else t.on_complete_action=null;let m={};this._qcNotes.trim()&&(m.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(m.cost=u);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 r`
|
||||
<h3>${s("trigger_configuration",t)}</h3>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",t)}</label>
|
||||
@@ -277,14 +277,14 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
.value=${this._triggerType}
|
||||
@change=${i=>this._triggerType=i.target.value}
|
||||
>
|
||||
${wt.map(i=>r`<option value=${i} ?selected=${i===this._triggerType}>${s(i,t)}</option>`)}
|
||||
${It.map(i=>r`<option value=${i} ?selected=${i===this._triggerType}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${e?this._renderCompoundEditor():r`
|
||||
<ms-textfield
|
||||
label="${s("entity_id",t)} (${s("comma_separated",t)})"
|
||||
.value=${this._triggerEntityIds.length>0?this._triggerEntityIds.join(", "):this._triggerEntityId}
|
||||
@input=${i=>{let _=i.target.value.split(",").map(h=>h.trim()).filter(Boolean);this._triggerEntityId=_[0]||"",this._triggerEntityIds=_,_[0]&&this._fetchEntityAttributes(_[0])}}
|
||||
@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])}}
|
||||
></ms-textfield>
|
||||
${this._triggerEntityIds.length>1?r`
|
||||
<div class="select-row">
|
||||
@@ -318,6 +318,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
></ms-textfield>
|
||||
`}
|
||||
${this._renderTriggerTypeFields()}
|
||||
${this._renderTriggerLiveHint()}
|
||||
`}
|
||||
<label>
|
||||
<input
|
||||
@@ -335,7 +336,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
@input=${i=>this._intervalDays=i.target.value}
|
||||
></ms-textfield>
|
||||
${this._intervalDays?this._renderUnitSelect():c}
|
||||
`}_patchCondition(t,e){this._compoundConditions=this._compoundConditions.map((i,o)=>o===t?{...i,...e}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Et()]}_removeCondition(t){this._compoundConditions=this._compoundConditions.filter((e,i)=>i!==t)}_renderCompoundEditor(){let t=this._lang;return r`
|
||||
`}_patchCondition(t,e){this._compoundConditions=this._compoundConditions.map((i,n)=>n===t?{...i,...e}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Tt()]}_removeCondition(t){this._compoundConditions=this._compoundConditions.filter((e,i)=>i!==t)}_renderCompoundEditor(){let t=this._lang;return r`
|
||||
<div class="select-row">
|
||||
<label>${s("compound_logic",t)}</label>
|
||||
<select
|
||||
@@ -351,10 +352,10 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<button type="button" class="secondary-btn" @click=${()=>this._addCondition()}>
|
||||
+ ${s("compound_add_condition",t)}
|
||||
</button>
|
||||
`}_renderCondition(t,e){let i=this._lang,o=e+1;return r`
|
||||
`}_renderCondition(t,e){let i=this._lang,n=e+1;return r`
|
||||
<div class="compound-condition">
|
||||
<div class="compound-condition-head">
|
||||
<span class="compound-condition-title">${s("compound_condition",i)} ${o}</span>
|
||||
<span class="compound-condition-title">${s("compound_condition",i)} ${n}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="icon-btn"
|
||||
@@ -365,44 +366,44 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<ms-textfield
|
||||
label="${s("entity_id",i)} (${s("comma_separated",i)})"
|
||||
.value=${t.entityIds}
|
||||
@input=${_=>this._patchCondition(e,{entityIds:_.target.value})}
|
||||
@input=${h=>this._patchCondition(e,{entityIds:h.target.value})}
|
||||
></ms-textfield>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",i)}</label>
|
||||
<select
|
||||
.value=${t.type}
|
||||
@change=${_=>this._patchCondition(e,{type:_.target.value})}
|
||||
@change=${h=>this._patchCondition(e,{type:h.target.value})}
|
||||
>
|
||||
${at.map(_=>r`<option value=${_} ?selected=${_===t.type}>${s(_,i)}</option>`)}
|
||||
${rt.map(h=>r`<option value=${h} ?selected=${h===t.type}>${s(h,i)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(t,e)}
|
||||
</div>
|
||||
`}_renderConditionTypeFields(t,e){let i=this._lang;return t.type==="threshold"?r`
|
||||
<ms-textfield label="${s("trigger_above",i)}" type="number" .value=${t.above}
|
||||
@input=${o=>this._patchCondition(e,{above:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{above:n.target.value})}></ms-textfield>
|
||||
<ms-textfield label="${s("trigger_below",i)}" type="number" .value=${t.below}
|
||||
@input=${o=>this._patchCondition(e,{below:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{below:n.target.value})}></ms-textfield>
|
||||
<ms-textfield label="${s("for_minutes",i)}" type="number" .value=${t.forMinutes}
|
||||
@input=${o=>this._patchCondition(e,{forMinutes:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{forMinutes:n.target.value})}></ms-textfield>
|
||||
`:t.type==="counter"?r`
|
||||
<ms-textfield label="${s("target_value",i)}" type="number" .value=${t.targetValue}
|
||||
@input=${o=>this._patchCondition(e,{targetValue:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{targetValue:n.target.value})}></ms-textfield>
|
||||
<label>
|
||||
<input type="checkbox" .checked=${t.deltaMode}
|
||||
@change=${o=>this._patchCondition(e,{deltaMode:o.target.checked})} />
|
||||
@change=${n=>this._patchCondition(e,{deltaMode:n.target.checked})} />
|
||||
${s("delta_mode",i)}
|
||||
</label>
|
||||
`:t.type==="state_change"?r`
|
||||
<ms-textfield label="${s("from_state_optional",i)}" .value=${t.fromState}
|
||||
@input=${o=>this._patchCondition(e,{fromState:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{fromState:n.target.value})}></ms-textfield>
|
||||
<ms-textfield label="${s("to_state_optional",i)}" .value=${t.toState}
|
||||
@input=${o=>this._patchCondition(e,{toState:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{toState:n.target.value})}></ms-textfield>
|
||||
<ms-textfield label="${s("target_changes",i)}" type="number" .value=${t.targetChanges}
|
||||
@input=${o=>this._patchCondition(e,{targetChanges:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{targetChanges:n.target.value})}></ms-textfield>
|
||||
`:t.type==="runtime"?r`
|
||||
<ms-textfield label="${s("runtime_hours",i)}" type="number" .value=${t.runtimeHours}
|
||||
@input=${o=>this._patchCondition(e,{runtimeHours:o.target.value})}></ms-textfield>
|
||||
@input=${n=>this._patchCondition(e,{runtimeHours:n.target.value})}></ms-textfield>
|
||||
`:c}_renderUnitSelect(){let t=this._lang;return r`
|
||||
<div class="select-row">
|
||||
<label>${s("interval_unit",t)}</label>
|
||||
@@ -412,22 +413,22 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
>
|
||||
${["days","weeks","months","years"].map(e=>r`<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]}_buildSchedule(){let t=i=>{let o=parseInt(this._calOffset,10)||0;return o&&(i.offset=Math.max(-15,Math.min(o,15))),i};if(this._scheduleType==="weekdays")return t({kind:"weekdays",weekdays:[...this._weekdays].sort((i,o)=>i-o)});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"||st.includes(this._scheduleType)))return c;let i=Lt(t);return r`
|
||||
</div>`}_toggleWeekday(t){this._weekdays=this._weekdays.includes(t)?this._weekdays.filter(e=>e!==t):[...this._weekdays,t]}_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"||at.includes(this._scheduleType)))return c;let i=Ht(t);return r`
|
||||
<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((o,_)=>r`
|
||||
${i.map((n,h)=>r`
|
||||
<button
|
||||
type="button"
|
||||
class="season-chip ${this._seasonMonths.includes(_+1)?"selected":""}"
|
||||
@click=${()=>this._toggleSeasonMonth(_+1)}
|
||||
>${o}</button>`)}
|
||||
class="season-chip ${this._seasonMonths.includes(h+1)?"selected":""}"
|
||||
@click=${()=>this._toggleSeasonMonth(h+1)}
|
||||
>${n}</button>`)}
|
||||
</div>
|
||||
|
||||
<label class="field-label">${s("series_end_label",t)}</label>
|
||||
<div class="select-row">
|
||||
<select .value=${this._endsMode}
|
||||
@change=${o=>this._endsMode=o.target.value}>
|
||||
@change=${n=>this._endsMode=n.target.value}>
|
||||
<option value="never" ?selected=${this._endsMode==="never"}>${s("series_end_never",t)}</option>
|
||||
<option value="count" ?selected=${this._endsMode==="count"}>${s("series_end_after_count",t)}</option>
|
||||
<option value="until" ?selected=${this._endsMode==="until"}>${s("series_end_until",t)}</option>
|
||||
@@ -438,36 +439,36 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
label="${s("series_end_count_label",t)}"
|
||||
type="number" min="1"
|
||||
.value=${this._endsCount}
|
||||
@input=${o=>this._endsCount=o.target.value}
|
||||
@input=${n=>this._endsCount=n.target.value}
|
||||
></ms-textfield>`:c}
|
||||
${this._endsMode==="until"?r`
|
||||
<ms-textfield
|
||||
label="${s("series_end_until_label",t)}"
|
||||
type="date"
|
||||
.value=${this._endsUntil}
|
||||
@input=${o=>this._endsUntil=o.target.value}
|
||||
@input=${n=>this._endsUntil=n.target.value}
|
||||
></ms-textfield>`:c}
|
||||
`}_renderCalendarFields(){let t=this._lang,e=At(t);if(this._scheduleType==="weekdays")return r`
|
||||
`}_renderCalendarFields(){let t=this._lang,e=Ct(t);if(this._scheduleType==="weekdays")return r`
|
||||
<label class="field-label">${s("recurrence_on_days",t)}</label>
|
||||
<div class="weekday-chips">
|
||||
${e.map((i,o)=>r`
|
||||
${e.map((i,n)=>r`
|
||||
<button
|
||||
type="button"
|
||||
class="weekday-chip ${this._weekdays.includes(o)?"selected":""}"
|
||||
@click=${()=>this._toggleWeekday(o)}
|
||||
class="weekday-chip ${this._weekdays.includes(n)?"selected":""}"
|
||||
@click=${()=>this._toggleWeekday(n)}
|
||||
>${i}</button>`)}
|
||||
</div>
|
||||
${this._renderCalOffsetField()}`;if(this._scheduleType==="nth_weekday"){let i=[["1",s("ord_1",t)],["2",s("ord_2",t)],["3",s("ord_3",t)],["4",s("ord_4",t)],["5",s("ord_5",t)],["-1",s("ord_last",t)]];return r`
|
||||
<div class="select-row">
|
||||
<label>${s("recurrence_occurrence",t)}</label>
|
||||
<select .value=${this._nth} @change=${o=>this._nth=o.target.value}>
|
||||
${i.map(([o,_])=>r`<option value=${o} ?selected=${o===this._nth}>${_}</option>`)}
|
||||
<select .value=${this._nth} @change=${n=>this._nth=n.target.value}>
|
||||
${i.map(([n,h])=>r`<option value=${n} ?selected=${n===this._nth}>${h}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="select-row">
|
||||
<label>${s("recurrence_weekday",t)}</label>
|
||||
<select .value=${this._nthWeekday} @change=${o=>this._nthWeekday=o.target.value}>
|
||||
${e.map((o,_)=>r`<option value=${String(_)} ?selected=${String(_)===this._nthWeekday}>${o}</option>`)}
|
||||
<select .value=${this._nthWeekday} @change=${n=>this._nthWeekday=n.target.value}>
|
||||
${e.map((n,h)=>r`<option value=${String(h)} ?selected=${String(h)===this._nthWeekday}>${n}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderCalOffsetField()}`}return this._scheduleType==="day_of_month"?r`
|
||||
@@ -499,7 +500,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
max="15"
|
||||
.value=${this._calOffset}
|
||||
@input=${e=>this._calOffset=e.target.value}
|
||||
></ms-textfield>`}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?r`
|
||||
></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)),u=p!=="unknown"&&p!=="unavailable"&&p!=null&&!isNaN(m),v=b=>Number.isInteger(b)?String(b):String(Math.round(b*10)/10),f=[];if(this._triggerType==="threshold"){let b=parseFloat(this._triggerAbove),$=parseFloat(this._triggerBelow);if(isNaN(b)&&isNaN($))return c;u&&f.push(s("trigger_hint_now",i).replace("{value}",v(m)+h)),isNaN(b)||f.push(s("trigger_hint_above",i).replace("{target}",v(b)+h)),isNaN($)||f.push(s("trigger_hint_below",i).replace("{target}",v($)+h))}else if(this._triggerType==="counter"){let b=parseFloat(this._triggerTargetValue);if(isNaN(b))return c;this._triggerDeltaMode?this._taskId?f.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(b)+h)):u?f.push(s("trigger_hint_counter_delta",i).replace("{value}",v(m)+h).replace("{due}",v(m+b)+h).replace("{target}",v(b)+h)):f.push(s("trigger_hint_counter_delta_edit",i).replace("{target}",v(b)+h)):(u&&f.push(s("trigger_hint_now",i).replace("{value}",v(m)+h)),f.push(s("trigger_hint_counter_abs",i).replace("{target}",v(b)+h)))}else if(this._triggerType==="runtime"){let b=parseFloat(this._triggerRuntimeHours);if(isNaN(b))return c;f.push(s("trigger_hint_runtime",i).replace("{hours}",v(b))),f.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}else if(this._triggerType==="state_change"){let b=parseInt(this._triggerTargetChanges,10)||1,$=this._triggerToState.trim();f.push(($?s("trigger_hint_state_change_to",i).replace("{state}",$):s("trigger_hint_state_change",i)).replace("{count}",String(b))),f.push(s("trigger_hint_state_now",i).replace("{value}",String(e.state)))}return f.length?r`<div class="trigger-live-hint">${f.join(" ")}</div>`:c}_renderTriggerTypeFields(){let t=this._lang;return this._triggerType==="threshold"?r`
|
||||
<ms-textfield
|
||||
label="${s("trigger_above",t)}"
|
||||
type="number"
|
||||
@@ -574,7 +575,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<label>${s("object",t)}</label>
|
||||
<select
|
||||
.value=${this._entryId}
|
||||
@change=${i=>this._entryId=i.target.value}
|
||||
@change=${i=>{this._entryId=i.target.value,this._consumesParts={},this._loadParts()}}
|
||||
>
|
||||
${this._objectChoices.map(i=>r`<option value=${i.entry_id} ?selected=${i.entry_id===this._entryId}>${i.name}</option>`)}
|
||||
</select>
|
||||
@@ -592,7 +593,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
.value=${this._type}
|
||||
@change=${i=>this._type=i.target.value}
|
||||
>
|
||||
${$t.map(i=>r`<option value=${i} ?selected=${i===this._type}>${s(i,t)}</option>`)}
|
||||
${kt.map(i=>r`<option value=${i} ?selected=${i===this._type}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?r`
|
||||
@@ -603,13 +604,39 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
></ms-textfield>
|
||||
<div class="field-help">${s("reading_unit_help",t)}</div>
|
||||
`:c}
|
||||
${this._partsLoadFailed?r`<div class="field-help parts-load-failed">${s("parts_load_failed",t)}</div>`:c}
|
||||
${this.parts.length?r`
|
||||
<div class="field">
|
||||
<label>${s("consumes_parts_label",t)}</label>
|
||||
${this.parts.map(i=>{let n=this._consumesParts[i.id];return r`
|
||||
<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?r`<input
|
||||
class="consumes-qty"
|
||||
type="number"
|
||||
min="1"
|
||||
max="999"
|
||||
.value=${String(n)}
|
||||
@input=${h=>{let p=parseInt(h.target.value,10);this._consumesParts={...this._consumesParts,[i.id]:Number.isFinite(p)&&p>=1?p:1}}}
|
||||
/>`:c}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`:c}
|
||||
<div class="select-row">
|
||||
<label>${s("priority",t)}</label>
|
||||
<select
|
||||
.value=${this._priority}
|
||||
@change=${i=>this._priority=i.target.value}
|
||||
>
|
||||
${xt.map(i=>r`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,t)}</option>`)}
|
||||
${wt.map(i=>r`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -628,7 +655,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
.value=${this._scheduleType}
|
||||
@change=${i=>this._scheduleType=i.target.value}
|
||||
>
|
||||
${kt.map(i=>r`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,t)}</option>`)}
|
||||
${Et.map(i=>r`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?r`
|
||||
@@ -704,7 +731,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<label>${s("responsible_user",t)}</label>
|
||||
<select
|
||||
.value=${this._responsibleUserId||""}
|
||||
@change=${i=>{let o=i.target.value;this._responsibleUserId=o||null}}
|
||||
@change=${i=>{let n=i.target.value;this._responsibleUserId=n||null}}
|
||||
>
|
||||
<option value="" ?selected=${!this._responsibleUserId}>${s("no_user_assigned",t)}</option>
|
||||
${this._availableUsers.map(i=>r`<option value=${i.id} ?selected=${i.id===this._responsibleUserId}>${i.name}</option>`)}
|
||||
@@ -816,7 +843,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};p.styles=$`
|
||||
`}};_.styles=w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -906,10 +933,41 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
resize: vertical;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.consumes-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
.consumes-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
}
|
||||
.consumes-qty {
|
||||
width: 64px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--divider-color);
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color);
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.field-help {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
/* Live computed trigger hint — reads the bound sensor and explains what
|
||||
happens next. Info-accented so it reads as guidance, not an error. */
|
||||
.trigger-live-hint {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
border-left: 3px solid var(--info-color, #2196f3);
|
||||
background: rgba(33, 150, 243, 0.08);
|
||||
border-radius: 0 6px 6px 0;
|
||||
padding: 6px 10px;
|
||||
margin: 4px 0;
|
||||
}
|
||||
.field-help a,
|
||||
.link-button {
|
||||
background: none;
|
||||
@@ -1035,7 +1093,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,a([g({attribute:!1})],p.prototype,"hass",2),a([g({type:Boolean,attribute:"checklists-enabled"})],p.prototype,"checklistsEnabled",2),a([g({type:Boolean,attribute:"schedule-time-enabled"})],p.prototype,"scheduleTimeEnabled",2),a([g({type:Boolean,attribute:"completion-actions-enabled"})],p.prototype,"completionActionsEnabled",2),a([g({type:Number,attribute:"default-warning-days"})],p.prototype,"defaultWarningDays",2),a([l()],p.prototype,"_open",2),a([l()],p.prototype,"_loading",2),a([l()],p.prototype,"_error",2),a([l()],p.prototype,"_entryId",2),a([l()],p.prototype,"_taskId",2),a([l()],p.prototype,"_objectChoices",2),a([l()],p.prototype,"_name",2),a([l()],p.prototype,"_type",2),a([l()],p.prototype,"_scheduleType",2),a([l()],p.prototype,"_intervalDays",2),a([l()],p.prototype,"_intervalUnit",2),a([l()],p.prototype,"_dueDate",2),a([l()],p.prototype,"_warningDays",2),a([l()],p.prototype,"_earliestCompletionDays",2),a([l()],p.prototype,"_intervalAnchor",2),a([l()],p.prototype,"_weekdays",2),a([l()],p.prototype,"_nth",2),a([l()],p.prototype,"_nthWeekday",2),a([l()],p.prototype,"_domDay",2),a([l()],p.prototype,"_domLastDay",2),a([l()],p.prototype,"_domBusiness",2),a([l()],p.prototype,"_calOffset",2),a([l()],p.prototype,"_seasonMonths",2),a([l()],p.prototype,"_endsMode",2),a([l()],p.prototype,"_endsCount",2),a([l()],p.prototype,"_endsUntil",2),a([l()],p.prototype,"_notes",2),a([l()],p.prototype,"_documentationUrl",2),a([l()],p.prototype,"_customIcon",2),a([l()],p.prototype,"_priority",2),a([l()],p.prototype,"_labels",2),a([l()],p.prototype,"_enabled",2),a([l()],p.prototype,"_triggerEntityId",2),a([l()],p.prototype,"_triggerEntityIds",2),a([l()],p.prototype,"_triggerEntityLogic",2),a([l()],p.prototype,"_triggerAttribute",2),a([l()],p.prototype,"_triggerType",2),a([l()],p.prototype,"_triggerAbove",2),a([l()],p.prototype,"_triggerBelow",2),a([l()],p.prototype,"_triggerForMinutes",2),a([l()],p.prototype,"_triggerTargetValue",2),a([l()],p.prototype,"_triggerDeltaMode",2),a([l()],p.prototype,"_autoCompleteOnRecovery",2),a([l()],p.prototype,"_triggerFromState",2),a([l()],p.prototype,"_triggerToState",2),a([l()],p.prototype,"_triggerTargetChanges",2),a([l()],p.prototype,"_triggerRuntimeHours",2),a([l()],p.prototype,"_compoundLogic",2),a([l()],p.prototype,"_compoundConditions",2),a([l()],p.prototype,"_suggestedAttributes",2),a([l()],p.prototype,"_availableAttributes",2),a([l()],p.prototype,"_entityDomain",2),a([l()],p.prototype,"_lastPerformed",2),a([l()],p.prototype,"_nfcTagId",2),a([l()],p.prototype,"_readingUnit",2),a([l()],p.prototype,"_availableTags",2),a([l()],p.prototype,"_responsibleUserId",2),a([l()],p.prototype,"_assigneePool",2),a([l()],p.prototype,"_rotationStrategy",2),a([l()],p.prototype,"_availableUsers",2),a([l()],p.prototype,"_checklistText",2),a([l()],p.prototype,"_scheduleTime",2),a([l()],p.prototype,"_actionService",2),a([l()],p.prototype,"_actionTargetEntity",2),a([l()],p.prototype,"_actionData",2),a([l()],p.prototype,"_actionDataJsonFallback",2),a([l()],p.prototype,"_actionTesting",2),a([l()],p.prototype,"_actionTestResult",2),a([l()],p.prototype,"_actionTestError",2),a([l()],p.prototype,"_qcNotes",2),a([l()],p.prototype,"_qcCost",2),a([l()],p.prototype,"_qcDuration",2),a([l()],p.prototype,"_qcFeedback",2),a([l()],p.prototype,"_environmentalEntity",2),a([l()],p.prototype,"_environmentalAttribute",2);customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",p);var v=class extends x{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";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=""}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="")}_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="";try{let o=new FormData;o.append("entry_id",this.entryId),o.append("tags","photo"),o.append("file",i,i.name);let _=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:o});if(!_.ok){this._error=_.status===413?s("doc_too_large",this.lang):s("doc_upload_failed",this.lang);return}let h=await _.json();h.id&&(this._photoDocId=h.id,this._photoPreview=URL.createObjectURL(i))}catch{this._error=s("doc_upload_failed",this.lang)}finally{this._photoUploading=!1}}}_removePhoto(){this._photoPreview&&URL.revokeObjectURL(this._photoPr
Line truncated
|
||||
`,a([g({attribute:!1})],_.prototype,"hass",2),a([g({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),a([g({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),a([g({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),a([g({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),a([l()],_.prototype,"parts",2),a([l()],_.prototype,"_open",2),a([l()],_.prototype,"_loading",2),a([l()],_.prototype,"_error",2),a([l()],_.prototype,"_entryId",2),a([l()],_.prototype,"_taskId",2),a([l()],_.prototype,"_objectChoices",2),a([l()],_.prototype,"_name",2),a([l()],_.prototype,"_type",2),a([l()],_.prototype,"_scheduleType",2),a([l()],_.prototype,"_intervalDays",2),a([l()],_.prototype,"_intervalUnit",2),a([l()],_.prototype,"_dueDate",2),a([l()],_.prototype,"_warningDays",2),a([l()],_.prototype,"_earliestCompletionDays",2),a([l()],_.prototype,"_intervalAnchor",2),a([l()],_.prototype,"_weekdays",2),a([l()],_.prototype,"_nth",2),a([l()],_.prototype,"_nthWeekday",2),a([l()],_.prototype,"_domDay",2),a([l()],_.prototype,"_domLastDay",2),a([l()],_.prototype,"_domBusiness",2),a([l()],_.prototype,"_calOffset",2),a([l()],_.prototype,"_seasonMonths",2),a([l()],_.prototype,"_endsMode",2),a([l()],_.prototype,"_endsCount",2),a([l()],_.prototype,"_endsUntil",2),a([l()],_.prototype,"_notes",2),a([l()],_.prototype,"_documentationUrl",2),a([l()],_.prototype,"_customIcon",2),a([l()],_.prototype,"_priority",2),a([l()],_.prototype,"_labels",2),a([l()],_.prototype,"_enabled",2),a([l()],_.prototype,"_triggerEntityId",2),a([l()],_.prototype,"_triggerEntityIds",2),a([l()],_.prototype,"_triggerEntityLogic",2),a([l()],_.prototype,"_triggerAttribute",2),a([l()],_.prototype,"_triggerType",2),a([l()],_.prototype,"_triggerAbove",2),a([l()],_.prototype,"_triggerBelow",2),a([l()],_.prototype,"_triggerForMinutes",2),a([l()],_.prototype,"_triggerTargetValue",2),a([l()],_.prototype,"_triggerDeltaMode",2),a([l()],_.prototype,"_autoCompleteOnRecovery",2),a([l()],_.prototype,"_triggerFromState",2),a([l()],_.prototype,"_triggerToState",2),a([l()],_.prototype,"_triggerTargetChanges",2),a([l()],_.prototype,"_triggerRuntimeHours",2),a([l()],_.prototype,"_compoundLogic",2),a([l()],_.prototype,"_compoundConditions",2),a([l()],_.prototype,"_suggestedAttributes",2),a([l()],_.prototype,"_availableAttributes",2),a([l()],_.prototype,"_entityDomain",2),a([l()],_.prototype,"_lastPerformed",2),a([l()],_.prototype,"_nfcTagId",2),a([l()],_.prototype,"_readingUnit",2),a([l()],_.prototype,"_consumesParts",2),a([l()],_.prototype,"_partsLoadFailed",2),a([l()],_.prototype,"_availableTags",2),a([l()],_.prototype,"_responsibleUserId",2),a([l()],_.prototype,"_assigneePool",2),a([l()],_.prototype,"_rotationStrategy",2),a([l()],_.prototype,"_availableUsers",2),a([l()],_.prototype,"_checklistText",2),a([l()],_.prototype,"_scheduleTime",2),a([l()],_.prototype,"_actionService",2),a([l()],_.prototype,"_actionTargetEntity",2),a([l()],_.prototype,"_actionData",2),a([l()],_.prototype,"_actionDataJsonFallback",2),a([l()],_.prototype,"_actionTesting",2),a([l()],_.prototype,"_actionTestResult",2),a([l()],_.prototype,"_actionTestError",2),a([l()],_.prototype,"_qcNotes",2),a([l()],_.prototype,"_qcCost",2),a([l()],_.prototype,"_qcDuration",2),a([l()],_.prototype,"_qcFeedback",2),a([l()],_.prototype,"_environmentalEntity",2),a([l()],_.prototype,"_environmentalAttribute",2);customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",_);var y=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.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=""}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):"")}_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="";try{let n=new FormData;n.append("entry_id",this.entryId),n.append("tags","photo"),n.append("file",i,i.name);let h=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:n});if(!h.ok){this._error=h.status===413?s("doc_too_large",this.lang):s("doc_upload_failed",this.lang)
Line truncated
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${s("complete_title",t)}${this.taskName}</div>
|
||||
<div class="content">
|
||||
@@ -1058,6 +1116,16 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
.value=${this._readingValue}
|
||||
@input=${e=>this._readingValue=e.target.value} />
|
||||
</label>`:c}
|
||||
${this.consumesInfo.length?r`<div class="consumes-hint">
|
||||
${this.consumesInfo.map(e=>r`<div>${e}</div>`)}
|
||||
</div>`:c}
|
||||
${this.restockDefault!==null?r`
|
||||
<label class="field">
|
||||
<span class="field-label">${s("restock_quantity_label",t)}</span>
|
||||
<input type="number" step="1" min="1" class="field-input"
|
||||
.value=${this._restockQty}
|
||||
@input=${e=>this._restockQty=e.target.value} />
|
||||
</label>`:c}
|
||||
<!-- Native <input>s rather than <ha-textfield>: when this dialog
|
||||
is opened from a Lovelace card via dialog-mount, ha-textfield
|
||||
isn't yet registered (HA loads it lazily when its own panels
|
||||
@@ -1130,7 +1198,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};v.styles=$`
|
||||
`}};y.styles=[it,w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1148,27 +1216,18 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
gap: 8px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
.consumes-hint {
|
||||
font-size: 13px;
|
||||
color: var(--secondary-text-color);
|
||||
border-left: 3px solid var(--primary-color);
|
||||
padding: 4px 8px;
|
||||
margin: 4px 0 8px;
|
||||
}
|
||||
.error {
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.field-input {
|
||||
padding: 8px 10px; font-size: 14px;
|
||||
background: var(--secondary-background-color, rgba(0,0,0,0.06));
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
/* .field/.field-label/.field-input come from nativeFieldStyles */
|
||||
.photo-pick {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -1269,7 +1328,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`,a([g({attribute:!1})],v.prototype,"hass",2),a([g()],v.prototype,"entryId",2),a([g()],v.prototype,"taskId",2),a([g()],v.prototype,"taskName",2),a([g()],v.prototype,"lang",2),a([g({type:Array})],v.prototype,"checklist",2),a([g({type:Boolean})],v.prototype,"adaptiveEnabled",2),a([g()],v.prototype,"taskType",2),a([g()],v.prototype,"readingUnit",2),a([l()],v.prototype,"_open",2),a([l()],v.prototype,"_notes",2),a([l()],v.prototype,"_cost",2),a([l()],v.prototype,"_duration",2),a([l()],v.prototype,"_loading",2),a([l()],v.prototype,"_error",2),a([l()],v.prototype,"_checklistState",2),a([l()],v.prototype,"_feedback",2),a([l()],v.prototype,"_photoDocId",2),a([l()],v.prototype,"_photoPreview",2),a([l()],v.prototype,"_photoUploading",2),a([l()],v.prototype,"_readingValue",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",v);var R=class extends x{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=k(t,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return c;let t=this._lang,e=this._draft;return r`
|
||||
`],a([g({attribute:!1})],y.prototype,"hass",2),a([g()],y.prototype,"entryId",2),a([g()],y.prototype,"taskId",2),a([g()],y.prototype,"taskName",2),a([g()],y.prototype,"lang",2),a([g({type:Array})],y.prototype,"checklist",2),a([g({type:Boolean})],y.prototype,"adaptiveEnabled",2),a([g()],y.prototype,"taskType",2),a([g()],y.prototype,"readingUnit",2),a([g({attribute:!1})],y.prototype,"restockDefault",2),a([g({type:Array})],y.prototype,"consumesInfo",2),a([l()],y.prototype,"_open",2),a([l()],y.prototype,"_notes",2),a([l()],y.prototype,"_cost",2),a([l()],y.prototype,"_duration",2),a([l()],y.prototype,"_loading",2),a([l()],y.prototype,"_error",2),a([l()],y.prototype,"_checklistState",2),a([l()],y.prototype,"_feedback",2),a([l()],y.prototype,"_photoDocId",2),a([l()],y.prototype,"_photoPreview",2),a([l()],y.prototype,"_photoUploading",2),a([l()],y.prototype,"_readingValue",2),a([l()],y.prototype,"_restockQty",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",y);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 r`
|
||||
<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>
|
||||
@@ -1281,13 +1340,13 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<span>${s("history_edit_timestamp",t)||"Timestamp"}</span>
|
||||
<input type="datetime-local"
|
||||
.value=${e.timestamp.length>=16?e.timestamp.slice(0,16):e.timestamp}
|
||||
@change=${i=>{let o=i.target.value;this._set("timestamp",o.length===16?`${o}:00`:o)}} />
|
||||
@change=${i=>{let n=i.target.value;this._set("timestamp",n.length===16?`${n}:00`:n)}} />
|
||||
</label>
|
||||
<label>
|
||||
<span>${s("notes_label",t)}</span>
|
||||
<textarea
|
||||
rows="3"
|
||||
@input=${i=>{let o=i.target.value;this._set("notes",o||null)}}
|
||||
@input=${i=>{let n=i.target.value;this._set("notes",n||null)}}
|
||||
.value=${e.notes??""}></textarea>
|
||||
</label>
|
||||
<div class="row">
|
||||
@@ -1295,13 +1354,13 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
<span>${s("cost",t)||"Cost"}</span>
|
||||
<input type="number" min="0" step="0.01"
|
||||
.value=${e.cost!=null?String(e.cost):""}
|
||||
@input=${i=>{let o=i.target.value;this._set("cost",o?Number(o):null)}} />
|
||||
@input=${i=>{let n=i.target.value;this._set("cost",n?Number(n):null)}} />
|
||||
</label>
|
||||
<label>
|
||||
<span>${s("duration",t)||"Duration (min)"}</span>
|
||||
<input type="number" min="0"
|
||||
.value=${e.duration!=null?String(e.duration):""}
|
||||
@input=${i=>{let o=i.target.value;this._set("duration",o?Number(o):null)}} />
|
||||
@input=${i=>{let n=i.target.value;this._set("duration",n?Number(n):null)}} />
|
||||
</label>
|
||||
</div>
|
||||
${this._error?r`<div class="error">${this._error}</div>`:c}
|
||||
@@ -1314,7 +1373,7 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`}};R.styles=$`
|
||||
`}};R.styles=w`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0;
|
||||
@@ -1376,8 +1435,8 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
background: rgba(211,47,47,0.1);
|
||||
border-radius: 6px;
|
||||
}
|
||||
`,a([g({attribute:!1})],R.prototype,"hass",2),a([l()],R.prototype,"_open",2),a([l()],R.prototype,"_saving",2),a([l()],R.prototype,"_error",2),a([l()],R.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function U(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function rt(n){return!n.startsWith("data:image/svg+xml,")&&!n.startsWith("data:image/png;base64,")?"":U(n)}function Ct(n){return n.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var T=class extends x{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,o){this._entryId=t,this._taskId=e,this._objectName=i,this._taskName=o,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 o=await Promise.all(i);if(t!==this._generateSeq)return;this._viewResult=o[0],o.length>1&&(this._completeResult=o[1])}catch(e){if(t!==this._generateSeq)return;let i=e?.code,o=e?.message;this._error=i==="no_url"||typeof o=="string"&&o.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(" "),o=window.open("","_blank","width=600,height=500");if(!o)return;let _=this.lang||"en",h=U(e),m=U(i),u=!!this._completeResult,y=U(s("qr_action_view",_)),I=U(s("qr_action_complete",_));o.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<title>${h}</title>
|
||||
`,a([g({attribute:!1})],R.prototype,"hass",2),a([l()],R.prototype,"_open",2),a([l()],R.prototype,"_saving",2),a([l()],R.prototype,"_error",2),a([l()],R.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function z(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function nt(o){return!o.startsWith("data:image/svg+xml,")&&!o.startsWith("data:image/png;base64,")?"":z(o)}function St(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=z(e),m=z(i),u=!!this._completeResult,v=z(s("qr_action_view",h)),f=z(s("qr_action_complete",h));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<title>${p}</title>
|
||||
<style>
|
||||
body{font-family:sans-serif;text-align:center;padding:20px}
|
||||
h2{margin:0 0 4px}
|
||||
@@ -1388,21 +1447,21 @@ import{a as $,b as r,c as q,d as c,e as x,f as g,g as l,i as V,j as s,k as Z,l a
|
||||
.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>
|
||||
<h2>${h}</h2>
|
||||
<h2>${p}</h2>
|
||||
${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${rt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${y}</div>
|
||||
<img src="${nt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${v}</div>
|
||||
</div>
|
||||
${u?`<div class="qr-col">
|
||||
<img src="${rt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${I}</div>
|
||||
<img src="${nt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${f}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${U(this._viewResult.url)}</div>
|
||||
<div class="url">${z(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),o.document.close()}_downloadSvg(t,e){let i=decodeURIComponent(t.svg_data_uri.replace("data:image/svg+xml,","")),o=new Blob([i],{type:"image/svg+xml"}),_=URL.createObjectURL(o),h=document.createElement("a");h.href=_;let m=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;h.download=`qr-${Ct(m)}-${e}.svg`,h.click(),URL.revokeObjectURL(_)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return r``;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 r`
|
||||
</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-${St(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 r``;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 r`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${e}</div>
|
||||
<div class="content">
|
||||
@@ -1463,7 +1522,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};T.styles=$`
|
||||
`}};A.styles=w`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1581,50 +1640,50 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,a([g({attribute:!1})],T.prototype,"hass",2),a([g()],T.prototype,"lang",2),a([l()],T.prototype,"_open",2),a([l()],T.prototype,"_loading",2),a([l()],T.prototype,"_error",2),a([l()],T.prototype,"_viewResult",2),a([l()],T.prototype,"_completeResult",2),a([l()],T.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",T);function nt(n,d){let t=n.interval_analysis,e=t?.weibull_beta,i=t?.weibull_eta;if(e==null||i==null||i<=0)return c;let o=n.interval_days??0,_=n.suggested_interval??o;return r`
|
||||
`,a([g({attribute:!1})],A.prototype,"hass",2),a([g()],A.prototype,"lang",2),a([l()],A.prototype,"_open",2),a([l()],A.prototype,"_loading",2),a([l()],A.prototype,"_error",2),a([l()],A.prototype,"_viewResult",2),a([l()],A.prototype,"_completeResult",2),a([l()],A.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",A);function ot(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 r`
|
||||
<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)}
|
||||
${Ht(e,d)}
|
||||
${Pt(e,d)}
|
||||
</div>
|
||||
${St(e,i,o,_,d)}
|
||||
${Rt(t,d)}
|
||||
${t?.confidence_interval_low!=null?Pt(t,n,d):c}
|
||||
${Rt(e,i,n,h,d)}
|
||||
${Ft(t,d)}
|
||||
${t?.confidence_interval_low!=null?Mt(t,o,d):c}
|
||||
</div>
|
||||
`}function Ht(n,d){let t,e,i;return n<.8?(t="early_failures",e="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):n<=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"):n<=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"),r`
|
||||
`}function Pt(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"),r`
|
||||
<span class="beta-badge ${t}">
|
||||
<ha-svg-icon path="${e}"></ha-svg-icon>
|
||||
${s(i,d)} (\u03B2=${n.toFixed(2)})
|
||||
${s(i,d)} (\u03B2=${o.toFixed(2)})
|
||||
</span>
|
||||
`}function St(n,d,t,e,i){let w=Math.max(t,e,d,1)*1.3,H=50,S=[];for(let A=0;A<=H;A++){let L=A/H*w,ft=1-Math.exp(-Math.pow(L/d,n)),bt=32+L/w*260,yt=136-ft*128;S.push([bt,yt])}let D=S.map(([A,L])=>`${A.toFixed(1)},${L.toFixed(1)}`).join(" "),K="M32,136 "+S.map(([A,L])=>`L${A.toFixed(1)},${L.toFixed(1)}`).join(" ")+` L${S[H][0].toFixed(1)},136 Z`,z=32+t/w*260,j=1-Math.exp(-Math.pow(t/d,n)),O=136-j*128,gt=((1-j)*100).toFixed(0),Y=32+e/w*260,vt=[0,.25,.5,.75,1];return r`
|
||||
`}function Rt(o,d,t,e,i){let $=Math.max(t,e,d,1)*1.3,S=50,P=[];for(let L=0;L<=S;L++){let C=L/S*$,yt=1-Math.exp(-Math.pow(C/d,o)),$t=32+C/$*260,xt=136-yt*128;P.push([$t,xt])}let j=P.map(([L,C])=>`${L.toFixed(1)},${C.toFixed(1)}`).join(" "),K="M32,136 "+P.map(([L,C])=>`L${L.toFixed(1)},${C.toFixed(1)}`).join(" ")+` L${P[S][0].toFixed(1)},136 Z`,q=32+t/$*260,D=1-Math.exp(-Math.pow(t/d,o)),O=136-D*128,ft=((1-D)*100).toFixed(0),Y=32+e/$*260,bt=[0,.25,.5,.75,1];return r`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",i)}">
|
||||
${vt.map(A=>{let L=136-A*128;return q`
|
||||
<line x1="${32}" y1="${L.toFixed(1)}" x2="${292}" y2="${L.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${A===.5?"4,3":c}" />
|
||||
<text x="${28}" y="${(L+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(A*100).toFixed(0)}%</text>
|
||||
${bt.map(L=>{let C=136-L*128;return N`
|
||||
<line x1="${32}" y1="${C.toFixed(1)}" x2="${292}" y2="${C.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${L===.5?"4,3":c}" />
|
||||
<text x="${28}" y="${(C+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(L*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(w/2)}</text>
|
||||
<text x="${292}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round(w)}</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="${D}" fill="none"
|
||||
<polyline points="${j}" fill="none"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="2" />
|
||||
|
||||
${t>0?q`
|
||||
<line x1="${z.toFixed(1)}" y1="${8}" x2="${z.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
${t>0?N`
|
||||
<line x1="${q.toFixed(1)}" y1="${8}" x2="${q.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
<circle cx="${z.toFixed(1)}" cy="${O.toFixed(1)}" r="3"
|
||||
<circle cx="${q.toFixed(1)}" cy="${O.toFixed(1)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${(z+4).toFixed(1)}" y="${(O-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${gt}%</text>
|
||||
<text x="${(q+4).toFixed(1)}" y="${(O-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${ft}%</text>
|
||||
`:c}
|
||||
|
||||
${e>0&&e!==t?q`
|
||||
${e>0&&e!==t?N`
|
||||
<line x1="${Y.toFixed(1)}" y1="${8}" x2="${Y.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:c}
|
||||
@@ -1640,40 +1699,40 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
${t>0?r`<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?r`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",i)}</span>`:c}
|
||||
</div>
|
||||
`}function Rt(n,d){return r`
|
||||
`}function Ft(o,d){return r`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("characteristic_life",d)}</span>
|
||||
<span class="weibull-info-value">${Math.round(n.weibull_eta)} ${s("days",d)}</span>
|
||||
<span class="weibull-info-value">${Math.round(o.weibull_eta)} ${s("days",d)}</span>
|
||||
</div>
|
||||
${n.weibull_r_squared!=null?r`
|
||||
${o.weibull_r_squared!=null?r`
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("weibull_r_squared",d)}</span>
|
||||
<span class="weibull-info-value">${n.weibull_r_squared.toFixed(3)}</span>
|
||||
<span class="weibull-info-value">${o.weibull_r_squared.toFixed(3)}</span>
|
||||
</div>
|
||||
`:c}
|
||||
</div>
|
||||
`}function Pt(n,d,t){let e=n.confidence_interval_low,i=n.confidence_interval_high,o=d.suggested_interval??d.interval_days??0,_=d.interval_days??0,h=Math.max(0,e-5),u=i+5-h,y=(e-h)/u*100,I=(i-e)/u*100,F=(o-h)/u*100,w=_>0?(_-h)/u*100:-1;return r`
|
||||
`}function Mt(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),u=i+5-p,v=(e-p)/u*100,f=(i-e)/u*100,b=(n-p)/u*100,$=h>0?(h-p)/u*100:-1;return r`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",t)}: ${o} ${s("days",t)} (${e}\u2013${i})
|
||||
${s("confidence_interval",t)}: ${n} ${s("days",t)} (${e}\u2013${i})
|
||||
</div>
|
||||
<div class="confidence-bar">
|
||||
<div class="confidence-fill" style="left:${y.toFixed(1)}%;width:${I.toFixed(1)}%"></div>
|
||||
${w>=0?r`<div class="confidence-marker current" style="left:${w.toFixed(1)}%"></div>`:c}
|
||||
<div class="confidence-marker recommended" style="left:${F.toFixed(1)}%"></div>
|
||||
<div class="confidence-fill" style="left:${v.toFixed(1)}%;width:${f.toFixed(1)}%"></div>
|
||||
${$>=0?r`<div class="confidence-marker current" style="left:${$.toFixed(1)}%"></div>`:c}
|
||||
<div class="confidence-marker recommended" style="left:${b.toFixed(1)}%"></div>
|
||||
</div>
|
||||
<div class="confidence-labels">
|
||||
<span class="confidence-text low">${s("confidence_conservative",t)} (${e}${s("days",t).charAt(0)})</span>
|
||||
<span class="confidence-text high">${s("confidence_aggressive",t)} (${i}${s("days",t).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function ot(n,d,t){let e=n.degradation_trend!=null&&n.degradation_trend!=="insufficient_data",i=n.days_until_threshold!=null,o=n.environmental_factor!=null&&n.environmental_factor!==1;if(!e&&!i&&!o)return c;let _=n.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":n.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 r`
|
||||
`}function lt(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 r`
|
||||
<div class="prediction-section">
|
||||
${n.sensor_prediction_urgency?r`
|
||||
${o.sensor_prediction_urgency?r`
|
||||
<div class="prediction-urgency-banner">
|
||||
<ha-svg-icon path="M1,21H23L12,2L1,21M12,18A1,1 0 0,1 11,17A1,1 0 0,1 12,16A1,1 0 0,1 13,17A1,1 0 0,1 12,18M13,15H11V10H13V15Z"></ha-svg-icon>
|
||||
${s("sensor_prediction_urgency",d).replace("{days}",String(Math.round(n.days_until_threshold||0)))}
|
||||
${s("sensor_prediction_urgency",d).replace("{days}",String(Math.round(o.days_until_threshold||0)))}
|
||||
</div>
|
||||
`:c}
|
||||
<div class="prediction-title">
|
||||
@@ -1683,39 +1742,39 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="prediction-grid">
|
||||
${e?r`
|
||||
<div class="prediction-item">
|
||||
<ha-svg-icon path="${_}"></ha-svg-icon>
|
||||
<ha-svg-icon path="${h}"></ha-svg-icon>
|
||||
<span class="prediction-label">${s("degradation_trend",d)}</span>
|
||||
<span class="prediction-value ${n.degradation_trend}">${s("trend_"+n.degradation_trend,d)}</span>
|
||||
${n.degradation_rate!=null?r`<span class="prediction-rate">${n.degradation_rate>0?"+":""}${Math.abs(n.degradation_rate)>=10?Math.round(n.degradation_rate).toLocaleString():n.degradation_rate.toFixed(1)} ${n.trigger_entity_info?.unit_of_measurement||""}/${s("day_short",d)}</span>`:c}
|
||||
<span class="prediction-value ${o.degradation_trend}">${s("trend_"+o.degradation_trend,d)}</span>
|
||||
${o.degradation_rate!=null?r`<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}
|
||||
</div>
|
||||
`:c}
|
||||
${i?r`
|
||||
<div class="prediction-item">
|
||||
<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${n.days_until_threshold===0?" exceeded":n.sensor_prediction_urgency?" urgent":""}">${n.days_until_threshold===0?s("threshold_exceeded",d):"~"+Math.round(n.days_until_threshold)+" "+s("days",d)}</span>
|
||||
${n.threshold_prediction_date?r`<span class="prediction-date">${N(n.threshold_prediction_date,d)}</span>`:c}
|
||||
${n.threshold_prediction_confidence?r`<span class="confidence-dot ${n.threshold_prediction_confidence}"></span>`:c}
|
||||
<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?r`<span class="prediction-date">${U(o.threshold_prediction_date,d)}</span>`:c}
|
||||
${o.threshold_prediction_confidence?r`<span class="confidence-dot ${o.threshold_prediction_confidence}"></span>`:c}
|
||||
</div>
|
||||
`:c}
|
||||
${o&&t.environmental?r`
|
||||
${n&&t.environmental?r`
|
||||
<div class="prediction-item">
|
||||
<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">${n.environmental_factor.toFixed(2)}x</span>
|
||||
${n.environmental_entity?r`<span class="prediction-entity entity-link" @click=${h=>et(h,n.environmental_entity)}>${n.environmental_entity}</span>`:c}
|
||||
<span class="prediction-value">${o.environmental_factor.toFixed(2)}x</span>
|
||||
${o.environmental_entity?r`<span class="prediction-entity entity-link" @click=${p=>et(p,o.environmental_entity)}>${o.environmental_entity}</span>`:c}
|
||||
</div>
|
||||
`:c}
|
||||
</div>
|
||||
</div>
|
||||
`}function lt(n,d,t,e){let i=Math.max(n||1,d);return r`
|
||||
`}function dt(o,d,t,e){let i=Math.max(o||1,d);return r`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
${s("current",e)}: ${n??"\u2014"} ${n!=null?s("days",e):""}
|
||||
${s("current",e)}: ${o??"\u2014"} ${o!=null?s("days",e):""}
|
||||
</div>
|
||||
<div class="interval-visual current"
|
||||
style="width: ${n!=null?Math.min(n/i*100,100):0}%"></div>
|
||||
style="width: ${o!=null?Math.min(o/i*100,100):0}%"></div>
|
||||
</div>
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -1726,14 +1785,14 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
style="width: ${Math.min(d/i*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var dt=["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 ct(n,d,t){if(!t.seasonal||!n.seasonal_factor||n.seasonal_factor===1)return c;let e=dt.map(h=>s(h,d)),i=new Date().getMonth(),o=n.seasonal_factors||n.interval_analysis?.seasonal_factors||null,_=o&&o.length===12?o:e.map((h,m)=>{let u=n.seasonal_factor||1,y=Math.sin((m-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+y))});return r`
|
||||
`}var ct=["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 pt(o,d,t){if(!t.seasonal||!o.seasonal_factor||o.seasonal_factor===1)return c;let e=ct.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 u=o.seasonal_factor||1,v=Math.sin((m-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+v))});return r`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",d)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
${_.map((h,m)=>{let u=h*40,y=h<.9?"low":h>1.1?"high":"normal";return r`
|
||||
<div class="seasonal-bar ${y} ${m===i?"current":""}"
|
||||
${h.map((p,m)=>{let u=p*40,v=p<.9?"low":p>1.1?"high":"normal";return r`
|
||||
<div class="seasonal-bar ${v} ${m===i?"current":""}"
|
||||
style="height: ${u}px"
|
||||
title="${e[m]}: ${h.toFixed(2)}x">
|
||||
title="${e[m]}: ${p.toFixed(2)}x">
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
@@ -1743,30 +1802,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 pt(n,d){return Mt(n,d)}function Mt(n,d){let t=n.seasonal_factors??n.interval_analysis?.seasonal_factors;if(!t||t.length!==12)return c;let e=n.interval_analysis?.seasonal_reason,i=new Date().getMonth(),o=300,_=100,h=8,u=_-h-4,y=Math.max(...t,1.5),I=o/12,F=I*.65,w=h+u-1/y*u;return r`
|
||||
`}function ht(o,d){return qt(o,d)}function qt(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,u=h-p-4,v=Math.max(...t,1.5),f=n/12,b=f*.65,$=p+u-1/v*u;return r`
|
||||
<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?r`<span class="source-tag">${e==="learned"?s("seasonal_learned",d):s("seasonal_manual",d)}</span>`:c}
|
||||
</div>
|
||||
<svg viewBox="0 0 ${o} ${_}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",d)}">
|
||||
<line x1="0" y1="${w.toFixed(1)}" x2="${o}" y2="${w.toFixed(1)}"
|
||||
<svg viewBox="0 0 ${n} ${h}" 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((H,S)=>{let D=H/y*u,K=S*I+(I-F)/2,z=h+u-D,j=S===i,O=H<1?"var(--success-color, #4caf50)":H>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return q`
|
||||
<rect x="${K.toFixed(1)}" y="${z.toFixed(1)}"
|
||||
width="${F.toFixed(1)}" height="${D.toFixed(1)}"
|
||||
fill="${O}" opacity="${j?1:.5}" rx="2" />
|
||||
${t.map((S,P)=>{let j=S/v*u,K=P*f+(f-b)/2,q=p+u-j,D=P===i,O=S<1?"var(--success-color, #4caf50)":S>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return N`
|
||||
<rect x="${K.toFixed(1)}" y="${q.toFixed(1)}"
|
||||
width="${b.toFixed(1)}" height="${j.toFixed(1)}"
|
||||
fill="${O}" opacity="${D?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${dt.map((H,S)=>r`<span class="seasonal-label ${S===i?"active-month":""}">${s(H,d)}</span>`)}
|
||||
${ct.map((S,P)=>r`<span class="seasonal-label ${P===i?"active-month":""}">${s(S,d)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var b=class extends x{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=k(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=k(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-3CFCNZ5R.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-3CFCNZ5R.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-3CFCNZ5R.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=k(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-ZZQ2BDDI.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-ZZQ2BDDI.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-ZZQ2BDDI.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
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",e)}</h4>
|
||||
${lt(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",e)}
|
||||
${dt(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}>
|
||||
@@ -1780,33 +1839,33 @@ ${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,o=t.degradation_trend!=null&&t.degradation_trend!=="insufficient_data"||t.days_until_threshold!=null||t.environmental_factor!=null&&t.environmental_factor!==1,_=this._features.adaptive&&t.interval_analysis?.weibull_beta!=null&&t.interval_analysis?.weibull_eta!=null,h=this._features.seasonal&&t.seasonal_factor&&t.seasonal_factor!==1;return!i&&!o&&!_&&!h?r`<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,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?r`<div class="adaptive-empty">
|
||||
${s("adaptive_no_data",e)||"Not enough completion history yet for adaptive analysis."}
|
||||
</div>`:r`
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?r`<div class="toast">${this._toast}</div>`:c}
|
||||
${i?this._renderRecommendation(t):c}
|
||||
${o?ot(t,e,this._features):c}
|
||||
${_?nt(t,e):c}
|
||||
${h?r`
|
||||
${ct(t,e,this._features)}
|
||||
${t.seasonal_factors?.length===12||t.interval_analysis?.seasonal_factors?.length===12?pt(t,e):c}
|
||||
${n?lt(t,e,this._features):c}
|
||||
${h?ot(t,e):c}
|
||||
${p?r`
|
||||
${pt(t,e,this._features)}
|
||||
${t.seasonal_factors?.length===12||t.interval_analysis?.seasonal_factors?.length===12?ht(t,e):c}
|
||||
`:c}
|
||||
</div>
|
||||
`}_renderDetails(t){let e=this._lang,i=t.history||[],o=i.filter(m=>m.type==="completed"),_=o.reduce((m,u)=>m+(typeof u.cost=="number"?u.cost:0),0),h=(()=>{let m=o.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return m.length?Math.round(m.reduce((u,y)=>u+y,0)/m.length):null})();return r`
|
||||
`}_renderDetails(t){let e=this._lang,i=t.history||[],n=i.filter(m=>m.type==="completed"),h=n.reduce((m,u)=>m+(typeof u.cost=="number"?u.cost:0),0),p=(()=>{let m=n.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return m.length?Math.round(m.reduce((u,v)=>u+v,0)/m.length):null})();return r`
|
||||
<div class="details">
|
||||
<div class="stats-grid">
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("times_performed",e)||"Performed"}</span>
|
||||
<span class="stat-value">${o.length}</span>
|
||||
<span class="stat-value">${n.length}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("total_cost",e)||"Total cost"}</span>
|
||||
<span class="stat-value">${_.toFixed(2)}</span>
|
||||
<span class="stat-value">${h.toFixed(2)}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("avg_duration",e)||"Avg duration"}</span>
|
||||
<span class="stat-value">${h!=null?`${h}m`:"\u2014"}</span>
|
||||
<span class="stat-value">${p!=null?`${p}m`:"\u2014"}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-header">
|
||||
@@ -1847,11 +1906,11 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<span class="task-name">${e.name}</span>
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-3CFCNZ5R.js").then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-ZZQ2BDDI.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${e.next_due?r`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${N(e.next_due,t)}</span>`:c}
|
||||
${e.last_performed?r`<span><strong>${s("last_performed",t)||"Last"}:</strong> ${N(e.last_performed,t)}</span>`:c}
|
||||
${e.next_due?r`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${U(e.next_due,t)}</span>`:c}
|
||||
${e.last_performed?r`<span><strong>${s("last_performed",t)||"Last"}:</strong> ${U(e.last_performed,t)}</span>`:c}
|
||||
${e.schedule?.kind&&!["manual","one_time"].includes(e.schedule.kind)||e.interval_days!=null?r`<span><strong>${s("interval",t)||"Interval"}:</strong> ${tt(e,t)}</span>`:c}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1862,7 +1921,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="inline-form">
|
||||
<label>${s("skip_reason",t)||"Skip reason (optional)"}</label>
|
||||
<input type="text" .value=${this._skipReason}
|
||||
@input=${o=>{this._skipReason=o.target.value}} />
|
||||
@input=${n=>{this._skipReason=n.target.value}} />
|
||||
<div class="inline-actions">
|
||||
<button class="btn cancel" @click=${()=>{this._showSkip=!1}} ?disabled=${this._busy}>
|
||||
${s("cancel",t)||"Cancel"}
|
||||
@@ -1876,7 +1935,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="inline-form">
|
||||
<label>${s("reset_to_date",t)||"Reset last_performed to"}</label>
|
||||
<input type="date" .value=${this._resetDate}
|
||||
@input=${o=>{this._resetDate=o.target.value}} />
|
||||
@input=${n=>{this._resetDate=n.target.value}} />
|
||||
<div class="inline-actions">
|
||||
<button class="btn cancel" @click=${()=>{this._showReset=!1}} ?disabled=${this._busy}>
|
||||
${s("cancel",t)||"Cancel"}
|
||||
@@ -1944,7 +2003,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
`}
|
||||
`:r`<div class="loading">${s("loading",t)||"Loading\u2026"}</div>`}
|
||||
</div>
|
||||
`}};b.styles=[it,$`
|
||||
`}};k.styles=[st,w`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
@@ -2124,7 +2183,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; }
|
||||
`],a([g({attribute:!1})],b.prototype,"hass",2),a([l()],b.prototype,"_open",2),a([l()],b.prototype,"_entryId",2),a([l()],b.prototype,"_taskId",2),a([l()],b.prototype,"_task",2),a([l()],b.prototype,"_objectName",2),a([l()],b.prototype,"_busy",2),a([l()],b.prototype,"_error",2),a([l()],b.prototype,"_showSkip",2),a([l()],b.prototype,"_showReset",2),a([l()],b.prototype,"_showDetails",2),a([l()],b.prototype,"_showAdaptive",2),a([l()],b.prototype,"_skipReason",2),a([l()],b.prototype,"_resetDate",2),a([l()],b.prototype,"_features",2),a([l()],b.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",b);var C=class extends x{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=k(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-3CFCNZ5R.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-3CFCNZ5R.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=k(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=k(e,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-3CFCNZ5R.js").then(({openTaskQuickActions:e})=>{e(this._entryId,t)})}render(){if(!this._open)return c;let t=this._lang,e=this._data,i=e?.object,o=e?.tasks||[],_=this.hass?.user?.is_admin??!0;return r`
|
||||
`],a([g({attribute:!1})],k.prototype,"hass",2),a([l()],k.prototype,"_open",2),a([l()],k.prototype,"_entryId",2),a([l()],k.prototype,"_taskId",2),a([l()],k.prototype,"_task",2),a([l()],k.prototype,"_objectName",2),a([l()],k.prototype,"_busy",2),a([l()],k.prototype,"_error",2),a([l()],k.prototype,"_showSkip",2),a([l()],k.prototype,"_showReset",2),a([l()],k.prototype,"_showDetails",2),a([l()],k.prototype,"_showAdaptive",2),a([l()],k.prototype,"_skipReason",2),a([l()],k.prototype,"_resetDate",2),a([l()],k.prototype,"_features",2),a([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-ZZQ2BDDI.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-ZZQ2BDDI.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-ZZQ2BDDI.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 r`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${e&&i?r`
|
||||
@@ -2138,15 +2197,15 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<div class="tasks-section">
|
||||
<div class="section-header">
|
||||
<strong>${s("tasks",t)||"Tasks"}</strong>
|
||||
<span class="count">${o.length}</span>
|
||||
<span class="count">${n.length}</span>
|
||||
</div>
|
||||
${o.length===0?r`<div class="empty">${s("no_tasks",t)||"No tasks yet."}</div>`:r`
|
||||
${n.length===0?r`<div class="empty">${s("no_tasks",t)||"No tasks yet."}</div>`:r`
|
||||
<div class="task-list">
|
||||
${o.map(h=>r`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(h.id)}>
|
||||
<span class="status-dot" style="background: ${V[h.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${h.name}</span>
|
||||
<span class="task-status">${s(h.status||"ok",t)}</span>
|
||||
${n.map(p=>r`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(p.id)}>
|
||||
<span class="status-dot" style="background: ${V[p.status]||"#ccc"}"></span>
|
||||
<span class="task-name">${p.name}</span>
|
||||
<span class="task-status">${s(p.status||"ok",t)}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
@@ -2160,7 +2219,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
</div>
|
||||
`:c}
|
||||
|
||||
${_?r`
|
||||
${h?r`
|
||||
<div class="actions">
|
||||
<button class="btn primary" @click=${this._onAddTask} ?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
@@ -2184,14 +2243,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:r`
|
||||
<div class="meta">
|
||||
${i.map(([o,_])=>r`
|
||||
${i.map(([n,h])=>r`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${o}</span>
|
||||
<span class="meta-value">${/^https?:\/\//i.test(_)?r`<a href="${_}" target="_blank" rel="noopener noreferrer">${_}</a>`:_}</span>
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${_t(h)?r`<a href="${h}" target="_blank" rel="noopener noreferrer">${h}</a>`:h}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
`}};C.styles=$`
|
||||
`}};H.styles=w`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
|
||||
@@ -2250,4 +2309,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; }
|
||||
`,a([g({attribute:!1})],C.prototype,"hass",2),a([l()],C.prototype,"_open",2),a([l()],C.prototype,"_entryId",2),a([l()],C.prototype,"_data",2),a([l()],C.prototype,"_busy",2),a([l()],C.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",C);var _t="maintenance-object-dialog",ut="maintenance-task-dialog",Ft="maintenance-history-edit-dialog",zt="maintenance-complete-dialog",qt="maintenance-qr-dialog",Ut="maintenance-task-quick-actions-dialog",Nt="maintenance-object-quick-actions-dialog";function G(){return document.querySelector("home-assistant")?.hass}function P(n){let d=document.body.querySelector(n);return d||(d=document.createElement(n),document.body.appendChild(d)),d}function M(n){let d=G();if(!d)return!1;n.hass=d;let t=d.language||"en";return Z(t)||J(t).then(()=>{n.requestUpdate?.()}),!0}var ht={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 mt(n){return B||(B=n.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(d=>({features:d.features??ht.features,defaultWarningDays:d.general?.default_warning_days??7})).catch(()=>ht),B)}function ni(){let n=P(_t);return M(n)?(n.openCreate(),!0):!1}function oi(n,d){let t=P(_t);return M(t)?(t.openEdit(n,d),!0):!1}function li(){let n=P(ut);if(!M(n))return!1;let d=G();return d?((async()=>{let t=await mt(d),e=n;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 di(n,d){let t=P(ut);if(!M(t))return!1;let e=G();return e?((async()=>{try{let[i,o]=await Promise.all([e.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n}),mt(e)]),_=(i.tasks||[]).find(m=>m.id===d);if(!_){console.warn(`openEditTaskDialog: task ${d} not found in entry ${n}`);return}let h=t;h.checklistsEnabled=o.features.checklists,h.scheduleTimeEnabled=o.features.schedule_time,h.completionActionsEnabled=o.features.completion_actions,h.defaultWarningDays=o.defaultWarningDays,await h.openEdit(n,_)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function ci(n){let d=P(Ft);return M(d)?(d.openEdit(n),!0):!1}function pi(n){let d=P(zt);return M(d)?(d.entryId=n.entry_id,d.taskId=n.task_id,d.taskName=n.task_name,d.checklist=n.checklist??[],d.adaptiveEnabled=!!n.adaptive_enabled,d.lang=G()?.language||"en",d.open(),!0):!1}function hi(n){let d=P(qt);return M(d)?(d.openForTask(n.entry_id,n.task_id,n.object_name,n.task_name),!0):!1}function _i(n,d){let t=P(Ut);return M(t)?(t.openFor(n,d),!0):!1}function ui(n){let d=P(Nt);return M(d)?(d.openFor(n),!0):!1}export{pi as openCompleteDialog,ni as openCreateObjectDialog,li as openCreateTaskDialog,oi as openEditObjectDialog,di as openEditTaskDialog,ci as openHistoryEditDialog,ui as openObjectQuickActions,hi as openQrDialog,_i as openTaskQuickActions};
|
||||
`,a([g({attribute:!1})],H.prototype,"hass",2),a([l()],H.prototype,"_open",2),a([l()],H.prototype,"_entryId",2),a([l()],H.prototype,"_data",2),a([l()],H.prototype,"_busy",2),a([l()],H.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",H);var mt="maintenance-object-dialog",gt="maintenance-task-dialog",Nt="maintenance-history-edit-dialog",zt="maintenance-complete-dialog",Ut="maintenance-qr-dialog",jt="maintenance-task-quick-actions-dialog",Dt="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 Z(t)||J(t).then(()=>{o.requestUpdate?.()}),!0}var ut={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 vt(o){return B||(B=o.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(d=>({features:d.features??ut.features,defaultWarningDays:d.general?.default_warning_days??7})).catch(()=>ut),B)}function ci(){let o=F(mt);return M(o)?(o.openCreate(),!0):!1}function pi(o,d){let t=F(mt);return M(t)?(t.openEdit(o,d),!0):!1}function hi(){let o=F(gt);if(!M(o))return!1;let d=G();return d?((async()=>{let t=await vt(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 _i(o,d){let t=F(gt);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}),vt(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 ui(o){let d=F(Nt);return M(d)?(d.openEdit(o),!0):!1}function mi(o){let d=F(zt);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 gi(o){let d=F(Ut);return M(d)?(d.openForTask(o.entry_id,o.task_id,o.object_name,o.task_name),!0):!1}function vi(o,d){let t=F(jt);return M(t)?(t.openFor(o,d),!0):!1}function fi(o){let d=F(Dt);return M(d)?(d.openFor(o),!0):!1}export{mi as openCompleteDialog,ci as openCreateObjectDialog,hi as openCreateTaskDialog,pi as openEditObjectDialog,_i as openEditTaskDialog,ui as openHistoryEditDialog,fi as openObjectQuickActions,gi as openQrDialog,vi as openTaskQuickActions};
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as m}from"./chunk-SHU63LHK.js";import{a as u,b as s,d as l,e as h,f as g,g as o,j as i,l as _,s as p}from"./chunk-GKOWV2CF.js";import{a}from"./chunk-LO2NM3CE.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`
|
||||
import{a as m}from"./chunk-ELFU7VML.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-K74DD3QA.js";import{a}from"./chunk-PEGRBZWY.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),_(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as m}from"./chunk-SHU63LHK.js";import{a as h,b as n,d as c,e as _,f as v,g as r,j as e,l as f,s as l}from"./chunk-GKOWV2CF.js";import{a as i}from"./chunk-LO2NM3CE.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`
|
||||
import{a as m}from"./chunk-ELFU7VML.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-K74DD3QA.js";import{a as i}from"./chunk-PEGRBZWY.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),f(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,b=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",g=p?"active":d?"scheduled":"inactive";return n`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
Reference in new issue
Block a user