331 files
This commit is contained in:
1 parent
22ba8b4648
commit
c4d601bfba
331 files changed
+10227
-50159
No files matched your search
-125
@@ -1,125 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
import{a as x,b as $}from"./chunk-MSGNUEIB.js";import{B as p,a as h,b as l,d as b,e as y,f as m,g as o,h as g,i as a,j as v,k as _,n as f,q as d}from"./chunk-UI7IMFM7.js";import{a as n}from"./chunk-BR3YZILG.js";var E=80,e=class extends y{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)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),v(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,f(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=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),r=this._localYearly.trim()===""?0:parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(r)&&r>=0&&(i.budget_yearly=r),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,r=this._status;if(!r)return l`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let i=g(r),k=r.alert_threshold_pct??E,w=[{label:a("budget_monthly",t),spent:r.monthly_spent||0,budget:r.monthly_budget||0},{label:a("budget_yearly",t),spent:r.yearly_spent||0,budget:r.yearly_budget||0}];return l`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">💰</span>
|
||||
<span>${this._config.title||a("settings_budget",t)}</span>
|
||||
</div>
|
||||
<span class="currency">${i}</span>
|
||||
</div>
|
||||
|
||||
${this._error?l`<div class="error">${this._error}</div>`:b}
|
||||
|
||||
${w.map(s=>{if(!(s.budget>0))return l`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${s.label}</label>
|
||||
<span class="track-numbers ok">${d(s.spent,i,t)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let c=Math.min(100,Math.max(0,s.spent/s.budget*100)),u=c>=100?"danger":c>=k?"warning":"ok";return l`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${s.label}</label>
|
||||
<span class="track-numbers ${u}">
|
||||
${d(s.spent,void 0,t)} / ${d(s.budget,i,t)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${u}" style="width:${c}%"></div></div>
|
||||
</div>
|
||||
`})}
|
||||
|
||||
${this._isAdmin?l`
|
||||
<div class="inputs-row">
|
||||
<div class="input-field">
|
||||
<label>${a("budget_monthly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localMonthly}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._localMonthly=s.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${a("budget_yearly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localYearly}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._localYearly=s.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?a("save",t):a("saved",t)}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_advanced",t)}
|
||||
</button>
|
||||
</div>
|
||||
`:l`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[$,h`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 10px; border-radius: 999px;
|
||||
}
|
||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
||||
.track-label-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.track-label-row label {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
||||
.track-numbers.ok { color: var(--primary-text-color); }
|
||||
.track-numbers.warning { color: #ff9800; }
|
||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
||||
.bar {
|
||||
height: 6px; background: var(--secondary-background-color);
|
||||
border-radius: 3px; overflow: hidden;
|
||||
}
|
||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
||||
.bar-fill.ok { background: var(--primary-color); }
|
||||
.bar-fill.warning { background: #ff9800; }
|
||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
||||
.inputs-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
|
||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.input-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
||||
.input-wrap input {
|
||||
flex: 1; padding: 6px 32px 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.input-suffix {
|
||||
position: absolute; right: 8px;
|
||||
color: var(--secondary-text-color); font-size: 13px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; align-items: center; }
|
||||
`],n([m({attribute:!1})],e.prototype,"hass",2),n([o()],e.prototype,"_config",2),n([o()],e.prototype,"_status",2),n([o()],e.prototype,"_busy",2),n([o()],e.prototype,"_error",2),n([o()],e.prototype,"_localMonthly",2),n([o()],e.prototype,"_localYearly",2),n([o()],e.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",e);x({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Inline monthly + yearly budget editor",preview:!1});export{e as MaintenanceBudgetSectionCard};
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as w,b as $}from"./chunk-IWH6LGYJ.js";import{a as h,b as o,d as m,e as y,f as v,g as l,h as g,i as _,j as f,k as x,n as p,z as u}from"./chunk-2ARNLSF6.js";import{a as n,g as i}from"./chunk-3MSNNIFG.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">💰</span>
|
||||
<span>${this._config.title||i("settings_budget",t)}</span>
|
||||
</div>
|
||||
<span class="currency">${a}</span>
|
||||
</div>
|
||||
|
||||
${this._error?o`<div class="error">${this._error}</div>`:m}
|
||||
|
||||
${k.map(r=>{if(!(r.budget>0))return o`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${r.label}</label>
|
||||
<span class="track-numbers ok">${p(r.spent,a,t)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let c=Math.min(100,Math.max(0,r.spent/r.budget*100)),b=c>=100?"danger":c>=d?"warning":"ok";return o`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${r.label}</label>
|
||||
<span class="track-numbers ${b}">
|
||||
${p(r.spent,void 0,t)} / ${p(r.budget,a,t)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${b}" style="width:${c}%"></div></div>
|
||||
</div>
|
||||
`})}
|
||||
|
||||
${this._isAdmin?o`
|
||||
<div class="inputs-row">
|
||||
<div class="input-field">
|
||||
<label>${i("budget_monthly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localMonthly}
|
||||
?disabled=${this._busy}
|
||||
@input=${r=>{this._localMonthly=r.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${a}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${i("budget_yearly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localYearly}
|
||||
?disabled=${this._busy}
|
||||
@input=${r=>{this._localYearly=r.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${a}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?i("save",t):i("saved",t)}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("budget_advanced",t)}
|
||||
</button>
|
||||
</div>
|
||||
`:o`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("budget_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[$,h`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 10px; border-radius: 999px;
|
||||
}
|
||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
||||
.track-label-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.track-label-row label {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
||||
.track-numbers.ok { color: var(--primary-text-color); }
|
||||
.track-numbers.warning { color: #ff9800; }
|
||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
||||
.bar {
|
||||
height: 6px; background: var(--secondary-background-color);
|
||||
border-radius: 3px; overflow: hidden;
|
||||
}
|
||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
||||
.bar-fill.ok { background: var(--primary-color); }
|
||||
.bar-fill.warning { background: #ff9800; }
|
||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
||||
/* minmax(0, …): a bare 1fr never shrinks below the number inputs'
|
||||
natural width — the row was 420 px wide on a phone (2026-09-27). */
|
||||
.inputs-row {
|
||||
display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
|
||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.input-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
||||
.input-wrap input {
|
||||
flex: 1; min-width: 0; width: 100%; box-sizing: border-box; padding: 6px 32px 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.input-suffix {
|
||||
position: absolute; right: 8px;
|
||||
color: var(--secondary-text-color); font-size: 13px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; align-items: center; }
|
||||
`],n([v({attribute:!1})],s.prototype,"hass",2),n([l()],s.prototype,"_config",2),n([l()],s.prototype,"_status",2),n([l()],s.prototype,"_busy",2),n([l()],s.prototype,"_error",2),n([l()],s.prototype,"_localMonthly",2),n([l()],s.prototype,"_localYearly",2),n([l()],s.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",s);w({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Edit the monthly and yearly budget right on the dashboard.",preview:!1});export{s as MaintenanceBudgetSectionCard};
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
import{a as x,b as $}from"./chunk-CH4XIFVT.js";import{B as p,a as h,b as l,d as b,e as y,f as m,g as o,h as g,i as a,j as v,k as _,n as f,q as d}from"./chunk-ZBY2DACR.js";import{a as n}from"./chunk-62AO4XFY.js";var E=80,e=class extends y{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)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),v(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,f(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=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),r=this._localYearly.trim()===""?0:parseFloat(this._localYearly),i={};!isNaN(t)&&t>=0&&(i.budget_monthly=t),!isNaN(r)&&r>=0&&(i.budget_yearly=r),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:i}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,r=this._status;if(!r)return l`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let i=g(r),k=r.alert_threshold_pct??E,w=[{label:a("budget_monthly",t),spent:r.monthly_spent||0,budget:r.monthly_budget||0},{label:a("budget_yearly",t),spent:r.yearly_spent||0,budget:r.yearly_budget||0}];return l`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">💰</span>
|
||||
<span>${this._config.title||a("settings_budget",t)}</span>
|
||||
</div>
|
||||
<span class="currency">${i}</span>
|
||||
</div>
|
||||
|
||||
${this._error?l`<div class="error">${this._error}</div>`:b}
|
||||
|
||||
${w.map(s=>{if(!(s.budget>0))return l`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${s.label}</label>
|
||||
<span class="track-numbers ok">${d(s.spent,i,t)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let c=Math.min(100,Math.max(0,s.spent/s.budget*100)),u=c>=100?"danger":c>=k?"warning":"ok";return l`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${s.label}</label>
|
||||
<span class="track-numbers ${u}">
|
||||
${d(s.spent,void 0,t)} / ${d(s.budget,i,t)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${u}" style="width:${c}%"></div></div>
|
||||
</div>
|
||||
`})}
|
||||
|
||||
${this._isAdmin?l`
|
||||
<div class="inputs-row">
|
||||
<div class="input-field">
|
||||
<label>${a("budget_monthly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localMonthly}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._localMonthly=s.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${a("budget_yearly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localYearly}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._localYearly=s.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${i}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?a("save",t):a("saved",t)}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_advanced",t)}
|
||||
</button>
|
||||
</div>
|
||||
`:l`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("budget_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[$,h`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 10px; border-radius: 999px;
|
||||
}
|
||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
||||
.track-label-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.track-label-row label {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
||||
.track-numbers.ok { color: var(--primary-text-color); }
|
||||
.track-numbers.warning { color: #ff9800; }
|
||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
||||
.bar {
|
||||
height: 6px; background: var(--secondary-background-color);
|
||||
border-radius: 3px; overflow: hidden;
|
||||
}
|
||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
||||
.bar-fill.ok { background: var(--primary-color); }
|
||||
.bar-fill.warning { background: #ff9800; }
|
||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
||||
.inputs-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
|
||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.input-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
||||
.input-wrap input {
|
||||
flex: 1; padding: 6px 32px 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.input-suffix {
|
||||
position: absolute; right: 8px;
|
||||
color: var(--secondary-text-color); font-size: 13px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; align-items: center; }
|
||||
`],n([m({attribute:!1})],e.prototype,"hass",2),n([o()],e.prototype,"_config",2),n([o()],e.prototype,"_status",2),n([o()],e.prototype,"_busy",2),n([o()],e.prototype,"_error",2),n([o()],e.prototype,"_localMonthly",2),n([o()],e.prototype,"_localYearly",2),n([o()],e.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",e);x({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Inline monthly + yearly budget editor",preview:!1});export{e as MaintenanceBudgetSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as w,b as $}from"./chunk-LKMEBXIJ.js";import{A as u,a as h,b as o,d as m,e as y,f as v,g as l,h as g,i as _,j as f,k as x,n as p}from"./chunk-V2H6N4AC.js";import{a as n,g as i}from"./chunk-RGIYRWN4.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as w,b as $}from"./chunk-GN5JMQ24.js";import{A as u,a as h,b as o,d as m,e as y,f as v,g as l,h as g,i as _,j as f,k as x,n as p}from"./chunk-XR5IXJXS.js";import{a as n,g as i}from"./chunk-G7Y44K4C.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
-127
@@ -1,127 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as w,b as $}from"./chunk-7S4QZ3RX.js";import{C as u,a as h,b as o,d as m,e as y,f as v,g as l,h as g,i,j as _,k as f,n as x,q as p}from"./chunk-6VYW2MWJ.js";import{a as n}from"./chunk-RVTWU5ZB.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">💰</span>
|
||||
<span>${this._config.title||i("settings_budget",t)}</span>
|
||||
</div>
|
||||
<span class="currency">${a}</span>
|
||||
</div>
|
||||
|
||||
${this._error?o`<div class="error">${this._error}</div>`:m}
|
||||
|
||||
${k.map(r=>{if(!(r.budget>0))return o`
|
||||
<div class="track spent-only">
|
||||
<div class="track-label-row">
|
||||
<label>${r.label}</label>
|
||||
<span class="track-numbers ok">${p(r.spent,a,t)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;let c=Math.min(100,Math.max(0,r.spent/r.budget*100)),b=c>=100?"danger":c>=d?"warning":"ok";return o`
|
||||
<div class="track">
|
||||
<div class="track-label-row">
|
||||
<label>${r.label}</label>
|
||||
<span class="track-numbers ${b}">
|
||||
${p(r.spent,void 0,t)} / ${p(r.budget,a,t)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bar"><div class="bar-fill ${b}" style="width:${c}%"></div></div>
|
||||
</div>
|
||||
`})}
|
||||
|
||||
${this._isAdmin?o`
|
||||
<div class="inputs-row">
|
||||
<div class="input-field">
|
||||
<label>${i("budget_monthly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localMonthly}
|
||||
?disabled=${this._busy}
|
||||
@input=${r=>{this._localMonthly=r.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${a}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<label>${i("budget_yearly_set",t)}</label>
|
||||
<div class="input-wrap">
|
||||
<input type="number" min="0" step="1"
|
||||
.value=${this._localYearly}
|
||||
?disabled=${this._busy}
|
||||
@input=${r=>{this._localYearly=r.target.value,this._dirty=!0}} />
|
||||
<span class="input-suffix">${a}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?i("save",t):i("saved",t)}
|
||||
</button>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("budget_advanced",t)}
|
||||
</button>
|
||||
</div>
|
||||
`:o`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("budget_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[$,h`
|
||||
.currency {
|
||||
font-size: 14px; font-weight: 600;
|
||||
color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 10px; border-radius: 999px;
|
||||
}
|
||||
.track { display: flex; flex-direction: column; gap: 4px; }
|
||||
.track-label-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.track-label-row label {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.track-numbers { font-size: 13px; font-weight: 600; }
|
||||
.track-numbers.ok { color: var(--primary-text-color); }
|
||||
.track-numbers.warning { color: #ff9800; }
|
||||
.track-numbers.danger { color: var(--error-color, #f44336); }
|
||||
.bar {
|
||||
height: 6px; background: var(--secondary-background-color);
|
||||
border-radius: 3px; overflow: hidden;
|
||||
}
|
||||
.bar-fill { height: 100%; transition: width 0.3s; border-radius: 3px; }
|
||||
.bar-fill.ok { background: var(--primary-color); }
|
||||
.bar-fill.warning { background: #ff9800; }
|
||||
.bar-fill.danger { background: var(--error-color, #f44336); }
|
||||
/* minmax(0, …): a bare 1fr never shrinks below the number inputs'
|
||||
natural width — the row was 420 px wide on a phone (2026-09-27). */
|
||||
.inputs-row {
|
||||
display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
|
||||
padding-top: 4px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.input-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.input-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.input-wrap { position: relative; display: flex; align-items: center; }
|
||||
.input-wrap input {
|
||||
flex: 1; min-width: 0; width: 100%; box-sizing: border-box; padding: 6px 32px 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.input-suffix {
|
||||
position: absolute; right: 8px;
|
||||
color: var(--secondary-text-color); font-size: 13px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; align-items: center; }
|
||||
`],n([v({attribute:!1})],s.prototype,"hass",2),n([l()],s.prototype,"_config",2),n([l()],s.prototype,"_status",2),n([l()],s.prototype,"_busy",2),n([l()],s.prototype,"_error",2),n([l()],s.prototype,"_localMonthly",2),n([l()],s.prototype,"_localYearly",2),n([l()],s.prototype,"_dirty",2);customElements.get("maintenance-budget-section-card")||customElements.define("maintenance-budget-section-card",s);w({type:"maintenance-budget-section-card",name:"Maintenance Supporter \u2014 Budget",description:"Inline monthly + yearly budget editor",preview:!1});export{s as MaintenanceBudgetSectionCard};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as i}from"./chunk-QP2XJAYX.js";var a={operatorWriteEnabled:!1,operatorIds:[]};function _(e,t=a){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}var u=["buttons_compact","buttons","icons"];function d(e){let[t,s]=i.default_warning_days,n=e?.general?.default_warning_days,r=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof n=="number"&&Number.isFinite(n)&&n>=t&&n<=s?n:o.defaultWarningDays,rowActionStyle:u.includes(r??"")?r:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(c=>typeof c=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0}}var o={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:a,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0};function l(){let e=window;return e.__msSettingsCache??={promise:null}}function m(e){let t=l();if(t.promise)return t.promise;let s=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(n=>d(n)).catch(()=>(t.promise===s&&(t.promise=null),o));return t.promise=s,s}function b(){l().promise=null}export{a,_ as b,m as c,b as d};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as i}from"./chunk-CTWCZMNP.js";var r={operatorWriteEnabled:!1,operatorIds:[]};function m(e,t=r){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}function l(e){return e==="use"?"use":"purchase"}var c=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function b(e){let t=c(e?.cost);if(t===null)return null;let n=c(e?.package_size);return n&&n>0?t/n:t}var d=["buttons_compact","buttons","icons"];function _(e){let[t,n]=i.default_warning_days,s=e?.general?.default_warning_days,a=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof s=="number"&&Number.isFinite(s)&&s>=t&&s<=n?s:o.defaultWarningDays,rowActionStyle:d.includes(a??"")?a:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(p=>typeof p=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0,partsCostMode:l(e?.budget?.parts_cost_mode)}}var o={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:r,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0,partsCostMode:"purchase"};function u(){let e=window;return e.__msSettingsCache??={promise:null}}function w(e){let t=u();if(t.promise)return t.promise;let n=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>_(s)).catch(()=>(t.promise===n&&(t.promise=null),o));return t.promise=n,n}function h(){u().promise=null}export{r as a,m as b,b as c,w as d,h as e};
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as i}from"./chunk-GDJJTBLT.js";var r={operatorWriteEnabled:!1,operatorIds:[]};function m(e,t=r){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}function l(e){return e==="use"?"use":"purchase"}var c=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function b(e){let t=c(e?.cost);if(t===null)return null;let n=c(e?.package_size);return n&&n>0?t/n:t}var d=["buttons_compact","buttons","icons"];function _(e){let[t,n]=i.default_warning_days,s=e?.general?.default_warning_days,a=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof s=="number"&&Number.isFinite(s)&&s>=t&&s<=n?s:o.defaultWarningDays,rowActionStyle:d.includes(a??"")?a:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(p=>typeof p=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0,partsCostMode:l(e?.budget?.parts_cost_mode)}}var o={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:r,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0,partsCostMode:"purchase"};function u(){let e=window;return e.__msSettingsCache??={promise:null}}function w(e){let t=u();if(t.promise)return t.promise;let n=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>_(s)).catch(()=>(t.promise===n&&(t.promise=null),o));return t.promise=n,n}function h(){u().promise=null}export{r as a,m as b,b as c,w as d,h as e};
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
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};
|
||||
@@ -1,66 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as u,b as s,d as r,e as _,f as m,g as o,j as d,x as c}from"./chunk-2ARNLSF6.js";import{a as n,g as p}from"./chunk-3MSNNIFG.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=15,A=[.1,.9],E=[0,365],T=[.01,999],$=[.01,9999];var i=class extends _{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
<ha-dialog open @closed=${this._cancel}>
|
||||
<div class="dialog-title">${this._title}</div>
|
||||
<div class="content">
|
||||
${this._message}
|
||||
${this._inputLabel?s`
|
||||
<!-- Native <input> rather than <ha-textfield>: HA loads
|
||||
ha-textfield lazily for its own panels, so inside this custom
|
||||
panel it can be unregistered and render with zero height —
|
||||
the prompt then shows no field at all (caught live testing
|
||||
the pause/replace prompts; same fix as complete-dialog). -->
|
||||
<label class="field">
|
||||
<span class="field-label">${this._inputLabel}</span>
|
||||
${this._options?s`<select class="field-input field-select"
|
||||
@change=${t=>this._inputValue=t.target.value}>
|
||||
${this._options.map(t=>s`<option value=${t.value} ?selected=${t.value===this._inputValue}>${t.label}</option>`)}
|
||||
</select>`:s`<input class="field-input"
|
||||
type="${this._inputType||"text"}"
|
||||
.value=${this._inputValue}
|
||||
@input=${t=>this._inputValue=t.target.value} />`}
|
||||
</label>
|
||||
`:r}
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<ha-button appearance="plain" @click=${this._cancel}>
|
||||
${p("cancel",e)}
|
||||
</ha-button>
|
||||
<ha-button
|
||||
class="${this._danger?"danger":""}"
|
||||
@click=${this._confirmAction}
|
||||
>
|
||||
${this._confirmText}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};i.styles=[c,u`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
/* shared native-field scaffold from nativeFieldStyles; the prompt input
|
||||
follows the message text, hence the extra top margin here */
|
||||
.field { margin-top: 12px; }
|
||||
.content {
|
||||
padding: 8px 0;
|
||||
min-width: 280px;
|
||||
line-height: 1.5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
ha-textfield {
|
||||
display: block;
|
||||
}
|
||||
ha-button.danger {
|
||||
--mdc-theme-primary: var(--error-color, #f44336);
|
||||
}
|
||||
`],n([m({attribute:!1})],i.prototype,"hass",2),n([o()],i.prototype,"_open",2),n([o()],i.prototype,"_title",2),n([o()],i.prototype,"_message",2),n([o()],i.prototype,"_confirmText",2),n([o()],i.prototype,"_danger",2),n([o()],i.prototype,"_inputLabel",2),n([o()],i.prototype,"_inputType",2),n([o()],i.prototype,"_options",2),n([o()],i.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",i);var h="maintenance-confirm-dialog",f="data-ms-lovelace-confirm";function v(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function H(l,a){let e=v(),t=e.querySelector(`${h}[${f}]`);return t||(t=document.createElement(h),t.setAttribute(f,""),e.appendChild(t)),t.hass=l,t.confirm(a)}export{g as a,b,x as c,y as d,R as e,A as f,E as g,T as h,$ as i,H as j};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as y,b as s,d,e as g,f as o,g as f,q as m}from"./chunk-V2H6N4AC.js";import{a,g as l}from"./chunk-RGIYRWN4.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as y,b as s,d,e as g,f as o,g as f,q as m}from"./chunk-XR5IXJXS.js";import{a,g as l}from"./chunk-G7Y44K4C.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:d}</span>`:d}
|
||||
<div class="row">
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
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};
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as i}from"./chunk-6BHUADHJ.js";var a={operatorWriteEnabled:!1,operatorIds:[]};function _(e,t=a){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}var u=["buttons_compact","buttons","icons"];function d(e){let[t,s]=i.default_warning_days,n=e?.general?.default_warning_days,r=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof n=="number"&&Number.isFinite(n)&&n>=t&&n<=s?n:o.defaultWarningDays,rowActionStyle:u.includes(r??"")?r:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(c=>typeof c=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0}}var o={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:a,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0};function l(){let e=window;return e.__msSettingsCache??={promise:null}}function m(e){let t=l();if(t.promise)return t.promise;let s=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(n=>d(n)).catch(()=>(t.promise===s&&(t.promise=null),o));return t.promise=s,s}function b(){l().promise=null}export{a,_ as b,m as c,b as d};
|
||||
@@ -1,60 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
import{a as t}from"./chunk-ZBY2DACR.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.title {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 16px; font-weight: 500;
|
||||
}
|
||||
.emoji { font-size: 20px; }
|
||||
|
||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
||||
.btn {
|
||||
padding: 6px 12px; font-size: 13px;
|
||||
border-radius: 6px; cursor: pointer;
|
||||
border: 1px solid var(--divider-color);
|
||||
background: var(--secondary-background-color, transparent);
|
||||
color: var(--primary-text-color);
|
||||
font-weight: 500;
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
color: var(--text-primary-color, white);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.btn.primary[disabled] { opacity: 0.6; }
|
||||
.btn.muted {
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
border-style: dashed;
|
||||
}
|
||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
||||
.btn.link {
|
||||
background: transparent; border: none; padding: 6px 4px;
|
||||
color: var(--primary-color); margin-left: auto;
|
||||
}
|
||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
||||
|
||||
/* Error + loading states */
|
||||
.error {
|
||||
padding: 8px; border-radius: 6px;
|
||||
background: rgba(211, 47, 47, 0.1);
|
||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
||||
}
|
||||
.loading {
|
||||
padding: 24px; text-align: center;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;export{e as a,d as b};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
var _=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var L=(n,e,t,s)=>{for(var r=s>1?void 0:s?f(e,t):e,c=n.length-1,l;c>=0;c--)(l=n[c])&&(r=(s?l(e,t,r):l(r))||r);return s&&r&&_(e,t,r),r};var v={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)"},p=["overdue","triggered","due_soon","ok"],E=["overdue","triggered","due_soon"],T=Object.fromEntries(p.map((n,e)=>[n,e]));var b={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"};var u="2.95.0";var a="en",g=(()=>{let n=window;return n.__msLocales||(n.__msLocales={store:{},inflight:{}}),n.__msLocales})(),o=g.store,i=g.inflight;function N(n){o.en=Object.assign({},n,o.en??{})}var S=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),m="/maintenance_supporter_locales";function d(n){let e=(n||a).toLowerCase();return e.startsWith("pt")&&e.endsWith("br")?"pt-br":e.substring(0,2)}function O(n,e,t){let s=d(e);return o[s]?.[n]??o.en?.[n]??t??n}function U(n){let e=d(n);return e===a||e in o}function k(n){let e=d(n);return e===a||e in o||!S.has(e)?Promise.resolve():(e in i||(i[e]=fetch(`${m}/${e}.json?v=${u}`).then(t=>t.ok?t.json():null).then(t=>{t?o[e]=t:delete i[e]}).catch(()=>{delete i[e]})),i[e])}export{L as a,v as b,E as c,b as d,N as e,d as f,O as g,U as h,k as i};
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
var _=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var L=(n,e,t,s)=>{for(var r=s>1?void 0:s?f(e,t):e,c=n.length-1,l;c>=0;c--)(l=n[c])&&(r=(s?l(e,t,r):l(r))||r);return s&&r&&_(e,t,r),r};var v={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)"},p=["overdue","triggered","due_soon","ok"],E=["overdue","triggered","due_soon"],T=Object.fromEntries(p.map((n,e)=>[n,e]));var b={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"};var u="2.97.1";var a="en",g=(()=>{let n=window;return n.__msLocales||(n.__msLocales={store:{},inflight:{}}),n.__msLocales})(),o=g.store,i=g.inflight;function N(n){o.en=Object.assign({},n,o.en??{})}var S=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),m="/maintenance_supporter_locales";function d(n){let e=(n||a).toLowerCase();return e.startsWith("pt")&&e.endsWith("br")?"pt-br":e.substring(0,2)}function O(n,e,t){let s=d(e);return o[s]?.[n]??o.en?.[n]??t??n}function U(n){let e=d(n);return e===a||e in o}function k(n){let e=d(n);return e===a||e in o||!S.has(e)?Promise.resolve():(e in i||(i[e]=fetch(`${m}/${e}.json?v=${u}`).then(t=>t.ok?t.json():null).then(t=>{t?o[e]=t:delete i[e]}).catch(()=>{delete i[e]})),i[e])}export{L as a,v as b,E as c,b as d,N as e,d as f,O as g,U as h,k as i};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as u,b as s,d as r,e as _,f as m,g as o,j as d,y as c}from"./chunk-V2H6N4AC.js";import{a as i,g as p}from"./chunk-RGIYRWN4.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=[0,365],A=15,E=[.1,.9],T=[0,365],$=[.01,1e4],G=[.01,1e5];var n=class extends _{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as u,b as s,d as r,e as _,f as m,g as o,j as d,y as c}from"./chunk-XR5IXJXS.js";import{a as i,g as p}from"./chunk-G7Y44K4C.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=[0,365],A=15,E=[.1,.9],T=[0,365],$=[.01,1e4],G=[.01,1e5];var n=class extends _{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
<ha-dialog open @closed=${this._cancel}>
|
||||
<div class="dialog-title">${this._title}</div>
|
||||
<div class="content">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as t}from"./chunk-6VYW2MWJ.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as t}from"./chunk-XR5IXJXS.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
function l(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}function f(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function d(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function c(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||d(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function p(r){return c(r??[]).map(n=>({timestamp:n.timestamp,values:d(n)})).filter(n=>n.values.length>0)}function m(r,n,i){let o;for(let t of r){if(i!==void 0){let s=new Date(t.timestamp).getTime();if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function _(r,n,i){let o=d(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of c(r)){if(e.timestamp>=n.timestamp)break;let s=d(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function R(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function h(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=20))break}return n}function y(r,n,i,o){let t=i,e=u=>typeof u=="string"?u:null,s=u=>typeof u=="number"?u:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:l(t),reading_value:s(t.reading_value),reading_values:d(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function E(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i);if(!e)return null;let s=e.history?.find(a=>a.timestamp===o);return s||(s=(await r.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:n,task_id:i})).history?.find(u=>u.timestamp===o)),s?y(n,i,s,e):null}export{l as a,f as b,d as c,p as d,m as e,_ as f,R as g,h,y as i,E as j};
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
function l(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}function f(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function d(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function c(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||d(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function p(r){return c(r??[]).map(n=>({timestamp:n.timestamp,values:d(n)})).filter(n=>n.values.length>0)}function m(r,n,i){let o;for(let t of r){if(i!==void 0){let s=new Date(t.timestamp).getTime();if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function _(r,n,i){let o=d(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of c(r)){if(e.timestamp>=n.timestamp)break;let s=d(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function R(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function h(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=20))break}return n}function y(r,n,i,o){let t=i,e=u=>typeof u=="string"?u:null,s=u=>typeof u=="number"?u:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:l(t),reading_value:s(t.reading_value),reading_values:d(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function E(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i);if(!e)return null;let s=e.history?.find(a=>a.timestamp===o);return s||(s=(await r.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:n,task_id:i})).history?.find(u=>u.timestamp===o)),s?y(n,i,s,e):null}export{l as a,f as b,d as c,p as d,m as e,_ as f,R as g,h,y as i,E as j};
|
||||
@@ -1,60 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as t}from"./chunk-2ARNLSF6.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.title {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 16px; font-weight: 500;
|
||||
}
|
||||
.emoji { font-size: 20px; }
|
||||
|
||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
||||
.btn {
|
||||
padding: 6px 12px; font-size: 13px;
|
||||
border-radius: 6px; cursor: pointer;
|
||||
border: 1px solid var(--divider-color);
|
||||
background: var(--secondary-background-color, transparent);
|
||||
color: var(--primary-text-color);
|
||||
font-weight: 500;
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
color: var(--text-primary-color, white);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.btn.primary[disabled] { opacity: 0.6; }
|
||||
.btn.muted {
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
border-style: dashed;
|
||||
}
|
||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
||||
.btn.link {
|
||||
background: transparent; border: none; padding: 6px 4px;
|
||||
color: var(--primary-color); margin-left: auto;
|
||||
}
|
||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
||||
|
||||
/* Error + loading states */
|
||||
.error {
|
||||
padding: 8px; border-radius: 6px;
|
||||
background: rgba(211, 47, 47, 0.1);
|
||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
||||
}
|
||||
.loading {
|
||||
padding: 24px; text-align: center;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;export{e as a,d as b};
|
||||
@@ -1,88 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
import{a as y,b as s,d as l,e as g,f as o,g as f,i as d,r as m}from"./chunk-ZBY2DACR.js";import{a}from"./chunk-62AO4XFY.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:l}</span>`:l}
|
||||
<div class="row">
|
||||
${this._typing?s`<input class="typed" type="text" inputmode="numeric" autocomplete="off"
|
||||
.value=${this._typed}
|
||||
placeholder=${m("1978-03-15",this.lang)}
|
||||
aria-invalid=${this._typedInvalid?"true":"false"}
|
||||
@input=${t=>{this._typed=t.target.value,this._typedInvalid=!1}}
|
||||
@keydown=${this._onTypedKey}
|
||||
@blur=${this._commitTyped} />`:s`<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${this._selector()}
|
||||
.value=${x(this.kind,this.value)}
|
||||
.required=${this.required}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._onSelectorChange}
|
||||
></ha-selector>`}
|
||||
${this.kind==="date"&&!this.disabled&&!this._typing?s`<button type="button" class="type-toggle" title=${d("date_type_toggle",this.lang)} aria-label=${d("date_type_toggle",this.lang)} @click=${this._startTyping}>
|
||||
<ha-icon icon="mdi:keyboard-outline"></ha-icon>
|
||||
</button>`:l}
|
||||
${this.clearable&&this.value&&!this.disabled&&!this._typing?s`<button type="button" class="clear" title=${d("clear",this.lang)} aria-label=${d("clear",this.lang)} @click=${this._clear}>
|
||||
<ha-icon icon="mdi:close"></ha-icon>
|
||||
</button>`:l}
|
||||
</div>
|
||||
${this._typedInvalid?s`<span class="helper invalid">${d("date_type_invalid",this.lang)}</span>`:this.helper?s`<span class="helper">${this.helper}</span>`:l}
|
||||
</div>
|
||||
`}};r.styles=y`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.label {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #888);
|
||||
font-weight: 500;
|
||||
}
|
||||
.req { color: var(--error-color, #f44336); margin-left: 2px; }
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
ha-selector {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.clear, .type-toggle {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
cursor: pointer;
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.clear:hover, .type-toggle:hover { background: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.08); }
|
||||
.clear:focus-visible, .type-toggle:focus-visible { outline: 2px solid var(--primary-color); }
|
||||
.helper {
|
||||
font-size: 11px;
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
.helper.invalid { color: var(--error-color, #f44336); font-style: normal; }
|
||||
input.typed {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--divider-color, #ccc);
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
font: inherit;
|
||||
}
|
||||
input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); }
|
||||
input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; }
|
||||
`,a([o({attribute:!1})],r.prototype,"hass",2),a([o()],r.prototype,"kind",2),a([o()],r.prototype,"label",2),a([o()],r.prototype,"value",2),a([o()],r.prototype,"helper",2),a([o({type:Boolean})],r.prototype,"clearable",2),a([o({type:Boolean})],r.prototype,"disabled",2),a([o({type:Boolean})],r.prototype,"required",2),a([o()],r.prototype,"lang",2),a([f()],r.prototype,"_typing",2),a([f()],r.prototype,"_typed",2),a([f()],r.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",r);
|
||||
@@ -1,60 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as t}from"./chunk-V2H6N4AC.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.title {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 16px; font-weight: 500;
|
||||
}
|
||||
.emoji { font-size: 20px; }
|
||||
|
||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
||||
.btn {
|
||||
padding: 6px 12px; font-size: 13px;
|
||||
border-radius: 6px; cursor: pointer;
|
||||
border: 1px solid var(--divider-color);
|
||||
background: var(--secondary-background-color, transparent);
|
||||
color: var(--primary-text-color);
|
||||
font-weight: 500;
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
color: var(--text-primary-color, white);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.btn.primary[disabled] { opacity: 0.6; }
|
||||
.btn.muted {
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
border-style: dashed;
|
||||
}
|
||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
||||
.btn.link {
|
||||
background: transparent; border: none; padding: 6px 4px;
|
||||
color: var(--primary-color); margin-left: auto;
|
||||
}
|
||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
||||
|
||||
/* Error + loading states */
|
||||
.error {
|
||||
padding: 8px; border-radius: 6px;
|
||||
background: rgba(211, 47, 47, 0.1);
|
||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
||||
}
|
||||
.loading {
|
||||
padding: 24px; text-align: center;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;export{e as a,d as b};
|
||||
@@ -1,60 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
import{a as t}from"./chunk-UI7IMFM7.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.title {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
font-size: 16px; font-weight: 500;
|
||||
}
|
||||
.emoji { font-size: 20px; }
|
||||
|
||||
/* Button family — primary action / muted-saved-state / link / icon-with-text */
|
||||
.btn {
|
||||
padding: 6px 12px; font-size: 13px;
|
||||
border-radius: 6px; cursor: pointer;
|
||||
border: 1px solid var(--divider-color);
|
||||
background: var(--secondary-background-color, transparent);
|
||||
color: var(--primary-text-color);
|
||||
font-weight: 500;
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
}
|
||||
.btn:hover { background: var(--state-icon-color, rgba(255,255,255,0.06)); }
|
||||
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
color: var(--text-primary-color, white);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.btn.primary[disabled] { opacity: 0.6; }
|
||||
.btn.muted {
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
border-style: dashed;
|
||||
}
|
||||
.btn.muted[disabled] { opacity: 1; cursor: default; }
|
||||
.btn.muted ha-icon, .btn.primary ha-icon { --mdc-icon-size: 14px; }
|
||||
.btn.link {
|
||||
background: transparent; border: none; padding: 6px 4px;
|
||||
color: var(--primary-color); margin-left: auto;
|
||||
}
|
||||
.btn.link:hover { background: transparent; text-decoration: underline; }
|
||||
|
||||
/* Error + loading states */
|
||||
.error {
|
||||
padding: 8px; border-radius: 6px;
|
||||
background: rgba(211, 47, 47, 0.1);
|
||||
color: var(--error-color, #d32f2f); font-size: 13px;
|
||||
}
|
||||
.loading {
|
||||
padding: 24px; text-align: center;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
`;export{e as a,d as b};
|
||||
@@ -1,88 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as y,b as s,d,e as g,f as o,g as f,p as m}from"./chunk-2ARNLSF6.js";import{a,g as l}from"./chunk-3MSNNIFG.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:d}</span>`:d}
|
||||
<div class="row">
|
||||
${this._typing?s`<input class="typed" type="text" inputmode="numeric" autocomplete="off"
|
||||
.value=${this._typed}
|
||||
placeholder=${m("1978-03-15",this.lang)}
|
||||
aria-invalid=${this._typedInvalid?"true":"false"}
|
||||
@input=${t=>{this._typed=t.target.value,this._typedInvalid=!1}}
|
||||
@keydown=${this._onTypedKey}
|
||||
@blur=${this._commitTyped} />`:s`<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${this._selector()}
|
||||
.value=${x(this.kind,this.value)}
|
||||
.required=${this.required}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._onSelectorChange}
|
||||
></ha-selector>`}
|
||||
${this.kind==="date"&&!this.disabled&&!this._typing?s`<button type="button" class="type-toggle" title=${l("date_type_toggle",this.lang)} aria-label=${l("date_type_toggle",this.lang)} @click=${this._startTyping}>
|
||||
<ha-icon icon="mdi:keyboard-outline"></ha-icon>
|
||||
</button>`:d}
|
||||
${this.clearable&&this.value&&!this.disabled&&!this._typing?s`<button type="button" class="clear" title=${l("clear",this.lang)} aria-label=${l("clear",this.lang)} @click=${this._clear}>
|
||||
<ha-icon icon="mdi:close"></ha-icon>
|
||||
</button>`:d}
|
||||
</div>
|
||||
${this._typedInvalid?s`<span class="helper invalid">${l("date_type_invalid",this.lang)}</span>`:this.helper?s`<span class="helper">${this.helper}</span>`:d}
|
||||
</div>
|
||||
`}};r.styles=y`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.label {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #888);
|
||||
font-weight: 500;
|
||||
}
|
||||
.req { color: var(--error-color, #f44336); margin-left: 2px; }
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
ha-selector {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.clear, .type-toggle {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
cursor: pointer;
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.clear:hover, .type-toggle:hover { background: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.08); }
|
||||
.clear:focus-visible, .type-toggle:focus-visible { outline: 2px solid var(--primary-color); }
|
||||
.helper {
|
||||
font-size: 11px;
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
.helper.invalid { color: var(--error-color, #f44336); font-style: normal; }
|
||||
input.typed {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--divider-color, #ccc);
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
font: inherit;
|
||||
}
|
||||
input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); }
|
||||
input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; }
|
||||
`,a([o({attribute:!1})],r.prototype,"hass",2),a([o()],r.prototype,"kind",2),a([o()],r.prototype,"label",2),a([o()],r.prototype,"value",2),a([o()],r.prototype,"helper",2),a([o({type:Boolean})],r.prototype,"clearable",2),a([o({type:Boolean})],r.prototype,"disabled",2),a([o({type:Boolean})],r.prototype,"required",2),a([o()],r.prototype,"lang",2),a([f()],r.prototype,"_typing",2),a([f()],r.prototype,"_typed",2),a([f()],r.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",r);
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
function l(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}function f(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function u(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function c(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||u(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function p(r){return c(r??[]).map(n=>({timestamp:n.timestamp,values:u(n)})).filter(n=>n.values.length>0)}function m(r,n,i){let o;for(let t of r){if(i!==void 0){let s=new Date(t.timestamp).getTime();if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function _(r,n,i){let o=u(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of c(r)){if(e.timestamp>=n.timestamp)break;let s=u(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function R(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function h(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=20))break}return n}function g(r,n,i,o){let t=i,e=d=>typeof d=="string"?d:null,s=d=>typeof d=="number"?d:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:l(t),reading_value:s(t.reading_value),reading_values:u(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function E(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i),s=e?.history?.find(a=>a.timestamp===o);return!e||!s?null:g(n,i,s,e)}export{l as a,f as b,u as c,p as d,m as e,_ as f,R as g,h,g as i,E as j};
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
function l(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}function f(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function u(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function c(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||u(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function p(r){return c(r??[]).map(n=>({timestamp:n.timestamp,values:u(n)})).filter(n=>n.values.length>0)}function m(r,n,i){let o;for(let t of r){if(i!==void 0){let s=new Date(t.timestamp).getTime();if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function _(r,n,i){let o=u(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of c(r)){if(e.timestamp>=n.timestamp)break;let s=u(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function R(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function h(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=20))break}return n}function g(r,n,i,o){let t=i,e=d=>typeof d=="string"?d:null,s=d=>typeof d=="number"?d:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:l(t),reading_value:s(t.reading_value),reading_values:u(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function E(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i),s=e?.history?.find(a=>a.timestamp===o);return!e||!s?null:g(n,i,s,e)}export{l as a,f as b,u as c,p as d,m as e,_ as f,R as g,h,g as i,E as j};
|
||||
@@ -1,66 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{A as c,a as p,b as s,d as r,e as u,f as _,g as o,i as m,k as d}from"./chunk-6VYW2MWJ.js";import{a as n}from"./chunk-RVTWU5ZB.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=15,A=[.1,.9],E=[0,365],T=[.01,999],$=[.01,9999];var i=class extends u{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
<ha-dialog open @closed=${this._cancel}>
|
||||
<div class="dialog-title">${this._title}</div>
|
||||
<div class="content">
|
||||
${this._message}
|
||||
${this._inputLabel?s`
|
||||
<!-- Native <input> rather than <ha-textfield>: HA loads
|
||||
ha-textfield lazily for its own panels, so inside this custom
|
||||
panel it can be unregistered and render with zero height —
|
||||
the prompt then shows no field at all (caught live testing
|
||||
the pause/replace prompts; same fix as complete-dialog). -->
|
||||
<label class="field">
|
||||
<span class="field-label">${this._inputLabel}</span>
|
||||
${this._options?s`<select class="field-input field-select"
|
||||
@change=${t=>this._inputValue=t.target.value}>
|
||||
${this._options.map(t=>s`<option value=${t.value} ?selected=${t.value===this._inputValue}>${t.label}</option>`)}
|
||||
</select>`:s`<input class="field-input"
|
||||
type="${this._inputType||"text"}"
|
||||
.value=${this._inputValue}
|
||||
@input=${t=>this._inputValue=t.target.value} />`}
|
||||
</label>
|
||||
`:r}
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<ha-button appearance="plain" @click=${this._cancel}>
|
||||
${m("cancel",e)}
|
||||
</ha-button>
|
||||
<ha-button
|
||||
class="${this._danger?"danger":""}"
|
||||
@click=${this._confirmAction}
|
||||
>
|
||||
${this._confirmText}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};i.styles=[c,p`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
/* shared native-field scaffold from nativeFieldStyles; the prompt input
|
||||
follows the message text, hence the extra top margin here */
|
||||
.field { margin-top: 12px; }
|
||||
.content {
|
||||
padding: 8px 0;
|
||||
min-width: 280px;
|
||||
line-height: 1.5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
ha-textfield {
|
||||
display: block;
|
||||
}
|
||||
ha-button.danger {
|
||||
--mdc-theme-primary: var(--error-color, #f44336);
|
||||
}
|
||||
`],n([_({attribute:!1})],i.prototype,"hass",2),n([o()],i.prototype,"_open",2),n([o()],i.prototype,"_title",2),n([o()],i.prototype,"_message",2),n([o()],i.prototype,"_confirmText",2),n([o()],i.prototype,"_danger",2),n([o()],i.prototype,"_inputLabel",2),n([o()],i.prototype,"_inputType",2),n([o()],i.prototype,"_options",2),n([o()],i.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",i);var h="maintenance-confirm-dialog",f="data-ms-lovelace-confirm";function v(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function H(l,a){let e=v(),t=e.querySelector(`${h}[${f}]`);return t||(t=document.createElement(h),t.setAttribute(f,""),e.appendChild(t)),t.hass=l,t.confirm(a)}export{g as a,b,x as c,y as d,R as e,A as f,E as g,T as h,$ as i,H as j};
|
||||
@@ -1,88 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
import{a as y,b as s,d as l,e as g,f as o,g as f,i as d,r as m}from"./chunk-UI7IMFM7.js";import{a}from"./chunk-BR3YZILG.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:l}</span>`:l}
|
||||
<div class="row">
|
||||
${this._typing?s`<input class="typed" type="text" inputmode="numeric" autocomplete="off"
|
||||
.value=${this._typed}
|
||||
placeholder=${m("1978-03-15",this.lang)}
|
||||
aria-invalid=${this._typedInvalid?"true":"false"}
|
||||
@input=${t=>{this._typed=t.target.value,this._typedInvalid=!1}}
|
||||
@keydown=${this._onTypedKey}
|
||||
@blur=${this._commitTyped} />`:s`<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${this._selector()}
|
||||
.value=${x(this.kind,this.value)}
|
||||
.required=${this.required}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._onSelectorChange}
|
||||
></ha-selector>`}
|
||||
${this.kind==="date"&&!this.disabled&&!this._typing?s`<button type="button" class="type-toggle" title=${d("date_type_toggle",this.lang)} aria-label=${d("date_type_toggle",this.lang)} @click=${this._startTyping}>
|
||||
<ha-icon icon="mdi:keyboard-outline"></ha-icon>
|
||||
</button>`:l}
|
||||
${this.clearable&&this.value&&!this.disabled&&!this._typing?s`<button type="button" class="clear" title=${d("clear",this.lang)} aria-label=${d("clear",this.lang)} @click=${this._clear}>
|
||||
<ha-icon icon="mdi:close"></ha-icon>
|
||||
</button>`:l}
|
||||
</div>
|
||||
${this._typedInvalid?s`<span class="helper invalid">${d("date_type_invalid",this.lang)}</span>`:this.helper?s`<span class="helper">${this.helper}</span>`:l}
|
||||
</div>
|
||||
`}};r.styles=y`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.label {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #888);
|
||||
font-weight: 500;
|
||||
}
|
||||
.req { color: var(--error-color, #f44336); margin-left: 2px; }
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
ha-selector {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.clear, .type-toggle {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
cursor: pointer;
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.clear:hover, .type-toggle:hover { background: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.08); }
|
||||
.clear:focus-visible, .type-toggle:focus-visible { outline: 2px solid var(--primary-color); }
|
||||
.helper {
|
||||
font-size: 11px;
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
.helper.invalid { color: var(--error-color, #f44336); font-style: normal; }
|
||||
input.typed {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--divider-color, #ccc);
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
font: inherit;
|
||||
}
|
||||
input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); }
|
||||
input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; }
|
||||
`,a([o({attribute:!1})],r.prototype,"hass",2),a([o()],r.prototype,"kind",2),a([o()],r.prototype,"label",2),a([o()],r.prototype,"value",2),a([o()],r.prototype,"helper",2),a([o({type:Boolean})],r.prototype,"clearable",2),a([o({type:Boolean})],r.prototype,"disabled",2),a([o({type:Boolean})],r.prototype,"required",2),a([o()],r.prototype,"lang",2),a([f()],r.prototype,"_typing",2),a([f()],r.prototype,"_typed",2),a([f()],r.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",r);
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
var _=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var L=(n,e,t,s)=>{for(var r=s>1?void 0:s?f(e,t):e,c=n.length-1,l;c>=0;c--)(l=n[c])&&(r=(s?l(e,t,r):l(r))||r);return s&&r&&_(e,t,r),r};var v={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)"},p=["overdue","triggered","due_soon","ok"],E=["overdue","triggered","due_soon"],T=Object.fromEntries(p.map((n,e)=>[n,e]));var b={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"};var u="2.96.0";var a="en",g=(()=>{let n=window;return n.__msLocales||(n.__msLocales={store:{},inflight:{}}),n.__msLocales})(),o=g.store,i=g.inflight;function N(n){o.en=Object.assign({},n,o.en??{})}var S=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),m="/maintenance_supporter_locales";function d(n){let e=(n||a).toLowerCase();return e.startsWith("pt")&&e.endsWith("br")?"pt-br":e.substring(0,2)}function O(n,e,t){let s=d(e);return o[s]?.[n]??o.en?.[n]??t??n}function U(n){let e=d(n);return e===a||e in o}function k(n){let e=d(n);return e===a||e in o||!S.has(e)?Promise.resolve():(e in i||(i[e]=fetch(`${m}/${e}.json?v=${u}`).then(t=>t.ok?t.json():null).then(t=>{t?o[e]=t:delete i[e]}).catch(()=>{delete i[e]})),i[e])}export{L as a,v as b,E as c,b as d,N as e,d as f,O as g,U as h,k as i};
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=(o,r,n,t)=>{for(var e=t>1?void 0:t?d(r,n):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(e=(t?s(r,n,e):s(e))||e);return t&&e&&c(r,n,e),e};var g={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)"},a=["overdue","triggered","due_soon","ok"],S=["overdue","triggered","due_soon"],m=Object.fromEntries(a.map((o,r)=>[o,r]));var p={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{u as a,g as b,S as c,p as d};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,2 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
function l(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}function f(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function d(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function c(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||d(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function p(r){return c(r??[]).map(n=>({timestamp:n.timestamp,values:d(n)})).filter(n=>n.values.length>0)}function m(r,n,i){let o;for(let t of r){if(i!==void 0){let s=new Date(t.timestamp).getTime();if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function _(r,n,i){let o=d(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of c(r)){if(e.timestamp>=n.timestamp)break;let s=d(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function R(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function h(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=20))break}return n}function y(r,n,i,o){let t=i,e=u=>typeof u=="string"?u:null,s=u=>typeof u=="number"?u:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:l(t),reading_value:s(t.reading_value),reading_values:d(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function E(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i);if(!e)return null;let s=e.history?.find(a=>a.timestamp===o);return s||(s=(await r.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:n,task_id:i})).history?.find(u=>u.timestamp===o)),s?y(n,i,s,e):null}export{l as a,f as b,d as c,p as d,m as e,_ as f,R as g,h,y as i,E as j};
|
||||
+11
-6
@@ -1,9 +1,9 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{e as W,f as j,g as _,h as K,i as V}from"./chunk-RGIYRWN4.js";var q=globalThis,U=q.ShadowRoot&&(q.ShadyCSS===void 0||q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),ce=new WeakMap,E=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==G)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(U&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=ce.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&ce.set(t,e))}return e}toString(){return this.cssText}},de=r=>new E(typeof r=="string"?r:r+"",void 0,G),S=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((o,a,n)=>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.")})(a)+r[n+1],r[0]);return new E(t,r,G)},_e=(r,e)=>{if(U)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),a=q.litNonce;a!==void 0&&o.setAttribute("nonce",a),o.textContent=t.cssText,r.appendChild(o)}},Y=U?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return de(t)})(r):r;var{is:qe,defineProperty:Ue,getOwnPropertyDescriptor:Fe,getOwnPropertyNames:Ie,getOwnPropertySymbols:He,getPrototypeOf:Be}=Object,F=globalThis,pe=F.trustedTypes,We=pe?pe.emptyScript:"",Ke=F.reactiveElementPolyfillSupport,N=(r,e)=>r,R={toAttribute(r,e){switch(e){case Boolean:r=r?We: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}},I=(r,e)=>!qe(r,e),ue={attribute:!0,type:String,converter:R,reflect:!1,useDefault:!1,hasChanged:I};Symbol.metadata??=Symbol("metadata"),F.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=ue){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(),a=this.getPropertyDescriptor(e,o,t);a!==void 0&&Ue(this.prototype,e,a)}}static getPropertyDescriptor(e,t,o){let{get:a,set:n}=Fe(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ue}static _$Ei(){if(this.hasOwnProperty(N("elementProperties")))return;let e=Be(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(N("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(N("properties"))){let t=this.properties,o=[...Ie(t),...He(t)];for(let a of o)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,a]of t)this.elementProperties.set(o,a)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let a=this._$Eu(t,o);a!==void 0&&this._$Eh.set(a,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 a of o)t.unshift(Y(a))}else e!==void 0&&t.push(Y(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 _e(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),a=this.constructor._$Eu(e,o);if(a!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:R).toAttribute(t,o.type);tLine truncated
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{e as W,f as j,g as _,h as K,i as V}from"./chunk-G7Y44K4C.js";var q=globalThis,U=q.ShadowRoot&&(q.ShadyCSS===void 0||q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),ce=new WeakMap,E=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==G)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(U&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ce.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ce.set(t,e))}return e}toString(){return this.cssText}},de=o=>new E(typeof o=="string"?o:o+"",void 0,G),S=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,a,n)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new E(t,o,G)},_e=(o,e)=>{if(U)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),a=q.litNonce;a!==void 0&&r.setAttribute("nonce",a),r.textContent=t.cssText,o.appendChild(r)}},Y=U?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return de(t)})(o):o;var{is:qe,defineProperty:Ue,getOwnPropertyDescriptor:Fe,getOwnPropertyNames:Ie,getOwnPropertySymbols:He,getPrototypeOf:Be}=Object,F=globalThis,pe=F.trustedTypes,We=pe?pe.emptyScript:"",Ke=F.reactiveElementPolyfillSupport,N=(o,e)=>o,R={toAttribute(o,e){switch(e){case Boolean:o=o?We:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},I=(o,e)=>!qe(o,e),ue={attribute:!0,type:String,converter:R,reflect:!1,useDefault:!1,hasChanged:I};Symbol.metadata??=Symbol("metadata"),F.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=ue){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),a=this.getPropertyDescriptor(e,r,t);a!==void 0&&Ue(this.prototype,e,a)}}static getPropertyDescriptor(e,t,r){let{get:a,set:n}=Fe(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:a,set(i){let l=a?.call(this);n?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ue}static _$Ei(){if(this.hasOwnProperty(N("elementProperties")))return;let e=Be(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(N("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(N("properties"))){let t=this.properties,r=[...Ie(t),...He(t)];for(let a of r)this.createProperty(a,t[a])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,a]of t)this.elementProperties.set(r,a)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let a=this._$Eu(t,r);a!==void 0&&this._$Eh.set(a,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let a of r)t.unshift(Y(a))}else e!==void 0&&t.push(Y(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _e(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:R).toAttribute(t,r.type);tLine truncated
|
||||
\f\r]`,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ge=/-->/g,fe=/>/g,v=RegExp(`>|${Q}(?:([^\\s"'>=/]+)(${Q}*=${Q}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ye=/'/g,be=/"/g,ke=/^(?:script|style|textarea|title)$/i,ae=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),bt=ae(1),vt=ae(2),wt=ae(3),k=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),ve=new WeakMap,w=x.createTreeWalker(x,129);function Se(r,e){if(!oe(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return me!==void 0?me.createHTML(e):e}var Ye=(r,e)=>{let t=r.length-1,o=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=P;for(let l=0;l<t;l++){let s=r[l],p,d,c=-1,m=0;for(;m<s.length&&(i.lastIndex=m,d=i.exec(s),d!==null);)m=i.lastIndex,i===P?d[1]==="!--"?i=ge:d[1]!==void 0?i=fe:d[2]!==void 0?(ke.test(d[2])&&(a=RegExp("</"+d[2],"g")),i=v):d[3]!==void 0&&(i=v):i===v?d[0]===">"?(i=a??P,c=-1):d[1]===void 0?c=-2:(c=i.lastIndex-d[2].length,p=d[1],i=d[3]===void 0?v:d[3]==='"'?be:ye):i===be||i===ye?i=v:i===ge||i===fe?i=P:(i=v,a=void 0);let y=i===v&&r[l+1].startsWith("/>")?" ":"";n+=i===P?s+Ve:c>=0?(o.push(p),s.slice(0,c)+we+s.slice(c)+b+y):s+b+(c===-2?l:y)}return[Se(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},O=class r{constructor({strings:e,_$litType$:t},o){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[p,d]=Ye(e,t);if(this.el=r.createElement(p,o),w.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=w.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(we)){let m=d[i++],y=a.getAttribute(c).split(b),L=/([.?@])?(.*)/.exec(m);s.push({type:1,index:n,name:L[2],strings:y,ctor:L[1]==="."?Z:L[1]==="?"?X:L[1]==="@"?ee:$}),a.removeAttribute(c)}else c.startsWith(b)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(ke.test(a.tagName)){let c=a.textContent.split(b),m=c.length-1;if(m>0){a.textContent=H?H.emptyScript:"";for(let y=0;y<m;y++)a.append(c[y],z()),w.nextNode(),s.push({type:2,index:++n});a.append(c[m],z())}}}else if(a.nodeType===8)if(a.data===xe)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(b,c+1))!==-1;)s.push({type:7,index:n}),c+=b.length-1}n++}}static createElement(e,t){let o=x.createElement("template");return o.innerHTML=e,o}};function A(r,e,t=r,o){if(e===k)return e;let a=o!==void 0?t._$Co?.[o]:t._$Cl,n=D(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(r),a._$AT(r,t,o)),o!==void 0?(t._$Co??=[])[o]=a:t._$Cl=a),a!==void 0&&(e=A(r,a._$AS(r,e.values),a,o)),e}var J=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,a=(e?.creationScope??x).importNode(t,!0);w.currentNode=a;let n=w.nextNode(),i=0,l=0,s=o[0];for(;s!==void 0;){if(i===s.index){let p;s.type===2?p=new M(n,n.nextSibling,this,e):s.type===1?p=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(p=new te(n,this,e)),this._$AV.push(p),s=o[++l]}i!==s?.index&&(n=w.nextNode(),i++)}return w.currentNode=x,a}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++}},M=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,a){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=A(this,e,t),D(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==k&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ge(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!==u&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:o}=e,a=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=O.createElement(Se(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new J(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=ve.get(e.strings);return t===void 0&&ve.set(e.strings,t=new O(e)),t}k(e){oe(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,a=0;for(let n of e)a===t.length?t.push(o=new r(this.O(z()),this.O(z()),this,this.options)):o=t[a],o._$AI(n),a++;a<t.length&&(this._$AR(o&&o._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=he(e).nextSibling;he(e).remove(),e=o}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,o,a,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):thLine truncated
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ye=/'/g,be=/"/g,xe=/^(?:script|style|textarea|title)$/i,ae=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),bt=ae(1),vt=ae(2),wt=ae(3),x=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),ve=new WeakMap,w=k.createTreeWalker(k,129);function Se(o,e){if(!re(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return me!==void 0?me.createHTML(e):e}var Ye=(o,e)=>{let t=o.length-1,r=[],a,n=e===2?"<svg>":e===3?"<math>":"",i=P;for(let l=0;l<t;l++){let s=o[l],p,d,c=-1,m=0;for(;m<s.length&&(i.lastIndex=m,d=i.exec(s),d!==null);)m=i.lastIndex,i===P?d[1]==="!--"?i=ge:d[1]!==void 0?i=fe:d[2]!==void 0?(xe.test(d[2])&&(a=RegExp("</"+d[2],"g")),i=v):d[3]!==void 0&&(i=v):i===v?d[0]===">"?(i=a??P,c=-1):d[1]===void 0?c=-2:(c=i.lastIndex-d[2].length,p=d[1],i=d[3]===void 0?v:d[3]==='"'?be:ye):i===be||i===ye?i=v:i===ge||i===fe?i=P:(i=v,a=void 0);let y=i===v&&o[l+1].startsWith("/>")?" ":"";n+=i===P?s+Ve:c>=0?(r.push(p),s.slice(0,c)+we+s.slice(c)+b+y):s+b+(c===-2?l:y)}return[Se(o,n+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},O=class o{constructor({strings:e,_$litType$:t},r){let a;this.parts=[];let n=0,i=0,l=e.length-1,s=this.parts,[p,d]=Ye(e,t);if(this.el=o.createElement(p,r),w.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(a=w.nextNode())!==null&&s.length<l;){if(a.nodeType===1){if(a.hasAttributes())for(let c of a.getAttributeNames())if(c.endsWith(we)){let m=d[i++],y=a.getAttribute(c).split(b),L=/([.?@])?(.*)/.exec(m);s.push({type:1,index:n,name:L[2],strings:y,ctor:L[1]==="."?Z:L[1]==="?"?X:L[1]==="@"?ee:$}),a.removeAttribute(c)}else c.startsWith(b)&&(s.push({type:6,index:n}),a.removeAttribute(c));if(xe.test(a.tagName)){let c=a.textContent.split(b),m=c.length-1;if(m>0){a.textContent=H?H.emptyScript:"";for(let y=0;y<m;y++)a.append(c[y],z()),w.nextNode(),s.push({type:2,index:++n});a.append(c[m],z())}}}else if(a.nodeType===8)if(a.data===ke)s.push({type:2,index:n});else{let c=-1;for(;(c=a.data.indexOf(b,c+1))!==-1;)s.push({type:7,index:n}),c+=b.length-1}n++}}static createElement(e,t){let r=k.createElement("template");return r.innerHTML=e,r}};function A(o,e,t=o,r){if(e===x)return e;let a=r!==void 0?t._$Co?.[r]:t._$Cl,n=D(e)?void 0:e._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=a:t._$Cl=a),a!==void 0&&(e=A(o,a._$AS(o,e.values),a,r)),e}var J=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,a=(e?.creationScope??k).importNode(t,!0);w.currentNode=a;let n=w.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let p;s.type===2?p=new M(n,n.nextSibling,this,e):s.type===1?p=new s.ctor(n,s.name,s.strings,this,e):s.type===6&&(p=new te(n,this,e)),this._$AV.push(p),s=r[++l]}i!==s?.index&&(n=w.nextNode(),i++)}return w.currentNode=k,a}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},M=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,a){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=A(this,e,t),D(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ge(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!==u&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,a=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=O.createElement(Se(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===a)this._$AH.p(t);else{let n=new J(a,this),i=n.u(this.options);n.p(t),this.T(i),this._$AH=n}}_$AC(e){let t=ve.get(e.strings);return t===void 0&&ve.set(e.strings,t=new O(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,a=0;for(let n of e)a===t.length?t.push(r=new o(this.O(z()),this.O(z()),this,this.options)):r=t[a],r._$AI(n),a++;a<t.length&&(this._$AR(r&&r._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=he(e).nextSibling;he(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,a,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thLine 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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",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",all_parts:"All parts",all_areas:"All areas",areas_filter:"Filter areas\u2026",areas_filter_none:"No area matches the filter.",area_cost_year:"Cost {year}",area_object_count:"{n} objects",area_object_count_one:"1 object",area_range_12m:"Last 12
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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",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",all_parts:"All parts",all_areas:"All areas",areas_filter:"Filter areas\u2026",areas_filter_none:"No area matches the filter.",area_cost_year:"Cost {year}",area_object_count:"{n} objects",area_object_count_one:"1 object",area_range_12m:"Last 12
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -33,7 +33,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
}
|
||||
/* #189: "· Residual waste, Paper" after a calendar-driven task's name. */
|
||||
.event-titles { color: var(--secondary-text-color); font-weight: 400; }
|
||||
`,Cr=S`
|
||||
`,jo=S`
|
||||
${st}
|
||||
${lt}
|
||||
:host {
|
||||
@@ -365,6 +365,10 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
|
||||
/* A note keeps its line breaks — what was done, one line each (#202) —
|
||||
and a long link wraps instead of widening the card. */
|
||||
.history-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
|
||||
.history-details {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
@@ -372,6 +376,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--secondary-text-color);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.history-details .history-credit { color: var(--success-color, #43a047); }
|
||||
|
||||
/* History filter chips */
|
||||
.history-filters {
|
||||
@@ -1265,7 +1270,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; hyphens: auto; overflow-wrap: anywhere; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var ct={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_icon:"ws_err_invalid_icon",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},dt={entry_id:"object",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",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function _t(r){let e=r.replace(/_ids?$/,"").split("_").filter(Boolean);if(e.length===0)return r;let t=e.join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}function pt(r,e){let t=dt[r];if(t){let o=_(t,e);if(o&&o!==t)return o}return _t(r)}function ut(r){let e=[...r.matchAll(/\['([^']+)'\]/g)].map(a=>a[1]),t=e.length?e[e.length-1]:void 0,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"}}var Me=r=>r.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>1);function ht(r,e){let t=new Set(Me(e));return Me(r).every(o=>t.has(o))}function Le(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,a=o.message||o.error?.message||"",n=o.code||o.error?.code||"",i=n?ct[n]:void 0,l=je(o.translation_domain??o.error?.translation_domain,o.translation_key??o.error?.translation_key,o.translation_placeholders??o.error?.translation_placeholders);if(l)return l;if(!a&&!i)return t;let s=ut(a),p=s.field?pt(s.field,e):"",d=c=>_(c,e).replace("{field}",p).replace("{n}",s.param??"");switch(s.rule){case"too_long":return d("err_too_long");case"too_short":return d("err_too_short");case"value_too_high":return d("err_value_too_high");case"value_too_low":return d("err_value_too_low");case"required":return d("err_required");case"wrong_type":return d("err_wrong_type").replace("{type}",s.param??"");case"invalid_choice":return d("err_invalid_choice");case"invalid_value":return d("err_invalid_value");default:if(i){let c=_(i,e);return j(e)==="en"&&a&&!ht(a,n)?`${c} (${a})`:c}return a||t}}async function Lr(r,e,t={}){t.busy?.(!0);try{let o=typeof e=="function"?await e():await r.hass.connection.sendMessagePromise(e);return t.reload&&await t.reload(),t.successToast&&t.onSuccess?.(t.successToast),o===void 0?null:o}catch(o){let
Line truncated
|
||||
`;var ct={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_icon:"ws_err_invalid_icon",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},dt={entry_id:"object",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",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function _t(o){let e=o.replace(/_ids?$/,"").split("_").filter(Boolean);if(e.length===0)return o;let t=e.join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}function pt(o,e){let t=dt[o];if(t){let r=_(t,e);if(r&&r!==t)return r}return _t(o)}function ut(o){let e=[...o.matchAll(/\['([^']+)'\]/g)].map(a=>a[1]),t=e.length?e[e.length-1]:void 0,r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}var Me=o=>o.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>1);function ht(o,e){let t=new Set(Me(e));return Me(o).every(r=>t.has(r))}function Le(o,e,t){if(t=t??_("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,a=r.message||r.error?.message||"",n=r.code||r.error?.code||"",i=n?ct[n]:void 0,l=je(r.translation_domain??r.error?.translation_domain,r.translation_key??r.error?.translation_key,r.translation_placeholders??r.error?.translation_placeholders);if(l)return l;if(!a&&!i)return t;let s=ut(a),p=s.field?pt(s.field,e):"",d=c=>_(c,e).replace("{field}",p).replace("{n}",s.param??"");switch(s.rule){case"too_long":return d("err_too_long");case"too_short":return d("err_too_short");case"value_too_high":return d("err_value_too_high");case"value_too_low":return d("err_value_too_low");case"required":return d("err_required");case"wrong_type":return d("err_wrong_type").replace("{type}",s.param??"");case"invalid_choice":return d("err_invalid_choice");case"invalid_value":return d("err_invalid_value");default:if(i){let c=_(i,e);return j(e)==="en"&&a&&!ht(a,n)?`${c} (${a})`:c}return a||t}}async function qo(o,e,t={}){t.busy?.(!0);try{let r=typeof e=="function"?await e():await o.hass.connection.sendMessagePromise(e);return t.reload&&await t.reload(),t.successToast&&t.onSuccess?.(t.successToast),r===void 0?null:r}catch(r){let
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
@@ -1,88 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as y,b as s,d as l,e as g,f as o,g as f,i as d,s as m}from"./chunk-6VYW2MWJ.js";import{a}from"./chunk-RVTWU5ZB.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:l}</span>`:l}
|
||||
<div class="row">
|
||||
${this._typing?s`<input class="typed" type="text" inputmode="numeric" autocomplete="off"
|
||||
.value=${this._typed}
|
||||
placeholder=${m("1978-03-15",this.lang)}
|
||||
aria-invalid=${this._typedInvalid?"true":"false"}
|
||||
@input=${t=>{this._typed=t.target.value,this._typedInvalid=!1}}
|
||||
@keydown=${this._onTypedKey}
|
||||
@blur=${this._commitTyped} />`:s`<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${this._selector()}
|
||||
.value=${x(this.kind,this.value)}
|
||||
.required=${this.required}
|
||||
.disabled=${this.disabled}
|
||||
@value-changed=${this._onSelectorChange}
|
||||
></ha-selector>`}
|
||||
${this.kind==="date"&&!this.disabled&&!this._typing?s`<button type="button" class="type-toggle" title=${d("date_type_toggle",this.lang)} aria-label=${d("date_type_toggle",this.lang)} @click=${this._startTyping}>
|
||||
<ha-icon icon="mdi:keyboard-outline"></ha-icon>
|
||||
</button>`:l}
|
||||
${this.clearable&&this.value&&!this.disabled&&!this._typing?s`<button type="button" class="clear" title=${d("clear",this.lang)} aria-label=${d("clear",this.lang)} @click=${this._clear}>
|
||||
<ha-icon icon="mdi:close"></ha-icon>
|
||||
</button>`:l}
|
||||
</div>
|
||||
${this._typedInvalid?s`<span class="helper invalid">${d("date_type_invalid",this.lang)}</span>`:this.helper?s`<span class="helper">${this.helper}</span>`:l}
|
||||
</div>
|
||||
`}};r.styles=y`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.label {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #888);
|
||||
font-weight: 500;
|
||||
}
|
||||
.req { color: var(--error-color, #f44336); margin-left: 2px; }
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
ha-selector {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.clear, .type-toggle {
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
cursor: pointer;
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.clear:hover, .type-toggle:hover { background: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.08); }
|
||||
.clear:focus-visible, .type-toggle:focus-visible { outline: 2px solid var(--primary-color); }
|
||||
.helper {
|
||||
font-size: 11px;
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
.helper.invalid { color: var(--error-color, #f44336); font-style: normal; }
|
||||
input.typed {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--divider-color, #ccc);
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
font: inherit;
|
||||
}
|
||||
input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); }
|
||||
input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; }
|
||||
`,a([o({attribute:!1})],r.prototype,"hass",2),a([o()],r.prototype,"kind",2),a([o()],r.prototype,"label",2),a([o()],r.prototype,"value",2),a([o()],r.prototype,"helper",2),a([o({type:Boolean})],r.prototype,"clearable",2),a([o({type:Boolean})],r.prototype,"disabled",2),a([o({type:Boolean})],r.prototype,"required",2),a([o()],r.prototype,"lang",2),a([f()],r.prototype,"_typing",2),a([f()],r.prototype,"_typed",2),a([f()],r.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",r);
|
||||
File diff suppressed because it is too large.
Load diff
-3290
File diff suppressed because it is too large.
Load diff
+216
-176
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}from"./chunk-XOYZSKDM.js";import"./chunk-SUKVNZGX.js";import{a as ke,b as ae,c as _t,d as Y,e as mt}from"./chunk-EAYT244O.js";import{c as ht,d as ut,e as _e,f as me,g as ge,h as qe,i as Q,j as ne,k as X}from"./chunk-CTWCZMNP.js";import{A,a as w,b as l,c as se,d as h,e as T,f,g as c,h as ue,j as R,k as rt,l as nt,m as E,n as B,o as re,p as Pe,q as j,r as $e,s as at,t as xe,u as Le,v as ot,w as lt,x as dt,y as ct,z as pt}from"./chunk-V2H6N4AC.js";import{a as d,b as We,d as be,g as s,h as Ge,i as Ke}from"./chunk-RGIYRWN4.js";var C=class extends T{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(e){let i=e.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return l`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as Je,b as Ze,c as Xe,d as et,e as tt,f as it,g as st,h as rt,i as nt}from"./chunk-IPUKIEZ2.js";import"./chunk-6RSHEGAW.js";import{a as Ee,b as oe,c as mt,d as Y,e as gt}from"./chunk-5BNA7QPW.js";import{c as ut,d as _t,e as me,f as ge,g as fe,h as Ne,i as Q,j as ae,k as ee}from"./chunk-GDJJTBLT.js";import{A,a as k,b as l,c as re,d as h,e as E,f,g as c,h as _e,j as P,k as at,l as ot,m as I,n as j,o as ne,p as qe,q as z,r as xe,s as lt,t as ke,u as He,v as dt,w as ct,x as pt,y as we,z as ht}from"./chunk-XR5IXJXS.js";import{a as d,b as Ke,d as $e,g as s,h as Qe,i as Ye}from"./chunk-G7Y44K4C.js";var C=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(e){let i=e.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return l`
|
||||
<label class="field">
|
||||
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:h}</span>`:h}
|
||||
${this.multiline?l`
|
||||
@@ -27,7 +27,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
/>`}
|
||||
${this.helper?l`<span class="helper">${this.helper}</span>`:h}
|
||||
</label>
|
||||
`}};C.styles=w`
|
||||
`}};C.styles=k`
|
||||
:host { display: block; }
|
||||
.field {
|
||||
display: flex;
|
||||
@@ -76,7 +76,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,d([f()],C.prototype,"label",2),d([f()],C.prototype,"value",2),d([f()],C.prototype,"placeholder",2),d([f()],C.prototype,"type",2),d([f({type:Boolean})],C.prototype,"required",2),d([f({type:Boolean})],C.prototype,"disabled",2),d([f()],C.prototype,"step",2),d([f()],C.prototype,"min",2),d([f()],C.prototype,"max",2),d([f()],C.prototype,"pattern",2),d([f()],C.prototype,"helper",2),d([f({type:Boolean})],C.prototype,"multiline",2),d([f({type:Number})],C.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",C);var I=class extends T{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;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return R(this.hass)}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._replacing=!1,this._error="",this._open=!0}openReplace(e,i){this._entryId=e,this._replacing=!0,this._name=i.name||"",this._oldDeviceId=i.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",this._error="",this._open=!0}openEdit(e,i){this._entryId=e,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let i=await A(this,e,{busy:t=>{this._loading=t},fallbackKey:"save_error",onError:t=>{this._error=t}});i!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:i?.entry_id,device_swap:i?.device_swap}})))}_deviceName(e){let t=this.hass?.devices?.[e];return t?.name_by_user||t?.name||e}_deviceSelector(e){return l`<ha-form
|
||||
`,d([f()],C.prototype,"label",2),d([f()],C.prototype,"value",2),d([f()],C.prototype,"placeholder",2),d([f()],C.prototype,"type",2),d([f({type:Boolean})],C.prototype,"required",2),d([f({type:Boolean})],C.prototype,"disabled",2),d([f()],C.prototype,"step",2),d([f()],C.prototype,"min",2),d([f()],C.prototype,"max",2),d([f()],C.prototype,"pattern",2),d([f()],C.prototype,"helper",2),d([f({type:Boolean})],C.prototype,"multiline",2),d([f({type:Number})],C.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",C);var S=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;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return P(this.hass)}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._replacing=!1,this._error="",this._open=!0}openReplace(e,i){this._entryId=e,this._replacing=!0,this._name=i.name||"",this._oldDeviceId=i.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",this._error="",this._open=!0}openEdit(e,i){this._entryId=e,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let i=await A(this,e,{busy:t=>{this._loading=t},fallbackKey:"save_error",onError:t=>{this._error=t}});i!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:i?.entry_id,device_swap:i?.device_swap}})))}_deviceName(e){let t=this.hass?.devices?.[e];return t?.name_by_user||t?.name||e}_deviceSelector(e){return l`<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${{device:this._haDeviceId||void 0}}
|
||||
.schema=${[{name:"device",selector:{device:{}}}]}
|
||||
@@ -221,7 +221,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};I.styles=w`
|
||||
`}};S.styles=k`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -291,9 +291,44 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.radio-row input {
|
||||
margin: 0;
|
||||
}
|
||||
`,d([f({attribute:!1})],I.prototype,"hass",2),d([f({attribute:!1})],I.prototype,"objects",2),d([c()],I.prototype,"_open",2),d([c()],I.prototype,"_loading",2),d([c()],I.prototype,"_error",2),d([c()],I.prototype,"_name",2),d([c()],I.prototype,"_manufacturer",2),d([c()],I.prototype,"_model",2),d([c()],I.prototype,"_serialNumber",2),d([c()],I.prototype,"_areaId",2),d([c()],I.prototype,"_installationDate",2),d([c()],I.prototype,"_warrantyExpiry",2),d([c()],I.prototype,"_documentationUrl",2),d([c()],I.prototype,"_notes",2),d([c()],I.prototype,"_haDeviceId",2),d([c()],I.prototype,"_parentEntryId",2),d([c()],I.prototype,"_entryId",2),d([c()],I.prototype,"_replacing",2),d([c()],I.prototype,"_oldDeviceId",2),d([c()],I.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",I);var gt=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"];function _i(r){let a=(r||"").split(/\s+/).filter(Boolean);return a.length===0?"?":a.length===1?a[0][0].toUpperCase():(a[0][0]+a[a.length-1][0]).toUpperCase()}function mi(r){let a=0;for(let e of r)a=a*31+e.charCodeAt(0)>>>0;return gt[a%gt.length]}function ft(r){return r?{id:r.id,name:r.name,initials:r.initials||_i(r.name),color:r.color||mi(r.id)}:null}var we=class{constructor(a){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=a}updateHass(a){this.hass=a}async getUsers(a=!1){let e=Date.now();if(!a&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=e,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(a,e,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:a,task_id:e,user_id:i})}async getTasksByUser(a){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:a})).tasks}getUserName(a){return!a||!this.usersCache?null:this.usersCache.find(i=>i.id===a)?.name||null}getPerson(a){return ft(this.getUser(a))}getUser(a){return!a||!this.usersCache?null:this.usersCache.find(e=>e.id===a)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(a){return a?a===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function z(r){return`${r.entry_id??""}\0${r.part_id}`}function vt(r,a,e,i){let t=!!r.entry_id&&r.entry_id!==a,n=t?r.entry_id:a,o=e.find(g=>g.entry_id===n),p=(o?.parts||[]).find(g=>g.id===r.part_id)||null,u=t&&o?.object?.name||"",m=p?.name||s("shared_part_unknown",i);return{part:p,foreign:t,ownerName:u,label:u?`${m} (${u})`:m}}function yt(r,a,e,i){let{part:t,label:n}=vt(r,a,e,i),o=t&&t.stock!==null&&t.stock!==void 0?` (${re(t.stock,t.unit,i)})`:"",p=t?.storage_location?` \u2014 ${t.storage_location}`:"";return`${E(r.quantity,i)}\xD7 ${n}${o}${p}`}function bt(r,a,e,i){let n=(e.find(p=>p.entry_id===a)?.parts||[]).map(p=>({...p})),o=new Set(n.map(p=>z({part_id:p.id})));for(let p of r?.consumes_parts||[]){if(!p.entry_id||p.entry_id===a)continue;let u=z(p);if(o.has(u))continue;o.add(u);let{part:m,ownerName:g}=vt(p,a,e,i);n.push({id:p.part_id,name:m?.name||s("shared_part_unknown",i),unit:m?.unit,stock:m?.stock??null,storage_location:m?.storage_location,entry_id:p.entry_id,owner_name:g})}return n}var He=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],$t=["sensor"],xt=["temperature","humidity","pressure"];function oe(r){let a=(r??"").trim();if(a==="")return null;let e=Number(a.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var Ne=["notes","cost","duration","photo","user"],fe={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var gi={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},fi="mdi:wrench-clock",Me=r=>r&&gi[r]||fi;var yi=["cleaning","inspection","replacement","calibration","service","reading","custom"],bi=["low","normal","high"],$i=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],Ee=["weekdays","nth_weekday","day_of_month","calendar"],kt=["time_based","one_time",...Ee],It=["threshold","counter","state_change","runtime","due_date"],wt=(r,a)=>s(r==="due_date"?"trigger_type_due_date":r,a),xi=[...It,"compound"],V={alpha:"0.3",min:"7",max:"365"},ee=Q;function Et(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onState
Line truncated
|
||||
`),this._phaseDefs=Object.entries(i.phases||{}).map(([m,g])=>{let{name:v,checklist:x,consumes_parts:b,required_completion_fields:S,...N}=g,K=g.consumes_parts||[],Z=K.findIndex(U=>!U.entry_id),F=Z>=0?K[Z]:void 0;return{id:m,name:g.name||m,checklistText:(g.checklist||[]).join(`
|
||||
`),partId:F?.part_id||"",partQty:F?.quantity!=null?String(F.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:K.filter((U,ie)=>ie!==Z).map(U=>({...U})),carry:N}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"",this._scheduleTimeOn=!!i.schedule_time;let o=i.on_complete_action;if(o&&o.service){this._actionService=o.service;let m=o.target?.entity_id;this._actionTargetEntity=Array.isArray(m)?m[0]||"":m||"",this._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let p=i.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 u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??V.alpha,this._adaptiveMin=u.min_interval_days?.toString()??V.min,this._adaptiveMax=u.max_interval_days?.toString()??V.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,i.trigger_config){let m=i.trigger_config;this._triggerEntityId=m.entity_id||m.entity_ids&&m.entity_ids[0]||"",this._triggerEntityIds=m.entity_ids||(m.entity_id?[m.entity_id]:[]),this._triggerEntityLogic=m.entity_logic||"any",this._setTypeFields(Tt(m)),this._triggerCombinator=m.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=m.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=m.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=m.trigger_runtime_max_session_seconds?.toString()||"",m.type==="compound"?(this._compoundLogic=m.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(m.conditions||[]).map(wi)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=V.alpha,this._adaptiveMin=V.min,this._adaptiveMax=V.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._tri
Line truncated
|
||||
`,d([f({attribute:!1})],S.prototype,"hass",2),d([f({attribute:!1})],S.prototype,"objects",2),d([c()],S.prototype,"_open",2),d([c()],S.prototype,"_loading",2),d([c()],S.prototype,"_error",2),d([c()],S.prototype,"_name",2),d([c()],S.prototype,"_manufacturer",2),d([c()],S.prototype,"_model",2),d([c()],S.prototype,"_serialNumber",2),d([c()],S.prototype,"_areaId",2),d([c()],S.prototype,"_installationDate",2),d([c()],S.prototype,"_warrantyExpiry",2),d([c()],S.prototype,"_documentationUrl",2),d([c()],S.prototype,"_notes",2),d([c()],S.prototype,"_haDeviceId",2),d([c()],S.prototype,"_parentEntryId",2),d([c()],S.prototype,"_entryId",2),d([c()],S.prototype,"_replacing",2),d([c()],S.prototype,"_oldDeviceId",2),d([c()],S.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",S);var ft=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"];function mi(r){let a=(r||"").split(/\s+/).filter(Boolean);return a.length===0?"?":a.length===1?a[0][0].toUpperCase():(a[0][0]+a[a.length-1][0]).toUpperCase()}function gi(r){let a=0;for(let e of r)a=a*31+e.charCodeAt(0)>>>0;return ft[a%ft.length]}function vt(r){return r?{id:r.id,name:r.name,initials:r.initials||mi(r.name),color:r.color||gi(r.id)}:null}var Ie=class{constructor(a){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=a}updateHass(a){this.hass=a}async getUsers(a=!1){let e=Date.now();if(!a&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=e,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(a,e,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:a,task_id:e,user_id:i})}async getTasksByUser(a){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:a})).tasks}getUserName(a){return!a||!this.usersCache?null:this.usersCache.find(i=>i.id===a)?.name||null}getPerson(a){return vt(this.getUser(a))}getUser(a){return!a||!this.usersCache?null:this.usersCache.find(e=>e.id===a)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(a){return a?a===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function U(r){return`${r.entry_id??""}\0${r.part_id}`}function yt(r,a,e,i){let t=!!r.entry_id&&r.entry_id!==a,n=t?r.entry_id:a,o=e.find(g=>g.entry_id===n),p=(o?.parts||[]).find(g=>g.id===r.part_id)||null,u=t&&o?.object?.name||"",m=p?.name||s("shared_part_unknown",i);return{part:p,foreign:t,ownerName:u,label:u?`${m} (${u})`:m}}function bt(r,a,e,i){let{part:t,label:n}=yt(r,a,e,i),o=t&&t.stock!==null&&t.stock!==void 0?` (${ne(t.stock,t.unit,i)})`:"",p=t?.storage_location?` \u2014 ${t.storage_location}`:"";return`${I(r.quantity,i)}\xD7 ${n}${o}${p}`}function $t(r,a,e,i){let n=(e.find(p=>p.entry_id===a)?.parts||[]).map(p=>({...p})),o=new Set(n.map(p=>U({part_id:p.id})));for(let p of r?.consumes_parts||[]){if(!p.entry_id||p.entry_id===a)continue;let u=U(p);if(o.has(u))continue;o.add(u);let{part:m,ownerName:g}=yt(p,a,e,i);n.push({id:p.part_id,name:m?.name||s("shared_part_unknown",i),unit:m?.unit,stock:m?.stock??null,storage_location:m?.storage_location,entry_id:p.entry_id,owner_name:g})}return n}var Me=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],xt=["sensor"],kt=["temperature","humidity","pressure"];function le(r){let a=(r??"").trim();if(a==="")return null;let e=Number(a.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var Oe=["notes","cost","duration","photo","user"],ve={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var fi={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},vi="mdi:wrench-clock",Fe=r=>r&&fi[r]||vi;var J=class extends E{constructor(){super(...arguments);this.value="";this.lang="en";this._credit=!1;this._amount=""}willUpdate(e){if(!e.has("value"))return;let i=(this.value??"").trim();if(i===this._signed())return;let t=parseFloat(i);if(i===""||Number.isNaN(t)){this._amount="",this._credit=!1;return}this._credit=t<0,this._amount=String(Math.abs(t))}_signed(){let e=this._amount.trim();return e===""?"":this._credit?`-${e}`:e}_emit(){this.value=this._signed(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value},bubbles:!0,composed:!0}))}_setCredit(e){this._credit!==e&&(this._credit=e,this._emit())}_onInput(e){let i=e.target.value;i.startsWith("-")&&(this._credit=!0),this.
Line truncated
|
||||
<div class="wrap">
|
||||
<div class="sign" role="group">
|
||||
<button type="button" class="kind cost ${this._credit?"":"on"}" aria-pressed=${String(!this._credit)}
|
||||
@click=${()=>this._setCredit(!1)}>${s("cost",e)}</button>
|
||||
<button type="button" class="kind credit ${this._credit?"on":""}" aria-pressed=${String(this._credit)}
|
||||
@click=${()=>this._setCredit(!0)}>${s("cost_kind_credit",e)}</button>
|
||||
</div>
|
||||
<input type="number" step="0.01" min="0" inputmode="decimal" class="field-input amount"
|
||||
.value=${this._amount} @input=${this._onInput} />
|
||||
</div>
|
||||
${this._credit?l`<div class="hint">${s("cost_credit_hint",e)}</div>`:h}
|
||||
`}};J.styles=[we,k`
|
||||
:host { display: block; }
|
||||
.wrap { display: flex; gap: 8px; align-items: stretch; }
|
||||
.sign {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
border: 1px solid var(--divider-color);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.kind {
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
padding: 0 10px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--secondary-text-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
.kind.on { background: var(--primary-color); color: var(--text-primary-color, #fff); }
|
||||
.kind.credit.on { background: var(--success-color, #43a047); }
|
||||
.amount { flex: 1; min-width: 0; }
|
||||
.hint { margin-top: 4px; font-size: 12px; color: var(--secondary-text-color); }
|
||||
`],d([f()],J.prototype,"value",2),d([f()],J.prototype,"lang",2),d([c()],J.prototype,"_credit",2),d([c()],J.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",J);var bi=["cleaning","inspection","replacement","calibration","service","reading","custom"],$i=["low","normal","high"],xi=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],Se=["weekdays","nth_weekday","day_of_month","calendar"],wt=["time_based","one_time",...Se],St=["threshold","counter","state_change","runtime","due_date"],Et=(r,a)=>s(r==="due_date"?"trigger_type_due_date":r,a),ki=[...St,"compound"],V={alpha:"0.3",min:"7",max:"365"},te=Q;function It(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}var wi=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states","trigger_days_before"]);function Tt(r){return{type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),daysBefore:r.trigger_days_before?.toString()??"0"}}function At(r,a){a.attribute&&(r.attribute=a.attribute);let e=parseInt(a.forMinutes,10);if(a.type==="threshold"){let i=parseFloat(a.above);isNaN(i)||(r.trigger_above=i);let t=parseFloat(a.below);isNaN(t)||(r.trigger_below=t);let n=parseFloat(a.equals);isNaN(n)||(r.trigger_equals=n);let o=parseFloat(a.notEquals);isNaN(o)||(r.trigger_not_equals=o),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="counter"){let i=parseFloat(a.targetValue);isNaN(i)||(r.trigger_target_value=i),r.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(r.trigger_from_state=a.fromState),a.toState&&(r.trigger_to_state=a.toState);let i=parseInt(a.targetChanges,10);isNaN(i)||(r.trigger_target_changes=i),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="runtime"){let i=parseFloat(a.runtimeHours);isNaN(i)||(r.trigger_runtime_hours=i);let t=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);t.length>0&&(r.trigger_on_states=t)}else if(a.type==="due_date"){let i=parseInt(a.daysBefore,10);r.trigger_days_before=isNaN(i)?0:i}}function Ei(r){return{entityIds:(r.entity_ids||(r.entity_id?[r.entity_id]:[])).join(", "),...Tt(r),carry:Object.fromEntries(Object.entries(r).filter(([e])=>!wi.has(e)&&!e.startsWith("_")))}}function Ii(r){let a=r.entityIds.split(",").map(i=>i.trim()).filter(Boolean);if(a.length===0)return null;let e={...r.carry||{},entity_id:a[0],entity_ids:a,type:r.type};return At(e,r),e}function Si(r){return Array.from({length:7},(a,e)=>He(e,r,"short"))}function Ti(r){return Array.from({length:12},(a,e)=>dt(e,r,"short"))}var _=class _ extends E{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.adaptiveFeature=!1;this.seasonalFeature=!1;this.environmentalFeature=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;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._calendarEntity="";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._notifyIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._triggerForMinutes="0";this._triggerCombinator="any";this._triggerTargetValue="";this._triggerDeltaMode=
Line truncated
|
||||
`),this._phaseDefs=Object.entries(i.phases||{}).map(([m,g])=>{let{name:v,checklist:x,consumes_parts:b,required_completion_fields:T,...N}=g,K=g.consumes_parts||[],X=K.findIndex(B=>!B.entry_id),F=X>=0?K[X]:void 0;return{id:m,name:g.name||m,checklistText:(g.checklist||[]).join(`
|
||||
`),partId:F?.part_id||"",partQty:F?.quantity!=null?String(F.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:K.filter((B,se)=>se!==X).map(B=>({...B})),carry:N}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"",this._scheduleTimeOn=!!i.schedule_time;let o=i.on_complete_action;if(o&&o.service){this._actionService=o.service;let m=o.target?.entity_id;this._actionTargetEntity=Array.isArray(m)?m[0]||"":m||"",this._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let p=i.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 u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??V.alpha,this._adaptiveMin=u.min_interval_days?.toString()??V.min,this._adaptiveMax=u.max_interval_days?.toString()??V.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,i.trigger_config){let m=i.trigger_config;this._triggerEntityId=m.entity_id||m.entity_ids&&m.entity_ids[0]||"",this._triggerEntityIds=m.entity_ids||(m.entity_id?[m.entity_id]:[]),this._triggerEntityLogic=m.entity_logic||"any",this._setTypeFields(Tt(m)),this._triggerCombinator=m.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=m.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=m.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=m.trigger_runtime_max_session_seconds?.toString()||"",m.type==="compound"?(this._compoundLogic=m.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(m.conditions||[]).map(Ei)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=V.alpha,this._adaptiveMin=V.min,this._adaptiveMax=V.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._tri
Line truncated
|
||||
<details class="ca-section">
|
||||
<summary>${s("on_complete_action_title",e)}</summary>
|
||||
<p class="field-help">${s("on_complete_action_desc",e)}</p>
|
||||
@@ -355,12 +390,11 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._qcNotes}
|
||||
@input=${t=>{this._qcNotes=t.target.value}}
|
||||
></ms-textfield>
|
||||
<ms-textfield
|
||||
label="${s("quick_complete_defaults_cost",e)}"
|
||||
type="number" min="0" step="0.01"
|
||||
.value=${this._qcCost}
|
||||
@input=${t=>{this._qcCost=t.target.value}}
|
||||
></ms-textfield>
|
||||
<div class="qc-cost">
|
||||
<span class="qc-cost-label">${s("quick_complete_defaults_cost",e)}</span>
|
||||
<ms-cost-input .lang=${e} .value=${this._qcCost}
|
||||
@value-changed=${t=>{this._qcCost=t.detail.value}}></ms-cost-input>
|
||||
</div>
|
||||
<ms-textfield
|
||||
label="${s("quick_complete_defaults_duration",e)}"
|
||||
type="number" min="0" step="1"
|
||||
@@ -376,7 +410,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<option value="not_sure">${s("feedback_not_sure",e)}</option>
|
||||
</select>
|
||||
</details>`:h}
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadForeignPools(){if(this._foreignOwners=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._foreignOwners=(e.objects||[]).filter(i=>i.entry_id!==this._entryId&&(i.parts||[]).length>0).map(i=>({entry_id:i.entry_id,name:i.object?.name||i.entry_id,parts:i.parts||[]})).sort((i,t)=>i.name.localeCompare(t.name))}catch{this._foreignOwners=[]}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}_fetchConditionAttributes(e){!e||!this.hass||this._conditionAttrOptions[e]||this._conditionAttrPending.has(e)||(this._conditionAttrPending.add(e),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e}).then(i=>{let t=i;this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:t.suggested_attributes||[],available:t.available_attributes||[]}}}).catch(()=>{this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:[],available:[]}}}))}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=i.domain||"",this._suggestedAttributes=i.suggested_attributes||[],this._availableAttributes=i.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}get _hasForeignPick(){return Object.values(this._consumesParts).some(e=>!!e.entry_id)}_renderConsumesRow(e,i){let t=z({part_id:e.id,entry_id:i}),n=this._consumesParts[t],o=i?{part_id:e.id,quantity:1,entry_id:i}:{part_id:e.id,quantity:1};return l`
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadForeignPools(){if(this._foreignOwners=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._foreignOwners=(e.objects||[]).filter(i=>i.entry_id!==this._entryId&&(i.parts||[]).length>0).map(i=>({entry_id:i.entry_id,name:i.object?.name||i.entry_id,parts:i.parts||[]})).sort((i,t)=>i.name.localeCompare(t.name))}catch{this._foreignOwners=[]}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}_fetchConditionAttributes(e){!e||!this.hass||this._conditionAttrOptions[e]||this._conditionAttrPending.has(e)||(this._conditionAttrPending.add(e),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e}).then(i=>{let t=i;this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:t.suggested_attributes||[],available:t.available_attributes||[]}}}).catch(()=>{this._conditionAttrOptions={...this._conditionAttrOptions,[e]:{suggested:[],available:[]}}}))}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=i.domain||"",this._suggestedAttributes=i.suggested_attributes||[],this._availableAttributes=i.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}get _hasForeignPick(){return Object.values(this._consumesParts).some(e=>!!e.entry_id)}_renderConsumesRow(e,i){let t=U({part_id:e.id,entry_id:i}),n=this._consumesParts[t],o=i?{part_id:e.id,quantity:1,entry_id:i}:{part_id:e.id,quantity:1};return l`
|
||||
<div class="consumes-row">
|
||||
<label class="consumes-check">
|
||||
<input
|
||||
@@ -389,14 +423,14 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${n!==void 0?l`<input
|
||||
class="consumes-qty"
|
||||
type="number"
|
||||
min=${ee[0]}
|
||||
max=${ee[1]}
|
||||
min=${te[0]}
|
||||
max=${te[1]}
|
||||
step="0.01"
|
||||
.value=${this._consumesQtyText[t]??String(n.quantity)}
|
||||
@input=${p=>{let u=p.target.value;this._consumesQtyText={...this._consumesQtyText,[t]:u};let m=parseFloat(u.replace(",","."));Number.isFinite(m)&&m>=ee[0]&&(this._consumesParts={...this._consumesParts,[t]:{...o,quantity:m}})}}
|
||||
@input=${p=>{let u=p.target.value;this._consumesQtyText={...this._consumesQtyText,[t]:u};let m=parseFloat(u.replace(",","."));Number.isFinite(m)&&m>=te[0]&&(this._consumesParts={...this._consumesParts,[t]:{...o,quantity:m}})}}
|
||||
/>`:h}
|
||||
</div>
|
||||
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let i of Object.keys(e)){let t=this._consumesQtyText[i];if(t===void 0)continue;let n=parseFloat(t.replace(",","."));if(!Number.isFinite(n)||n<ee[0]||n>ee[1]){let o=p=>E(p,this._lang,{maximumFractionDigits:2});return this._error=s("settings_value_out_of_range",this._lang).replace("{min}",o(ee[0])).replace("{max}",o(ee[1])),!1}e[i]={...e[i],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,i){let t=new Set(this._requiredCompletion);i?t.add(e):t.delete(e),this._requiredCompletion=[...t]}_patchReading(e,i){this._readings=this._readings.map(t=>t.id===e?{...t,...i}:t)}_renderReadingsEditor(e){let i=tt(this._readings);return l`
|
||||
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let i of Object.keys(e)){let t=this._consumesQtyText[i];if(t===void 0)continue;let n=parseFloat(t.replace(",","."));if(!Number.isFinite(n)||n<te[0]||n>te[1]){let o=p=>I(p,this._lang,{maximumFractionDigits:2});return this._error=s("settings_value_out_of_range",this._lang).replace("{min}",o(te[0])).replace("{max}",o(te[1])),!1}e[i]={...e[i],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,i){let t=new Set(this._requiredCompletion);i?t.add(e):t.delete(e),this._requiredCompletion=[...t]}_patchReading(e,i){this._readings=this._readings.map(t=>t.id===e?{...t,...i}:t)}_renderReadingsEditor(e){let i=st(this._readings);return l`
|
||||
<div class="readings-editor">
|
||||
<div class="field-label">${s("readings_section",e)}</div>
|
||||
<div class="field-help">${s("readings_hint",e)}</div>
|
||||
@@ -422,7 +456,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
`)}
|
||||
${this._readings.length<20?l`
|
||||
<ha-button appearance="plain" class="reading-add"
|
||||
@click=${()=>this._readings=[...this._readings,{id:Ye(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
|
||||
@click=${()=>this._readings=[...this._readings,{id:Ze(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon> ${s("reading_add",e)}
|
||||
</ha-button>`:h}
|
||||
</div>
|
||||
@@ -477,14 +511,14 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</label>
|
||||
${t.reqOverride?l`
|
||||
<div class="required-completion phase-req-fields">
|
||||
${Ne.map(n=>l`
|
||||
${Oe.map(n=>l`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${t.reqFields.includes(n)}
|
||||
@change=${o=>{let p=o.target.checked,u=new Set(t.reqFields);p?u.add(n):u.delete(n),this._patchPhaseDef(t.id,{reqFields:[...u]})}}
|
||||
/>
|
||||
<span>${s(fe[n],e)}</span>
|
||||
<span>${s(ve[n],e)}</span>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
@@ -513,9 +547,9 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</select>
|
||||
</div>
|
||||
`:h}
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(i)&&e>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=s("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=s("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await A(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let i=this._taskId||e?.task_id,t=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let n=o=>{this._warning=s("subsave_warning",this._lang).replace("{detail}",o)};if(i&&this._scheduleType==="sensor_based"&&t&&await A(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:i,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:n})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),i&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),p=parseInt(this._adaptiveMin,10),u=parseInt(this._adaptiveMax,10);await A(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:i,enabled:this._adaptiveEnabled,...o>=ge[0]&&o<=ge[1]?{ewa_alpha:o}:{},...!isNaN(p)&&p>=1?{min_interval_days:p}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?i&&(this._taskId=i):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();e.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):Ee.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(t=>t.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=it(this._readings);{let t={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let p={...o.carry,name:o.name.trim()},u=o.checklistText.split(`
|
||||
`).map(g=>g.trim()).filter(Boolean);u.length&&(p.checklist=u);let m=[];if(o.partId){let g=parseFloat(o.partQty);m.push({part_id:o.partId,quantity:Number.isFinite(g)&&g>0?g:1})}for(let g of o.extraParts)m.push(g.entry_id?{part_id:g.part_id,quantity:g.quantity,entry_id:g.entry_id}:{part_id:g.part_id,quantity:g.quantity});m.length&&(p.consumes_parts=m),o.reqOverride&&(p.required_completion_fields=[...o.reqFields]),t[o.id]=p}let n=this._phaseSeq.filter(o=>o in t);e.phases=Object.keys(t).length&&n.length?t:null,e.phase_sequence=e.phases?n:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(t=>t.entry_id?{part_id:t.part_id,quantity:t.quantity,entry_id:t.entry_id}:{part_id:t.part_id,quantity:t.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(e.responsible_user_id=this._responsibleUserId),e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let t=this._compoundConditions.map(Ei).filter(n=>n!==null);if(t.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:t};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let t=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],n={entity_id:t[0],entity_ids:t,type:this._triggerType};if(St(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),t.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&kt.includes(this._scheduleType)){let t=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(t)?t:null}if(this.checklistsEnabled){let t=this._checklistText.split(`
|
||||
`).map(n=>n.trim()).filter(Boolean).slice(0,100);e.checklist=t.length?t:null}if(this.completionActionsEnabled||this._actionPresent){let t=this._actionService.trim();if(t&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(t)){let n={service:t},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?n.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(n.target={entity_id:o});let p=this._buildActionData();Object.keys(p).length>0&&(n.data=p),this._actionSkipAuto&&(n.skip_auto=!0),e.on_complete_action=n}else e.on_complete_action=null}if(this.completionActionsEnabled){let t={};this._qcNotes.trim()&&(t.notes=this._qcNotes.trim());let n=parseFloat(this._qcCost);!isNaN(n)&&n>=0&&(t.cost=n);let o=oe(this._qcDuration);o!==null&&(t.duration=o),this._qcFeedback&&(t.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(t).length?t:null}return e}_close(){this._open=!1,this._warning="",this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,i=this._triggerType==="compound";return l`
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(i)&&e>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=s("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=s("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await A(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let i=this._taskId||e?.task_id,t=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let n=o=>{this._warning=s("subsave_warning",this._lang).replace("{detail}",o)};if(i&&this._scheduleType==="sensor_based"&&t&&await A(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:i,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:n})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),i&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),p=parseInt(this._adaptiveMin,10),u=parseInt(this._adaptiveMax,10);await A(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:i,enabled:this._adaptiveEnabled,...o>=fe[0]&&o<=fe[1]?{ewa_alpha:o}:{},...!isNaN(p)&&p>=1?{min_interval_days:p}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?i&&(this._taskId=i):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();e.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):Se.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(t=>t.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=rt(this._readings);{let t={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let p={...o.carry,name:o.name.trim()},u=o.checklistText.split(`
|
||||
`).map(g=>g.trim()).filter(Boolean);u.length&&(p.checklist=u);let m=[];if(o.partId){let g=parseFloat(o.partQty);m.push({part_id:o.partId,quantity:Number.isFinite(g)&&g>0?g:1})}for(let g of o.extraParts)m.push(g.entry_id?{part_id:g.part_id,quantity:g.quantity,entry_id:g.entry_id}:{part_id:g.part_id,quantity:g.quantity});m.length&&(p.consumes_parts=m),o.reqOverride&&(p.required_completion_fields=[...o.reqFields]),t[o.id]=p}let n=this._phaseSeq.filter(o=>o in t);e.phases=Object.keys(t).length&&n.length?t:null,e.phase_sequence=e.phases?n:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(t=>t.entry_id?{part_id:t.part_id,quantity:t.quantity,entry_id:t.entry_id}:{part_id:t.part_id,quantity:t.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(e.responsible_user_id=this._responsibleUserId),e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let t=this._compoundConditions.map(Ii).filter(n=>n!==null);if(t.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:t};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let t=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],n={entity_id:t[0],entity_ids:t,type:this._triggerType};if(At(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),t.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&wt.includes(this._scheduleType)){let t=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(t)?t:null}if(this.checklistsEnabled){let t=this._checklistText.split(`
|
||||
`).map(n=>n.trim()).filter(Boolean).slice(0,100);e.checklist=t.length?t:null}if(this.completionActionsEnabled||this._actionPresent){let t=this._actionService.trim();if(t&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(t)){let n={service:t},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?n.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(n.target={entity_id:o});let p=this._buildActionData();Object.keys(p).length>0&&(n.data=p),this._actionSkipAuto&&(n.skip_auto=!0),e.on_complete_action=n}else e.on_complete_action=null}if(this.completionActionsEnabled){let t={};this._qcNotes.trim()&&(t.notes=this._qcNotes.trim());let n=parseFloat(this._qcCost);isNaN(n)||(t.cost=n);let o=le(this._qcDuration);o!==null&&(t.duration=o),this._qcFeedback&&(t.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(t).length?t:null}return e}_close(){this._open=!1,this._warning="",this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,i=this._triggerType==="compound";return l`
|
||||
<h3>${s("trigger_configuration",e)}</h3>
|
||||
<div class="select-row">
|
||||
<label>${s("trigger_type",e)}</label>
|
||||
@@ -523,7 +557,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._triggerType}
|
||||
@change=${t=>this._triggerType=t.target.value}
|
||||
>
|
||||
${xi.map(t=>l`<option value=${t} ?selected=${t===this._triggerType}>${wt(t,e)}</option>`)}
|
||||
${ki.map(t=>l`<option value=${t} ?selected=${t===this._triggerType}>${Et(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${i?this._renderCompoundEditor():l`
|
||||
@@ -537,7 +571,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:He}}}]}
|
||||
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:Me}}}]}
|
||||
.data=${{trigger_entities:this._triggerEntityIds.length>0?this._triggerEntityIds:this._triggerEntityId?[this._triggerEntityId]:[]}}
|
||||
.computeLabel=${()=>s("entity_id",e)}
|
||||
@value-changed=${t=>{let n=(t.detail.value.trigger_entities||[]).filter(Boolean);this._triggerEntityId=n[0]||"",this._triggerEntityIds=n,n[0]?this._fetchEntityAttributes(n[0]):this._fetchEntityAttributes("")}}
|
||||
@@ -585,7 +619,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</select>
|
||||
</div>
|
||||
`:h}
|
||||
`}_patchCondition(e,i){this._compoundConditions=this._compoundConditions.map((t,n)=>n===e?{...t,...i}:t)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Et()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((i,t)=>t!==e)}_renderCompoundEditor(){let e=this._lang;return l`
|
||||
`}_patchCondition(e,i){this._compoundConditions=this._compoundConditions.map((t,n)=>n===e?{...t,...i}:t)}_addCondition(){this._compoundConditions=[...this._compoundConditions,It()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((i,t)=>t!==e)}_renderCompoundEditor(){let e=this._lang;return l`
|
||||
<div class="select-row">
|
||||
<label>${s("compound_logic",e)}</label>
|
||||
<select
|
||||
@@ -622,7 +656,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:He}}}]}
|
||||
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:Me}}}]}
|
||||
.data=${{condition_entities:e.entityIds.split(",").map(o=>o.trim()).filter(Boolean)}}
|
||||
.computeLabel=${()=>s("entity_id",t)}
|
||||
@value-changed=${o=>{let p=(o.detail.value.condition_entities||[]).filter(Boolean);this._patchCondition(i,{entityIds:p.join(", ")})}}
|
||||
@@ -634,7 +668,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${e.type}
|
||||
@change=${o=>this._patchCondition(i,{type:o.target.value})}
|
||||
>
|
||||
${It.map(o=>l`<option value=${o} ?selected=${o===e.type}>${wt(o,t)}</option>`)}
|
||||
${St.map(o=>l`<option value=${o} ?selected=${o===e.type}>${Et(o,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(e,i)}
|
||||
@@ -699,8 +733,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ms-textfield
|
||||
label="${s("adaptive_ewa_alpha",e)}"
|
||||
type="number"
|
||||
min=${ge[0]}
|
||||
max=${ge[1]}
|
||||
min=${fe[0]}
|
||||
max=${fe[1]}
|
||||
step="0.1"
|
||||
.value=${this._adaptiveAlpha}
|
||||
@input=${i=>this._adaptiveAlpha=i.target.value}
|
||||
@@ -773,7 +807,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${this._renderOnStatesField({value:e.onStates,entityId:n,onInput:o=>this._patchCondition(i,{onStates:o})})}
|
||||
`}return e.type==="due_date"?l`
|
||||
<ms-textfield label="${s("days_before",t)}" type="number" step="1"
|
||||
min=${_e[0]} max=${_e[1]} .value=${e.daysBefore}
|
||||
min=${me[0]} max=${me[1]} .value=${e.daysBefore}
|
||||
@input=${n=>this._patchCondition(i,{daysBefore:n.target.value})}></ms-textfield>
|
||||
`:h}_renderUnitSelect(){let e=this._lang;return l`
|
||||
<div class="select-row">
|
||||
@@ -784,12 +818,12 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
>
|
||||
${["days","weeks","months","years"].map(i=>l`<option value=${i} ?selected=${i===this._intervalUnit}>${s("unit_"+i,e)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(i=>i!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(Ee.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let i of e.keys())if(_._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!i){this._pickerProbeStrikes=0;return}let t=(u,m,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&m.push(u);for(let v of[u.shadowRoot,u])if(v)for(let x of Array.from(v.children??[]))t(x,m,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let u of n)t(u,o);let p=o.length===0||o.some(u=>u.offsetHeight===0);if(e.offsetHeight===0||p){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=t.occurrences||[],this._schedulePreviewEnded=!!t.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",t=this._schedulePreview.map((o,p)=>{let u=new Date(`${o}T12:00:00`).getDay();return`${Le(u===0?6:u-1,e,"short")} ${j(o,e)}${p===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(i=>i!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(Se.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let i of e.keys())if(_._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!i){this._pickerProbeStrikes=0;return}let t=(u,m,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&m.push(u);for(let v of[u.shadowRoot,u])if(v)for(let x of Array.from(v.children??[]))t(x,m,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let u of n)t(u,o);let p=o.length===0||o.some(u=>u.offsetHeight===0);if(e.offsetHeight===0||p){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=t.occurrences||[],this._schedulePreviewEnded=!!t.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",t=this._schedulePreview.map((o,p)=>{let u=new Date(`${o}T12:00:00`).getDay();return`${He(u===0?6:u-1,e,"short")} ${z(o,e)}${p===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
|
||||
<div class="trigger-live-hint schedule-preview">
|
||||
${s("schedule_preview_title",e)}: ${t}${this._schedulePreviewEnded?l` <span class="field-help">${s("schedule_preview_ends",e)}</span>`:h}
|
||||
${n}
|
||||
</div>
|
||||
`}_buildSchedule(){let e=t=>{let n=parseInt(this._calOffset,10)||0;return n&&(t.offset=Math.max(-me,Math.min(n,me))),t};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((t,n)=>t-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});let i={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(i.business=!0),e(i)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((i,t)=>i-t)),this._endsMode==="count"){let i=parseInt(this._endsCount,10);i>=1&&(e.ends={count:i})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(i=>i!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||Ee.includes(this._scheduleType)))return h;let t=Ti(e);return l`
|
||||
`}_buildSchedule(){let e=t=>{let n=parseInt(this._calOffset,10)||0;return n&&(t.offset=Math.max(-ge,Math.min(n,ge))),t};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((t,n)=>t-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});let i={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(i.business=!0),e(i)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((i,t)=>i-t)),this._endsMode==="count"){let i=parseInt(this._endsCount,10);i>=1&&(e.ends={count:i})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(i=>i!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||Se.includes(this._scheduleType)))return h;let t=Ti(e);return l`
|
||||
<label class="field-label">${s("season_window_label",e)}</label>
|
||||
<div class="field-help">${s("season_window_hint",e)}</div>
|
||||
<div class="weekday-chips season-chips">
|
||||
@@ -826,7 +860,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._endsUntil}
|
||||
@value-changed=${n=>this._endsUntil=n.detail.value}
|
||||
></ms-date-field>`:h}
|
||||
`}_renderCalendarFields(){let e=this._lang,i=Ii(e);if(this._scheduleType==="weekdays")return l`
|
||||
`}_renderCalendarFields(){let e=this._lang,i=Si(e);if(this._scheduleType==="weekdays")return l`
|
||||
<label class="field-label">${s("recurrence_on_days",e)}</label>
|
||||
<div class="weekday-chips">
|
||||
${i.map((t,n)=>l`
|
||||
@@ -892,11 +926,11 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
label="${s("recurrence_offset",e)}"
|
||||
helper="${s("recurrence_offset_help",e)}"
|
||||
type="number"
|
||||
min=${-me}
|
||||
max=${me}
|
||||
min=${-ge}
|
||||
max=${ge}
|
||||
.value=${this._calOffset}
|
||||
@input=${i=>this._calOffset=i.target.value}
|
||||
></ms-textfield>`}_thresholdLimitsOverlap(){let e=parseFloat(this._triggerAbove),i=parseFloat(this._triggerBelow);return!isNaN(e)&&!isNaN(i)&&i>e}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerType==="threshold"&&this._thresholdLimitsOverlap()?l`<div class="trigger-live-hint warn">${s("trigger_hint_overlap",this._lang)}</div>`:h,i=this._triggerEntityId||this._triggerEntityIds[0];if(!i||!this.hass?.states)return e;let t=this.hass.states[i];if(!t)return e;let n=this._lang,o=t.attributes?.unit_of_measurement,p=typeof o=="string"&&o?` ${o}`:"",u=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,m=typeof u=="number"?u:parseFloat(String(u)),g=u!=="unknown"&&u!=="unavailable"&&u!=null&&!isNaN(m),v=b=>E(b,n,{maximumFractionDigits:1}),x=[];if(this._triggerType==="threshold"){let b=parseFloat(this._triggerAbove),S=parseFloat(this._triggerBelow);if(isNaN(b)&&isNaN(S))return h;g&&x.push(s("trigger_hint_now",n).replace("{value}",v(m)+p)),isNaN(b)||x.push(s("trigger_hint_above",n).replace("{target}",v(b)+p)),isNaN(S)||x.push(s("trigger_hint_below",n).replace("{target}",v(S)+p))}else if(this._triggerType==="counter"){let b=parseFloat(this._triggerTargetValue);if(isNaN(b))return h;this._triggerDeltaMode?this._taskId?x.push(s("trigger_hint_counter_delta_edit",n).replace("{target}",v(b)+p)):g?x.push(s("trigger_hint_counter_delta",n).replace("{value}",v(m)+p).replace("{due}",v(m+b)+p).replace("{target}",v(b)+p)):x.push(s("trigger_hint_counter_delta_edit",n).replace("{target}",v(b)+p)):(g&&x.push(s("trigger_hint_now",n).replace("{value}",v(m)+p)),x.push(s("trigger_hint_counter_abs",n).replace("{target}",v(b)+p)))}else if(this._triggerType==="runtime"){let b=parseFloat(this._triggerRuntimeHours);if(isNaN(b))return h;x.push(s("trigger_hint_runtime",n).replace("{hours}",v(b))),x.push(s("trigger_hint_state_now",n).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let b=parseInt(this._triggerTargetChanges,10)||1,S=this._triggerToState.trim();x.push((S?s("trigger_hint_state_change_to",n).replace("{state}",S):s("trigger_hint_state_change",n)).replace("{count}",String(b))),x.push(s("trigger_hint_state_now",n).replace("{value}",String(t.state)))}else if(this._triggerType==="due_date"){let b=parseInt(this._triggerDaysBefore,10)||0;x.push(b===0?s("trigger_hint_due_date_same_day",n):b===1?s("trigger_hint_due_date_one",n):s("trigger_hint_due_date",n).replace("{days}",String(b)));let S=u==null?"":String(u);S&&!isNaN(Date.parse(S))&&x.push(s("trigger_hint_due_date_now",n).replace("{date}",j(S,n)))}return x.length?l`<div class="trigger-live-hint">${x.join(" ")}</div>${e}`:e}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l`
|
||||
></ms-textfield>`}_thresholdLimitsOverlap(){let e=parseFloat(this._triggerAbove),i=parseFloat(this._triggerBelow);return!isNaN(e)&&!isNaN(i)&&i>e}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerType==="threshold"&&this._thresholdLimitsOverlap()?l`<div class="trigger-live-hint warn">${s("trigger_hint_overlap",this._lang)}</div>`:h,i=this._triggerEntityId||this._triggerEntityIds[0];if(!i||!this.hass?.states)return e;let t=this.hass.states[i];if(!t)return e;let n=this._lang,o=t.attributes?.unit_of_measurement,p=typeof o=="string"&&o?` ${o}`:"",u=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,m=typeof u=="number"?u:parseFloat(String(u)),g=u!=="unknown"&&u!=="unavailable"&&u!=null&&!isNaN(m),v=b=>I(b,n,{maximumFractionDigits:1}),x=[];if(this._triggerType==="threshold"){let b=parseFloat(this._triggerAbove),T=parseFloat(this._triggerBelow);if(isNaN(b)&&isNaN(T))return h;g&&x.push(s("trigger_hint_now",n).replace("{value}",v(m)+p)),isNaN(b)||x.push(s("trigger_hint_above",n).replace("{target}",v(b)+p)),isNaN(T)||x.push(s("trigger_hint_below",n).replace("{target}",v(T)+p))}else if(this._triggerType==="counter"){let b=parseFloat(this._triggerTargetValue);if(isNaN(b))return h;this._triggerDeltaMode?this._taskId?x.push(s("trigger_hint_counter_delta_edit",n).replace("{target}",v(b)+p)):g?x.push(s("trigger_hint_counter_delta",n).replace("{value}",v(m)+p).replace("{due}",v(m+b)+p).replace("{target}",v(b)+p)):x.push(s("trigger_hint_counter_delta_edit",n).replace("{target}",v(b)+p)):(g&&x.push(s("trigger_hint_now",n).replace("{value}",v(m)+p)),x.push(s("trigger_hint_counter_abs",n).replace("{target}",v(b)+p)))}else if(this._triggerType==="runtime"){let b=parseFloat(this._triggerRuntimeHours);if(isNaN(b))return h;x.push(s("trigger_hint_runtime",n).replace("{hours}",v(b))),x.push(s("trigger_hint_state_now",n).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let b=parseInt(this._triggerTargetChanges,10)||1,T=this._triggerToState.trim();x.push((T?s("trigger_hint_state_change_to",n).replace("{state}",T):s("trigger_hint_state_change",n)).replace("{count}",String(b))),x.push(s("trigger_hint_state_now",n).replace("{value}",String(t.state)))}else if(this._triggerType==="due_date"){let b=parseInt(this._triggerDaysBefore,10)||0;x.push(b===0?s("trigger_hint_due_date_same_day",n):b===1?s("trigger_hint_due_date_one",n):s("trigger_hint_due_date",n).replace("{days}",String(b)));let T=u==null?"":String(u);T&&!isNaN(Date.parse(T))&&x.push(s("trigger_hint_due_date_now",n).replace("{date}",z(T,n)))}return x.length?l`<div class="trigger-live-hint">${x.join(" ")}</div>${e}`:e}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l`
|
||||
<ms-textfield
|
||||
label="${s("trigger_above",e)}"
|
||||
type="number"
|
||||
@@ -969,7 +1003,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ms-textfield
|
||||
label="${s("target_changes",e)}"
|
||||
type="number"
|
||||
min=${ut[0]}
|
||||
min=${_t[0]}
|
||||
.value=${this._triggerTargetChanges}
|
||||
@input=${i=>this._triggerTargetChanges=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -978,7 +1012,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ms-textfield
|
||||
label="${s("for_at_least_minutes",e)}"
|
||||
type="number"
|
||||
min=${ht[0]}
|
||||
min=${ut[0]}
|
||||
.value=${this._triggerForMinutes}
|
||||
@input=${i=>this._triggerForMinutes=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1006,8 +1040,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
label="${s("days_before",e)}"
|
||||
type="number"
|
||||
step="1"
|
||||
min=${_e[0]}
|
||||
max=${_e[1]}
|
||||
min=${me[0]}
|
||||
max=${me[1]}
|
||||
.value=${this._triggerDaysBefore}
|
||||
@input=${i=>this._triggerDaysBefore=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1041,7 +1075,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._type}
|
||||
@change=${t=>this._type=t.target.value}
|
||||
>
|
||||
${yi.map(t=>l`<option value=${t} ?selected=${t===this._type}>${s(t,e)}</option>`)}
|
||||
${bi.map(t=>l`<option value=${t} ?selected=${t===this._type}>${s(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?l`
|
||||
@@ -1076,7 +1110,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._priority}
|
||||
@change=${t=>this._priority=t.target.value}
|
||||
>
|
||||
${bi.map(t=>l`<option value=${t} ?selected=${t===this._priority}>${s("priority_"+t,e)}</option>`)}
|
||||
${$i.map(t=>l`<option value=${t} ?selected=${t===this._priority}>${s("priority_"+t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -1114,7 +1148,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._scheduleType}
|
||||
@change=${t=>this._scheduleType=t.target.value}
|
||||
>
|
||||
${$i.map(t=>l`<option value=${t} ?selected=${t===this._scheduleType}>${s(t,e)}</option>`)}
|
||||
${xi.map(t=>l`<option value=${t} ?selected=${t===this._scheduleType}>${s(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?l`
|
||||
@@ -1147,7 +1181,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
@value-changed=${t=>this._dueDate=t.detail.value}
|
||||
></ms-date-field>
|
||||
`:h}
|
||||
${this.scheduleTimeEnabled&&kt.includes(this._scheduleType)?l`
|
||||
${this.scheduleTimeEnabled&&wt.includes(this._scheduleType)?l`
|
||||
<label class="checkbox-row schedule-time-toggle">
|
||||
<input type="checkbox" .checked=${this._scheduleTimeOn}
|
||||
@change=${t=>this._scheduleTimeOn=t.target.checked} />
|
||||
@@ -1169,8 +1203,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ms-textfield
|
||||
label="${s("warning_days",e)}"
|
||||
type="number"
|
||||
min=${qe[0]}
|
||||
max=${qe[1]}
|
||||
min=${Ne[0]}
|
||||
max=${Ne[1]}
|
||||
.value=${this._warningDays}
|
||||
@input=${t=>this._warningDays=t.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1196,14 +1230,14 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${this._renderPhasesEditor(e)}
|
||||
<h3>${s("require_on_completion",e)}</h3>
|
||||
<div class="required-completion">
|
||||
${Ne.map(t=>l`
|
||||
${Oe.map(t=>l`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${this._requiredCompletion.includes(t)}
|
||||
@change=${n=>this._toggleRequired(t,n.target.checked)}
|
||||
/>
|
||||
<span>${s(fe[t],e)}</span>
|
||||
<span>${s(ve[t],e)}</span>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
@@ -1265,7 +1299,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:$t,device_class:xt}}}]}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:xt,device_class:kt}}}]}
|
||||
.data=${{environmental_entity:this._environmentalEntity}}
|
||||
.computeLabel=${()=>s("environmental_entity_optional",e)}
|
||||
.computeHelper=${()=>s("environmental_entity_helper",e)}
|
||||
@@ -1301,8 +1335,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
@value-changed=${t=>this._notifyIcon=t.detail.value||""}
|
||||
></ha-icon-picker>
|
||||
<div class="field-help notify-icon-help">
|
||||
<ha-icon icon=${this._notifyIcon.trim()||Me(this._type)}></ha-icon>
|
||||
${s("notify_icon_hint",e).replace("{default}",Me(this._type))}
|
||||
<ha-icon icon=${this._notifyIcon.trim()||Fe(this._type)}></ha-icon>
|
||||
${s("notify_icon_hint",e).replace("{default}",Fe(this._type))}
|
||||
</div>
|
||||
${this._availableTags.length>0?l`
|
||||
<div class="select-row">
|
||||
@@ -1379,7 +1413,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};_._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_calendarEntity","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),_.styles=w`
|
||||
`}};_._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_calendarEntity","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),_.styles=k`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1623,6 +1657,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
font-weight: 500;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.qc-cost { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
|
||||
.qc-cost-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-help {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
@@ -1778,8 +1814,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,d([f({attribute:!1})],_.prototype,"hass",2),d([f({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),d([f({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),d([f({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),d([f({type:Boolean,attribute:"adaptive-feature"})],_.prototype,"adaptiveFeature",2),d([f({type:Boolean,attribute:"seasonal-feature"})],_.prototype,"seasonalFeature",2),d([f({type:Boolean,attribute:"environmental-feature"})],_.prototype,"environmentalFeature",2),d([f({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),d([c()],_.prototype,"parts",2),d([c()],_.prototype,"_foreignOwners",2),d([c()],_.prototype,"_open",2),d([c()],_.prototype,"_entityPickerFallback",2),d([c()],_.prototype,"_loading",2),d([c()],_.prototype,"_error",2),d([c()],_.prototype,"_warning",2),d([c()],_.prototype,"_entryId",2),d([c()],_.prototype,"_taskId",2),d([c()],_.prototype,"_isFleetTask",2),d([c()],_.prototype,"_objectChoices",2),d([c()],_.prototype,"_name",2),d([c()],_.prototype,"_type",2),d([c()],_.prototype,"_scheduleType",2),d([c()],_.prototype,"_intervalDays",2),d([c()],_.prototype,"_intervalUnit",2),d([c()],_.prototype,"_dueDate",2),d([c()],_.prototype,"_warningDays",2),d([c()],_.prototype,"_earliestCompletionDays",2),d([c()],_.prototype,"_intervalAnchor",2),d([c()],_.prototype,"_weekdays",2),d([c()],_.prototype,"_nth",2),d([c()],_.prototype,"_nthWeekday",2),d([c()],_.prototype,"_domDay",2),d([c()],_.prototype,"_domLastDay",2),d([c()],_.prototype,"_domBusiness",2),d([c()],_.prototype,"_calOffset",2),d([c()],_.prototype,"_calendarEntity",2),d([c()],_.prototype,"_seasonMonths",2),d([c()],_.prototype,"_endsMode",2),d([c()],_.prototype,"_endsCount",2),d([c()],_.prototype,"_endsUntil",2),d([c()],_.prototype,"_schedulePreview",2),d([c()],_.prototype,"_schedulePreviewEnded",2),d([c()],_.prototype,"_notes",2),d([c()],_.prototype,"_documentationUrl",2),d([c()],_.prototype,"_customIcon",2),d([c()],_.prototype,"_notifyIcon",2),d([c()],_.prototype,"_priority",2),d([c()],_.prototype,"_labels",2),d([c()],_.prototype,"_mirrorTodoEntities",2),d([c()],_.prototype,"_enabled",2),d([c()],_.prototype,"_triggerEntityId",2),d([c()],_.prototype,"_triggerEntityIds",2),d([c()],_.prototype,"_triggerEntityLogic",2),d([c()],_.prototype,"_triggerAttribute",2),d([c()],_.prototype,"_triggerType",2),d([c()],_.prototype,"_triggerAbove",2),d([c()],_.prototype,"_triggerBelow",2),d([c()],_.prototype,"_triggerEquals",2),d([c()],_.prototype,"_triggerNotEquals",2),d([c()],_.prototype,"_triggerForMinutes",2),d([c()],_.prototype,"_triggerCombinator",2),d([c()],_.prototype,"_triggerTargetValue",2),d([c()],_.prototype,"_triggerDeltaMode",2),d([c()],_.prototype,"_triggerBaselineValue",2),d([c()],_.prototype,"_liveBaselineValue",2),d([c()],_.prototype,"_autoCompleteOnRecovery",2),d([c()],_.prototype,"_triggerFromState",2),d([c()],_.prototype,"_triggerToState",2),d([c()],_.prototype,"_triggerTargetChanges",2),d([c()],_.prototype,"_triggerRuntimeHours",2),d([c()],_.prototype,"_triggerDaysBefore",2),d([c()],_.prototype,"_triggerRuntimeMaxSession",2),d([c()],_.prototype,"_triggerOnStates",2),d([c()],_.prototype,"_compoundLogic",2),d([c()],_.prototype,"_compoundConditions",2),d([c()],_.prototype,"_suggestedAttributes",2),d([c()],_.prototype,"_availableAttributes",2),d([c()],_.prototype,"_entityDomain",2),d([c()],_.prototype,"_lastPerformed",2),d([c()],_.prototype,"_nfcTagId",2),d([c()],_.prototype,"_requireTagScan",2),d([c()],_.prototype,"_allowSkip",2),d([c()],_.prototype,"_notifyEnabled",2),d([c()],_.prototype,"_readingUnit",2),d([c()],_.prototype,"_readings",2),d([c()],_.prototype,"_consumesParts",2),d([c()],_.prototype,"_consumesQtyText",2),d([c()],_.prototype,"_partsLoadFailed",2),d([c()],_.prototype,"_availableTags",2),d([c()],_.prototype,"_responsibleUserId",2),d([c()],_.prototype,"_assigneePool",2),d([c()],_.prototype,"_rotationStrategy",2),d([c()],_.prototype,"_availableUsers",2),d([c()],_.prototype,"_checklistText",2),d([c()],_.prototype,"_phaseDefs",2),d([c()],_.prototype,"_phaseSeq",2),d([c()],_.prototype,"_requiredCompletion",2),d([c()],_.prototype,"_scheduleTime",2),d([c()],_.prototype,"_scheduleTimeOn",2),d([c()],_.prototype,"_actionService",2),d([c()],_.prototype,"_actionTargetEntity",2),d([c()],_.prototype,"_actionSkipAuto",2),d([c()],_.prototype,"_actionPresent",2),d([c()],_.prototype,"_actionData",2),d([c()],_.prototype,"_actionDataJsonFallback",2),d([c()],_.prototype,"_actionTesting",2),d([c()],_.prototype,"_actionTestResult",2),d([c()],_.prototype,"_actionTestError",2),d([c()],_.prototype,"_qcNotes",2),d([c()],_.prototype,"_qcCost",2),d([c()],_.prototype,"_qcDuration",2),d([c()],_.prototype,"_qcFeedback",2),d([c()],_.prototype,"_environmentalEntity",2),d([c()],_.prototype,"_environmentalAttribute",2),d([c()],_.prototype,"_adaptiveEnabled",2),d([c()],_.prototype,"_adaptiveAlpha",2),d([c()],_.prototy
Line truncated
|
||||
`),i=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),i=!0)}catch{}if(!i){let t=this.shadowRoot?.querySelector(".details textarea");if(t){t.focus(),t.select();try{i=document.execCommand("copy")}catch{i=!1}}}this._copied=i}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let i=e.videoWidth||640,t=e.videoHeight||480,n=Math.min(1,Ri/Math.max(i,t)),o=document.createElement("canvas");o.width=Math.round(i*n),o.height=Math.round(t*n);let p=o.getContext("2d");if(!p)throw new Error("no_canvas");p.drawImage(e,0,0,o.width,o.height);let u=await new Promise(v=>o.toBlob(v,"image/jpeg",Pi));if(!u)throw new Error("no_blob");let m=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),g=new File([u],`photo-${m}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:g},bubbles:!0,composed:!0}))}catch(i){this._unavailable(i instanceof Error?i.message:String(i))}finally{this._busy=!1}}}render(){if(!this._open)return h;let e=this.lang,i=this._busy||this._switching;return l`
|
||||
`,d([f({attribute:!1})],_.prototype,"hass",2),d([f({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),d([f({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),d([f({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),d([f({type:Boolean,attribute:"adaptive-feature"})],_.prototype,"adaptiveFeature",2),d([f({type:Boolean,attribute:"seasonal-feature"})],_.prototype,"seasonalFeature",2),d([f({type:Boolean,attribute:"environmental-feature"})],_.prototype,"environmentalFeature",2),d([f({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),d([c()],_.prototype,"parts",2),d([c()],_.prototype,"_foreignOwners",2),d([c()],_.prototype,"_open",2),d([c()],_.prototype,"_entityPickerFallback",2),d([c()],_.prototype,"_loading",2),d([c()],_.prototype,"_error",2),d([c()],_.prototype,"_warning",2),d([c()],_.prototype,"_entryId",2),d([c()],_.prototype,"_taskId",2),d([c()],_.prototype,"_isFleetTask",2),d([c()],_.prototype,"_objectChoices",2),d([c()],_.prototype,"_name",2),d([c()],_.prototype,"_type",2),d([c()],_.prototype,"_scheduleType",2),d([c()],_.prototype,"_intervalDays",2),d([c()],_.prototype,"_intervalUnit",2),d([c()],_.prototype,"_dueDate",2),d([c()],_.prototype,"_warningDays",2),d([c()],_.prototype,"_earliestCompletionDays",2),d([c()],_.prototype,"_intervalAnchor",2),d([c()],_.prototype,"_weekdays",2),d([c()],_.prototype,"_nth",2),d([c()],_.prototype,"_nthWeekday",2),d([c()],_.prototype,"_domDay",2),d([c()],_.prototype,"_domLastDay",2),d([c()],_.prototype,"_domBusiness",2),d([c()],_.prototype,"_calOffset",2),d([c()],_.prototype,"_calendarEntity",2),d([c()],_.prototype,"_seasonMonths",2),d([c()],_.prototype,"_endsMode",2),d([c()],_.prototype,"_endsCount",2),d([c()],_.prototype,"_endsUntil",2),d([c()],_.prototype,"_schedulePreview",2),d([c()],_.prototype,"_schedulePreviewEnded",2),d([c()],_.prototype,"_notes",2),d([c()],_.prototype,"_documentationUrl",2),d([c()],_.prototype,"_customIcon",2),d([c()],_.prototype,"_notifyIcon",2),d([c()],_.prototype,"_priority",2),d([c()],_.prototype,"_labels",2),d([c()],_.prototype,"_mirrorTodoEntities",2),d([c()],_.prototype,"_enabled",2),d([c()],_.prototype,"_triggerEntityId",2),d([c()],_.prototype,"_triggerEntityIds",2),d([c()],_.prototype,"_triggerEntityLogic",2),d([c()],_.prototype,"_triggerAttribute",2),d([c()],_.prototype,"_triggerType",2),d([c()],_.prototype,"_triggerAbove",2),d([c()],_.prototype,"_triggerBelow",2),d([c()],_.prototype,"_triggerEquals",2),d([c()],_.prototype,"_triggerNotEquals",2),d([c()],_.prototype,"_triggerForMinutes",2),d([c()],_.prototype,"_triggerCombinator",2),d([c()],_.prototype,"_triggerTargetValue",2),d([c()],_.prototype,"_triggerDeltaMode",2),d([c()],_.prototype,"_triggerBaselineValue",2),d([c()],_.prototype,"_liveBaselineValue",2),d([c()],_.prototype,"_autoCompleteOnRecovery",2),d([c()],_.prototype,"_triggerFromState",2),d([c()],_.prototype,"_triggerToState",2),d([c()],_.prototype,"_triggerTargetChanges",2),d([c()],_.prototype,"_triggerRuntimeHours",2),d([c()],_.prototype,"_triggerDaysBefore",2),d([c()],_.prototype,"_triggerRuntimeMaxSession",2),d([c()],_.prototype,"_triggerOnStates",2),d([c()],_.prototype,"_compoundLogic",2),d([c()],_.prototype,"_compoundConditions",2),d([c()],_.prototype,"_suggestedAttributes",2),d([c()],_.prototype,"_availableAttributes",2),d([c()],_.prototype,"_entityDomain",2),d([c()],_.prototype,"_lastPerformed",2),d([c()],_.prototype,"_nfcTagId",2),d([c()],_.prototype,"_requireTagScan",2),d([c()],_.prototype,"_allowSkip",2),d([c()],_.prototype,"_notifyEnabled",2),d([c()],_.prototype,"_readingUnit",2),d([c()],_.prototype,"_readings",2),d([c()],_.prototype,"_consumesParts",2),d([c()],_.prototype,"_consumesQtyText",2),d([c()],_.prototype,"_partsLoadFailed",2),d([c()],_.prototype,"_availableTags",2),d([c()],_.prototype,"_responsibleUserId",2),d([c()],_.prototype,"_assigneePool",2),d([c()],_.prototype,"_rotationStrategy",2),d([c()],_.prototype,"_availableUsers",2),d([c()],_.prototype,"_checklistText",2),d([c()],_.prototype,"_phaseDefs",2),d([c()],_.prototype,"_phaseSeq",2),d([c()],_.prototype,"_requiredCompletion",2),d([c()],_.prototype,"_scheduleTime",2),d([c()],_.prototype,"_scheduleTimeOn",2),d([c()],_.prototype,"_actionService",2),d([c()],_.prototype,"_actionTargetEntity",2),d([c()],_.prototype,"_actionSkipAuto",2),d([c()],_.prototype,"_actionPresent",2),d([c()],_.prototype,"_actionData",2),d([c()],_.prototype,"_actionDataJsonFallback",2),d([c()],_.prototype,"_actionTesting",2),d([c()],_.prototype,"_actionTestResult",2),d([c()],_.prototype,"_actionTestError",2),d([c()],_.prototype,"_qcNotes",2),d([c()],_.prototype,"_qcCost",2),d([c()],_.prototype,"_qcDuration",2),d([c()],_.prototype,"_qcFeedback",2),d([c()],_.prototype,"_environmentalEntity",2),d([c()],_.prototype,"_environmentalAttribute",2),d([c()],_.prototype,"_adaptiveEnabled",2),d([c()],_.prototype,"_adaptiveAlpha",2),d([c()],_.prototy
Line truncated
|
||||
`),i=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),i=!0)}catch{}if(!i){let t=this.shadowRoot?.querySelector(".details textarea");if(t){t.focus(),t.select();try{i=document.execCommand("copy")}catch{i=!1}}}this._copied=i}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let i=e.videoWidth||640,t=e.videoHeight||480,n=Math.min(1,Ri/Math.max(i,t)),o=document.createElement("canvas");o.width=Math.round(i*n),o.height=Math.round(t*n);let p=o.getContext("2d");if(!p)throw new Error("no_canvas");p.drawImage(e,0,0,o.width,o.height);let u=await new Promise(v=>o.toBlob(v,"image/jpeg",Li));if(!u)throw new Error("no_blob");let m=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),g=new File([u],`photo-${m}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:g},bubbles:!0,composed:!0}))}catch(i){this._unavailable(i instanceof Error?i.message:String(i))}finally{this._busy=!1}}}render(){if(!this._open)return h;let e=this.lang,i=this._busy||this._switching;return l`
|
||||
<div class="overlay" role="dialog" aria-modal="true" aria-label=${s("doc_camera",e)}>
|
||||
<video autoplay playsinline muted></video>
|
||||
${this._switching?l`<div class="switching" role="status">${s("camera_switching",e)}</div>`:h}
|
||||
@@ -1803,7 +1839,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`}};q.styles=w`
|
||||
`}};q.styles=k`
|
||||
:host { display: contents; }
|
||||
.overlay {
|
||||
position: fixed; inset: 0; z-index: 10000;
|
||||
@@ -1844,7 +1880,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.shoot { background: var(--primary-color, #03a9f4); color: #fff; border: none; font-weight: 600; }
|
||||
.shoot[disabled] { opacity: 0.6; cursor: default; }
|
||||
.shoot ha-icon { --mdc-icon-size: 22px; }
|
||||
`,d([f({type:String})],q.prototype,"lang",2),d([c()],q.prototype,"_open",2),d([c()],q.prototype,"_busy",2),d([c()],q.prototype,"_switching",2),d([c()],q.prototype,"_devices",2),d([c()],q.prototype,"_deviceIndex",2),d([c()],q.prototype,"_switchFailed",2),d([c()],q.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",q);var Te=w`
|
||||
`,d([f({type:String})],q.prototype,"lang",2),d([c()],q.prototype,"_open",2),d([c()],q.prototype,"_busy",2),d([c()],q.prototype,"_switching",2),d([c()],q.prototype,"_devices",2),d([c()],q.prototype,"_deviceIndex",2),d([c()],q.prototype,"_switchFailed",2),d([c()],q.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",q);var Ae=k`
|
||||
ms-photo-picker { display: contents; }
|
||||
.photo-pickers {
|
||||
display: flex;
|
||||
@@ -1873,7 +1909,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
color: var(--secondary-text-color);
|
||||
margin-top: 4px;
|
||||
}
|
||||
`,H=class extends T{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=Ie();this._inAppCamera=Ft()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let i=e.target,t=Array.from(i.files??[]);i.value="",this._emit(t)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return h;let e=this.lang,i=this._locked?"disabled":"",t=this.busy?s("uploading",e):s("doc_camera",e),n=s(this._singlePick?"choose_photo":"choose_photos",e);return l`
|
||||
`,H=class extends E{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=Te();this._inAppCamera=Dt()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let i=e.target,t=Array.from(i.files??[]);i.value="",this._emit(t)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return h;let e=this.lang,i=this._locked?"disabled":"",t=this.busy?s("uploading",e):s("doc_camera",e),n=s(this._singlePick?"choose_photo":"choose_photos",e);return l`
|
||||
<div class="photo-pickers">
|
||||
${this.showCamera?l`<label class="photo-pick photo-pick-camera ${i}" role="button" tabindex="0"
|
||||
aria-label=${t} title=${this.compact?t:h}
|
||||
@@ -1896,7 +1932,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${this.showCamera&&this._inAppCamera?l`<ms-camera-capture .lang=${e}
|
||||
@photo-captured=${o=>this._emit([o.detail.file])}
|
||||
@capture-unavailable=${this._onCameraUnavailable}></ms-camera-capture>`:h}
|
||||
`}};d([f({type:String})],H.prototype,"lang",2),d([f({type:Boolean})],H.prototype,"disabled",2),d([f({type:Boolean})],H.prototype,"busy",2),d([f({type:String})],H.prototype,"accept",2),d([f({type:Boolean})],H.prototype,"showCamera",2),d([f({type:Boolean})],H.prototype,"showGallery",2),d([f({type:Boolean})],H.prototype,"compact",2),d([f({type:Number})],H.prototype,"remaining",2),d([c()],H.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",H);var de=Q,y=class extends T{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new le(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((i,t)=>[String(t),!!this.checklistPrefill[i]]).filter(([,i])=>i)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(i=>[z(i),{...i}])),this._usedQtyText={})}_rangeError(e,i){let t=this.lang;return s("settings_value_out_of_range",t).replace("{min}",E(e,t,{maximumFractionDigits:2})).replace("{max}",E(i,t,{maximumFractionDigits:2}))}_toggleCheck(e){let i=String(e);this._checklistState={...this._checklistState,[i]:!this._checklistState[i]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId};if(this._notes&&(e.notes=this._notes),this._cost){let n=parseFloat(this._cost);!isNaN(n)&&n>=0&&(e.cost=n)}let i=oe(this._duration);if(i!==null&&(e.duration=i),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(new Date(this._completedAt).getTime()>Date.now()){this._error=s("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let n={};for(let o of this.readings){let p=(this._readingValues[o.id]??"").trim();if(p==="")continue;let u=parseFloat(p.replace(",","."));isNaN(u)||(n[o.id]=u)}Object.keys(n).length>0&&(e.reading_values=n)}else if(this._readingValue!==""){let n=parseFloat(this._readingValue);isNaN(n)||(e.reading_value=n)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let n=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(n)||n<ne[0]||n>ne[1]){this._error=this._rangeError(...ne);return}e.restock_quantity=n}if(this.parts.length>0){let n=[];for(let[o,p]of Object.entries(this._usedParts)){let u=this._usedQtyText[o],m=u===void 0?p.quantity:parseFloat(u.replace(",","."));if(!Number.isFinite(m)||m<de[0]||m>de[1]){this._error=this._rangeError(...de);return}n.push({...p,quantity:m})}e.used_parts=n.map(o=>o.entry_id?{part_id:o.part_id,quantity:o.quantity,entry_id:o.entry_id}:{part_id:o.part_id,quantity:o.quantity})}await A(this,e,{busy:n=>{this._loading=n},lang:this.lang,fallbackKey:"save_error",onError:n=>{this._error=n}})!==void 0&&(this._photos.markAttached(),this._open=!1,this.dispatchEvent(new CustomEvent("task-completed")))}_renderReadingField(e,i){let t=this._completedAt?new Date(this._completedAt).getTime():NaN,n=Xe(this.readingHistory,e.id,isNaN(t)?void 0:t),o=e.unit||this.readingUnit,p=(this._readingValues[e.id]??"").trim(),u=p===""?NaN:parseFloat(p.replace(",",".")),m=n!==void 0&&!isNaN(u)&&u<n.value,g=n!==void 0?E(n.value,i,{maximumFractionDigits:3}):"";return l`
|
||||
`}};d([f({type:String})],H.prototype,"lang",2),d([f({type:Boolean})],H.prototype,"disabled",2),d([f({type:Boolean})],H.prototype,"busy",2),d([f({type:String})],H.prototype,"accept",2),d([f({type:Boolean})],H.prototype,"showCamera",2),d([f({type:Boolean})],H.prototype,"showGallery",2),d([f({type:Boolean})],H.prototype,"compact",2),d([f({type:Number})],H.prototype,"remaining",2),d([c()],H.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",H);var ce=Q,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.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new de(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((i,t)=>[String(t),!!this.checklistPrefill[i]]).filter(([,i])=>i)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(i=>[U(i),{...i}])),this._usedQtyText={})}_rangeError(e,i){let t=this.lang;return s("settings_value_out_of_range",t).replace("{min}",I(e,t,{maximumFractionDigits:2})).replace("{max}",I(i,t,{maximumFractionDigits:2}))}_toggleCheck(e){let i=String(e);this._checklistState={...this._checklistState,[i]:!this._checklistState[i]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId},i=this._notes.trim();if(i&&(e.notes=i),this._cost){let o=parseFloat(this._cost);isNaN(o)||(e.cost=o)}let t=le(this._duration);if(t!==null&&(e.duration=t),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(new Date(this._completedAt).getTime()>Date.now()){this._error=s("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let o={};for(let p of this.readings){let u=(this._readingValues[p.id]??"").trim();if(u==="")continue;let m=parseFloat(u.replace(",","."));isNaN(m)||(o[p.id]=m)}Object.keys(o).length>0&&(e.reading_values=o)}else if(this._readingValue!==""){let o=parseFloat(this._readingValue);isNaN(o)||(e.reading_value=o)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let o=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(o)||o<ae[0]||o>ae[1]){this._error=this._rangeError(...ae);return}e.restock_quantity=o}if(this.parts.length>0){let o=[];for(let[p,u]of Object.entries(this._usedParts)){let m=this._usedQtyText[p],g=m===void 0?u.quantity:parseFloat(m.replace(",","."));if(!Number.isFinite(g)||g<ce[0]||g>ce[1]){this._error=this._rangeError(...ce);return}o.push({...u,quantity:g})}e.used_parts=o.map(p=>p.entry_id?{part_id:p.part_id,quantity:p.quantity,entry_id:p.entry_id}:{part_id:p.part_id,quantity:p.quantity})}await A(this,e,{busy:o=>{this._loading=o},lang:this.lang,fallbackKey:"save_error",onError:o=>{this._error=o}})!==void 0&&(this._photos.markAttached(),this._open=!1,this.dispatchEvent(new CustomEvent("task-completed")))}_renderReadingField(e,i){let t=this._completedAt?new Date(this._completedAt).getTime():NaN,n=tt(this.readingHistory,e.id,isNaN(t)?void 0:t),o=e.unit||this.readingUnit,p=(this._readingValues[e.id]??"").trim(),u=p===""?NaN:parseFloat(p.replace(",",".")),m=n!==void 0&&!isNaN(u)&&u<n.value,g=n!==void 0?I(n.value,i,{maximumFractionDigits:3}):"";return l`
|
||||
<label class="field reading-field">
|
||||
<span class="field-label">${e.name}${o?` (${o})`:""}</span>
|
||||
<input type="text" inputmode="decimal" class="field-input"
|
||||
@@ -1904,11 +1940,11 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${this._readingValues[e.id]??""}
|
||||
@input=${v=>{this._readingValues={...this._readingValues,[e.id]:v.target.value}}} />
|
||||
${m?l`<span class="reading-warn">${s("reading_below_last",i).replace("{value}",g)}</span>`:h}
|
||||
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(i=>!e[i])}_req(e){return this.requiredFields.includes(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:h}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,i=!1;for(let t of Object.values(this._usedParts)){let n=this.parts.find(p=>z({part_id:p.id,entry_id:p.entry_id})===z(t)),o=_t(n);o!==null&&(e+=o*(t.quantity||1),i=!0)}return i?Math.round(e*100)/100:null}_renderCostSuggestion(e){let i=this._purchaseSuggestion();if(this.restockDefault!==null){let p=this.partsCostMode==="use"?l`<div class="cost-note">${s("cost_purchase_use_hint",e)}</div>`:h;if(this._cost.trim()!==""||i==null||i<=0)return p;let u=B(i,this.currencySymbol,e);return l`<button
|
||||
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(i=>!e[i])}_demands(e){return this.requiredFields.includes(e)}_req(e){return this._demands(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:h}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,i=!1;for(let t of Object.values(this._usedParts)){let n=this.parts.find(p=>U({part_id:p.id,entry_id:p.entry_id})===U(t)),o=mt(n);o!==null&&(e+=o*(t.quantity||1),i=!0)}return i?Math.round(e*100)/100:null}_renderCostSuggestion(e){let i=this._purchaseSuggestion();if(this.restockDefault!==null){let p=this.partsCostMode==="use"?l`<div class="cost-note">${s("cost_purchase_use_hint",e)}</div>`:h;if(this._cost.trim()!==""||i==null||i<=0)return p;let u=j(i,this.currencySymbol,e);return l`<button
|
||||
type="button"
|
||||
class="cost-suggestion"
|
||||
@click=${()=>this._cost=String(Math.round(i*100)/100)}
|
||||
>${s("cost_from_parts",e).replace("{amount}",u)}</button>${p}`}let t=this._partsValue();if(t==null||t<=0)return h;let n=B(t,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${s(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=At(new Date)}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",i=this._error||this._photos.errorText(e);return l`
|
||||
>${s("cost_from_parts",e).replace("{amount}",u)}</button>${p}`}let t=this._partsValue();if(t==null||t<=0)return h;let n=j(t,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${s(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=Ct(new Date)}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",i=this._error||this._photos.errorText(e);return l`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${s("complete_title",e)}${this.taskName}</div>
|
||||
${this.phaseLabel?l`<div class="phase-line">${s("phase_current",e)}: ${this.phaseLabel}</div>`:h}
|
||||
@@ -1938,17 +1974,17 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</label>`:h}
|
||||
${this.parts.length?l`<div class="used-parts">
|
||||
<span class="field-label">${s("complete_parts_used",e)}</span>
|
||||
${this.parts.map(t=>{let n=z({part_id:t.id,entry_id:t.entry_id}),o=this._usedParts[n],p=o!==void 0,u=t.entry_id?{part_id:t.id,quantity:1,entry_id:t.entry_id}:{part_id:t.id,quantity:1};return l`<div class="used-part-row">
|
||||
${this.parts.map(t=>{let n=U({part_id:t.id,entry_id:t.entry_id}),o=this._usedParts[n],p=o!==void 0,u=t.entry_id?{part_id:t.id,quantity:1,entry_id:t.entry_id}:{part_id:t.id,quantity:1};return l`<div class="used-part-row">
|
||||
<label class="used-part-check">
|
||||
<input type="checkbox" .checked=${p}
|
||||
@change=${m=>{let g={...this._usedParts};if(m.target.checked)g[n]=g[n]||u;else{delete g[n];let v={...this._usedQtyText};delete v[n],this._usedQtyText=v}this._usedParts=g}} />
|
||||
<span
|
||||
>${t.name}${t.owner_name?l`<span class="used-part-owner"> (${t.owner_name})</span>`:h}${t.stock!==null&&t.stock!==void 0?` (${re(t.stock,t.unit,e)})`:""}</span
|
||||
>${t.name}${t.owner_name?l`<span class="used-part-owner"> (${t.owner_name})</span>`:h}${t.stock!==null&&t.stock!==void 0?` (${ne(t.stock,t.unit,e)})`:""}</span
|
||||
>
|
||||
</label>
|
||||
${p?l`<input class="used-part-qty" type="number" min=${de[0]} max=${de[1]} step="0.01"
|
||||
${p?l`<input class="used-part-qty" type="number" min=${ce[0]} max=${ce[1]} step="0.01"
|
||||
.value=${this._usedQtyText[n]??String(o.quantity)}
|
||||
@input=${m=>{let g=m.target.value;this._usedQtyText={...this._usedQtyText,[n]:g};let v=parseFloat(g.replace(",","."));Number.isFinite(v)&&v>=de[0]&&(this._usedParts={...this._usedParts,[n]:{...u,quantity:v}})}} />`:h}
|
||||
@input=${m=>{let g=m.target.value;this._usedQtyText={...this._usedQtyText,[n]:g};let v=parseFloat(g.replace(",","."));Number.isFinite(v)&&v>=ce[0]&&(this._usedParts={...this._usedParts,[n]:{...u,quantity:v}})}} />`:h}
|
||||
</div>`})}
|
||||
</div>`:this.consumesInfo.length?l`<div class="consumes-hint">
|
||||
${this.consumesInfo.map(t=>l`<div>${t}</div>`)}
|
||||
@@ -1956,7 +1992,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${this.restockDefault!==null?l`
|
||||
<label class="field">
|
||||
<span class="field-label">${s("restock_quantity_label",e)}${this.restockPackage?` (\xD7 ${this.restockPackage})`:""}</span>
|
||||
<input type="number" step="0.01" min=${ne[0]} max=${ne[1]} class="field-input"
|
||||
<input type="number" step="0.01" min=${ae[0]} max=${ae[1]} class="field-input"
|
||||
.value=${this._restockQty}
|
||||
@input=${t=>this._restockQty=t.target.value} />
|
||||
</label>`:h}
|
||||
@@ -1967,20 +2003,22 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
only sees the title + Cancel/Complete buttons — the original
|
||||
bug report. Native inputs always render. -->
|
||||
<label class="field">
|
||||
<span class="field-label">${s("notes_optional",e)}${this._req("notes")}</span>
|
||||
<input type="text" class="field-input"
|
||||
<span class="field-label">${this._demands("notes")?s("notes_label",e):s("notes_optional",e)}${this._req("notes")}</span>
|
||||
<!-- Several lines (#202): what was done, one line each. The
|
||||
history and the printouts keep the line breaks; they show
|
||||
notes as plain text, so no Markdown hint here. -->
|
||||
<textarea class="field-input notes-input" rows="3"
|
||||
.value=${this._notes}
|
||||
@input=${t=>this._notes=t.target.value} />
|
||||
@input=${t=>this._notes=t.target.value}></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">${s("cost_optional",e)}${this._req("cost")}</span>
|
||||
<input type="number" step="0.01" min="0" class="field-input"
|
||||
.value=${this._cost}
|
||||
@input=${t=>this._cost=t.target.value} />
|
||||
<div class="field">
|
||||
<span class="field-label">${this._demands("cost")?s("cost",e):s("cost_optional",e)}${this._req("cost")}</span>
|
||||
<ms-cost-input .lang=${e} .value=${this._cost}
|
||||
@value-changed=${t=>this._cost=t.detail.value}></ms-cost-input>
|
||||
${this._renderCostSuggestion(e)}
|
||||
</label>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">${s("duration_minutes",e)}${this._req("duration")}</span>
|
||||
<span class="field-label">${this._demands("duration")?s("quick_complete_defaults_duration",e):s("duration_minutes",e)}${this._req("duration")}</span>
|
||||
<input type="number" step="1" min="0" inputmode="numeric" class="field-input"
|
||||
.value=${this._duration}
|
||||
@input=${t=>this._duration=t.target.value} />
|
||||
@@ -1999,7 +2037,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
</button>`}
|
||||
</div>
|
||||
<div class="field">
|
||||
<span class="field-label">${s("completion_photos_optional",e)}${this._req("photo")}</span>
|
||||
<span class="field-label">${this._demands("photo")?s("completion_photos",e):s("completion_photos_optional",e)}${this._req("photo")}</span>
|
||||
${this._photos.photos.length>0?l`<div class="photo-strip">
|
||||
${this._photos.photos.map(t=>l`
|
||||
<div class="photo-preview">
|
||||
@@ -2039,18 +2077,19 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<ha-button
|
||||
@click=${this._complete}
|
||||
.disabled=${this._loading||this._photos.uploading||this._missingRequired.length>0}
|
||||
title=${this._photos.uploading?s("uploading",e):this._missingRequired.length?this._missingRequired.map(t=>s("err_required",e).replace("{field}",s(fe[t]??t,e))).join(" \xB7 "):""}
|
||||
title=${this._photos.uploading?s("uploading",e):this._missingRequired.length?this._missingRequired.map(t=>s("err_required",e).replace("{field}",s(ve[t]??t,e))).join(" \xB7 "):""}
|
||||
>
|
||||
${this._loading?s("completing",e):s("complete",e)}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};y.styles=[ct,Te,w`
|
||||
`}};y.styles=[we,Ae,k`
|
||||
.req-mark {
|
||||
color: var(--error-color, #f44336);
|
||||
margin-left: 2px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.notes-input { resize: vertical; line-height: 1.4; }
|
||||
/* #104: one-click cost suggestion from parts — quiet link-style chip. */
|
||||
.cost-note {
|
||||
font-size: 12px;
|
||||
@@ -2260,7 +2299,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],d([f({attribute:!1})],y.prototype,"hass",2),d([f()],y.prototype,"entryId",2),d([f()],y.prototype,"taskId",2),d([f()],y.prototype,"taskName",2),d([f()],y.prototype,"lang",2),d([f({type:Array})],y.prototype,"checklist",2),d([f({type:Boolean})],y.prototype,"adaptiveEnabled",2),d([f()],y.prototype,"taskType",2),d([f()],y.prototype,"readingUnit",2),d([f({attribute:!1})],y.prototype,"readings",2),d([f({attribute:!1})],y.prototype,"readingHistory",2),d([f({attribute:!1})],y.prototype,"restockDefault",2),d([f({attribute:!1})],y.prototype,"restockUnitCost",2),d([f({attribute:!1})],y.prototype,"restockPackage",2),d([f()],y.prototype,"currencySymbol",2),d([f({attribute:!1})],y.prototype,"partsCostMode",2),d([f({attribute:!1})],y.prototype,"parts",2),d([f({attribute:!1})],y.prototype,"consumesParts",2),d([f({type:Array})],y.prototype,"consumesInfo",2),d([f({type:Array})],y.prototype,"requiredFields",2),d([f()],y.prototype,"phaseLabel",2),d([f({type:Boolean})],y.prototype,"requireTagScan",2),d([f({type:Boolean})],y.prototype,"viaTagScan",2),d([c()],y.prototype,"_open",2),d([c()],y.prototype,"_notes",2),d([c()],y.prototype,"_cost",2),d([c()],y.prototype,"_duration",2),d([c()],y.prototype,"_loading",2),d([c()],y.prototype,"_error",2),d([c()],y.prototype,"_checklistState",2),d([c()],y.prototype,"_feedback",2),d([c()],y.prototype,"_readingValue",2),d([c()],y.prototype,"_readingValues",2),d([c()],y.prototype,"_restockQty",2),d([c()],y.prototype,"_completedAt",2),d([c()],y.prototype,"_usedParts",2),d([c()],y.prototype,"_usedQtyText",2),d([f({attribute:!1})],y.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",y);var ce=w`
|
||||
`],d([f({attribute:!1})],y.prototype,"hass",2),d([f()],y.prototype,"entryId",2),d([f()],y.prototype,"taskId",2),d([f()],y.prototype,"taskName",2),d([f()],y.prototype,"lang",2),d([f({type:Array})],y.prototype,"checklist",2),d([f({type:Boolean})],y.prototype,"adaptiveEnabled",2),d([f()],y.prototype,"taskType",2),d([f()],y.prototype,"readingUnit",2),d([f({attribute:!1})],y.prototype,"readings",2),d([f({attribute:!1})],y.prototype,"readingHistory",2),d([f({attribute:!1})],y.prototype,"restockDefault",2),d([f({attribute:!1})],y.prototype,"restockUnitCost",2),d([f({attribute:!1})],y.prototype,"restockPackage",2),d([f()],y.prototype,"currencySymbol",2),d([f({attribute:!1})],y.prototype,"partsCostMode",2),d([f({attribute:!1})],y.prototype,"parts",2),d([f({attribute:!1})],y.prototype,"consumesParts",2),d([f({type:Array})],y.prototype,"consumesInfo",2),d([f({type:Array})],y.prototype,"requiredFields",2),d([f()],y.prototype,"phaseLabel",2),d([f({type:Boolean})],y.prototype,"requireTagScan",2),d([f({type:Boolean})],y.prototype,"viaTagScan",2),d([c()],y.prototype,"_open",2),d([c()],y.prototype,"_notes",2),d([c()],y.prototype,"_cost",2),d([c()],y.prototype,"_duration",2),d([c()],y.prototype,"_loading",2),d([c()],y.prototype,"_error",2),d([c()],y.prototype,"_checklistState",2),d([c()],y.prototype,"_feedback",2),d([c()],y.prototype,"_readingValue",2),d([c()],y.prototype,"_readingValues",2),d([c()],y.prototype,"_restockQty",2),d([c()],y.prototype,"_completedAt",2),d([c()],y.prototype,"_usedParts",2),d([c()],y.prototype,"_usedQtyText",2),d([f({attribute:!1})],y.prototype,"checklistPrefill",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",y);var pe=k`
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
background: rgba(0,0,0,0.5);
|
||||
@@ -2280,15 +2319,15 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
}
|
||||
/* Focused programmatically on open (so Escape works at once) — no ring. */
|
||||
.dialog:focus { outline: none; }
|
||||
`;function Ni(r,a){r.key!=="Escape"||r.defaultPrevented||r.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(r.preventDefault(),r.stopPropagation(),a())}function pe(r,a){return l`
|
||||
`;function Mi(r,a){r.key!=="Escape"||r.defaultPrevented||r.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(r.preventDefault(),r.stopPropagation(),a())}function he(r,a){return l`
|
||||
<div class="backdrop" @click=${r}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true" tabindex="-1"
|
||||
@keydown=${e=>Ni(e,r)}>${a}</div>
|
||||
`}function he(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}function jt(r,a,e){let i=new Blob([r],{type:e}),t=URL.createObjectURL(i),n=document.createElement("a");n.href=t,n.download=a,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(t),6e4)}async function Mi(r,a,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:a,expires:e})).path}async function zt(r,a,e=300){return Mi(r,`/api/maintenance_supporter/document/${a}`,e)}var J=class extends T{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await zt(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?h:this._url?l`
|
||||
@keydown=${e=>Mi(e,r)}>${a}</div>
|
||||
`}function ue(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}function zt(r,a,e){let i=new Blob([r],{type:e}),t=URL.createObjectURL(i),n=document.createElement("a");n.href=t,n.download=a,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(t),6e4)}async function Oi(r,a,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:a,expires:e})).path}async function Ut(r,a,e=300){return Oi(r,`/api/maintenance_supporter/document/${a}`,e)}var Z=class extends E{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await Ut(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?h:this._url?l`
|
||||
<a href=${this._url} target="_blank" rel="noopener" class="wrap">
|
||||
<img src=${this._url} alt="" loading="lazy"
|
||||
@error=${()=>this._failed=!0} />
|
||||
</a>`:l`<div class="ph"></div>`}};J.styles=w`
|
||||
</a>`:l`<div class="ph"></div>`}};Z.styles=k`
|
||||
.wrap { display: inline-block; margin-top: 4px; }
|
||||
/* #161: uniform 96px tiles — several photos sit in a strip, so a
|
||||
tiny or portrait shot must not collapse its slot. */
|
||||
@@ -2308,7 +2347,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
background: var(--secondary-background-color, rgba(0,0,0,0.06));
|
||||
margin-top: 4px;
|
||||
}
|
||||
`,d([f({attribute:!1})],J.prototype,"hass",2),d([f()],J.prototype,"docId",2),d([c()],J.prototype,"_url",2),d([c()],J.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",J);var P=class extends T{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new le(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return R(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let i=[],t=new Set;for(let o of e.readings??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=i;let n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let i of this._readingRows){let t=(this._readingText[i.id]??"").trim();if(t==="")continue;let n=parseFloat(t.replace(",","."));isNaN(n)||(e[i.id]=n)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let i=this._openGen;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(i!==this._openGen)return;let n=[];for(let p of t.parts||[]){let u=p.entry_id===e.entry_id,m=p.consumers.some(g=>g.entry_id===e.entry_id&&g.task_id===e.task_id);!u&&!m||n.push({part_id:p.part_id,name:p.name,entry_id:p.entry_id,foreign:!u,object_name:p.object_name})}for(let p of e.used_parts||[]){let u=p.entry_id||e.entry_id;n.some(m=>m.part_id===p.part_id&&m.entry_id===u)||n.push({part_id:p.part_id,name:p.name||p.part_id,entry_id:u,foreign:u!==e.entry_id,object_name:null})}let o={};for(let p of e.used_parts||[])o[`${p.entry_id||e.entry_id}:${p.part_id}`]=p.quantity??1;this._partOptions=n,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(i!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[i])=>e.localeCompare(i)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,i){this._draft&&(this._draft={...this._draft,[e]:i})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang;if(!await X(this.hass,{title:s("history_delete_entry",e),message:s("history_delete_confirm",e),confirmText:s("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let t=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:t.entry_id,task_id:t.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:t.entry_id,task_id:t.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return A(this,e,{busy:i=>{this._saving=i},onError:i=>{this._error=i}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,i=this._originalSnapshot,t={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:i.original_timestamp};if(e.timestamp!==i.timestamp&&(t.timestamp=e.timestamp),e.notes!==i.notes&&(t.notes=e.notes),e.cost!==i.cost&&(t.cost=e.cost),e.duration!==i.duration&&(t.duration=e.duration),e.completed_by!==i.completed_by&&(t.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==i.reading_value&&(t.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),p={};for(let u of this._readingRows)p[u.id]=o[u.id]??null;t.reading_values=p}if(JSON.stringify(this._photos.ids)!==this._photosOriginal&&(t.photo_doc_ids=this._photos.ids),Object.keys(t).filter(o=>!["type","entry_id","task_id","original_timestamp"].includes(o)).length===0){this.close();return}await this._runWs(t)!==void 0&&(this._photos.markAttached(),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:e.entry_id
Line truncated
|
||||
`,d([f({attribute:!1})],Z.prototype,"hass",2),d([f()],Z.prototype,"docId",2),d([c()],Z.prototype,"_url",2),d([c()],Z.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Z);var R=class extends E{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new de(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return P(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let i=[],t=new Set;for(let o of e.readings??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=i;let n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let i of this._readingRows){let t=(this._readingText[i.id]??"").trim();if(t==="")continue;let n=parseFloat(t.replace(",","."));isNaN(n)||(e[i.id]=n)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let i=this._openGen;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(i!==this._openGen)return;let n=[];for(let p of t.parts||[]){let u=p.entry_id===e.entry_id,m=p.consumers.some(g=>g.entry_id===e.entry_id&&g.task_id===e.task_id);!u&&!m||n.push({part_id:p.part_id,name:p.name,entry_id:p.entry_id,foreign:!u,object_name:p.object_name})}for(let p of e.used_parts||[]){let u=p.entry_id||e.entry_id;n.some(m=>m.part_id===p.part_id&&m.entry_id===u)||n.push({part_id:p.part_id,name:p.name||p.part_id,entry_id:u,foreign:u!==e.entry_id,object_name:null})}let o={};for(let p of e.used_parts||[])o[`${p.entry_id||e.entry_id}:${p.part_id}`]=p.quantity??1;this._partOptions=n,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(i!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[i])=>e.localeCompare(i)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,i){this._draft&&(this._draft={...this._draft,[e]:i})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang;if(!await ee(this.hass,{title:s("history_delete_entry",e),message:s("history_delete_confirm",e),confirmText:s("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let t=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:t.entry_id,task_id:t.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:t.entry_id,task_id:t.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return A(this,e,{busy:i=>{this._saving=i},onError:i=>{this._error=i}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,i=this._originalSnapshot,t={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:i.original_timestamp};if(e.timestamp!==i.timestamp&&(t.timestamp=e.timestamp),e.notes!==i.notes&&(t.notes=e.notes),e.cost!==i.cost&&(t.cost=e.cost),e.duration!==i.duration&&(t.duration=e.duration),e.completed_by!==i.completed_by&&(t.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==i.reading_value&&(t.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),p={};for(let u of this._readingRows)p[u.id]=o[u.id]??null;t.reading_values=p}if(JSON.stringify(this._photos.ids)!==this._photosOriginal&&(t.photo_doc_ids=this._photos.ids),Object.keys(t).filter(o=>!["type","entry_id","task_id","original_timestamp"].includes(o)).length===0){this.close();return}await this._runWs(t)!==void 0&&(this._photos.markAttached(),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:e.entry_i
Line truncated
|
||||
<h2>${s("history_edit_title",e)}</h2>
|
||||
<div class="entry-type">
|
||||
<ha-icon icon="mdi:tag-outline"></ha-icon>
|
||||
@@ -2331,17 +2370,16 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
.value=${i.notes??""}></textarea>
|
||||
</label>
|
||||
<div class="row">
|
||||
<label>
|
||||
<div class="cost-field">
|
||||
<span>${s("cost",e)}</span>
|
||||
<input type="number" min="0" step="0.01"
|
||||
.value=${i.cost!=null?String(i.cost):""}
|
||||
@input=${n=>{let o=n.target.value;this._set("cost",o?Number(o):null)}} />
|
||||
</label>
|
||||
<ms-cost-input .lang=${e} .value=${i.cost!=null?String(i.cost):""}
|
||||
@value-changed=${n=>{let o=n.detail.value;this._set("cost",o?Number(o):null)}}></ms-cost-input>
|
||||
</div>
|
||||
<label>
|
||||
<span>${s("duration",e)}</span>
|
||||
<input type="number" min="0" step="1" inputmode="numeric"
|
||||
.value=${i.duration!=null?String(i.duration):""}
|
||||
@input=${n=>{this._set("duration",oe(n.target.value))}} />
|
||||
@input=${n=>{this._set("duration",le(n.target.value))}} />
|
||||
</label>
|
||||
</div>
|
||||
${this._renderReadings(i,e)}
|
||||
@@ -2391,7 +2429,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${this._saving?s("saving",e):s("save",e)}
|
||||
</button>
|
||||
</div>
|
||||
`)}updated(e){e.has("_open")&&this._open&&he(this.shadowRoot)}_renderReadings(e,i){return this._readingRows.length>0?l`
|
||||
`)}updated(e){e.has("_open")&&this._open&&ue(this.shadowRoot)}_renderReadings(e,i){return this._readingRows.length>0?l`
|
||||
<div class="readings-block">
|
||||
<span class="parts-title">${s("readings_section",i)}</span>
|
||||
${this._readingRows.map(t=>l`
|
||||
@@ -2408,7 +2446,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
<input type="number" step="any"
|
||||
.value=${e.reading_value!=null?String(e.reading_value):""}
|
||||
@input=${t=>{let n=t.target.value,o=n===""?NaN:Number(n);this._set("reading_value",isNaN(o)?null:o)}} />
|
||||
</label>`}};P.styles=[Te,ce,w`
|
||||
</label>`}};R.styles=[Ae,pe,k`
|
||||
:host { display: contents; --ms-modal-max-height: 90vh; --ms-modal-gap: 12px; }
|
||||
h2 { margin: 0; font-size: 18px; }
|
||||
.entry-type {
|
||||
@@ -2417,6 +2455,8 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
}
|
||||
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
|
||||
label span { color: var(--secondary-text-color); }
|
||||
.cost-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
|
||||
.cost-field > span { color: var(--secondary-text-color); }
|
||||
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
input, textarea {
|
||||
padding: 8px; font-size: 14px;
|
||||
@@ -2496,7 +2536,7 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
}
|
||||
/* the camera / gallery pickers come from photoPickerStyles (ms-photo-picker) */
|
||||
.photos-hint { font-size: 12px; color: var(--secondary-text-color); }
|
||||
`],d([f({attribute:!1})],P.prototype,"hass",2),d([c()],P.prototype,"_open",2),d([c()],P.prototype,"_saving",2),d([c()],P.prototype,"_error",2),d([c()],P.prototype,"_draft",2),d([c()],P.prototype,"_partOptions",2),d([c()],P.prototype,"_partQty",2),d([c()],P.prototype,"_readingRows",2),d([c()],P.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",P);function te(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ze(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":te(r)}function Oi(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var L=class extends T{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||R(this.hass)}openForObject(e,i){this._entryId=e,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}openForTask(e,i,t,n){this._entryId=e,this._taskId=i,this._objectName=t,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let t=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&(t.push(this.hass.connection.sendMessagePromise({...i,action:"complete"})),await this._hasQuickCompleteDefaults()&&t.push(this.hass.connection.sendMessagePromise({...i,action:"quick_complete"})));let n=await Promise.all(t);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(i){if(e!==this._generateSeq)return;let t=i?.code,n=i?.message;this._error=t==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this._dialogLang):s("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let i=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(t=>t.id===this._taskId);return!!i?.quick_complete_defaults&&Object.keys(i.quick_complete_defaults).length>0}catch{return!1}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,i=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,t=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,p=te(i),u=te(t),m=!!this._completeResult,g=!!this._quickResult,v=te(s("qr_action_view",o)),x=te(s("qr_action_complete",o)),b=te(s("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`],d([f({attribute:!1})],R.prototype,"hass",2),d([c()],R.prototype,"_open",2),d([c()],R.prototype,"_saving",2),d([c()],R.prototype,"_error",2),d([c()],R.prototype,"_draft",2),d([c()],R.prototype,"_partOptions",2),d([c()],R.prototype,"_partQty",2),d([c()],R.prototype,"_readingRows",2),d([c()],R.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function ie(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Be(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":ie(r)}function Fi(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var L=class extends E{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||P(this.hass)}openForObject(e,i){this._entryId=e,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}openForTask(e,i,t,n){this._entryId=e,this._taskId=i,this._objectName=t,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let t=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&(t.push(this.hass.connection.sendMessagePromise({...i,action:"complete"})),await this._hasQuickCompleteDefaults()&&t.push(this.hass.connection.sendMessagePromise({...i,action:"quick_complete"})));let n=await Promise.all(t);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(i){if(e!==this._generateSeq)return;let t=i?.code,n=i?.message;this._error=t==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this._dialogLang):s("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let i=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(t=>t.id===this._taskId);return!!i?.quick_complete_defaults&&Object.keys(i.quick_complete_defaults).length>0}catch{return!1}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,i=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,t=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,p=ie(i),u=ie(t),m=!!this._completeResult,g=!!this._quickResult,v=ie(s("qr_action_view",o)),x=ie(s("qr_action_complete",o)),b=ie(s("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>${p}</title>
|
||||
<style>
|
||||
@@ -2518,21 +2558,21 @@ import{a as Qe,b as Ye,c as Je,d as Ze,e as Xe,f as et,g as tt,h as it,i as st}f
|
||||
${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${ze(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<img src="${Be(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${v}</div>
|
||||
</div>
|
||||
${m?`<div class="qr-col">
|
||||
<img src="${ze(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<img src="${Be(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${x}</div>
|
||||
</div>`:""}
|
||||
${g?`<div class="qr-col">
|
||||
<img src="${ze(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
|
||||
<img src="${Be(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
|
||||
<div class="qr-label">${b}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${te(this._viewResult.url)}</div>
|
||||
<div class="url">${ie(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,i){let t=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;jt(t,`qr-${Oi(n)}-${i}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,i=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,t=!!this._viewResult;return l`
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,i){let t=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;zt(t,`qr-${Fi(n)}-${i}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,i=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,t=!!this._viewResult;return l`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${i}</div>
|
||||
<div class="content">
|
||||
@@ -2608,7 +2648,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};L.styles=w`
|
||||
`}};L.styles=k`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -2728,9 +2768,9 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,d([f({attribute:!1})],L.prototype,"hass",2),d([f()],L.prototype,"lang",2),d([c()],L.prototype,"_open",2),d([c()],L.prototype,"_loading",2),d([c()],L.prototype,"_error",2),d([c()],L.prototype,"_viewResult",2),d([c()],L.prototype,"_completeResult",2),d([c()],L.prototype,"_quickResult",2),d([c()],L.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",L);function Ut(r,a,e=new Date){let i=r?.hours,t=r?.snoozed_until?new Date(r.snoozed_until):null;if(typeof i!="number"||!t||isNaN(t.getTime()))return s("snoozed",a);let o=t.toDateString()===e.toDateString()?Pe(t,a):$e(r.snoozed_until,a);return(i===1?s("snoozed_for_one",a):s("snoozed_for",a).replace("{hours}",E(i,a))).replace("{until}",o)}function Fi(r,a){if(a<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%a}function Di(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function Ue(r){if(!r||!Di(r))return null;let a=r.phase_sequence,e=Fi(r.phase_cursor,a.length),i=a[e],t=r.phases?.[i];return t?{id:i,name:t.name,index:e,count:a.length,notes:t.notes,checklist:t.checklist!==void 0?t.checklist:r.checklist??[],consumesParts:t.consumes_parts!==void 0?t.consumes_parts:r.consumes_parts??[],requiredFields:t.required_completion_fields!==void 0?t.required_completion_fields:r.required_completion_fields??[]}:null}function ve(r){let a=Ue(r);return a?`${a.index+1}/${a.count} \xB7 ${a.name}`:""}function ji(r,a){return typeof r=="number"&&Number.isFinite(r)&&r>=.01?r:a}function Bt(r){let a=r.task??null,e=a?Ue(a):null,i=e?e.consumesParts:a?.consumes_parts||[],t=!!a?.part_ref,n=r.objects.find(g=>g.entry_id===r.entryId)?.parts||[],o=t?n.find(g=>g.id===a.part_ref.part_id):void 0,p=r.features?r.features.checklists:r.checklistsEnabled??!0,u=r.features?r.features.checklists?r.checklist??a?.checklist??[]:[]:r.checklist??[],m=r.features?r.features.adaptive&&(r.adaptiveEnabled??!!a?.adaptive_config?.enabled):!!r.adaptiveEnabled;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:e?p?e.checklist:[]:u,adaptive_enabled:m,required_completion_fields:e?e.requiredFields:a?.required_completion_fields||[],task_type:a?.type||"",reading_unit:a?.reading_unit||"",readings:a?.readings||[],reading_history:Ze(a?.history),parts:t?[]:bt({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:t?[]:i,phase_label:e?ve(a):"",require_tag_scan:!!a?.require_tag_scan,restock_default:t?ji(o?.restock_quantity,1):null,restock_unit_cost:t?o?.cost??null:null,restock_package:t&&o?.package_size?re(o.package_size,o.unit,r.lang):"",currency_symbol:ue({currency_symbol:r.currencySymbol}),consumes_info:i.map(g=>yt(g,r.entryId,r.objects,r.lang)),checklist_prefill:a?.checklist_progress||{},via_tag_scan:!!r.viaTagScan,parts_cost_mode:r.partsCostMode??"purchase"}}function Vt(r,a,e){r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.lang=e,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.taskType=a.task_type??"",r.readingUnit=a.reading_unit??"",r.readings=a.readings??[],r.readingHistory=a.reading_history??[],r.parts=a.parts??[],r.consumesParts=a.consumes_parts??[],r.phaseLabel=a.phase_label??"",r.requireTagScan=!!a.require_tag_scan,r.restockDefault=a.restock_default??null,r.restockUnitCost=a.restock_unit_cost??null,r.restockPackage=a.restock_package??"",r.currencySymbol=ue(a),r.consumesInfo=a.consumes_info??[],r.checklistPrefill=a.checklist_prefill??{},r.viaTagScan=!!a.via_tag_scan,r.partsCostMode=a.parts_cost_mode??"purchase",r.open({viaTagScan:!!a.via_tag_scan})}function Se(r){return r?customElements.get("ha-markdown")?l`<ha-markdown class="notes-md" .content=${r} breaks></ha-markdown>`:l`${r}`:h}var Wt=r=>typeof r=="number"&&Number.isInteger(r)&&r>0;function zi(r){return r&&Wt(r.ref_no)?String(r.ref_no):null}function Gt(r,a){let e=zi(r);return e&&a&&Wt(a.ref_no)?`${e}.${a.ref_no}`:null}function Kt(r,a){return r?l`<span class="ref-chip" title=${a??""}>#${r}</span>`:h}var Ui={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},Bi=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,a)=>({date:j(r[1],a)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converteLine truncated
|
||||
`,d([f({attribute:!1})],L.prototype,"hass",2),d([f()],L.prototype,"lang",2),d([c()],L.prototype,"_open",2),d([c()],L.prototype,"_loading",2),d([c()],L.prototype,"_error",2),d([c()],L.prototype,"_viewResult",2),d([c()],L.prototype,"_completeResult",2),d([c()],L.prototype,"_quickResult",2),d([c()],L.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",L);function Bt(r,a,e=new Date){let i=r?.hours,t=r?.snoozed_until?new Date(r.snoozed_until):null;if(typeof i!="number"||!t||isNaN(t.getTime()))return s("snoozed",a);let o=t.toDateString()===e.toDateString()?qe(t,a):xe(r.snoozed_until,a);return(i===1?s("snoozed_for_one",a):s("snoozed_for",a).replace("{hours}",I(i,a))).replace("{until}",o)}function Di(r,a){if(a<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%a}function ji(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function Ve(r){if(!r||!ji(r))return null;let a=r.phase_sequence,e=Di(r.phase_cursor,a.length),i=a[e],t=r.phases?.[i];return t?{id:i,name:t.name,index:e,count:a.length,notes:t.notes,checklist:t.checklist!==void 0?t.checklist:r.checklist??[],consumesParts:t.consumes_parts!==void 0?t.consumes_parts:r.consumes_parts??[],requiredFields:t.required_completion_fields!==void 0?t.required_completion_fields:r.required_completion_fields??[]}:null}function ye(r){let a=Ve(r);return a?`${a.index+1}/${a.count} \xB7 ${a.name}`:""}function zi(r,a){return typeof r=="number"&&Number.isFinite(r)&&r>=.01?r:a}function Vt(r){let a=r.task??null,e=a?Ve(a):null,i=e?e.consumesParts:a?.consumes_parts||[],t=!!a?.part_ref,n=r.objects.find(g=>g.entry_id===r.entryId)?.parts||[],o=t?n.find(g=>g.id===a.part_ref.part_id):void 0,p=r.features?r.features.checklists:r.checklistsEnabled??!0,u=r.features?r.features.checklists?r.checklist??a?.checklist??[]:[]:r.checklist??[],m=r.features?r.features.adaptive&&(r.adaptiveEnabled??!!a?.adaptive_config?.enabled):!!r.adaptiveEnabled;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:e?p?e.checklist:[]:u,adaptive_enabled:m,required_completion_fields:e?e.requiredFields:a?.required_completion_fields||[],task_type:a?.type||"",reading_unit:a?.reading_unit||"",readings:a?.readings||[],reading_history:et(a?.history),parts:t?[]:$t({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:t?[]:i,phase_label:e?ye(a):"",require_tag_scan:!!a?.require_tag_scan,restock_default:t?zi(o?.restock_quantity,1):null,restock_unit_cost:t?o?.cost??null:null,restock_package:t&&o?.package_size?ne(o.package_size,o.unit,r.lang):"",currency_symbol:_e({currency_symbol:r.currencySymbol}),consumes_info:i.map(g=>bt(g,r.entryId,r.objects,r.lang)),checklist_prefill:a?.checklist_progress||{},via_tag_scan:!!r.viaTagScan,parts_cost_mode:r.partsCostMode??"purchase"}}function Wt(r,a,e){r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.lang=e,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.taskType=a.task_type??"",r.readingUnit=a.reading_unit??"",r.readings=a.readings??[],r.readingHistory=a.reading_history??[],r.parts=a.parts??[],r.consumesParts=a.consumes_parts??[],r.phaseLabel=a.phase_label??"",r.requireTagScan=!!a.require_tag_scan,r.restockDefault=a.restock_default??null,r.restockUnitCost=a.restock_unit_cost??null,r.restockPackage=a.restock_package??"",r.currencySymbol=_e(a),r.consumesInfo=a.consumes_info??[],r.checklistPrefill=a.checklist_prefill??{},r.viaTagScan=!!a.via_tag_scan,r.partsCostMode=a.parts_cost_mode??"purchase",r.open({viaTagScan:!!a.via_tag_scan})}function Ce(r){return r?customElements.get("ha-markdown")?l`<ha-markdown class="notes-md" .content=${r} breaks></ha-markdown>`:l`${r}`:h}var Gt=r=>typeof r=="number"&&Number.isInteger(r)&&r>0;function Ui(r){return r&&Gt(r.ref_no)?String(r.ref_no):null}function Kt(r,a){let e=Ui(r);return e&&a&&Gt(a.ref_no)?`${e}.${a.ref_no}`:null}function Qt(r,a){return r?l`<span class="ref-chip" title=${a??""}>#${r}</span>`:h}var Bi={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},Vi=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,a)=>({date:z(r[1],a)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converteLine truncated
|
||||
${e.map(i=>l`<maintenance-history-photo .hass=${r} .docId=${i}></maintenance-history-photo>`)}
|
||||
</div>`:h}function Ki(r,a){let e=a.lang,i=o=>E(o,e,{maximumFractionDigits:3}),t=o=>o==null?"":` (${o>=0?"+":""}${i(o)})`,n=Je(r);return n.length>0?l`<div class="history-readings">
|
||||
</div>`:h}function Qi(r,a){let e=a.lang,i=o=>I(o,e,{maximumFractionDigits:3}),t=o=>o==null?"":` (${o>=0?"+":""}${i(o)})`,n=Xe(r);return n.length>0?l`<div class="history-readings">
|
||||
${n.map(o=>l`<span class="history-reading">
|
||||
<span class="history-reading-name">${o.name}</span>
|
||||
<span class="history-reading-value">${i(o.value)}${o.unit?` ${o.unit}`:""}${t(a.readingSlotDelta?.(r,o.id))}</span>
|
||||
@@ -2738,15 +2778,15 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>`:r.reading_value!=null?l`<div class="history-readings"><span class="history-reading">
|
||||
<span class="history-reading-name">${s("reading_label",e)}</span>
|
||||
<span class="history-reading-value">${i(r.reading_value)}${a.readingUnit?` ${a.readingUnit}`:""}${t(a.readingDelta?.(r))}</span>
|
||||
</span></div>`:h}function Jt(r,a,e={}){let i=a.lang,{compact:t=!1,showRef:n=!0,showBadges:o=!0,showEdit:p=!0}=e,u=a.openEdit,m=p&&!!u&&Vi.includes(r.type),g=typeof r.parts_cost=="number"?r.parts_cost:null,v=r.cost_basis==="use",x=v&&!!r.purchase;return l`
|
||||
</span></div>`:h}function Zt(r,a,e={}){let i=a.lang,{compact:t=!1,showRef:n=!0,showBadges:o=!0,showEdit:p=!0}=e,u=a.openEdit,m=p&&!!u&&Wi.includes(r.type),g=typeof r.parts_cost=="number"?r.parts_cost:null,v=r.cost_basis==="use",x=v&&!!r.purchase;return l`
|
||||
<div class="history-entry${t?" compact":""}">
|
||||
${t?h:l`<div class="history-icon ${r.type}">
|
||||
<ha-icon .icon=${be[r.type]||"mdi:circle"}></ha-icon>
|
||||
<ha-icon .icon=${$e[r.type]||"mdi:circle"}></ha-icon>
|
||||
</div>`}
|
||||
<div class="history-content">
|
||||
<div class="history-row">
|
||||
<strong>${s(r.type,i)}</strong>
|
||||
${n?Kt(Wi(a,r),s("ref_number",i)):h}
|
||||
${n?Qt(Gi(a,r),s("ref_number",i)):h}
|
||||
${o&&r.phase_id?l`<span class="history-phase-badge">${a.phaseNames?.[r.phase_id]||r.phase_id}</span>`:h}
|
||||
${o&&r.auto?l`<span class="history-auto-badge">${s("history_auto",i)}</span>`:h}
|
||||
${m?l`<button class="history-edit-btn"
|
||||
@@ -2755,63 +2795,63 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>`:h}
|
||||
</div>
|
||||
<div class="history-date">${$e(r.timestamp,i)}</div>
|
||||
${r.notes?l`<div>${Qt(r.notes,i)}</div>`:h}
|
||||
${Gi(a.hass,r)}
|
||||
${Ki(r,a)}
|
||||
<div class="history-date">${xe(r.timestamp,i)}</div>
|
||||
${r.notes?l`<div class="history-notes">${Yt(r.notes,i)}</div>`:h}
|
||||
${Ki(a.hass,r)}
|
||||
${Qi(r,a)}
|
||||
${r.cost!=null||r.duration!=null||r.trigger_value!=null||g!=null?l`<div class="history-details">
|
||||
${r.cost!=null?x?l`<span>${s("history_purchase_stock",i).replace("{amount}",B(r.cost,a.currencySymbol,i))}</span>`:l`<span>${s("cost",i)}: ${B(r.cost,a.currencySymbol,i)}</span>`:h}
|
||||
${g!=null?l`<span title=${s(v?"history_parts_counted_hint":"history_parts_info_hint",i)}>${s(v?"history_parts_counted":"history_parts_info",i).replace("{amount}",B(g,a.currencySymbol,i))}</span>`:h}
|
||||
${r.duration!=null?l`<span>${s("duration",i)}: ${xe(r.duration,i)}</span>`:h}
|
||||
${r.cost!=null?x?l`<span>${s("history_purchase_stock",i).replace("{amount}",j(r.cost,a.currencySymbol,i))}</span>`:r.cost<0?l`<span class="history-credit">${s("cost_kind_credit",i)}: ${j(-r.cost,a.currencySymbol,i)}</span>`:l`<span>${s("cost",i)}: ${j(r.cost,a.currencySymbol,i)}</span>`:h}
|
||||
${g!=null?l`<span title=${s(v?"history_parts_counted_hint":"history_parts_info_hint",i)}>${s(v?"history_parts_counted":"history_parts_info",i).replace("{amount}",j(g,a.currencySymbol,i))}</span>`:h}
|
||||
${r.duration!=null?l`<span>${s("duration",i)}: ${ke(r.duration,i)}</span>`:h}
|
||||
${r.trigger_value!=null?l`<span>${s("trigger_val",i)}: ${r.trigger_value}</span>`:h}
|
||||
</div>`:h}
|
||||
</div>
|
||||
</div>
|
||||
`}var Qi="var(--maint-done-color, #78909c)";function ye(r){return r.archived?"archived":r.is_done?"done":r.status||"ok"}function Be(r,a){return s(r==="done"?"completed":r,a)}function Ae(r){let a=ye(r);return a==="done"?Qi:We[a]||"var(--disabled-color, #9e9e9e)"}function Yi(r){return be[r==="done"?"completed":r]||"mdi:circle-medium"}function Zt(r,a,e="pill"){let i=ye(r),t=Be(i,a);return e==="chip"?l`<span class="status-chip ${i}">${t}</span>`:l`<span class="status-badge ${i}" role="img" title="${t}" aria-label="${t}"><ha-icon icon="${Yi(i)}"></ha-icon><span class="status-label">${t}</span></span>`}var Ce=class{constructor(){this._handle=null}schedule(a,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,a()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}};function $(r){return r.toFixed(1)}function Xt(r,a){let e=r.interval_analysis,i=e?.weibull_beta,t=e?.weibull_eta;if(i==null||t==null||t<=0)return h;let n=r.interval_days??0,o=r.suggested_interval??n;return l`
|
||||
`}var Yi="var(--maint-done-color, #78909c)";function be(r){return r.archived?"archived":r.is_done?"done":r.status||"ok"}function We(r,a){return s(r==="done"?"completed":r,a)}function Pe(r){let a=be(r);return a==="done"?Yi:Ke[a]||"var(--disabled-color, #9e9e9e)"}function Ji(r){return $e[r==="done"?"completed":r]||"mdi:circle-medium"}function Xt(r,a,e="pill"){let i=be(r),t=We(i,a);return e==="chip"?l`<span class="status-chip ${i}">${t}</span>`:l`<span class="status-badge ${i}" role="img" title="${t}" aria-label="${t}"><ha-icon icon="${Ji(i)}"></ha-icon><span class="status-label">${t}</span></span>`}var Re=class{constructor(){this._handle=null}schedule(a,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,a()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}};function $(r){return r.toFixed(1)}function ei(r,a){let e=r.interval_analysis,i=e?.weibull_beta,t=e?.weibull_eta;if(i==null||t==null||t<=0)return h;let n=r.interval_days??0,o=r.suggested_interval??n;return l`
|
||||
<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",a)}
|
||||
${Ji(i,a)}
|
||||
${Zi(i,a)}
|
||||
</div>
|
||||
${Zi(i,t,n,o,a)}
|
||||
${Xi(e,a)}
|
||||
${e?.confidence_interval_low!=null?es(e,r,a):h}
|
||||
${Xi(i,t,n,o,a)}
|
||||
${es(e,a)}
|
||||
${e?.confidence_interval_low!=null?ts(e,r,a):h}
|
||||
</div>
|
||||
`}function Ji(r,a){let e,i,t;return r<.8?(e="early_failures",i="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",t="beta_early_failures"):r<=1.2?(e="random_failures",i="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",t="beta_random_failures"):r<=3.5?(e="wear_out",i="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",t="beta_wear_out"):(e="highly_predictable",i="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",t="beta_highly_predictable"),l`
|
||||
`}function Zi(r,a){let e,i,t;return r<.8?(e="early_failures",i="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",t="beta_early_failures"):r<=1.2?(e="random_failures",i="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",t="beta_random_failures"):r<=3.5?(e="wear_out",i="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",t="beta_wear_out"):(e="highly_predictable",i="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",t="beta_highly_predictable"),l`
|
||||
<span class="beta-badge ${e}">
|
||||
<ha-svg-icon path="${i}"></ha-svg-icon>
|
||||
${s(t,a)} (\u03B2=${E(r,a,2)})
|
||||
${s(t,a)} (\u03B2=${I(r,a,2)})
|
||||
</span>
|
||||
`}function Zi(r,a,e,i,t){let b=Math.max(e,i,a,1)*1.3,S=50,N=[];for(let M=0;M<=S;M++){let D=M/S*b,pi=1-Math.exp(-Math.pow(D/a,r)),hi=32+D/b*260,ui=136-pi*128;N.push([hi,ui])}let K=N.map(([M,D])=>`${$(M)},${$(D)}`).join(" "),Z="M32,136 "+N.map(([M,D])=>`L${$(M)},${$(D)}`).join(" ")+` L${$(N[S][0])},136 Z`,F=32+e/b*260,U=1-Math.exp(-Math.pow(e/a,r)),ie=136-U*128,di=E((1-U)*100,t,0),Ve=32+i/b*260,ci=[0,.25,.5,.75,1];return l`
|
||||
`}function Xi(r,a,e,i,t){let b=Math.max(e,i,a,1)*1.3,T=50,N=[];for(let M=0;M<=T;M++){let D=M/T*b,hi=1-Math.exp(-Math.pow(D/a,r)),ui=32+D/b*260,_i=136-hi*128;N.push([ui,_i])}let K=N.map(([M,D])=>`${$(M)},${$(D)}`).join(" "),X="M32,136 "+N.map(([M,D])=>`L${$(M)},${$(D)}`).join(" ")+` L${$(N[T][0])},136 Z`,F=32+e/b*260,B=1-Math.exp(-Math.pow(e/a,r)),se=136-B*128,ci=I((1-B)*100,t,0),Ge=32+i/b*260,pi=[0,.25,.5,.75,1];return l`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",t)}">
|
||||
${ci.map(M=>{let D=136-M*128;return se`
|
||||
${pi.map(M=>{let D=136-M*128;return re`
|
||||
<line x1="${32}" y1="${$(D)}" x2="${292}" y2="${$(D)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${M===.5?"4,3":h}" />
|
||||
<text x="${28}" y="${$(D+3)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${E(M*100,t,0)}%</text>
|
||||
font-size="8" text-anchor="end">${I(M*100,t,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(b/2)}</text>
|
||||
<text x="${292}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round(b)}</text>
|
||||
|
||||
<path d="${Z}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<path d="${X}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<polyline points="${K}" fill="none"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="2" />
|
||||
|
||||
${e>0?se`
|
||||
${e>0?re`
|
||||
<line x1="${$(F)}" y1="${8}" x2="${$(F)}" y2="${$(136)}"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
<circle cx="${$(F)}" cy="${$(ie)}" r="3"
|
||||
<circle cx="${$(F)}" cy="${$(se)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${$(F+4)}" y="${$(ie-6)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${di}%</text>
|
||||
<text x="${$(F+4)}" y="${$(se-6)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${ci}%</text>
|
||||
`:h}
|
||||
|
||||
${i>0&&i!==e?se`
|
||||
<line x1="${$(Ve)}" y1="${8}" x2="${$(Ve)}" y2="${$(136)}"
|
||||
${i>0&&i!==e?re`
|
||||
<line x1="${$(Ge)}" y1="${8}" x2="${$(Ge)}" y2="${$(136)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:h}
|
||||
|
||||
@@ -2826,7 +2866,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${e>0?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${s("current_interval_marker",t)}</span>`:h}
|
||||
${i>0&&i!==e?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",t)}</span>`:h}
|
||||
</div>
|
||||
`}function Xi(r,a){return l`
|
||||
`}function es(r,a){return l`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("characteristic_life",a)}</span>
|
||||
@@ -2835,11 +2875,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${r.weibull_r_squared!=null?l`
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("weibull_r_squared",a)}</span>
|
||||
<span class="weibull-info-value">${E(r.weibull_r_squared,a,3)}</span>
|
||||
<span class="weibull-info-value">${I(r.weibull_r_squared,a,3)}</span>
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
`}function es(r,a,e){let i=r.confidence_interval_low,t=r.confidence_interval_high,n=a.suggested_interval??a.interval_days??0,o=a.interval_days??0,p=Math.max(0,i-5),m=t+5-p,g=(i-p)/m*100,v=(t-i)/m*100,x=(n-p)/m*100,b=o>0?(o-p)/m*100:-1;return l`
|
||||
`}function ts(r,a,e){let i=r.confidence_interval_low,t=r.confidence_interval_high,n=a.suggested_interval??a.interval_days??0,o=a.interval_days??0,p=Math.max(0,i-5),m=t+5-p,g=(i-p)/m*100,v=(t-i)/m*100,x=(n-p)/m*100,b=o>0?(o-p)/m*100:-1;return l`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",e)}: ${n} ${s("days",e)} (${i}\u2013${t})
|
||||
@@ -2854,7 +2894,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="confidence-text high">${s("confidence_aggressive",e)} (${t}${s("days",e).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function ei(r,a,e){let i=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",t=r.days_until_threshold!=null,n=r.environmental_factor!=null&&r.environmental_factor!==1;if(!i&&!t&&!n)return h;let o=r.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":r.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 l`
|
||||
`}function ti(r,a,e){let i=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",t=r.days_until_threshold!=null,n=r.environmental_factor!=null&&r.environmental_factor!==1;if(!i&&!t&&!n)return h;let o=r.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":r.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 l`
|
||||
<div class="prediction-section">
|
||||
${r.sensor_prediction_urgency?l`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -2872,7 +2912,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<ha-svg-icon path="${o}"></ha-svg-icon>
|
||||
<span class="prediction-label">${s("degradation_trend",a)}</span>
|
||||
<span class="prediction-value ${r.degradation_trend}">${s("trend_"+r.degradation_trend,a)}</span>
|
||||
${r.degradation_rate!=null?l`<span class="prediction-rate">${r.degradation_rate>0?"+":""}${E(r.degradation_rate,a,Math.abs(r.degradation_rate)>=10?0:1)} ${r.trigger_entity_info?.unit_of_measurement||""}/${s("day_short",a)}</span>`:h}
|
||||
${r.degradation_rate!=null?l`<span class="prediction-rate">${r.degradation_rate>0?"+":""}${I(r.degradation_rate,a,Math.abs(r.degradation_rate)>=10?0:1)} ${r.trigger_entity_info?.unit_of_measurement||""}/${s("day_short",a)}</span>`:h}
|
||||
</div>
|
||||
`:h}
|
||||
${t?l`
|
||||
@@ -2880,7 +2920,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<ha-svg-icon path="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z"></ha-svg-icon>
|
||||
<span class="prediction-label">${s("days_until_threshold",a)}</span>
|
||||
<span class="prediction-value prediction-days${r.days_until_threshold===0?" exceeded":r.sensor_prediction_urgency?" urgent":""}">${r.days_until_threshold===0?s("threshold_exceeded",a):"~"+Math.round(r.days_until_threshold)+" "+s("days",a)}</span>
|
||||
${r.threshold_prediction_date?l`<span class="prediction-date">${j(r.threshold_prediction_date,a)}</span>`:h}
|
||||
${r.threshold_prediction_date?l`<span class="prediction-date">${z(r.threshold_prediction_date,a)}</span>`:h}
|
||||
${r.threshold_prediction_confidence?l`<span class="confidence-dot ${r.threshold_prediction_confidence}"></span>`:h}
|
||||
${(r.prediction_cycles??0)>0?l`<span class="prediction-cycles">${s("prediction_cycles",a)}: ${r.prediction_cycles}</span>`:h}
|
||||
</div>
|
||||
@@ -2889,13 +2929,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<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",a)}</span>
|
||||
<span class="prediction-value">${E(r.environmental_factor,a,2)}x</span>
|
||||
${r.environmental_entity?l`<span class="prediction-entity entity-link" @click=${p=>dt(p,r.environmental_entity)}>${r.environmental_entity}</span>`:h}
|
||||
<span class="prediction-value">${I(r.environmental_factor,a,2)}x</span>
|
||||
${r.environmental_entity?l`<span class="prediction-entity entity-link" @click=${p=>pt(p,r.environmental_entity)}>${r.environmental_entity}</span>`:h}
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
</div>
|
||||
`}function ti(r,a,e,i){let t=Math.max(r||1,a);return l`
|
||||
`}function ii(r,a,e,i){let t=Math.max(r||1,a);return l`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -2913,14 +2953,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
style="width: ${Math.min(a/t*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var ii=["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 si(r,a,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return h;let i=ii.map(p=>s(p,a)),t=new Date().getMonth(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:i.map((p,u)=>{let m=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,m+g))});return l`
|
||||
`}var si=["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 ri(r,a,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return h;let i=si.map(p=>s(p,a)),t=new Date().getMonth(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:i.map((p,u)=>{let m=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,m+g))});return l`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",a)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
${o.map((p,u)=>{let m=p*40,g=p<.9?"low":p>1.1?"high":"normal";return l`
|
||||
<div class="seasonal-bar ${g} ${u===t?"current":""}"
|
||||
style="height: ${m}px"
|
||||
title="${i[u]}: ${E(p,a,2)}x">
|
||||
title="${i[u]}: ${I(p,a,2)}x">
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
@@ -2930,7 +2970,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${s("longer",a)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function ri(r,a){return ts(r,a)}function ts(r,a){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let i=r.interval_analysis?.seasonal_reason,t=new Date().getMonth(),n=300,o=100,p=8,m=o-p-4,g=Math.max(...e,1.5),v=n/12,x=v*.65,b=p+m-1/g*m;return l`
|
||||
`}function ni(r,a){return is(r,a)}function is(r,a){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let i=r.interval_analysis?.seasonal_reason,t=new Date().getMonth(),n=300,o=100,p=8,m=o-p-4,g=Math.max(...e,1.5),v=n/12,x=v*.65,b=p+m-1/g*m;return l`
|
||||
<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>
|
||||
@@ -2940,22 +2980,22 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<svg viewBox="0 0 ${n} ${o}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_seasonal",a)}">
|
||||
<line x1="0" y1="${$(b)}" x2="${n}" y2="${$(b)}"
|
||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||
${e.map((S,N)=>{let K=S/g*m,Z=N*v+(v-x)/2,F=p+m-K,U=N===t,ie=S<1?"var(--success-color, #4caf50)":S>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return se`
|
||||
<rect x="${$(Z)}" y="${$(F)}"
|
||||
${e.map((T,N)=>{let K=T/g*m,X=N*v+(v-x)/2,F=p+m-K,B=N===t,se=T<1?"var(--success-color, #4caf50)":T>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return re`
|
||||
<rect x="${$(X)}" y="${$(F)}"
|
||||
width="${$(x)}" height="${$(K)}"
|
||||
fill="${ie}" opacity="${U?1:.5}" rx="2" />
|
||||
fill="${se}" opacity="${B?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${ii.map((S,N)=>l`<span class="seasonal-label ${N===t?"active-month":""}">${s(S,a)}</span>`)}
|
||||
${si.map((T,N)=>l`<span class="seasonal-label ${N===t?"active-month":""}">${s(T,a)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var k=class extends T{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._toastTimer=new Ce;this._access=ke;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return R(this.hass)}async openFor(e,i){(e!==this._entryId||i!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=Fe(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await Y(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=ue(e.budget??void 0),rt(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,i){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},i)}async _loadTask(){let e=this._entryId,i=this._taskId;if(!e||!i)return;let t=++this._loadSeq,n="",o=await A(this,{type:"maintenance_supporter/object",entry_id:e},{onError:u=>{n=u}});if(t!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let p=(o?.tasks||[]).find(u=>u.id===i);this._task=p??null,this._taskRef=Gt(o?.object,p),p||(this._error=s("ws_err_not_found",this._lang))}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-ZNHSIDHE.js").then(async({openCompleteDialog:e})=>{let i=this._task,t=[];try{t=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(Bt({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:t,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:Ut(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-ZNHSIDHE.js").then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-ZNHSIDHE.js").then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId||!await X(this.hass,{title:s("delete",this._lang),message:s("delete_task_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenLine truncated
|
||||
`}var w=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._toastTimer=new Re;this._access=Ee;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return P(this.hass)}async openFor(e,i){(e!==this._entryId||i!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=je(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await Y(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=_e(e.budget??void 0),at(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,i){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},i)}async _loadTask(){let e=this._entryId,i=this._taskId;if(!e||!i)return;let t=++this._loadSeq,n="",o=await A(this,{type:"maintenance_supporter/object",entry_id:e},{onError:u=>{n=u}});if(t!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let p=(o?.tasks||[]).find(u=>u.id===i);this._task=p??null,this._taskRef=Kt(o?.object,p),p||(this._error=s("ws_err_not_found",this._lang))}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-JZ3NZ27Q.js").then(async({openCompleteDialog:e})=>{let i=this._task,t=[];try{t=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(Vt({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:t,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:Bt(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-JZ3NZ27Q.js").then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-JZ3NZ27Q.js").then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId||!await ee(this.hass,{title:s("delete",this._lang),message:s("delete_task_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/mainteLine truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",i)}</h4>
|
||||
${ti(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",i)}
|
||||
${ii(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",i)}
|
||||
<div class="recommendation-actions">
|
||||
${ae(this.hass?.user,this._access)?l`<button class="btn primary qa-apply-suggestion"
|
||||
${oe(this.hass?.user,this._access)?l`<button class="btn primary qa-apply-suggestion"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:check"></ha-icon>
|
||||
${s("apply_suggestion",i)}
|
||||
@@ -2973,14 +3013,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?l`<div class="toast">${this._toast}</div>`:h}
|
||||
${t?this._renderRecommendation(e):h}
|
||||
${n?ei(e,i,this._features):h}
|
||||
${o?Xt(e,i):h}
|
||||
${n?ti(e,i,this._features):h}
|
||||
${o?ei(e,i):h}
|
||||
${p?l`
|
||||
${si(e,i,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?ri(e,i):h}
|
||||
${ri(e,i,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?ni(e,i):h}
|
||||
`:h}
|
||||
</div>
|
||||
`}_renderDetails(e){let i=this._lang,t=e.history||[],n=e.history_count??t.length,o=Yt(t).slice(0,20);return l`
|
||||
`}_renderDetails(e){let i=this._lang,t=e.history||[],n=e.history_count??t.length,o=Jt(t).slice(0,20);return l`
|
||||
<div class="details">
|
||||
<div class="stats-grid">
|
||||
<div class="stat">
|
||||
@@ -2989,11 +3029,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("total_cost",i)}</span>
|
||||
<span class="stat-value">${B(e.total_cost??0,this._currencySymbol,i)}</span>
|
||||
<span class="stat-value">${j(e.total_cost??0,this._currencySymbol,i)}</span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("avg_duration",i)}</span>
|
||||
<span class="stat-value">${xe(e.average_duration!=null?Math.round(e.average_duration):null,i)}</span>
|
||||
<span class="stat-value">${ke(e.average_duration!=null?Math.round(e.average_duration):null,i)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-header">
|
||||
@@ -3002,29 +3042,29 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
${t.length===0?l`<div class="history-empty">${s("history_empty",i)}</div>`:l`
|
||||
<div class="history-list">
|
||||
${o.map(p=>Jt(p,{lang:i,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:ae(this.hass?.user,this._access)?u=>this._onEditHistoryEntry(u):void 0,readingUnit:e.reading_unit,readingSlotDelta:(u,m)=>et(t,u,m),taskRef:this._taskRef},{compact:!0}))}
|
||||
${o.map(p=>Zt(p,{lang:i,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:oe(this.hass?.user,this._access)?u=>this._onEditHistoryEntry(u):void 0,readingUnit:e.reading_unit,readingSlotDelta:(u,m)=>it(t,u,m),taskRef:this._taskRef},{compact:!0}))}
|
||||
${n>o.length?l`<div class="history-more">… +${n-o.length} ${s("older_entries",i)}</div>`:h}
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
`}render(){if(!this._open)return h;let e=this._lang,i=this._task,t=ae(this.hass?.user,this._access),n=!!i&&(!!i.archived||i.enabled===!1||i.status==="paused");return pe(()=>this.close(),l`
|
||||
`}render(){if(!this._open)return h;let e=this._lang,i=this._task,t=oe(this.hass?.user,this._access),n=!!i&&(!!i.archived||i.enabled===!1||i.status==="paused");return he(()=>this.close(),l`
|
||||
${i?l`
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="status-dot" style="background: ${Ae(i)}"></span>
|
||||
<span class="status-dot" style="background: ${Pe(i)}"></span>
|
||||
<span class="task-name">${i.name}</span>
|
||||
${Zt(i,e)}
|
||||
${Xt(i,e)}
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-ZNHSIDHE.js").then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-JZ3NZ27Q.js").then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${i.next_due?l`<span><strong>${s("next_due",e)}:</strong> ${j(i.next_due,e)}</span>`:h}
|
||||
${i.last_performed?l`<span><strong>${s("last_performed",e)}:</strong> ${j(i.last_performed,e)}</span>`:h}
|
||||
${i.schedule?.kind&&!["manual","one_time"].includes(i.schedule.kind)||i.interval_days!=null?l`<span><strong>${s("interval",e)}:</strong> ${lt(i,e)}</span>`:h}
|
||||
${ve(i)?l`<span><strong>${s("phase_current",e)}:</strong> ${ve(i)}</span>`:h}
|
||||
${i.next_due?l`<span><strong>${s("next_due",e)}:</strong> ${z(i.next_due,e)}</span>`:h}
|
||||
${i.last_performed?l`<span><strong>${s("last_performed",e)}:</strong> ${z(i.last_performed,e)}</span>`:h}
|
||||
${i.schedule?.kind&&!["manual","one_time"].includes(i.schedule.kind)||i.interval_days!=null?l`<span><strong>${s("interval",e)}:</strong> ${ct(i,e)}</span>`:h}
|
||||
${ye(i)?l`<span><strong>${s("phase_current",e)}:</strong> ${ye(i)}</span>`:h}
|
||||
</div>
|
||||
${i.notes?l`<div class="notes-body">${Se(i.notes)}</div>`:h}
|
||||
${i.notes?l`<div class="notes-body">${Ce(i.notes)}</div>`:h}
|
||||
</div>
|
||||
|
||||
${this._error?l`<div class="error">${this._error}</div>`:h}
|
||||
@@ -3151,7 +3191,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`}
|
||||
`:this._error?l`<div class="error">${this._error}</div>`:l`<div class="loading">${s("loading",e)}</div>`}
|
||||
`)}updated(e){e.has("_open")&&this._open&&he(this.shadowRoot)}};k.styles=[pt,ce,w`
|
||||
`)}updated(e){e.has("_open")&&this._open&&ue(this.shadowRoot)}};w.styles=[ht,pe,k`
|
||||
:host { display: contents; --ms-modal-max-width: 460px; }
|
||||
.header { display: flex; flex-direction: column; gap: 6px; }
|
||||
.title { display: flex; align-items: center; gap: 10px; }
|
||||
@@ -3309,7 +3349,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],d([f({attribute:!1})],k.prototype,"hass",2),d([c()],k.prototype,"_open",2),d([c()],k.prototype,"_entryId",2),d([c()],k.prototype,"_taskId",2),d([c()],k.prototype,"_task",2),d([c()],k.prototype,"_objectName",2),d([c()],k.prototype,"_taskRef",2),d([c()],k.prototype,"_busy",2),d([c()],k.prototype,"_error",2),d([c()],k.prototype,"_showSkip",2),d([c()],k.prototype,"_showReset",2),d([c()],k.prototype,"_showPostpone",2),d([c()],k.prototype,"_showDetails",2),d([c()],k.prototype,"_showAdaptive",2),d([c()],k.prototype,"_skipReason",2),d([c()],k.prototype,"_resetDate",2),d([c()],k.prototype,"_postponeDate",2),d([c()],k.prototype,"_features",2),d([c()],k.prototype,"_toast",2),d([c()],k.prototype,"_access",2),d([c()],k.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function ni(r){return!!r&&/^https?:\/\//i.test(r)}var O=class extends T{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=ke}get _lang(){return R(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),Y(this.hass).then(i=>{this._access=i.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await A(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:i=>{this._error=i}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-ZNHSIDHE.js").then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-ZNHSIDHE.js").then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await X(this.hass,{title:s("delete",this._lang),message:s("delete_object_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;let i=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await X(this.hass,{title:s("archive_object",this._lang),message:s("confirm_archive_object",this._lang),confirmText:s("archive_object",this._lang)}))return;let i=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&import("./dialog-mount-ZNHSIDHE.js").then(({openTaskQuickActions:i})=>{i(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,i=this._data,t=i?.object,n=i?.tasks||[],o=ae(this.hass?.user,this._access);return pe(()=>this.close(),l`
|
||||
`],d([f({attribute:!1})],w.prototype,"hass",2),d([c()],w.prototype,"_open",2),d([c()],w.prototype,"_entryId",2),d([c()],w.prototype,"_taskId",2),d([c()],w.prototype,"_task",2),d([c()],w.prototype,"_objectName",2),d([c()],w.prototype,"_taskRef",2),d([c()],w.prototype,"_busy",2),d([c()],w.prototype,"_error",2),d([c()],w.prototype,"_showSkip",2),d([c()],w.prototype,"_showReset",2),d([c()],w.prototype,"_showPostpone",2),d([c()],w.prototype,"_showDetails",2),d([c()],w.prototype,"_showAdaptive",2),d([c()],w.prototype,"_skipReason",2),d([c()],w.prototype,"_resetDate",2),d([c()],w.prototype,"_postponeDate",2),d([c()],w.prototype,"_features",2),d([c()],w.prototype,"_toast",2),d([c()],w.prototype,"_access",2),d([c()],w.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",w);function ai(r){return!!r&&/^https?:\/\//i.test(r)}var O=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=Ee}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),Y(this.hass).then(i=>{this._access=i.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await A(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:i=>{this._error=i}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-JZ3NZ27Q.js").then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-JZ3NZ27Q.js").then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await ee(this.hass,{title:s("delete",this._lang),message:s("delete_object_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;let i=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await ee(this.hass,{title:s("archive_object",this._lang),message:s("confirm_archive_object",this._lang),confirmText:s("archive_object",this._lang)}))return;let i=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&import("./dialog-mount-JZ3NZ27Q.js").then(({openTaskQuickActions:i})=>{i(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,i=this._data,t=i?.object,n=i?.tasks||[],o=oe(this.hass?.user,this._access);return he(()=>this.close(),l`
|
||||
${i&&t?l`
|
||||
<div class="header">
|
||||
<div class="title">${t.name}</div>
|
||||
@@ -3327,9 +3367,9 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="task-list">
|
||||
${n.map(p=>l`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(p.id)}>
|
||||
<span class="status-dot" style="background: ${Ae(p)}"></span>
|
||||
<span class="status-dot" style="background: ${Pe(p)}"></span>
|
||||
<span class="task-name">${p.name}</span>
|
||||
<span class="task-status ${ye(p)}">${Be(ye(p),e)}</span>
|
||||
<span class="task-status ${be(p)}">${We(be(p),e)}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
@@ -3339,7 +3379,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${t.notes?l`
|
||||
<div class="notes-section">
|
||||
<strong>${s("object_notes_label",e)}</strong>
|
||||
<div class="notes-body">${Se(t.notes)}</div>
|
||||
<div class="notes-body">${Ce(t.notes)}</div>
|
||||
</div>
|
||||
`:h}
|
||||
|
||||
@@ -3364,16 +3404,16 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`:h}
|
||||
`:l`<div class="loading">${s("loading",e)}</div>`}
|
||||
`)}updated(e){e.has("_open")&&this._open&&he(this.shadowRoot)}_renderMetaRow(e){let i=this._lang,t=[];return e.area_id&&t.push([s("area",i),e.area_id]),e.manufacturer&&t.push([s("manufacturer",i),e.manufacturer]),e.model&&t.push([s("model",i),e.model]),e.serial_number&&t.push([s("serial_number_label",i),e.serial_number]),e.installation_date&&t.push([s("installed",i),e.installation_date]),e.warranty_expiry&&t.push([s("warranty",i),e.warranty_expiry]),e.documentation_url&&t.push([s("documentation_url_label",i),e.documentation_url]),t.length===0?h:l`
|
||||
`)}updated(e){e.has("_open")&&this._open&&ue(this.shadowRoot)}_renderMetaRow(e){let i=this._lang,t=[];return e.area_id&&t.push([s("area",i),e.area_id]),e.manufacturer&&t.push([s("manufacturer",i),e.manufacturer]),e.model&&t.push([s("model",i),e.model]),e.serial_number&&t.push([s("serial_number_label",i),e.serial_number]),e.installation_date&&t.push([s("installed",i),e.installation_date]),e.warranty_expiry&&t.push([s("warranty",i),e.warranty_expiry]),e.documentation_url&&t.push([s("documentation_url_label",i),e.documentation_url]),t.length===0?h:l`
|
||||
<div class="meta">
|
||||
${t.map(([n,o])=>l`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${ni(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
|
||||
<span class="meta-value">${ai(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
`}};O.styles=[ce,w`
|
||||
`}};O.styles=[pe,k`
|
||||
:host { display: contents; }
|
||||
.header { display: flex; flex-direction: column; gap: 6px; }
|
||||
.title { font-size: 20px; font-weight: 600; }
|
||||
@@ -3418,4 +3458,4 @@ ${u?`<div class="sub">${u}</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; }
|
||||
`],d([f({attribute:!1})],O.prototype,"hass",2),d([c()],O.prototype,"_open",2),d([c()],O.prototype,"_entryId",2),d([c()],O.prototype,"_data",2),d([c()],O.prototype,"_busy",2),d([c()],O.prototype,"_error",2),d([c()],O.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",O);var ai="maintenance-object-dialog",oi="maintenance-task-dialog",is="maintenance-history-edit-dialog",ss="maintenance-complete-dialog",rs="maintenance-qr-dialog",ns="maintenance-task-quick-actions-dialog",as="maintenance-object-quick-actions-dialog";function Re(){return document.querySelector("home-assistant")?.hass}function os(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function W(r){let a=os(),e=a.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==a&&a.appendChild(e):(e=document.createElement(r),a.appendChild(e)),e}function G(r){let a=Re();if(!a)return!1;r.hass=a;let e=R(a);return Ge(e)||Ke(e).then(()=>{r.requestUpdate?.()}),nt(a.locale,a.config?.country),!0}function co(r){return Y(r).then(a=>a.rowActionStyle)}function po(){mt()}function ho(){let r=W(ai);return G(r)?(r.openCreate(),!0):!1}function uo(r,a){let e=W(ai);return G(e)?(e.openEdit(r,a),!0):!1}function _o(r="",a){let e=W(oi);if(!G(e))return!1;let i=Re();return i?((async()=>{let t=await Y(i),n=e;li(n,t),n.openCreate(r,a)})(),!0):!1}function li(r,a){r.checklistsEnabled=a.features.checklists,r.scheduleTimeEnabled=a.features.schedule_time,r.completionActionsEnabled=a.features.completion_actions,r.adaptiveFeature=a.features.adaptive,r.seasonalFeature=a.features.seasonal,r.environmentalFeature=a.features.environmental,r.defaultWarningDays=a.defaultWarningDays}function mo(r,a){let e=W(oi);if(!G(e))return!1;let i=Re();return i?((async()=>{try{let[t,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),Y(i)]),o=(t.tasks||[]).find(u=>u.id===a);if(!o){console.warn(`openEditTaskDialog: task ${a} not found in entry ${r}`);return}let p=e;li(p,n),await p.openEdit(r,o)}catch(t){console.warn("openEditTaskDialog: failed to load task/features",t)}})(),!0):!1}function go(r){let a=W(is);return G(a)?(a.openEdit(r),!0):!1}function fo(r){let a=W(ss);return G(a)?(Vt(a,r,R(Re())),!0):!1}function vo(r){let a=W(rs);return G(a)?(a.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function yo(r,a){let e=W(ns);return G(e)?(e.openFor(r,a),!0):!1}function bo(r){let a=W(as);return G(a)?(a.openFor(r),!0):!1}export{po as __resetSettingsCacheForTests,co as getRowActionStyle,fo as openCompleteDialog,ho as openCreateObjectDialog,_o as openCreateTaskDialog,uo as openEditObjectDialog,mo as openEditTaskDialog,go as openHistoryEditDialog,bo as openObjectQuickActions,vo as openQrDialog,yo as openTaskQuickActions};
|
||||
`],d([f({attribute:!1})],O.prototype,"hass",2),d([c()],O.prototype,"_open",2),d([c()],O.prototype,"_entryId",2),d([c()],O.prototype,"_data",2),d([c()],O.prototype,"_busy",2),d([c()],O.prototype,"_error",2),d([c()],O.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",O);var oi="maintenance-object-dialog",li="maintenance-task-dialog",ss="maintenance-history-edit-dialog",rs="maintenance-complete-dialog",ns="maintenance-qr-dialog",as="maintenance-task-quick-actions-dialog",os="maintenance-object-quick-actions-dialog";function Le(){return document.querySelector("home-assistant")?.hass}function ls(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function W(r){let a=ls(),e=a.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==a&&a.appendChild(e):(e=document.createElement(r),a.appendChild(e)),e}function G(r){let a=Le();if(!a)return!1;r.hass=a;let e=P(a);return Qe(e)||Ye(e).then(()=>{r.requestUpdate?.()}),ot(a.locale,a.config?.country),!0}function yo(r){return Y(r).then(a=>a.rowActionStyle)}function bo(){gt()}function $o(){let r=W(oi);return G(r)?(r.openCreate(),!0):!1}function xo(r,a){let e=W(oi);return G(e)?(e.openEdit(r,a),!0):!1}function ko(r="",a){let e=W(li);if(!G(e))return!1;let i=Le();return i?((async()=>{let t=await Y(i),n=e;di(n,t),n.openCreate(r,a)})(),!0):!1}function di(r,a){r.checklistsEnabled=a.features.checklists,r.scheduleTimeEnabled=a.features.schedule_time,r.completionActionsEnabled=a.features.completion_actions,r.adaptiveFeature=a.features.adaptive,r.seasonalFeature=a.features.seasonal,r.environmentalFeature=a.features.environmental,r.defaultWarningDays=a.defaultWarningDays}function wo(r,a){let e=W(li);if(!G(e))return!1;let i=Le();return i?((async()=>{try{let[t,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),Y(i)]),o=(t.tasks||[]).find(u=>u.id===a);if(!o){console.warn(`openEditTaskDialog: task ${a} not found in entry ${r}`);return}let p=e;di(p,n),await p.openEdit(r,o)}catch(t){console.warn("openEditTaskDialog: failed to load task/features",t)}})(),!0):!1}function Eo(r){let a=W(ss);return G(a)?(a.openEdit(r),!0):!1}function Io(r){let a=W(rs);return G(a)?(Wt(a,r,P(Le())),!0):!1}function So(r){let a=W(ns);return G(a)?(a.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function To(r,a){let e=W(as);return G(e)?(e.openFor(r,a),!0):!1}function Ao(r){let a=W(os);return G(a)?(a.openFor(r),!0):!1}export{bo as __resetSettingsCacheForTests,yo as getRowActionStyle,Io as openCompleteDialog,$o as openCreateObjectDialog,ko as openCreateTaskDialog,xo as openEditObjectDialog,wo as openEditTaskDialog,Eo as openHistoryEditDialog,Ao as openObjectQuickActions,So as openQrDialog,To as openTaskQuickActions};
|
||||
-3234
File diff suppressed because it is too large.
Load diff
-3265
File diff suppressed because it is too large.
Load diff
-3264
File diff suppressed because it is too large.
Load diff
-137
@@ -1,137 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
import{a as v,b}from"./chunk-MSGNUEIB.js";import{B as p,a as u,b as s,d as c,e as h,f as g,g as o,i,k as _,m}from"./chunk-UI7IMFM7.js";import{a}from"./chunk-BR3YZILG.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)}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(),m(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).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)}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏷️</span>
|
||||
<span>${this._config.title||i("groups",t)}</span>
|
||||
<span class="count">${r.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${this._error?s`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${r.length===0?s`<div class="empty">${i("groups_empty",t)}</div>`:s`
|
||||
<div class="group-list">
|
||||
${r.map(n=>{let d=this._groups[n],y=d.task_refs?.length??0,f=this._editingId===n;return s`
|
||||
<div class="group-row">
|
||||
${f?s`
|
||||
<input class="edit-input" type="text"
|
||||
.value=${this._editingName}
|
||||
?disabled=${this._busy}
|
||||
@input=${l=>{this._editingName=l.target.value}}
|
||||
@keydown=${l=>this._onKeyDown(l,this._saveEdit.bind(this))} />
|
||||
<button class="btn small primary"
|
||||
@click=${this._saveEdit}
|
||||
?disabled=${this._busy||!this._editingName.trim()}>
|
||||
${i("save",t)}
|
||||
</button>
|
||||
<button class="btn small"
|
||||
@click=${()=>{this._editingId=null}}>
|
||||
${i("cancel",t)}
|
||||
</button>
|
||||
`:s`
|
||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
||||
<span class="task-count">${y}</span>
|
||||
${this._isAdmin?s`
|
||||
<button class="icon-btn"
|
||||
title="${i("edit",t)}"
|
||||
@click=${()=>this._startEdit(n)}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>
|
||||
<button class="icon-btn danger"
|
||||
title="${i("delete",t)}"
|
||||
@click=${()=>this._deleteGroup(n,d.name||"Unnamed")}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:delete"></ha-icon>
|
||||
</button>
|
||||
`:c}
|
||||
`}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}
|
||||
|
||||
${this._isAdmin?s`
|
||||
<div class="add-row">
|
||||
<input type="text"
|
||||
placeholder="${i("group_new_placeholder",t)}"
|
||||
.value=${this._newName}
|
||||
?disabled=${this._busy}
|
||||
@input=${n=>{this._newName=n.target.value}}
|
||||
@keydown=${n=>this._onKeyDown(n,this._addGroup.bind(this))} />
|
||||
<button class="btn primary"
|
||||
@click=${this._addGroup}
|
||||
?disabled=${this._busy||!this._newName.trim()}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
${i("add",t)}
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_manage_tasks",t)}
|
||||
</button>
|
||||
`:s`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[b,u`
|
||||
.count {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 8px; border-radius: 999px;
|
||||
}
|
||||
.empty {
|
||||
padding: 16px; text-align: center;
|
||||
color: var(--secondary-text-color); font-style: italic;
|
||||
}
|
||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
||||
.group-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: 6px;
|
||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
||||
}
|
||||
.group-name { flex: 1; font-size: 14px; }
|
||||
.task-count {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
||||
padding: 1px 8px; border-radius: 999px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.edit-input {
|
||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
||||
background: var(--card-background-color, #1c1c1c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.icon-btn {
|
||||
background: transparent; border: none; cursor: pointer;
|
||||
color: var(--secondary-text-color); padding: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.icon-btn:hover {
|
||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.icon-btn.danger:hover { color: var(--error-color); }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.add-row {
|
||||
display: flex; gap: 6px;
|
||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.add-row input {
|
||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
/* Card-specific overrides on the shared .btn */
|
||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
`],a([g({attribute:!1})],e.prototype,"hass",2),a([o()],e.prototype,"_config",2),a([o()],e.prototype,"_groups",2),a([o()],e.prototype,"_loaded",2),a([o()],e.prototype,"_busy",2),a([o()],e.prototype,"_error",2),a([o()],e.prototype,"_newName",2),a([o()],e.prototype,"_editingId",2),a([o()],e.prototype,"_editingName",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);v({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Inline group CRUD",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as v,b as y}from"./chunk-IWH6LGYJ.js";import{a as f,b as x,c as k}from"./chunk-C275ZO4V.js";import{j as b}from"./chunk-6BHUADHJ.js";import{a as h,b as a,d as c,e as g,f as _,g as o,j as m,z as l}from"./chunk-2ARNLSF6.js";import{a as n,g as i,i as u}from"./chunk-3MSNNIFG.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return m(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),u(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as v,b as y}from"./chunk-GN5JMQ24.js";import{a as f,b as x,d as k}from"./chunk-5BNA7QPW.js";import{k as b}from"./chunk-GDJJTBLT.js";import{A as l,a as h,b as a,d as c,e as g,f as _,g as o,j as m}from"./chunk-XR5IXJXS.js";import{a as n,g as i,i as u}from"./chunk-G7Y44K4C.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return m(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),u(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as v,b as y}from"./chunk-LKMEBXIJ.js";import{a as f,b as x,d as k}from"./chunk-EAYT244O.js";import{k as b}from"./chunk-CTWCZMNP.js";import{A as l,a as h,b as a,d as c,e as g,f as _,g as o,j as m}from"./chunk-V2H6N4AC.js";import{a as n,g as i,i as u}from"./chunk-RGIYRWN4.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return m(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),u(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏷️</span>
|
||||
<span>${this._config.title||i("groups",t)}</span>
|
||||
<span class="count">${r.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${this._error?a`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${r.length===0?a`<div class="empty">${i("groups_empty",t)}</div>`:a`
|
||||
<div class="group-list">
|
||||
${r.map(s=>{let d=this._groups[s],$=d.task_refs?.length??0,w=this._editingId===s;return a`
|
||||
<div class="group-row">
|
||||
${w?a`
|
||||
<input class="edit-input" type="text"
|
||||
.value=${this._editingName}
|
||||
?disabled=${this._busy}
|
||||
@input=${p=>{this._editingName=p.target.value}}
|
||||
@keydown=${p=>this._onKeyDown(p,this._saveEdit.bind(this))} />
|
||||
<button class="btn small primary"
|
||||
@click=${this._saveEdit}
|
||||
?disabled=${this._busy||!this._editingName.trim()}>
|
||||
${i("save",t)}
|
||||
</button>
|
||||
<button class="btn small"
|
||||
@click=${()=>{this._editingId=null}}>
|
||||
${i("cancel",t)}
|
||||
</button>
|
||||
`:a`
|
||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
||||
<span class="task-count">${$}</span>
|
||||
${this._canWrite?a`
|
||||
<button class="icon-btn"
|
||||
title="${i("edit",t)}"
|
||||
@click=${()=>this._startEdit(s)}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>
|
||||
<button class="icon-btn danger"
|
||||
title="${i("delete",t)}"
|
||||
@click=${()=>this._deleteGroup(s,d.name||"Unnamed")}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:delete"></ha-icon>
|
||||
</button>
|
||||
`:c}
|
||||
`}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}
|
||||
|
||||
${this._canWrite?a`
|
||||
<div class="add-row">
|
||||
<input type="text"
|
||||
placeholder="${i("group_new_placeholder",t)}"
|
||||
.value=${this._newName}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._newName=s.target.value}}
|
||||
@keydown=${s=>this._onKeyDown(s,this._addGroup.bind(this))} />
|
||||
<button class="btn primary"
|
||||
@click=${this._addGroup}
|
||||
?disabled=${this._busy||!this._newName.trim()}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
${i("add",t)}
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_manage_tasks",t)}
|
||||
</button>
|
||||
`:a`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[y,h`
|
||||
.count {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 8px; border-radius: 999px;
|
||||
}
|
||||
.empty {
|
||||
padding: 16px; text-align: center;
|
||||
color: var(--secondary-text-color); font-style: italic;
|
||||
}
|
||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
||||
.group-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: 6px;
|
||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
||||
}
|
||||
.group-name { flex: 1; font-size: 14px; }
|
||||
.task-count {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
||||
padding: 1px 8px; border-radius: 999px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.edit-input {
|
||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
||||
background: var(--card-background-color, #1c1c1c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.icon-btn {
|
||||
background: transparent; border: none; cursor: pointer;
|
||||
color: var(--secondary-text-color); padding: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.icon-btn:hover {
|
||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.icon-btn.danger:hover { color: var(--error-color); }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.add-row {
|
||||
display: flex; gap: 6px;
|
||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.add-row input {
|
||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
/* Card-specific overrides on the shared .btn */
|
||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
`],n([_({attribute:!1})],e.prototype,"hass",2),n([o()],e.prototype,"_config",2),n([o()],e.prototype,"_groups",2),n([o()],e.prototype,"_loaded",2),n([o()],e.prototype,"_busy",2),n([o()],e.prototype,"_error",2),n([o()],e.prototype,"_newName",2),n([o()],e.prototype,"_editingId",2),n([o()],e.prototype,"_editingName",2),n([o()],e.prototype,"_access",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);v({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Create, rename and delete task groups right on the dashboard.",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as v,b as y}from"./chunk-7S4QZ3RX.js";import{a as f,b as x,c as k}from"./chunk-42I2X2DS.js";import{j as b}from"./chunk-QP2XJAYX.js";import{C as l,a as u,b as a,d as c,e as g,f as h,g as o,i,k as _,m}from"./chunk-6VYW2MWJ.js";import{a as n}from"./chunk-RVTWU5ZB.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return _(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),m(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏷️</span>
|
||||
<span>${this._config.title||i("groups",t)}</span>
|
||||
<span class="count">${r.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${this._error?a`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${r.length===0?a`<div class="empty">${i("groups_empty",t)}</div>`:a`
|
||||
<div class="group-list">
|
||||
${r.map(s=>{let d=this._groups[s],$=d.task_refs?.length??0,w=this._editingId===s;return a`
|
||||
<div class="group-row">
|
||||
${w?a`
|
||||
<input class="edit-input" type="text"
|
||||
.value=${this._editingName}
|
||||
?disabled=${this._busy}
|
||||
@input=${p=>{this._editingName=p.target.value}}
|
||||
@keydown=${p=>this._onKeyDown(p,this._saveEdit.bind(this))} />
|
||||
<button class="btn small primary"
|
||||
@click=${this._saveEdit}
|
||||
?disabled=${this._busy||!this._editingName.trim()}>
|
||||
${i("save",t)}
|
||||
</button>
|
||||
<button class="btn small"
|
||||
@click=${()=>{this._editingId=null}}>
|
||||
${i("cancel",t)}
|
||||
</button>
|
||||
`:a`
|
||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
||||
<span class="task-count">${$}</span>
|
||||
${this._canWrite?a`
|
||||
<button class="icon-btn"
|
||||
title="${i("edit",t)}"
|
||||
@click=${()=>this._startEdit(s)}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>
|
||||
<button class="icon-btn danger"
|
||||
title="${i("delete",t)}"
|
||||
@click=${()=>this._deleteGroup(s,d.name||"Unnamed")}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:delete"></ha-icon>
|
||||
</button>
|
||||
`:c}
|
||||
`}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}
|
||||
|
||||
${this._canWrite?a`
|
||||
<div class="add-row">
|
||||
<input type="text"
|
||||
placeholder="${i("group_new_placeholder",t)}"
|
||||
.value=${this._newName}
|
||||
?disabled=${this._busy}
|
||||
@input=${s=>{this._newName=s.target.value}}
|
||||
@keydown=${s=>this._onKeyDown(s,this._addGroup.bind(this))} />
|
||||
<button class="btn primary"
|
||||
@click=${this._addGroup}
|
||||
?disabled=${this._busy||!this._newName.trim()}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
${i("add",t)}
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_manage_tasks",t)}
|
||||
</button>
|
||||
`:a`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[y,u`
|
||||
.count {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 8px; border-radius: 999px;
|
||||
}
|
||||
.empty {
|
||||
padding: 16px; text-align: center;
|
||||
color: var(--secondary-text-color); font-style: italic;
|
||||
}
|
||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
||||
.group-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: 6px;
|
||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
||||
}
|
||||
.group-name { flex: 1; font-size: 14px; }
|
||||
.task-count {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
||||
padding: 1px 8px; border-radius: 999px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.edit-input {
|
||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
||||
background: var(--card-background-color, #1c1c1c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.icon-btn {
|
||||
background: transparent; border: none; cursor: pointer;
|
||||
color: var(--secondary-text-color); padding: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.icon-btn:hover {
|
||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.icon-btn.danger:hover { color: var(--error-color); }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.add-row {
|
||||
display: flex; gap: 6px;
|
||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.add-row input {
|
||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
/* Card-specific overrides on the shared .btn */
|
||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
`],n([h({attribute:!1})],e.prototype,"hass",2),n([o()],e.prototype,"_config",2),n([o()],e.prototype,"_groups",2),n([o()],e.prototype,"_loaded",2),n([o()],e.prototype,"_busy",2),n([o()],e.prototype,"_error",2),n([o()],e.prototype,"_newName",2),n([o()],e.prototype,"_editingId",2),n([o()],e.prototype,"_editingName",2),n([o()],e.prototype,"_access",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);v({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Inline group CRUD",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
import{a as v,b}from"./chunk-CH4XIFVT.js";import{B as p,a as u,b as s,d as c,e as h,f as g,g as o,i,k as _,m}from"./chunk-ZBY2DACR.js";import{a}from"./chunk-62AO4XFY.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)}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(),m(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).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)}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏷️</span>
|
||||
<span>${this._config.title||i("groups",t)}</span>
|
||||
<span class="count">${r.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${this._error?s`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${r.length===0?s`<div class="empty">${i("groups_empty",t)}</div>`:s`
|
||||
<div class="group-list">
|
||||
${r.map(n=>{let d=this._groups[n],y=d.task_refs?.length??0,f=this._editingId===n;return s`
|
||||
<div class="group-row">
|
||||
${f?s`
|
||||
<input class="edit-input" type="text"
|
||||
.value=${this._editingName}
|
||||
?disabled=${this._busy}
|
||||
@input=${l=>{this._editingName=l.target.value}}
|
||||
@keydown=${l=>this._onKeyDown(l,this._saveEdit.bind(this))} />
|
||||
<button class="btn small primary"
|
||||
@click=${this._saveEdit}
|
||||
?disabled=${this._busy||!this._editingName.trim()}>
|
||||
${i("save",t)}
|
||||
</button>
|
||||
<button class="btn small"
|
||||
@click=${()=>{this._editingId=null}}>
|
||||
${i("cancel",t)}
|
||||
</button>
|
||||
`:s`
|
||||
<span class="group-name">${d.name||"Unnamed"}</span>
|
||||
<span class="task-count">${y}</span>
|
||||
${this._isAdmin?s`
|
||||
<button class="icon-btn"
|
||||
title="${i("edit",t)}"
|
||||
@click=${()=>this._startEdit(n)}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>
|
||||
<button class="icon-btn danger"
|
||||
title="${i("delete",t)}"
|
||||
@click=${()=>this._deleteGroup(n,d.name||"Unnamed")}
|
||||
?disabled=${this._busy}>
|
||||
<ha-icon icon="mdi:delete"></ha-icon>
|
||||
</button>
|
||||
`:c}
|
||||
`}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}
|
||||
|
||||
${this._isAdmin?s`
|
||||
<div class="add-row">
|
||||
<input type="text"
|
||||
placeholder="${i("group_new_placeholder",t)}"
|
||||
.value=${this._newName}
|
||||
?disabled=${this._busy}
|
||||
@input=${n=>{this._newName=n.target.value}}
|
||||
@keydown=${n=>this._onKeyDown(n,this._addGroup.bind(this))} />
|
||||
<button class="btn primary"
|
||||
@click=${this._addGroup}
|
||||
?disabled=${this._busy||!this._newName.trim()}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon>
|
||||
${i("add",t)}
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_manage_tasks",t)}
|
||||
</button>
|
||||
`:s`
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${i("groups_open_panel",t)}
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};e.styles=[b,u`
|
||||
.count {
|
||||
font-size: 12px; color: var(--secondary-text-color);
|
||||
background: var(--secondary-background-color);
|
||||
padding: 2px 8px; border-radius: 999px;
|
||||
}
|
||||
.empty {
|
||||
padding: 16px; text-align: center;
|
||||
color: var(--secondary-text-color); font-style: italic;
|
||||
}
|
||||
.group-list { display: flex; flex-direction: column; gap: 4px; }
|
||||
.group-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: 6px;
|
||||
background: var(--secondary-background-color, rgba(255,255,255,0.03));
|
||||
}
|
||||
.group-name { flex: 1; font-size: 14px; }
|
||||
.task-count {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
background: var(--card-background-color, rgba(0,0,0,0.2));
|
||||
padding: 1px 8px; border-radius: 999px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.edit-input {
|
||||
flex: 1; padding: 4px 8px; font-size: 14px;
|
||||
background: var(--card-background-color, #1c1c1c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--primary-color); border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.icon-btn {
|
||||
background: transparent; border: none; cursor: pointer;
|
||||
color: var(--secondary-text-color); padding: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.icon-btn:hover {
|
||||
background: var(--state-icon-color, rgba(255,255,255,0.06));
|
||||
color: var(--primary-text-color);
|
||||
}
|
||||
.icon-btn.danger:hover { color: var(--error-color); }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.add-row {
|
||||
display: flex; gap: 6px;
|
||||
padding-top: 8px; border-top: 1px solid var(--divider-color);
|
||||
}
|
||||
.add-row input {
|
||||
flex: 1; padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
/* Card-specific overrides on the shared .btn */
|
||||
.btn.small { padding: 4px 8px; font-size: 12px; }
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
`],a([g({attribute:!1})],e.prototype,"hass",2),a([o()],e.prototype,"_config",2),a([o()],e.prototype,"_groups",2),a([o()],e.prototype,"_loaded",2),a([o()],e.prototype,"_busy",2),a([o()],e.prototype,"_error",2),a([o()],e.prototype,"_newName",2),a([o()],e.prototype,"_editingId",2),a([o()],e.prototype,"_editingName",2);customElements.get("maintenance-groups-section-card")||customElements.define("maintenance-groups-section-card",e);v({type:"maintenance-groups-section-card",name:"Maintenance Supporter \u2014 Groups",description:"Inline group CRUD",preview:!1});export{e as MaintenanceGroupsSectionCard};
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.88.0 */
|
||||
import{a as g,b as y}from"./chunk-CH4XIFVT.js";import"./chunk-KK4NNJHL.js";import{B as o,a as h,b as r,d as c,e as _,f as v,g as n,i as e,j as f,k as m,m as b}from"./chunk-ZBY2DACR.js";import{a as i}from"./chunk-62AO4XFY.js";var s=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 m(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),f(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),b(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=o(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let a=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=a}catch(a){this._error=o(a,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=o(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang))){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=o(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,a=this._state;if(!a)return r`<ha-card><div class="loading">${e("loading",t)}</div></ha-card>`;let p=a.is_active===!0,d=a.enabled===!0,u=a.exempt_task_ids?.length??0,$=p?e("vacation_status_active",t):d?e("vacation_status_scheduled",t):e("vacation_status_inactive",t),x=p?"active":d?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏖️</span>
|
||||
<span>${this._config.title||e("vacation_mode",t)}</span>
|
||||
</div>
|
||||
<span class="status-pill ${x}">${$}</span>
|
||||
</div>
|
||||
|
||||
${this._error?r`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${this._isAdmin?r`
|
||||
<div class="row toggle-row">
|
||||
<label>${e("enable",t)}</label>
|
||||
<ha-switch
|
||||
.checked=${d}
|
||||
.disabled=${this._busy}
|
||||
@change=${l=>this._toggleEnabled(l.target.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
|
||||
<div class="dates-row">
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_start",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localStart}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${l=>{this._localStart=l.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_end",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localEnd}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${l=>{this._localEnd=l.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field buffer">
|
||||
<label>${e("vacation_buffer",t)}</label>
|
||||
<input type="number" min="0" max="14"
|
||||
.value=${String(this._localBuffer)}
|
||||
?disabled=${this._busy}
|
||||
@input=${l=>{this._localBuffer=parseInt(l.target.value,10)||0,this._dirty=!0}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?e("save",t):e("saved",t)}
|
||||
</button>
|
||||
${p?r`<button class="btn"
|
||||
@click=${this._endNow}
|
||||
?disabled=${this._busy}>
|
||||
${e("vacation_end_now",t)}
|
||||
</button>`:c}
|
||||
${u>0?r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${u} ${e("vacation_exempt_count",t)}…
|
||||
</button>`:r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${e("vacation_advanced",t)}
|
||||
</button>`}
|
||||
</div>
|
||||
`:r`
|
||||
<div class="readonly">
|
||||
${d&&a.start&&a.end?r`<div>${a.start} → ${a.end}</div>`:c}
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${e("vacation_open_panel",t)}
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[y,h`
|
||||
.status-pill {
|
||||
font-size: 11px; font-weight: 600;
|
||||
padding: 3px 8px; border-radius: 999px;
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.status-pill.active {
|
||||
background: rgba(76, 175, 80, 0.15);
|
||||
color: #4caf50;
|
||||
}
|
||||
.status-pill.scheduled {
|
||||
background: rgba(255, 152, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
.status-pill.inactive {
|
||||
background: rgba(158, 158, 158, 0.15);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.row.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.row.toggle-row label {
|
||||
font-size: 14px; color: var(--primary-text-color);
|
||||
}
|
||||
.dates-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
||||
}
|
||||
.date-field.buffer label { white-space: nowrap; }
|
||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.date-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.date-field input {
|
||||
padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.actions {
|
||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
||||
}
|
||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
||||
`],i([v({attribute:!1})],s.prototype,"hass",2),i([n()],s.prototype,"_config",2),i([n()],s.prototype,"_state",2),i([n()],s.prototype,"_busy",2),i([n()],s.prototype,"_error",2),i([n()],s.prototype,"_localStart",2),i([n()],s.prototype,"_localEnd",2),i([n()],s.prototype,"_localBuffer",2),i([n()],s.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",s);g({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Inline vacation mode toggle + dates",preview:!1});export{s as MaintenanceVacationSectionCard};
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.94.0 */
|
||||
import{a as y,b as x}from"./chunk-7S4QZ3RX.js";import"./chunk-XXOH7YPH.js";import{b as p,j as $}from"./chunk-QP2XJAYX.js";import{C as u,a as h,b as r,d as c,e as v,f,g as n,i as a,j as m,k as b,m as g}from"./chunk-6VYW2MWJ.js";import{a as s}from"./chunk-RVTWU5ZB.js";var i=class extends v{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return b(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),m(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),g(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏖️</span>
|
||||
<span>${this._config.title||a("vacation_mode",t)}</span>
|
||||
</div>
|
||||
<span class="status-pill ${k}">${w}</span>
|
||||
</div>
|
||||
|
||||
${this._error?r`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${this._isAdmin?r`
|
||||
<div class="row toggle-row">
|
||||
<label>${a("enable",t)}</label>
|
||||
<ha-switch
|
||||
.checked=${l}
|
||||
.disabled=${this._busy}
|
||||
@change=${d=>this._toggleEnabled(d.target.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
|
||||
<div class="dates-row">
|
||||
<div class="date-field">
|
||||
<label>${a("vacation_start",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localStart}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${d=>{this._localStart=d.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field">
|
||||
<label>${a("vacation_end",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localEnd}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${d=>{this._localEnd=d.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field buffer">
|
||||
<label>${a("vacation_buffer",t)}</label>
|
||||
<input type="number" min=${p[0]} max=${p[1]}
|
||||
.value=${this._localBuffer}
|
||||
?disabled=${this._busy}
|
||||
@input=${d=>{this._localBuffer=d.target.value,this._dirty=!0}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?a("save",t):a("saved",t)}
|
||||
</button>
|
||||
${o?r`<button class="btn"
|
||||
@click=${this._endNow}
|
||||
?disabled=${this._busy}>
|
||||
${a("vacation_end_now",t)}
|
||||
</button>`:c}
|
||||
${_>0?r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${_} ${a("vacation_exempt_count",t)}…
|
||||
</button>`:r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${a("vacation_advanced",t)}
|
||||
</button>`}
|
||||
</div>
|
||||
`:r`
|
||||
<div class="readonly">
|
||||
${l&&e.start&&e.end?r`<div>${e.start} → ${e.end}</div>`:c}
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("vacation_open_panel",t)}
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};i.styles=[x,h`
|
||||
.status-pill {
|
||||
font-size: 11px; font-weight: 600;
|
||||
padding: 3px 8px; border-radius: 999px;
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.status-pill.active {
|
||||
background: rgba(76, 175, 80, 0.15);
|
||||
color: #4caf50;
|
||||
}
|
||||
.status-pill.scheduled {
|
||||
background: rgba(255, 152, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
.status-pill.inactive {
|
||||
background: rgba(158, 158, 158, 0.15);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.row.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.row.toggle-row label {
|
||||
font-size: 14px; color: var(--primary-text-color);
|
||||
}
|
||||
.dates-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
||||
}
|
||||
.date-field.buffer label { white-space: nowrap; }
|
||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.date-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.date-field input {
|
||||
padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.actions {
|
||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
||||
}
|
||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
||||
`],s([f({attribute:!1})],i.prototype,"hass",2),s([n()],i.prototype,"_config",2),s([n()],i.prototype,"_state",2),s([n()],i.prototype,"_busy",2),s([n()],i.prototype,"_error",2),s([n()],i.prototype,"_localStart",2),s([n()],i.prototype,"_localEnd",2),s([n()],i.prototype,"_localBuffer",2),s([n()],i.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",i);y({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Inline vacation mode toggle + dates",preview:!1});export{i as MaintenanceVacationSectionCard};
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.90.0 */
|
||||
import{a as g,b as y}from"./chunk-MSGNUEIB.js";import"./chunk-R3EVJQWN.js";import{B as o,a as h,b as r,d as c,e as _,f as v,g as n,i as e,j as f,k as m,m as b}from"./chunk-UI7IMFM7.js";import{a as i}from"./chunk-BR3YZILG.js";var s=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 m(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),f(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),b(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=o(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let a=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=a}catch(a){this._error=o(a,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=o(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang))){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=o(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,a=this._state;if(!a)return r`<ha-card><div class="loading">${e("loading",t)}</div></ha-card>`;let p=a.is_active===!0,d=a.enabled===!0,u=a.exempt_task_ids?.length??0,$=p?e("vacation_status_active",t):d?e("vacation_status_scheduled",t):e("vacation_status_inactive",t),x=p?"active":d?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏖️</span>
|
||||
<span>${this._config.title||e("vacation_mode",t)}</span>
|
||||
</div>
|
||||
<span class="status-pill ${x}">${$}</span>
|
||||
</div>
|
||||
|
||||
${this._error?r`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${this._isAdmin?r`
|
||||
<div class="row toggle-row">
|
||||
<label>${e("enable",t)}</label>
|
||||
<ha-switch
|
||||
.checked=${d}
|
||||
.disabled=${this._busy}
|
||||
@change=${l=>this._toggleEnabled(l.target.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
|
||||
<div class="dates-row">
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_start",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localStart}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${l=>{this._localStart=l.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field">
|
||||
<label>${e("vacation_end",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localEnd}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${l=>{this._localEnd=l.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field buffer">
|
||||
<label>${e("vacation_buffer",t)}</label>
|
||||
<input type="number" min="0" max="14"
|
||||
.value=${String(this._localBuffer)}
|
||||
?disabled=${this._busy}
|
||||
@input=${l=>{this._localBuffer=parseInt(l.target.value,10)||0,this._dirty=!0}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?e("save",t):e("saved",t)}
|
||||
</button>
|
||||
${p?r`<button class="btn"
|
||||
@click=${this._endNow}
|
||||
?disabled=${this._busy}>
|
||||
${e("vacation_end_now",t)}
|
||||
</button>`:c}
|
||||
${u>0?r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${u} ${e("vacation_exempt_count",t)}…
|
||||
</button>`:r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${e("vacation_advanced",t)}
|
||||
</button>`}
|
||||
</div>
|
||||
`:r`
|
||||
<div class="readonly">
|
||||
${d&&a.start&&a.end?r`<div>${a.start} → ${a.end}</div>`:c}
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${e("vacation_open_panel",t)}
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};s.styles=[y,h`
|
||||
.status-pill {
|
||||
font-size: 11px; font-weight: 600;
|
||||
padding: 3px 8px; border-radius: 999px;
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.status-pill.active {
|
||||
background: rgba(76, 175, 80, 0.15);
|
||||
color: #4caf50;
|
||||
}
|
||||
.status-pill.scheduled {
|
||||
background: rgba(255, 152, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
.status-pill.inactive {
|
||||
background: rgba(158, 158, 158, 0.15);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.row.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.row.toggle-row label {
|
||||
font-size: 14px; color: var(--primary-text-color);
|
||||
}
|
||||
.dates-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
||||
}
|
||||
.date-field.buffer label { white-space: nowrap; }
|
||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.date-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.date-field input {
|
||||
padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.actions {
|
||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
||||
}
|
||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
||||
`],i([v({attribute:!1})],s.prototype,"hass",2),i([n()],s.prototype,"_config",2),i([n()],s.prototype,"_state",2),i([n()],s.prototype,"_busy",2),i([n()],s.prototype,"_error",2),i([n()],s.prototype,"_localStart",2),i([n()],s.prototype,"_localEnd",2),i([n()],s.prototype,"_localBuffer",2),i([n()],s.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",s);g({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Inline vacation mode toggle + dates",preview:!1});export{s as MaintenanceVacationSectionCard};
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
/*! maintenance_supporter frontend 2.95.0 */
|
||||
import{a as y,b as x}from"./chunk-IWH6LGYJ.js";import"./chunk-N5LSMQW7.js";import{b as p,j as $}from"./chunk-6BHUADHJ.js";import{a as v,b as r,d as c,e as f,f as m,g as n,i as b,j as g,z as u}from"./chunk-2ARNLSF6.js";import{a as s,g as a,i as h}from"./chunk-3MSNNIFG.js";var i=class extends f{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return g(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),b(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),h(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="emoji">🏖️</span>
|
||||
<span>${this._config.title||a("vacation_mode",t)}</span>
|
||||
</div>
|
||||
<span class="status-pill ${k}">${w}</span>
|
||||
</div>
|
||||
|
||||
${this._error?r`<div class="error">${this._error}</div>`:c}
|
||||
|
||||
${this._isAdmin?r`
|
||||
<div class="row toggle-row">
|
||||
<label>${a("enable",t)}</label>
|
||||
<ha-switch
|
||||
.checked=${l}
|
||||
.disabled=${this._busy}
|
||||
@change=${d=>this._toggleEnabled(d.target.checked)}
|
||||
></ha-switch>
|
||||
</div>
|
||||
|
||||
<div class="dates-row">
|
||||
<div class="date-field">
|
||||
<label>${a("vacation_start",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localStart}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${d=>{this._localStart=d.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field">
|
||||
<label>${a("vacation_end",t)}</label>
|
||||
<ms-date-field
|
||||
kind="date"
|
||||
clearable
|
||||
.hass=${this.hass}
|
||||
.lang=${t}
|
||||
.value=${this._localEnd}
|
||||
.disabled=${this._busy}
|
||||
@value-changed=${d=>{this._localEnd=d.detail.value,this._dirty=!0}}
|
||||
></ms-date-field>
|
||||
</div>
|
||||
<div class="date-field buffer">
|
||||
<label>${a("vacation_buffer",t)}</label>
|
||||
<input type="number" min=${p[0]} max=${p[1]}
|
||||
.value=${this._localBuffer}
|
||||
?disabled=${this._busy}
|
||||
@input=${d=>{this._localBuffer=d.target.value,this._dirty=!0}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn ${this._dirty?"primary":"muted"}"
|
||||
@click=${this._save}
|
||||
?disabled=${this._busy||!this._dirty}>
|
||||
<ha-icon icon="${this._dirty?"mdi:content-save":"mdi:check"}"></ha-icon>
|
||||
${this._dirty?a("save",t):a("saved",t)}
|
||||
</button>
|
||||
${o?r`<button class="btn"
|
||||
@click=${this._endNow}
|
||||
?disabled=${this._busy}>
|
||||
${a("vacation_end_now",t)}
|
||||
</button>`:c}
|
||||
${_>0?r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${_} ${a("vacation_exempt_count",t)}…
|
||||
</button>`:r`<button class="btn link"
|
||||
@click=${this._onDeepLink}>
|
||||
${a("vacation_advanced",t)}
|
||||
</button>`}
|
||||
</div>
|
||||
`:r`
|
||||
<div class="readonly">
|
||||
${l&&e.start&&e.end?r`<div>${e.start} → ${e.end}</div>`:c}
|
||||
<button class="btn link" @click=${this._onDeepLink}>
|
||||
${a("vacation_open_panel",t)}
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};i.styles=[x,v`
|
||||
.status-pill {
|
||||
font-size: 11px; font-weight: 600;
|
||||
padding: 3px 8px; border-radius: 999px;
|
||||
text-transform: uppercase; letter-spacing: 0.5px;
|
||||
}
|
||||
.status-pill.active {
|
||||
background: rgba(76, 175, 80, 0.15);
|
||||
color: #4caf50;
|
||||
}
|
||||
.status-pill.scheduled {
|
||||
background: rgba(255, 152, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
.status-pill.inactive {
|
||||
background: rgba(158, 158, 158, 0.15);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.row.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
.row.toggle-row label {
|
||||
font-size: 14px; color: var(--primary-text-color);
|
||||
}
|
||||
.dates-row {
|
||||
display: grid; grid-template-columns: 1fr 1fr 100px; gap: 10px;
|
||||
}
|
||||
.date-field.buffer label { white-space: nowrap; }
|
||||
.date-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.date-field label {
|
||||
font-size: 11px; color: var(--secondary-text-color);
|
||||
text-transform: uppercase; letter-spacing: 0.3px;
|
||||
}
|
||||
.date-field input {
|
||||
padding: 6px 8px; font-size: 13px;
|
||||
background: var(--secondary-background-color, #2c2c2c);
|
||||
color: var(--primary-text-color);
|
||||
border: 1px solid var(--divider-color); border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.date-field input:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.actions {
|
||||
display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
|
||||
}
|
||||
.readonly { display: flex; flex-direction: column; gap: 8px; }
|
||||
`],s([m({attribute:!1})],i.prototype,"hass",2),s([n()],i.prototype,"_config",2),s([n()],i.prototype,"_state",2),s([n()],i.prototype,"_busy",2),s([n()],i.prototype,"_error",2),s([n()],i.prototype,"_localStart",2),s([n()],i.prototype,"_localEnd",2),s([n()],i.prototype,"_localBuffer",2),s([n()],i.prototype,"_dirty",2);customElements.get("maintenance-vacation-section-card")||customElements.define("maintenance-vacation-section-card",i);y({type:"maintenance-vacation-section-card",name:"Maintenance Supporter \u2014 Vacation",description:"Switch vacation mode on or off and set its dates right on the dashboard.",preview:!1});export{i as MaintenanceVacationSectionCard};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.96.0 */
|
||||
import{a as y,b as x}from"./chunk-LKMEBXIJ.js";import"./chunk-SUKVNZGX.js";import{b as p,k as $}from"./chunk-CTWCZMNP.js";import{A as u,a as v,b as r,d as c,e as f,f as m,g as n,i as b,j as g}from"./chunk-V2H6N4AC.js";import{a as s,g as a,i as h}from"./chunk-RGIYRWN4.js";var i=class extends f{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return g(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),b(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),h(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
/*! maintenance_supporter frontend 2.97.1 */
|
||||
import{a as y,b as x}from"./chunk-GN5JMQ24.js";import"./chunk-6RSHEGAW.js";import{b as p,k as $}from"./chunk-GDJJTBLT.js";import{A as u,a as v,b as r,d as c,e as f,f as m,g as n,i as b,j as g}from"./chunk-XR5IXJXS.js";import{a as s,g as a,i as h}from"./chunk-G7Y44K4C.js";var i=class extends f{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return g(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),b(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),h(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
Reference in new issue
Block a user