myio-js-library 0.1.580 → 0.1.581

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -989,7 +989,7 @@ module.exports = __toCommonJS(src_exports);
989
989
  // package.json
990
990
  var package_default = {
991
991
  name: "myio-js-library",
992
- version: "0.1.580",
992
+ version: "0.1.581",
993
993
  description: "A clean, standalone JS SDK for MYIO projects",
994
994
  license: "MIT",
995
995
  repository: "github:gh-myio/myio-js-library",
@@ -21082,10 +21082,18 @@ function indicatorStateText(ind, short = false) {
21082
21082
  if (ind.kind === "valve") return ind.active ? short ? "Aberta" : "aberta" : short ? "Fechada" : "fechada";
21083
21083
  return ind.active ? short ? "Ligada" : "ligada" : short ? "Deslig." : "desligada";
21084
21084
  }
21085
+ var SHORT_TAG_MAX = 4;
21086
+ function indicatorTag(ind) {
21087
+ const label = String(ind?.label ?? "").trim();
21088
+ return label && label.length <= SHORT_TAG_MAX && !/\s/.test(label) ? label : String(ind?.code ?? "");
21089
+ }
21085
21090
  function indicatorTitle(ind) {
21086
21091
  const profile = ind.deviceProfile ? ` (${ind.deviceProfile})` : "";
21087
21092
  const since = ind.since ? ` desde ${formatClock(ind.since)}` : "";
21088
- return `${ind.code} \xB7 ${ind.label}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
21093
+ const tag = indicatorTag(ind);
21094
+ const name = String(ind.label ?? "").trim();
21095
+ const head = name && name !== tag ? `${tag} \xB7 ${name}` : tag;
21096
+ return `${head}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
21089
21097
  }
21090
21098
  function ensureEquipmentIndicatorStyles() {
21091
21099
  if (typeof document === "undefined" || document.getElementById(STYLE_ID4)) return;
@@ -21140,7 +21148,8 @@ function ensureEquipmentIndicatorStyles() {
21140
21148
  function renderEquipmentStripHTML(indicators) {
21141
21149
  return (indicators || []).map((ind) => {
21142
21150
  const cls = indicatorStateClass(ind);
21143
- const content = ind.kind === "valve" && ind.code.length <= 1 ? VALVE_SVG : escapeHtml2(ind.code);
21151
+ const tag = indicatorTag(ind);
21152
+ const content = ind.kind === "valve" && tag.length <= 1 ? VALVE_SVG : escapeHtml2(tag);
21144
21153
  return `<span class="myio-eq-b ${cls}" data-code="${escapeHtml2(ind.code)}" title="${escapeHtml2(indicatorTitle(ind))}">${content}</span>`;
21145
21154
  }).join("");
21146
21155
  }
@@ -21165,12 +21174,12 @@ function renderEquipmentTilesHTML(indicators) {
21165
21174
  if (!indicators?.length) return "";
21166
21175
  return `<div class="myio-eq-tiles">${indicators.map((ind) => {
21167
21176
  const cls = indicatorStateClass(ind);
21168
- return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(ind.code)}</b><small>${indicatorStateText(ind, true)}</small></div>`;
21177
+ return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(indicatorTag(ind))}</b><small>${indicatorStateText(ind, true)}</small></div>`;
21169
21178
  }).join("")}</div>`;
21170
21179
  }
21171
21180
  function renderEquipmentShortcutHTML(indicators, label = "Bombas") {
21172
21181
  const anyOn = (indicators || []).some((i) => i.kind === "pump" && i.active === true);
21173
- return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(ind.code)}</i>`).join("");
21182
+ return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(indicatorTag(ind))}</i>`).join("");
21174
21183
  }
21175
21184
 
21176
21185
  // src/components/financial-goals/moneyFormat.ts
