myio-js-library 0.1.203 → 0.1.206

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.
@@ -11830,6 +11830,7 @@
11830
11830
  centralName,
11831
11831
  connectionStatusTime,
11832
11832
  timeVal,
11833
+ lastDisconnectTime,
11833
11834
  customerName,
11834
11835
  waterLevel,
11835
11836
  waterPercentage,
@@ -12794,7 +12795,8 @@
12794
12795
  centralName,
12795
12796
  connectionStatusTime,
12796
12797
  timeVal,
12797
- deviceStatus
12798
+ deviceStatus,
12799
+ lastDisconnectTime
12798
12800
  }
12799
12801
  });
12800
12802
  });
@@ -25469,9 +25471,12 @@
25469
25471
  attachEventListeners() {
25470
25472
  const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
25471
25473
  if (openModalBtn) {
25472
- openModalBtn.onclick = () => {
25474
+ openModalBtn.addEventListener("click", (e) => {
25475
+ e.preventDefault();
25476
+ e.stopPropagation();
25477
+ console.log("[AnnotationsTab] Create button clicked");
25473
25478
  this.showNewAnnotationModal();
25474
- };
25479
+ });
25475
25480
  } else {
25476
25481
  console.warn("[AnnotationsTab] Create button not found");
25477
25482
  }
@@ -41948,24 +41953,25 @@
41948
41953
  <h4>Energia</h4>
41949
41954
  </div>
41950
41955
  <div class="domain-fields">
41951
- <div class="field-group">
41956
+ <div class="field-group field-total">
41952
41957
  <label for="energy_total">Total Contratado</label>
41953
- <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0">
41958
+ <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
41954
41959
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.total}</small>
41960
+ <small class="field-hint">Soma automatica</small>
41955
41961
  </div>
41956
41962
  <div class="field-group">
41957
41963
  <label for="energy_entries">Entradas</label>
41958
- <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0">
41964
+ <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0" data-domain="energy">
41959
41965
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.entries}</small>
41960
41966
  </div>
41961
41967
  <div class="field-group">
41962
41968
  <label for="energy_commonArea">Area Comum</label>
41963
- <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0">
41969
+ <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0" data-domain="energy">
41964
41970
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.commonArea}</small>
41965
41971
  </div>
41966
41972
  <div class="field-group">
41967
41973
  <label for="energy_stores">Lojas</label>
41968
- <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0">
41974
+ <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0" data-domain="energy">
41969
41975
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.stores}</small>
41970
41976
  </div>
41971
41977
  </div>
@@ -41978,24 +41984,25 @@
41978
41984
  <h4>Agua</h4>
41979
41985
  </div>
41980
41986
  <div class="domain-fields">
41981
- <div class="field-group">
41987
+ <div class="field-group field-total">
41982
41988
  <label for="water_total">Total Contratado</label>
41983
- <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0">
41989
+ <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
41984
41990
  <small class="field-key">${DEVICE_COUNT_KEYS.water.total}</small>
41991
+ <small class="field-hint">Soma automatica</small>
41985
41992
  </div>
41986
41993
  <div class="field-group">
41987
41994
  <label for="water_entries">Entradas</label>
41988
- <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0">
41995
+ <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0" data-domain="water">
41989
41996
  <small class="field-key">${DEVICE_COUNT_KEYS.water.entries}</small>
41990
41997
  </div>
41991
41998
  <div class="field-group">
41992
41999
  <label for="water_commonArea">Area Comum</label>
41993
- <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0">
42000
+ <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0" data-domain="water">
41994
42001
  <small class="field-key">${DEVICE_COUNT_KEYS.water.commonArea}</small>
41995
42002
  </div>
41996
42003
  <div class="field-group">
41997
42004
  <label for="water_stores">Lojas</label>
41998
- <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0">
42005
+ <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0" data-domain="water">
41999
42006
  <small class="field-key">${DEVICE_COUNT_KEYS.water.stores}</small>
42000
42007
  </div>
42001
42008
  </div>
@@ -42008,19 +42015,20 @@
42008
42015
  <h4>Temperatura</h4>
42009
42016
  </div>
42010
42017
  <div class="domain-fields">
42011
- <div class="field-group">
42018
+ <div class="field-group field-total">
42012
42019
  <label for="temperature_total">Total Contratado</label>
42013
- <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0">
42020
+ <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42014
42021
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.total}</small>
42022
+ <small class="field-hint">Soma automatica</small>
42015
42023
  </div>
42016
42024
  <div class="field-group">
42017
42025
  <label for="temperature_internal">Sensores Internos</label>
42018
- <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0">
42026
+ <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0" data-domain="temperature">
42019
42027
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.internal}</small>
42020
42028
  </div>
42021
42029
  <div class="field-group">