@@ -64026,11 +64035,13 @@ var WellEquipmentTab = class {
64026
64035
  <label for="wet-b2-device">Bomba B2</label>${options("pump", "B2", binding(this.bindings.pumps, "B2"))}${labelInput("B2", binding(this.bindings.pumps, "B2"))}
64027
64036
  <label for="wet-s-device">Solenoide S</label>${options("valve", "S", binding(this.bindings.valves, "S"))}${labelInput("S", binding(this.bindings.valves, "S"))}
64028
64037
  </div>
64038
+ <p class="wet-hint">R\xF3tulos com at\xE9 4 caracteres (ex.: B3) aparecem no card no lugar de B1/B2/S.</p>
64029
64039
  <p id="wet-message" class="wet-message" role="status" aria-live="polite"></p>
64030
64040
  <button type="button" id="wet-save" ${this.loaded ? "" : "disabled"}>Salvar v\xEDnculos</button>
64031
64041
  </section>
64032
64042
  <style>
64033
64043
  .wet-tab{padding:24px;color:#374151}.wet-grid{display:grid;grid-template-columns:130px minmax(180px,1fr) minmax(180px,1fr);gap:12px;align-items:center}
64044
+ .wet-hint{margin:12px 0 0;font-size:12px;color:#6b7280}
64034
64045
  .wet-grid label{font-weight:600}.wet-grid select,.wet-grid input{box-sizing:border-box;width:100%;min-height:38px;padding:7px 9px;border:1px solid #d1d5db;border-radius:6px;background:white}
64035
64046
  #wet-save{margin-top:18px;padding:9px 16px;border:0;border-radius:6px;background:#2563eb;color:white;font-weight:600;cursor:pointer}
64036
64047
  #wet-save:disabled{opacity:.6;cursor:wait}.wet-message{min-height:20px;margin:12px 0 0}.wet-message.wet-error,.wet-error{color:#b91c1c}.wet-message.wet-success{color:#15803d}.wet-state{text-align:center;padding:30px;color:#6b7280}
@@ -64132,7 +64143,8 @@ var WellEquipmentTab = class {
64132
64143
  // src/components/premium-modals/settings/retrolavagem/RetrolavagemTab.ts
64133
64144
  var RETROLAVAGEM_PROFILE = "HIDROMETRO_ENTRADA_RETROLAVAGEM";
64134
64145
  var RETROLAVAGEM_BINDINGS_KEY = "retrolavagemBindings";
64135
- var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 10;
64146
+ var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 5;
64147
+ var RETROLAVAGEM_LEGACY_MAX_PER_SIDE = 10;
64136
64148
  var MAX_CUSTOMER_DEVICE_PAGES2 = 100;
64137
64149
  var SIDE_TEXT = {
64138
64150
  inputs: { title: "Entrada", add: "+ Adicionar entrada", hint: "Hidr\xF4metros que medem a \xE1gua que entra na retrolavagem." },
@@ -64162,7 +64174,7 @@ function normalizeRetrolavagemBindings(value) {
64162
64174
  }
64163
64175
  const raw = parsed && typeof parsed === "object" ? parsed : {};
64164
64176
  const seen = /* @__PURE__ */ new Set();
64165
- const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, MAX_RETROLAVAGEM_DEVICES_PER_SIDE).map((item) => ({
64177
+ const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, RETROLAVAGEM_LEGACY_MAX_PER_SIDE).map((item) => ({
64166
64178
  tbId: item.tbId,
64167
64179
  label: String(item.label || item.tbId),
64168
64180
  ...item.gcdrId ? { gcdrId: String(item.gcdrId) } : {}
@@ -64269,6 +64281,7 @@ var RetrolavagemTab = class {
64269
64281
  const text2 = SIDE_TEXT[side];
64270
64282
  const rows = this.rows[side];
64271
64283
  const full = rows.length >= MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
64284
+ const excess = rows.length - MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
64272
64285
  const options = (current) => {
64273
64286
  const missing = current && !this.catalog.some((o) => o.tbId === current) ? `<option value="${escapeHtml7(current)}" selected data-unavailable="true">V\xEDnculo atual indispon\xEDvel \u2014 ${escapeHtml7(
64274
64287
  this.storedRef(current)?.label || current
@@ -64281,6 +64294,7 @@ var RetrolavagemTab = class {
64281
64294
  <fieldset class="rlt-side" data-side="${side}">
64282
64295
  <legend>${text2.title} <span class="rlt-count">${rows.length}/${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}</span></legend>
64283
64296
  <p class="rlt-hint">${text2.hint}</p>
64297
+ ${excess > 0 ? `<p class="rlt-over" role="alert">Esta retrolavagem tem ${rows.length} hidr\xF4metros de ${text2.title.toLowerCase()}, acima do limite de ${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}. O painel continua somando todos. Remova ${excess} para poder salvar.</p>` : ""}
64284
64298
  ${rows.length ? rows.map(
64285
64299
  (tbId, i) => `<div class="rlt-row">
64286
64300
  <select data-side="${side}" data-index="${i}" aria-label="${text2.title} ${i + 1}">${options(tbId)}</select>
@@ -64306,6 +64320,7 @@ var RetrolavagemTab = class {
64306
64320
  .rlt-side{border:1px solid #e5e7eb;border-radius:8px;padding:12px 14px;margin:0}.rlt-side legend{font-weight:700;padding:0 6px}
64307
64321
  .rlt-count{font-weight:500;color:#6b7280;font-size:12px}.rlt-hint,.rlt-empty,.rlt-note{margin:0 0 10px;font-size:13px;color:#6b7280}
64308
64322
  .rlt-note{background:#f1ecfa;color:#3e1a7d;border-radius:6px;padding:8px 10px}
64323
+ .rlt-over{margin:0 0 10px;font-size:13px;color:#92400e;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;padding:8px 10px}
64309
64324
  .rlt-row{display:flex;gap:8px;margin-bottom:8px}.rlt-row select{flex:1;min-width:0;min-height:36px;padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;background:#fff}
64310
64325
  .rlt-remove{border:1px solid #d1d5db;background:#fff;border-radius:6px;padding:0 10px;cursor:pointer;color:#6b7280}
64311
64326
  .rlt-add{border:1px dashed #9ca3af;background:#fff;border-radius:6px;padding:7px 12px;cursor:pointer;color:#374151;font-weight:600}
@@ -66217,10 +66232,14 @@ var SettingsModalView = class _SettingsModalView {
66217
66232
  isWellEquipmentDevice() {
66218
66233
  return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
66219
66234
  }
66220
- /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída (aba só para SuperAdmin). */
66235
+ /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída. */
66221
66236
  isRetrolavagemDevice() {
66222
66237
  return String(this.config.deviceProfile || "").toUpperCase() === RETROLAVAGEM_PROFILE;
66223
66238
  }
66239
+ /** Permissão de configuração: SuperAdmin ou administrador da holding já validado pelo host. */
66240
+ canManageRetrolavagem() {
66241
+ return this.isSuperAdmin() || this.config.holdingAdmin === true;
66242
+ }
66224
66243
  render(initialData) {
66225
66244
  this.originalActiveElement = document.activeElement;
66226
66245
  document.body.appendChild(this.container);
@@ -66256,7 +66275,7 @@ var SettingsModalView = class _SettingsModalView {
66256
66275
  if (this.isWellEquipmentDevice() && this.isSuperAdmin()) {
66257
66276
  this.initWellEquipmentTab();
66258
66277
  }
66259
- if (this.isRetrolavagemDevice() && this.isSuperAdmin()) {
66278
+ if (this.isRetrolavagemDevice() && this.canManageRetrolavagem()) {
66260
66279
  this.initRetrolavagemTab();
66261
66280
  }
66262
66281
  if (this.config.isGateway && this.isSuperAdmin()) {
@@ -66538,7 +66557,7 @@ var SettingsModalView = class _SettingsModalView {
66538
66557
  }
66539
66558
  async initRetrolavagemTab() {
66540
66559
  const container = this.modal.querySelector("#retrolavagem-tab-content");
66541
- if (!container || !this.isRetrolavagemDevice() || !this.isSuperAdmin()) return;
66560
+ if (!container || !this.isRetrolavagemDevice() || !this.canManageRetrolavagem()) return;
66542
66561
  const customerId = this.config.customerId || window.MyIOUtils?.customerTB_ID;
66543
66562
  const { deviceId, jwtToken, tbBaseUrl } = this.config;
66544
66563
  if (!deviceId || !jwtToken || !customerId) {
@@ -66806,7 +66825,7 @@ var SettingsModalView = class _SettingsModalView {
66806
66825
  </svg>
66807
66826
  Equipamentos do Po\xE7o
66808
66827
  </button>` : ""}
66809
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
66828
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
66810
66829
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
66811
66830
  <path d="M3 12h7M14 12h7"></path>
66812
66831
  <path d="M7 8l-4 4 4 4"></path>
@@ -66871,7 +66890,7 @@ var SettingsModalView = class _SettingsModalView {
66871
66890
  ${this.isWellEquipmentDevice() && this.isSuperAdmin() ? `<div id="well-equipment-tab-content" class="tab-content" style="display:none;">
66872
66891
  <p class="wet-state">Carregando v\xEDnculos e equipamentos\u2026</p>
66873
66892
  </div>` : ""}
66874
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
66893
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
66875
66894
  <p class="rlt-state">Carregando v\xEDnculos e hidr\xF4metros\u2026</p>
66876
66895
  </div>` : ""}
66877
66896
  <!-- RFC-0232: Incidentes (interpola\xE7\xE3o) Tab Content \u2014 central + admin MyIO only.
@@ -80879,6 +80898,12 @@ function timelineHTML(history, now, kind) {
80879
80898
  <small><span>${formatClock(now - DAY_MS)}</span><span>agora</span></small>
80880
80899
  </div>`;
80881
80900
  }
80901
+ function equipmentNameHTML(item, fallbackProfile) {
80902
+ const tag = indicatorTag(item);
80903
+ const label = String(item.label ?? "").trim();
80904
+ const name = label && label !== tag ? label : item.identifier || item.deviceProfile || fallbackProfile;
80905
+ return `<span class="myio-wp-tag">${escapeHtml2(tag)}</span>${escapeHtml2(name)}`;
80906
+ }
80882
80907
  function pumpCardHTML(p, now, images, focusWellId) {
80883
80908
  const on = isActive(p.history);
80884
80909
  const known = Array.isArray(p.history);
@@ -80895,7 +80920,7 @@ function pumpCardHTML(p, now, images, focusWellId) {
80895
80920
  <div class="myio-wp-top">
80896
80921
  <img class="myio-wp-img" src="${escapeHtml2(images.pump)}" alt="">
80897
80922
  <div>
80898
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(p.code)}</span>${escapeHtml2(p.label)}</div>
80923
+ <div class="myio-wp-name">${equipmentNameHTML(p, "BOMBA_POCO")}</div>
80899
80924
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(p.deviceProfile || "BOMBA_POCO")}</span>${meta}</div>
80900
80925
  </div>
80901
80926
  <span class="myio-wp-state ${!known ? "unk" : on ? "on" : "off"}">${PUMP_SVG}${!known ? "SEM LEITURA" : on ? "LIGADA" : "DESLIGADA"}</span>
@@ -80925,7 +80950,7 @@ function valveCardHTML(v, now, images) {
80925
80950
  <div style="display:flex;flex-direction:column;gap:10px;min-width:0">
80926
80951
  <div class="myio-wp-top">
80927
80952
  <div>
80928
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(v.code)}</span>${escapeHtml2(v.label)}</div>
80953
+ <div class="myio-wp-name">${equipmentNameHTML(v, "SOLENOIDE")}</div>
80929
80954
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(v.deviceProfile || "SOLENOIDE")}</span>${meta}</div>
80930
80955
  </div>
80931
80956
  <span class="myio-wp-state ${!known ? "unk" : open ? "open" : "closed"}">${VALVE_SVG}${!known ? "SEM LEITURA" : open ? "ABERTA" : "FECHADA"}</span>
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  // package.json
11
11
  var package_default = {
12
12
  name: "myio-js-library",
13
- version: "0.1.580",
13
+ version: "0.1.581",
14
14
  description: "A clean, standalone JS SDK for MYIO projects",
15
15
  license: "MIT",
16
16
  repository: "github:gh-myio/myio-js-library",
@@ -19378,10 +19378,18 @@ function indicatorStateText(ind, short = false) {
19378
19378
  if (ind.kind === "valve") return ind.active ? short ? "Aberta" : "aberta" : short ? "Fechada" : "fechada";
19379
19379
  return ind.active ? short ? "Ligada" : "ligada" : short ? "Deslig." : "desligada";
19380
19380
  }
19381
+ var SHORT_TAG_MAX = 4;
19382
+ function indicatorTag(ind) {
19383
+ const label = String(ind?.label ?? "").trim();
19384
+ return label && label.length <= SHORT_TAG_MAX && !/\s/.test(label) ? label : String(ind?.code ?? "");
19385
+ }
19381
19386
  function indicatorTitle(ind) {
19382
19387
  const profile = ind.deviceProfile ? ` (${ind.deviceProfile})` : "";
19383
19388
  const since = ind.since ? ` desde ${formatClock(ind.since)}` : "";
19384
- return `${ind.code} \xB7 ${ind.label}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
19389
+ const tag = indicatorTag(ind);
19390
+ const name = String(ind.label ?? "").trim();
19391
+ const head = name && name !== tag ? `${tag} \xB7 ${name}` : tag;
19392
+ return `${head}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
19385
19393
  }
19386
19394
  function ensureEquipmentIndicatorStyles() {
19387
19395
  if (typeof document === "undefined" || document.getElementById(STYLE_ID4)) return;
@@ -19436,7 +19444,8 @@ function ensureEquipmentIndicatorStyles() {
19436
19444
  function renderEquipmentStripHTML(indicators) {
19437
19445
  return (indicators || []).map((ind) => {
19438
19446
  const cls = indicatorStateClass(ind);
19439
- const content = ind.kind === "valve" && ind.code.length <= 1 ? VALVE_SVG : escapeHtml2(ind.code);
19447
+ const tag = indicatorTag(ind);
19448
+ const content = ind.kind === "valve" && tag.length <= 1 ? VALVE_SVG : escapeHtml2(tag);
19440
19449
  return `<span class="myio-eq-b ${cls}" data-code="${escapeHtml2(ind.code)}" title="${escapeHtml2(indicatorTitle(ind))}">${content}</span>`;
19441
19450
  }).join("");
19442
19451
  }
@@ -19461,12 +19470,12 @@ function renderEquipmentTilesHTML(indicators) {
19461
19470
  if (!indicators?.length) return "";
19462
19471
  return `<div class="myio-eq-tiles">${indicators.map((ind) => {
19463
19472
  const cls = indicatorStateClass(ind);
19464
- return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(ind.code)}</b><small>${indicatorStateText(ind, true)}</small></div>`;
19473
+ return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(indicatorTag(ind))}</b><small>${indicatorStateText(ind, true)}</small></div>`;
19465
19474
  }).join("")}</div>`;
19466
19475
  }
19467
19476
  function renderEquipmentShortcutHTML(indicators, label = "Bombas") {
19468
19477
  const anyOn = (indicators || []).some((i) => i.kind === "pump" && i.active === true);
19469
- return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(ind.code)}</i>`).join("");
19478
+ return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(indicatorTag(ind))}</i>`).join("");
19470
19479
  }
19471
19480
 
19472
19481
  // src/components/financial-goals/moneyFormat.ts
@@ -62322,11 +62331,13 @@ var WellEquipmentTab = class {
62322
62331
  <label for="wet-b2-device">Bomba B2</label>${options("pump", "B2", binding(this.bindings.pumps, "B2"))}${labelInput("B2", binding(this.bindings.pumps, "B2"))}
62323
62332
  <label for="wet-s-device">Solenoide S</label>${options("valve", "S", binding(this.bindings.valves, "S"))}${labelInput("S", binding(this.bindings.valves, "S"))}
62324
62333
  </div>
62334
+ <p class="wet-hint">R\xF3tulos com at\xE9 4 caracteres (ex.: B3) aparecem no card no lugar de B1/B2/S.</p>
62325
62335
  <p id="wet-message" class="wet-message" role="status" aria-live="polite"></p>
62326
62336
  <button type="button" id="wet-save" ${this.loaded ? "" : "disabled"}>Salvar v\xEDnculos</button>
62327
62337
  </section>
62328
62338
  <style>
62329
62339
  .wet-tab{padding:24px;color:#374151}.wet-grid{display:grid;grid-template-columns:130px minmax(180px,1fr) minmax(180px,1fr);gap:12px;align-items:center}
62340
+ .wet-hint{margin:12px 0 0;font-size:12px;color:#6b7280}
62330
62341
  .wet-grid label{font-weight:600}.wet-grid select,.wet-grid input{box-sizing:border-box;width:100%;min-height:38px;padding:7px 9px;border:1px solid #d1d5db;border-radius:6px;background:white}
62331
62342
  #wet-save{margin-top:18px;padding:9px 16px;border:0;border-radius:6px;background:#2563eb;color:white;font-weight:600;cursor:pointer}
62332
62343
  #wet-save:disabled{opacity:.6;cursor:wait}.wet-message{min-height:20px;margin:12px 0 0}.wet-message.wet-error,.wet-error{color:#b91c1c}.wet-message.wet-success{color:#15803d}.wet-state{text-align:center;padding:30px;color:#6b7280}
@@ -62428,7 +62439,8 @@ var WellEquipmentTab = class {
62428
62439
  // src/components/premium-modals/settings/retrolavagem/RetrolavagemTab.ts
62429
62440
  var RETROLAVAGEM_PROFILE = "HIDROMETRO_ENTRADA_RETROLAVAGEM";
62430
62441
  var RETROLAVAGEM_BINDINGS_KEY = "retrolavagemBindings";
62431
- var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 10;
62442
+ var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 5;
62443
+ var RETROLAVAGEM_LEGACY_MAX_PER_SIDE = 10;
62432
62444
  var MAX_CUSTOMER_DEVICE_PAGES2 = 100;
62433
62445
  var SIDE_TEXT = {
62434
62446
  inputs: { title: "Entrada", add: "+ Adicionar entrada", hint: "Hidr\xF4metros que medem a \xE1gua que entra na retrolavagem." },
@@ -62458,7 +62470,7 @@ function normalizeRetrolavagemBindings(value) {
62458
62470
  }
62459
62471
  const raw = parsed && typeof parsed === "object" ? parsed : {};
62460
62472
  const seen = /* @__PURE__ */ new Set();
62461
- const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, MAX_RETROLAVAGEM_DEVICES_PER_SIDE).map((item) => ({
62473
+ const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, RETROLAVAGEM_LEGACY_MAX_PER_SIDE).map((item) => ({
62462
62474
  tbId: item.tbId,
62463
62475
  label: String(item.label || item.tbId),
62464
62476
  ...item.gcdrId ? { gcdrId: String(item.gcdrId) } : {}
@@ -62565,6 +62577,7 @@ var RetrolavagemTab = class {
62565
62577
  const text2 = SIDE_TEXT[side];
62566
62578
  const rows = this.rows[side];
62567
62579
  const full = rows.length >= MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
62580
+ const excess = rows.length - MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
62568
62581
  const options = (current) => {
62569
62582
  const missing = current && !this.catalog.some((o) => o.tbId === current) ? `<option value="${escapeHtml7(current)}" selected data-unavailable="true">V\xEDnculo atual indispon\xEDvel \u2014 ${escapeHtml7(
62570
62583
  this.storedRef(current)?.label || current
@@ -62577,6 +62590,7 @@ var RetrolavagemTab = class {
62577
62590
  <fieldset class="rlt-side" data-side="${side}">
62578
62591
  <legend>${text2.title} <span class="rlt-count">${rows.length}/${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}</span></legend>
62579
62592
  <p class="rlt-hint">${text2.hint}</p>
62593
+ ${excess > 0 ? `<p class="rlt-over" role="alert">Esta retrolavagem tem ${rows.length} hidr\xF4metros de ${text2.title.toLowerCase()}, acima do limite de ${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}. O painel continua somando todos. Remova ${excess} para poder salvar.</p>` : ""}
62580
62594
  ${rows.length ? rows.map(
62581
62595
  (tbId, i) => `<div class="rlt-row">
62582
62596
  <select data-side="${side}" data-index="${i}" aria-label="${text2.title} ${i + 1}">${options(tbId)}</select>
@@ -62602,6 +62616,7 @@ var RetrolavagemTab = class {
62602
62616
  .rlt-side{border:1px solid #e5e7eb;border-radius:8px;padding:12px 14px;margin:0}.rlt-side legend{font-weight:700;padding:0 6px}
62603
62617
  .rlt-count{font-weight:500;color:#6b7280;font-size:12px}.rlt-hint,.rlt-empty,.rlt-note{margin:0 0 10px;font-size:13px;color:#6b7280}
62604
62618
  .rlt-note{background:#f1ecfa;color:#3e1a7d;border-radius:6px;padding:8px 10px}
62619
+ .rlt-over{margin:0 0 10px;font-size:13px;color:#92400e;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;padding:8px 10px}
62605
62620
  .rlt-row{display:flex;gap:8px;margin-bottom:8px}.rlt-row select{flex:1;min-width:0;min-height:36px;padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;background:#fff}
62606
62621
  .rlt-remove{border:1px solid #d1d5db;background:#fff;border-radius:6px;padding:0 10px;cursor:pointer;color:#6b7280}
62607
62622
  .rlt-add{border:1px dashed #9ca3af;background:#fff;border-radius:6px;padding:7px 12px;cursor:pointer;color:#374151;font-weight:600}
@@ -64513,10 +64528,14 @@ var SettingsModalView = class _SettingsModalView {
64513
64528
  isWellEquipmentDevice() {
64514
64529
  return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
64515
64530
  }
64516
- /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída (aba só para SuperAdmin). */
64531
+ /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída. */
64517
64532
  isRetrolavagemDevice() {
64518
64533
  return String(this.config.deviceProfile || "").toUpperCase() === RETROLAVAGEM_PROFILE;
64519
64534
  }
64535
+ /** Permissão de configuração: SuperAdmin ou administrador da holding já validado pelo host. */
64536
+ canManageRetrolavagem() {
64537
+ return this.isSuperAdmin() || this.config.holdingAdmin === true;
64538
+ }
64520
64539
  render(initialData) {
64521
64540
  this.originalActiveElement = document.activeElement;
64522
64541
  document.body.appendChild(this.container);
@@ -64552,7 +64571,7 @@ var SettingsModalView = class _SettingsModalView {
64552
64571
  if (this.isWellEquipmentDevice() && this.isSuperAdmin()) {
64553
64572
  this.initWellEquipmentTab();
64554
64573
  }
64555
- if (this.isRetrolavagemDevice() && this.isSuperAdmin()) {
64574
+ if (this.isRetrolavagemDevice() && this.canManageRetrolavagem()) {
64556
64575
  this.initRetrolavagemTab();
64557
64576
  }
64558
64577
  if (this.config.isGateway && this.isSuperAdmin()) {
@@ -64834,7 +64853,7 @@ var SettingsModalView = class _SettingsModalView {
64834
64853
  }
64835
64854
  async initRetrolavagemTab() {
64836
64855
  const container = this.modal.querySelector("#retrolavagem-tab-content");
64837
- if (!container || !this.isRetrolavagemDevice() || !this.isSuperAdmin()) return;
64856
+ if (!container || !this.isRetrolavagemDevice() || !this.canManageRetrolavagem()) return;
64838
64857
  const customerId = this.config.customerId || window.MyIOUtils?.customerTB_ID;
64839
64858
  const { deviceId, jwtToken, tbBaseUrl } = this.config;
64840
64859
  if (!deviceId || !jwtToken || !customerId) {
@@ -65102,7 +65121,7 @@ var SettingsModalView = class _SettingsModalView {
65102
65121
  </svg>
65103
65122
  Equipamentos do Po\xE7o
65104
65123
  </button>` : ""}
65105
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
65124
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
65106
65125
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
65107
65126
  <path d="M3 12h7M14 12h7"></path>
65108
65127
  <path d="M7 8l-4 4 4 4"></path>
@@ -65167,7 +65186,7 @@ var SettingsModalView = class _SettingsModalView {
65167
65186
  ${this.isWellEquipmentDevice() && this.isSuperAdmin() ? `<div id="well-equipment-tab-content" class="tab-content" style="display:none;">
65168
65187
  <p class="wet-state">Carregando v\xEDnculos e equipamentos\u2026</p>
65169
65188
  </div>` : ""}
65170
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
65189
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
65171
65190
  <p class="rlt-state">Carregando v\xEDnculos e hidr\xF4metros\u2026</p>
65172
65191
  </div>` : ""}
65173
65192
  <!-- RFC-0232: Incidentes (interpola\xE7\xE3o) Tab Content \u2014 central + admin MyIO only.
@@ -79175,6 +79194,12 @@ function timelineHTML(history, now, kind) {
79175
79194
  <small><span>${formatClock(now - DAY_MS)}</span><span>agora</span></small>
79176
79195
  </div>`;
79177
79196
  }
79197
+ function equipmentNameHTML(item, fallbackProfile) {
79198
+ const tag = indicatorTag(item);
79199
+ const label = String(item.label ?? "").trim();
79200
+ const name = label && label !== tag ? label : item.identifier || item.deviceProfile || fallbackProfile;
79201
+ return `<span class="myio-wp-tag">${escapeHtml2(tag)}</span>${escapeHtml2(name)}`;
79202
+ }
79178
79203
  function pumpCardHTML(p, now, images, focusWellId) {
79179
79204
  const on = isActive(p.history);
79180
79205
  const known = Array.isArray(p.history);
@@ -79191,7 +79216,7 @@ function pumpCardHTML(p, now, images, focusWellId) {
79191
79216
  <div class="myio-wp-top">
79192
79217
  <img class="myio-wp-img" src="${escapeHtml2(images.pump)}" alt="">
79193
79218
  <div>
79194
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(p.code)}</span>${escapeHtml2(p.label)}</div>
79219
+ <div class="myio-wp-name">${equipmentNameHTML(p, "BOMBA_POCO")}</div>
79195
79220
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(p.deviceProfile || "BOMBA_POCO")}</span>${meta}</div>
79196
79221
  </div>
79197
79222
  <span class="myio-wp-state ${!known ? "unk" : on ? "on" : "off"}">${PUMP_SVG}${!known ? "SEM LEITURA" : on ? "LIGADA" : "DESLIGADA"}</span>
@@ -79221,7 +79246,7 @@ function valveCardHTML(v, now, images) {
79221
79246
  <div style="display:flex;flex-direction:column;gap:10px;min-width:0">
79222
79247
  <div class="myio-wp-top">
79223
79248
  <div>
79224
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(v.code)}</span>${escapeHtml2(v.label)}</div>
79249
+ <div class="myio-wp-name">${equipmentNameHTML(v, "SOLENOIDE")}</div>
79225
79250
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(v.deviceProfile || "SOLENOIDE")}</span>${meta}</div>
79226
79251
  </div>
79227
79252
  <span class="myio-wp-state ${!known ? "unk" : open ? "open" : "closed"}">${VALVE_SVG}${!known ? "SEM LEITURA" : open ? "ABERTA" : "FECHADA"}</span>
@@ -5524,7 +5524,7 @@
5524
5524
 
5525
5525
  // package.json
5526
5526
  var package_default = {
5527
- version: "0.1.580"};
5527
+ version: "0.1.581"};
5528
5528
 
5529
5529
  // src/utils/format/energy.ts
5530
5530
  function formatPower(value, decimals = 2) {
@@ -24781,10 +24781,18 @@
24781
24781
  if (ind.kind === "valve") return ind.active ? short ? "Aberta" : "aberta" : short ? "Fechada" : "fechada";
24782
24782
  return ind.active ? short ? "Ligada" : "ligada" : short ? "Deslig." : "desligada";
24783
24783
  }
24784
+ var SHORT_TAG_MAX = 4;
24785
+ function indicatorTag(ind) {
24786
+ const label = String(ind?.label ?? "").trim();
24787
+ return label && label.length <= SHORT_TAG_MAX && !/\s/.test(label) ? label : String(ind?.code ?? "");
24788
+ }
24784
24789
  function indicatorTitle(ind) {
24785
24790
  const profile = ind.deviceProfile ? ` (${ind.deviceProfile})` : "";
24786
24791
  const since = ind.since ? ` desde ${formatClock(ind.since)}` : "";
24787
- return `${ind.code} \xB7 ${ind.label}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
24792
+ const tag = indicatorTag(ind);
24793
+ const name = String(ind.label ?? "").trim();
24794
+ const head = name && name !== tag ? `${tag} \xB7 ${name}` : tag;
24795
+ return `${head}${profile}: ${indicatorStateText(ind)}${ind.active === null || ind.active === void 0 ? "" : since}`;
24788
24796
  }
24789
24797
  function ensureEquipmentIndicatorStyles() {
24790
24798
  if (typeof document === "undefined" || document.getElementById(STYLE_ID4)) return;
@@ -24839,7 +24847,8 @@
24839
24847
  function renderEquipmentStripHTML(indicators) {
24840
24848
  return (indicators || []).map((ind) => {
24841
24849
  const cls = indicatorStateClass(ind);
24842
- const content = ind.kind === "valve" && ind.code.length <= 1 ? VALVE_SVG : escapeHtml2(ind.code);
24850
+ const tag = indicatorTag(ind);
24851
+ const content = ind.kind === "valve" && tag.length <= 1 ? VALVE_SVG : escapeHtml2(tag);
24843
24852
  return `<span class="myio-eq-b ${cls}" data-code="${escapeHtml2(ind.code)}" title="${escapeHtml2(indicatorTitle(ind))}">${content}</span>`;
24844
24853
  }).join("");
24845
24854
  }
@@ -24864,12 +24873,12 @@
24864
24873
  if (!indicators?.length) return "";
24865
24874
  return `<div class="myio-eq-tiles">${indicators.map((ind) => {
24866
24875
  const cls = indicatorStateClass(ind);
24867
- return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(ind.code)}</b><small>${indicatorStateText(ind, true)}</small></div>`;
24876
+ return `<div class="myio-eq-ti ${cls}" title="${escapeHtml2(indicatorTitle(ind))}"><i></i><b>${escapeHtml2(indicatorTag(ind))}</b><small>${indicatorStateText(ind, true)}</small></div>`;
24868
24877
  }).join("")}</div>`;
24869
24878
  }
24870
24879
  function renderEquipmentShortcutHTML(indicators, label = "Bombas") {
24871
24880
  const anyOn = (indicators || []).some((i) => i.kind === "pump" && i.active === true);
24872
- return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(ind.code)}</i>`).join("");
24881
+ return `<span class="${anyOn ? "myio-eq-spin" : ""}" style="display:inline-flex">${PUMP_SVG}</span><span>${escapeHtml2(label)}</span>` + (indicators || []).map((ind) => `<i class="${indicatorStateClass(ind)}">${escapeHtml2(indicatorTag(ind))}</i>`).join("");
24873
24882
  }
24874
24883
 
24875
24884
  // src/components/financial-goals/moneyFormat.ts
@@ -67680,11 +67689,13 @@ ${kpiRows}` : ""}
67680
67689
  <label for="wet-b2-device">Bomba B2</label>${options("pump", "B2", binding(this.bindings.pumps, "B2"))}${labelInput("B2", binding(this.bindings.pumps, "B2"))}
67681
67690
  <label for="wet-s-device">Solenoide S</label>${options("valve", "S", binding(this.bindings.valves, "S"))}${labelInput("S", binding(this.bindings.valves, "S"))}
67682
67691
  </div>
67692
+ <p class="wet-hint">R\xF3tulos com at\xE9 4 caracteres (ex.: B3) aparecem no card no lugar de B1/B2/S.</p>
67683
67693
  <p id="wet-message" class="wet-message" role="status" aria-live="polite"></p>
67684
67694
  <button type="button" id="wet-save" ${this.loaded ? "" : "disabled"}>Salvar v\xEDnculos</button>
67685
67695
  </section>
67686
67696
  <style>
67687
67697
  .wet-tab{padding:24px;color:#374151}.wet-grid{display:grid;grid-template-columns:130px minmax(180px,1fr) minmax(180px,1fr);gap:12px;align-items:center}
67698
+ .wet-hint{margin:12px 0 0;font-size:12px;color:#6b7280}
67688
67699
  .wet-grid label{font-weight:600}.wet-grid select,.wet-grid input{box-sizing:border-box;width:100%;min-height:38px;padding:7px 9px;border:1px solid #d1d5db;border-radius:6px;background:white}
67689
67700
  #wet-save{margin-top:18px;padding:9px 16px;border:0;border-radius:6px;background:#2563eb;color:white;font-weight:600;cursor:pointer}
67690
67701
  #wet-save:disabled{opacity:.6;cursor:wait}.wet-message{min-height:20px;margin:12px 0 0}.wet-message.wet-error,.wet-error{color:#b91c1c}.wet-message.wet-success{color:#15803d}.wet-state{text-align:center;padding:30px;color:#6b7280}
@@ -67786,7 +67797,8 @@ ${kpiRows}` : ""}
67786
67797
  // src/components/premium-modals/settings/retrolavagem/RetrolavagemTab.ts
67787
67798
  var RETROLAVAGEM_PROFILE = "HIDROMETRO_ENTRADA_RETROLAVAGEM";
67788
67799
  var RETROLAVAGEM_BINDINGS_KEY = "retrolavagemBindings";
67789
- var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 10;
67800
+ var MAX_RETROLAVAGEM_DEVICES_PER_SIDE = 5;
67801
+ var RETROLAVAGEM_LEGACY_MAX_PER_SIDE = 10;
67790
67802
  var MAX_CUSTOMER_DEVICE_PAGES2 = 100;
67791
67803
  var SIDE_TEXT = {
67792
67804
  inputs: { title: "Entrada", add: "+ Adicionar entrada", hint: "Hidr\xF4metros que medem a \xE1gua que entra na retrolavagem." },
@@ -67816,7 +67828,7 @@ ${kpiRows}` : ""}
67816
67828
  }
67817
67829
  const raw = parsed && typeof parsed === "object" ? parsed : {};
67818
67830
  const seen = /* @__PURE__ */ new Set();
67819
- const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, MAX_RETROLAVAGEM_DEVICES_PER_SIDE).map((item) => ({
67831
+ const side = (items) => (Array.isArray(items) ? items : []).filter((item) => !!item && typeof item === "object" && typeof item.tbId === "string" && !!item.tbId).filter((item) => seen.has(item.tbId) ? false : (seen.add(item.tbId), true)).slice(0, RETROLAVAGEM_LEGACY_MAX_PER_SIDE).map((item) => ({
67820
67832
  tbId: item.tbId,
67821
67833
  label: String(item.label || item.tbId),
67822
67834
  ...item.gcdrId ? { gcdrId: String(item.gcdrId) } : {}
@@ -67923,6 +67935,7 @@ ${kpiRows}` : ""}
67923
67935
  const text2 = SIDE_TEXT[side];
67924
67936
  const rows = this.rows[side];
67925
67937
  const full = rows.length >= MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
67938
+ const excess = rows.length - MAX_RETROLAVAGEM_DEVICES_PER_SIDE;
67926
67939
  const options = (current) => {
67927
67940
  const missing = current && !this.catalog.some((o) => o.tbId === current) ? `<option value="${escapeHtml7(current)}" selected data-unavailable="true">V\xEDnculo atual indispon\xEDvel \u2014 ${escapeHtml7(
67928
67941
  this.storedRef(current)?.label || current
@@ -67935,6 +67948,7 @@ ${kpiRows}` : ""}
67935
67948
  <fieldset class="rlt-side" data-side="${side}">
67936
67949
  <legend>${text2.title} <span class="rlt-count">${rows.length}/${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}</span></legend>
67937
67950
  <p class="rlt-hint">${text2.hint}</p>
67951
+ ${excess > 0 ? `<p class="rlt-over" role="alert">Esta retrolavagem tem ${rows.length} hidr\xF4metros de ${text2.title.toLowerCase()}, acima do limite de ${MAX_RETROLAVAGEM_DEVICES_PER_SIDE}. O painel continua somando todos. Remova ${excess} para poder salvar.</p>` : ""}
67938
67952
  ${rows.length ? rows.map(
67939
67953
  (tbId, i) => `<div class="rlt-row">
67940
67954
  <select data-side="${side}" data-index="${i}" aria-label="${text2.title} ${i + 1}">${options(tbId)}</select>
@@ -67960,6 +67974,7 @@ ${kpiRows}` : ""}
67960
67974
  .rlt-side{border:1px solid #e5e7eb;border-radius:8px;padding:12px 14px;margin:0}.rlt-side legend{font-weight:700;padding:0 6px}
67961
67975
  .rlt-count{font-weight:500;color:#6b7280;font-size:12px}.rlt-hint,.rlt-empty,.rlt-note{margin:0 0 10px;font-size:13px;color:#6b7280}
67962
67976
  .rlt-note{background:#f1ecfa;color:#3e1a7d;border-radius:6px;padding:8px 10px}
67977
+ .rlt-over{margin:0 0 10px;font-size:13px;color:#92400e;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;padding:8px 10px}
67963
67978
  .rlt-row{display:flex;gap:8px;margin-bottom:8px}.rlt-row select{flex:1;min-width:0;min-height:36px;padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;background:#fff}
67964
67979
  .rlt-remove{border:1px solid #d1d5db;background:#fff;border-radius:6px;padding:0 10px;cursor:pointer;color:#6b7280}
67965
67980
  .rlt-add{border:1px dashed #9ca3af;background:#fff;border-radius:6px;padding:7px 12px;cursor:pointer;color:#374151;font-weight:600}
@@ -69871,10 +69886,14 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
69871
69886
  isWellEquipmentDevice() {
69872
69887
  return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
69873
69888
  }
69874
- /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída (aba só para SuperAdmin). */
69889
+ /** Retrolavagem virtual: escolhe os hidrômetros de entrada e de saída. */
69875
69890
  isRetrolavagemDevice() {
69876
69891
  return String(this.config.deviceProfile || "").toUpperCase() === RETROLAVAGEM_PROFILE;
69877
69892
  }
69893
+ /** Permissão de configuração: SuperAdmin ou administrador da holding já validado pelo host. */
69894
+ canManageRetrolavagem() {
69895
+ return this.isSuperAdmin() || this.config.holdingAdmin === true;
69896
+ }
69878
69897
  render(initialData) {
69879
69898
  this.originalActiveElement = document.activeElement;
69880
69899
  document.body.appendChild(this.container);
@@ -69910,7 +69929,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
69910
69929
  if (this.isWellEquipmentDevice() && this.isSuperAdmin()) {
69911
69930
  this.initWellEquipmentTab();
69912
69931
  }
69913
- if (this.isRetrolavagemDevice() && this.isSuperAdmin()) {
69932
+ if (this.isRetrolavagemDevice() && this.canManageRetrolavagem()) {
69914
69933
  this.initRetrolavagemTab();
69915
69934
  }
69916
69935
  if (this.config.isGateway && this.isSuperAdmin()) {
@@ -70192,7 +70211,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
70192
70211
  }
70193
70212
  async initRetrolavagemTab() {
70194
70213
  const container = this.modal.querySelector("#retrolavagem-tab-content");
70195
- if (!container || !this.isRetrolavagemDevice() || !this.isSuperAdmin()) return;
70214
+ if (!container || !this.isRetrolavagemDevice() || !this.canManageRetrolavagem()) return;
70196
70215
  const customerId = this.config.customerId || window.MyIOUtils?.customerTB_ID;
70197
70216
  const { deviceId, jwtToken, tbBaseUrl } = this.config;
70198
70217
  if (!deviceId || !jwtToken || !customerId) {
@@ -70460,7 +70479,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
70460
70479
  </svg>
70461
70480
  Equipamentos do Po\xE7o
70462
70481
  </button>` : ""}
70463
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
70482
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<button type="button" class="modal-tab" data-tab="retrolavagem">
70464
70483
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
70465
70484
  <path d="M3 12h7M14 12h7"></path>
70466
70485
  <path d="M7 8l-4 4 4 4"></path>
@@ -70525,7 +70544,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
70525
70544
  ${this.isWellEquipmentDevice() && this.isSuperAdmin() ? `<div id="well-equipment-tab-content" class="tab-content" style="display:none;">
70526
70545
  <p class="wet-state">Carregando v\xEDnculos e equipamentos\u2026</p>
70527
70546
  </div>` : ""}
70528
- ${this.isRetrolavagemDevice() && this.isSuperAdmin() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
70547
+ ${this.isRetrolavagemDevice() && this.canManageRetrolavagem() ? `<div id="retrolavagem-tab-content" class="tab-content" style="display:none;">
70529
70548
  <p class="rlt-state">Carregando v\xEDnculos e hidr\xF4metros\u2026</p>
70530
70549
  </div>` : ""}
70531
70550
  <!-- RFC-0232: Incidentes (interpola\xE7\xE3o) Tab Content \u2014 central + admin MyIO only.
@@ -84532,6 +84551,12 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
84532
84551
  <small><span>${formatClock(now - DAY_MS)}</span><span>agora</span></small>
84533
84552
  </div>`;
84534
84553
  }
84554
+ function equipmentNameHTML(item, fallbackProfile) {
84555
+ const tag = indicatorTag(item);
84556
+ const label = String(item.label ?? "").trim();
84557
+ const name = label && label !== tag ? label : item.identifier || item.deviceProfile || fallbackProfile;
84558
+ return `<span class="myio-wp-tag">${escapeHtml2(tag)}</span>${escapeHtml2(name)}`;
84559
+ }
84535
84560
  function pumpCardHTML(p, now, images, focusWellId) {
84536
84561
  const on = isActive(p.history);
84537
84562
  const known = Array.isArray(p.history);
@@ -84548,7 +84573,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
84548
84573
  <div class="myio-wp-top">
84549
84574
  <img class="myio-wp-img" src="${escapeHtml2(images.pump)}" alt="">
84550
84575
  <div>
84551
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(p.code)}</span>${escapeHtml2(p.label)}</div>
84576
+ <div class="myio-wp-name">${equipmentNameHTML(p, "BOMBA_POCO")}</div>
84552
84577
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(p.deviceProfile || "BOMBA_POCO")}</span>${meta}</div>
84553
84578
  </div>
84554
84579
  <span class="myio-wp-state ${!known ? "unk" : on ? "on" : "off"}">${PUMP_SVG}${!known ? "SEM LEITURA" : on ? "LIGADA" : "DESLIGADA"}</span>
@@ -84578,7 +84603,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
84578
84603
  <div style="display:flex;flex-direction:column;gap:10px;min-width:0">
84579
84604
  <div class="myio-wp-top">
84580
84605
  <div>
84581
- <div class="myio-wp-name"><span class="myio-wp-tag">${escapeHtml2(v.code)}</span>${escapeHtml2(v.label)}</div>
84606
+ <div class="myio-wp-name">${equipmentNameHTML(v, "SOLENOIDE")}</div>
84582
84607
  <div class="myio-wp-meta"><span class="myio-wp-prof">${escapeHtml2(v.deviceProfile || "SOLENOIDE")}</span>${meta}</div>
84583
84608
  </div>
84584
84609
  <span class="myio-wp-state ${!known ? "unk" : open ? "open" : "closed"}">${VALVE_SVG}${!known ? "SEM LEITURA" : open ? "ABERTA" : "FECHADA"}</span>