42022
- <label for="temperature_stores">Lojas</label>
42023
- <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0">
42030
+ <label for="temperature_stores">Sensores Externos</label>
42031
+ <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0" data-domain="temperature">
42024
42032
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.stores}</small>
42025
42033
  </div>
42026
42034
  </div>
@@ -42219,6 +42227,26 @@
42219
42227
  font-family: 'Courier New', monospace;
42220
42228
  }
42221
42229
 
42230
+ .myio-contract-devices-modal .field-hint {
42231
+ font-size: 10px;
42232
+ color: #6c757d;
42233
+ font-style: italic;
42234
+ }
42235
+
42236
+ .myio-contract-devices-modal .input-readonly {
42237
+ background: #f0f0f0;
42238
+ color: #555;
42239
+ cursor: not-allowed;
42240
+ font-weight: 600;
42241
+ }
42242
+
42243
+ .myio-contract-devices-modal .field-total {
42244
+ background: #f8f9fa;
42245
+ padding: 10px;
42246
+ border-radius: 6px;
42247
+ margin-bottom: 4px;
42248
+ }
42249
+
42222
42250
  .myio-contract-devices-modal .modal-footer {
42223
42251
  padding: 16px 24px;
42224
42252
  border-top: 1px solid #e0e0e0;
@@ -42297,22 +42325,22 @@
42297
42325
  }
42298
42326
  };
42299
42327
  if (data.energy) {
42300
- setValue("energy_total", data.energy.total);
42301
42328
  setValue("energy_entries", data.energy.entries);
42302
42329
  setValue("energy_commonArea", data.energy.commonArea);
42303
42330
  setValue("energy_stores", data.energy.stores);
42304
42331
  }
42305
42332
  if (data.water) {
42306
- setValue("water_total", data.water.total);
42307
42333
  setValue("water_entries", data.water.entries);
42308
42334
  setValue("water_commonArea", data.water.commonArea);
42309
42335
  setValue("water_stores", data.water.stores);
42310
42336
  }
42311
42337
  if (data.temperature) {
42312
- setValue("temperature_total", data.temperature.total);
42313
42338
  setValue("temperature_internal", data.temperature.internal);
42314
42339
  setValue("temperature_stores", data.temperature.stores);
42315
42340
  }
42341
+ this.calculateDomainTotal("energy");
42342
+ this.calculateDomainTotal("water");
42343
+ this.calculateDomainTotal("temperature");
42316
42344
  }
42317
42345
  attachEventListeners() {
42318
42346
  const closeBtn = this.modal.querySelector(".close-btn");
@@ -42344,6 +42372,50 @@
42344
42372
  this.config.onClose();
42345
42373
  }
42346
42374
  });
42375
+ this.setupAutoCalculation();
42376
+ }
42377
+ setupAutoCalculation() {
42378
+ const energyFields = ["energy_entries", "energy_commonArea", "energy_stores"];
42379
+ energyFields.forEach((fieldName) => {
42380
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42381
+ if (input) {
42382
+ input.addEventListener("input", () => this.calculateDomainTotal("energy"));
42383
+ }
42384
+ });
42385
+ const waterFields = ["water_entries", "water_commonArea", "water_stores"];
42386
+ waterFields.forEach((fieldName) => {
42387
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42388
+ if (input) {
42389
+ input.addEventListener("input", () => this.calculateDomainTotal("water"));
42390
+ }
42391
+ });
42392
+ const temperatureFields = ["temperature_internal", "temperature_stores"];
42393
+ temperatureFields.forEach((fieldName) => {
42394
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42395
+ if (input) {
42396
+ input.addEventListener("input", () => this.calculateDomainTotal("temperature"));
42397
+ }
42398
+ });
42399
+ }
42400
+ calculateDomainTotal(domain) {
42401
+ const getValue = (name) => {
42402
+ const input = this.form.querySelector(`[name="${name}"]`);
42403
+ if (!input || input.value === "") return 0;
42404
+ const num = parseInt(input.value, 10);
42405
+ return isNaN(num) ? 0 : num;
42406
+ };
42407
+ let total = 0;
42408
+ if (domain === "energy") {
42409
+ total = getValue("energy_entries") + getValue("energy_commonArea") + getValue("energy_stores");
42410
+ } else if (domain === "water") {
42411
+ total = getValue("water_entries") + getValue("water_commonArea") + getValue("water_stores");
42412
+ } else if (domain === "temperature") {
42413
+ total = getValue("temperature_internal") + getValue("temperature_stores");
42414
+ }
42415
+ const totalInput = this.form.querySelector(`[name="${domain}_total"]`);
42416
+ if (totalInput) {
42417
+ totalInput.value = String(total);
42418
+ }
42347
42419
  }
42348
42420
  setupAccessibility() {
42349
42421
  const firstInput = this.modal.querySelector("input");