myio-js-library 0.1.577 → 0.1.578
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 +30 -17
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -17
- package/dist/myio-js-library.umd.js +30 -17
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -986,7 +986,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
986
986
|
// package.json
|
|
987
987
|
var package_default = {
|
|
988
988
|
name: "myio-js-library",
|
|
989
|
-
version: "0.1.
|
|
989
|
+
version: "0.1.578",
|
|
990
990
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
991
991
|
license: "MIT",
|
|
992
992
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -66129,6 +66129,13 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66129
66129
|
canEditIdentifier() {
|
|
66130
66130
|
return this.isSuperAdmin() || this.config.holdingAdmin === true;
|
|
66131
66131
|
}
|
|
66132
|
+
/**
|
|
66133
|
+
* Campos comerciais (ABL / Contrato / Segmento / Atividade): visíveis para todos,
|
|
66134
|
+
* editáveis só para admin — mesma regra do Identificador (superadmin ou holding admin).
|
|
66135
|
+
*/
|
|
66136
|
+
canEditCommercial() {
|
|
66137
|
+
return this.canEditIdentifier();
|
|
66138
|
+
}
|
|
66132
66139
|
isWellEquipmentDevice() {
|
|
66133
66140
|
return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
|
|
66134
66141
|
}
|
|
@@ -66154,9 +66161,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66154
66161
|
if (lastUpdatedEl) {
|
|
66155
66162
|
lastUpdatedEl.textContent = formData.lastUpdatedTime ? this.formatTs(formData.lastUpdatedTime) : "\u2014";
|
|
66156
66163
|
}
|
|
66157
|
-
|
|
66158
|
-
this.initCommercialFields(formData);
|
|
66159
|
-
}
|
|
66164
|
+
this.initCommercialFields(formData);
|
|
66160
66165
|
if (!this.config.gcdrDeviceId && formData.gcdrDeviceId) {
|
|
66161
66166
|
this.config.gcdrDeviceId = formData.gcdrDeviceId;
|
|
66162
66167
|
}
|
|
@@ -66586,7 +66591,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66586
66591
|
cancelBtn.disabled = isLoading;
|
|
66587
66592
|
}
|
|
66588
66593
|
formInputs.forEach((input) => {
|
|
66589
|
-
input.disabled = isLoading;
|
|
66594
|
+
input.disabled = isLoading || input.dataset.locked === "true";
|
|
66590
66595
|
});
|
|
66591
66596
|
}
|
|
66592
66597
|
formatDomainLabel(domain) {
|
|
@@ -66876,7 +66881,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66876
66881
|
</div>
|
|
66877
66882
|
|
|
66878
66883
|
</div>
|
|
66879
|
-
${this.
|
|
66884
|
+
${this.getCommercialFieldsHTML()}
|
|
66880
66885
|
</div>
|
|
66881
66886
|
|
|
66882
66887
|
<!-- Central/gateway identity+telemetry \u2014 only for CentralSettingsModal (isGateway);
|
|
@@ -66895,12 +66900,14 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66895
66900
|
`;
|
|
66896
66901
|
}
|
|
66897
66902
|
/**
|
|
66898
|
-
* Campos comerciais —
|
|
66899
|
-
*
|
|
66903
|
+
* Campos comerciais — visíveis para todos, editáveis só para admin (canEditCommercial).
|
|
66904
|
+
* Sem permissão: ABL/Contrato readonly (o FormData reenvia o valor carregado, sem mudança)
|
|
66905
|
+
* e selects disabled + data-locked (não entram no FormData → o save não toca segment/activity).
|
|
66900
66906
|
* Linha 1: ABL + Contrato (texto). Linha 2: Segmento → Atividade (selects em cascata,
|
|
66901
66907
|
* opções preenchidas em initCommercialFields após carregar o catálogo).
|
|
66902
66908
|
*/
|
|
66903
66909
|
getCommercialFieldsHTML() {
|
|
66910
|
+
const ro = this.canEditCommercial() ? "" : " readonly";
|
|
66904
66911
|
const customerName = String(
|
|
66905
66912
|
this.config.customerName || window.MyIOUtils?.customerName || ""
|
|
66906
66913
|
).trim();
|
|
@@ -66911,11 +66918,11 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66911
66918
|
<div class="commercial-grid">
|
|
66912
66919
|
<div class="commercial-field">
|
|
66913
66920
|
<label class="identity-field-label" for="abl">ABL</label>
|
|
66914
|
-
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="Ex.: 120,50 m\xB2">
|
|
66921
|
+
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="${ro ? "\u2014" : "Ex.: 120,50 m\xB2"}"${ro}>
|
|
66915
66922
|
</div>
|
|
66916
66923
|
<div class="commercial-field">
|
|
66917
66924
|
<label class="identity-field-label" for="contract">Contrato</label>
|
|
66918
|
-
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="N\xBA / identifica\xE7\xE3o do contrato">
|
|
66925
|
+
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="${ro ? "\u2014" : "N\xBA / identifica\xE7\xE3o do contrato"}"${ro}>
|
|
66919
66926
|
</div>
|
|
66920
66927
|
<div class="commercial-field">
|
|
66921
66928
|
<label class="identity-field-label" for="segment">Segmento</label>
|
|
@@ -66945,18 +66952,24 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66945
66952
|
const savedActivity = String(saved.activity || "");
|
|
66946
66953
|
const segments = catalog.map((s) => s.segment);
|
|
66947
66954
|
if (savedSegment && !segments.includes(savedSegment)) segments.push(savedSegment);
|
|
66948
|
-
|
|
66949
|
-
segmentEl.
|
|
66955
|
+
const canEdit = this.canEditCommercial();
|
|
66956
|
+
segmentEl.innerHTML = options(segments, savedSegment, canEdit ? "Selecione\u2026" : "\u2014");
|
|
66957
|
+
segmentEl.disabled = !canEdit;
|
|
66950
66958
|
const fillActivities = (segment, selected) => {
|
|
66951
66959
|
if (!segment) {
|
|
66952
|
-
activityEl.innerHTML = options([], "", "Selecione o segmento primeiro");
|
|
66960
|
+
activityEl.innerHTML = options([], "", canEdit ? "Selecione o segmento primeiro" : "\u2014");
|
|
66953
66961
|
activityEl.disabled = true;
|
|
66954
66962
|
return;
|
|
66955
66963
|
}
|
|
66956
|
-
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, "Selecione\u2026");
|
|
66957
|
-
activityEl.disabled =
|
|
66964
|
+
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, canEdit ? "Selecione\u2026" : "\u2014");
|
|
66965
|
+
activityEl.disabled = !canEdit;
|
|
66958
66966
|
};
|
|
66959
66967
|
fillActivities(savedSegment, savedActivity);
|
|
66968
|
+
if (!canEdit) {
|
|
66969
|
+
segmentEl.dataset.locked = "true";
|
|
66970
|
+
activityEl.dataset.locked = "true";
|
|
66971
|
+
return;
|
|
66972
|
+
}
|
|
66960
66973
|
segmentEl.addEventListener("change", () => fillActivities(segmentEl.value, ""));
|
|
66961
66974
|
}
|
|
66962
66975
|
/** RFC-0171: Offset de Temperatura — sempre visível para domain=temperature; editável só para @myio.com.br */
|
|
@@ -68642,7 +68655,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
68642
68655
|
cursor: default;
|
|
68643
68656
|
}
|
|
68644
68657
|
|
|
68645
|
-
/* Campos comerciais (s\xF3
|
|
68658
|
+
/* Campos comerciais (vis\xEDveis para todos; edit\xE1veis s\xF3 para admin) */
|
|
68646
68659
|
.commercial-block {
|
|
68647
68660
|
margin-top: 14px;
|
|
68648
68661
|
padding-top: 12px;
|
|
@@ -80207,7 +80220,7 @@ var DefaultSettingsFetcher = class _DefaultSettingsFetcher {
|
|
|
80207
80220
|
"label",
|
|
80208
80221
|
"floor",
|
|
80209
80222
|
"identifier",
|
|
80210
|
-
// Campos comerciais (só
|
|
80223
|
+
// Campos comerciais (visíveis para todos; editáveis só para admin no modal)
|
|
80211
80224
|
"abl",
|
|
80212
80225
|
"contract",
|
|
80213
80226
|
"segment",
|
package/dist/index.d.cts
CHANGED
|
@@ -7570,7 +7570,7 @@ interface OpenDashboardPopupSettingsParams {
|
|
|
7570
7570
|
superadmin?: boolean;
|
|
7571
7571
|
userEmail?: string;
|
|
7572
7572
|
holdingAdmin?: boolean;
|
|
7573
|
-
/** Catálogo Segmento → Atividade dos campos comerciais (só
|
|
7573
|
+
/** Catálogo Segmento → Atividade dos campos comerciais (visíveis para todos; editáveis só para admin).
|
|
7574
7574
|
* Lista ou loader async; omitido → DEFAULT_STORE_SEGMENTS. */
|
|
7575
7575
|
segmentCatalog?: StoreSegmentCatalogSource;
|
|
7576
7576
|
connectionData?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -7570,7 +7570,7 @@ interface OpenDashboardPopupSettingsParams {
|
|
|
7570
7570
|
superadmin?: boolean;
|
|
7571
7571
|
userEmail?: string;
|
|
7572
7572
|
holdingAdmin?: boolean;
|
|
7573
|
-
/** Catálogo Segmento → Atividade dos campos comerciais (só
|
|
7573
|
+
/** Catálogo Segmento → Atividade dos campos comerciais (visíveis para todos; editáveis só para admin).
|
|
7574
7574
|
* Lista ou loader async; omitido → DEFAULT_STORE_SEGMENTS. */
|
|
7575
7575
|
segmentCatalog?: StoreSegmentCatalogSource;
|
|
7576
7576
|
connectionData?: {
|
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.
|
|
13
|
+
version: "0.1.578",
|
|
14
14
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
15
15
|
license: "MIT",
|
|
16
16
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -64428,6 +64428,13 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
64428
64428
|
canEditIdentifier() {
|
|
64429
64429
|
return this.isSuperAdmin() || this.config.holdingAdmin === true;
|
|
64430
64430
|
}
|
|
64431
|
+
/**
|
|
64432
|
+
* Campos comerciais (ABL / Contrato / Segmento / Atividade): visíveis para todos,
|
|
64433
|
+
* editáveis só para admin — mesma regra do Identificador (superadmin ou holding admin).
|
|
64434
|
+
*/
|
|
64435
|
+
canEditCommercial() {
|
|
64436
|
+
return this.canEditIdentifier();
|
|
64437
|
+
}
|
|
64431
64438
|
isWellEquipmentDevice() {
|
|
64432
64439
|
return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
|
|
64433
64440
|
}
|
|
@@ -64453,9 +64460,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
64453
64460
|
if (lastUpdatedEl) {
|
|
64454
64461
|
lastUpdatedEl.textContent = formData.lastUpdatedTime ? this.formatTs(formData.lastUpdatedTime) : "\u2014";
|
|
64455
64462
|
}
|
|
64456
|
-
|
|
64457
|
-
this.initCommercialFields(formData);
|
|
64458
|
-
}
|
|
64463
|
+
this.initCommercialFields(formData);
|
|
64459
64464
|
if (!this.config.gcdrDeviceId && formData.gcdrDeviceId) {
|
|
64460
64465
|
this.config.gcdrDeviceId = formData.gcdrDeviceId;
|
|
64461
64466
|
}
|
|
@@ -64885,7 +64890,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
64885
64890
|
cancelBtn.disabled = isLoading;
|
|
64886
64891
|
}
|
|
64887
64892
|
formInputs.forEach((input) => {
|
|
64888
|
-
input.disabled = isLoading;
|
|
64893
|
+
input.disabled = isLoading || input.dataset.locked === "true";
|
|
64889
64894
|
});
|
|
64890
64895
|
}
|
|
64891
64896
|
formatDomainLabel(domain) {
|
|
@@ -65175,7 +65180,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
65175
65180
|
</div>
|
|
65176
65181
|
|
|
65177
65182
|
</div>
|
|
65178
|
-
${this.
|
|
65183
|
+
${this.getCommercialFieldsHTML()}
|
|
65179
65184
|
</div>
|
|
65180
65185
|
|
|
65181
65186
|
<!-- Central/gateway identity+telemetry \u2014 only for CentralSettingsModal (isGateway);
|
|
@@ -65194,12 +65199,14 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
65194
65199
|
`;
|
|
65195
65200
|
}
|
|
65196
65201
|
/**
|
|
65197
|
-
* Campos comerciais —
|
|
65198
|
-
*
|
|
65202
|
+
* Campos comerciais — visíveis para todos, editáveis só para admin (canEditCommercial).
|
|
65203
|
+
* Sem permissão: ABL/Contrato readonly (o FormData reenvia o valor carregado, sem mudança)
|
|
65204
|
+
* e selects disabled + data-locked (não entram no FormData → o save não toca segment/activity).
|
|
65199
65205
|
* Linha 1: ABL + Contrato (texto). Linha 2: Segmento → Atividade (selects em cascata,
|
|
65200
65206
|
* opções preenchidas em initCommercialFields após carregar o catálogo).
|
|
65201
65207
|
*/
|
|
65202
65208
|
getCommercialFieldsHTML() {
|
|
65209
|
+
const ro = this.canEditCommercial() ? "" : " readonly";
|
|
65203
65210
|
const customerName = String(
|
|
65204
65211
|
this.config.customerName || window.MyIOUtils?.customerName || ""
|
|
65205
65212
|
).trim();
|
|
@@ -65210,11 +65217,11 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
65210
65217
|
<div class="commercial-grid">
|
|
65211
65218
|
<div class="commercial-field">
|
|
65212
65219
|
<label class="identity-field-label" for="abl">ABL</label>
|
|
65213
|
-
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="Ex.: 120,50 m\xB2">
|
|
65220
|
+
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="${ro ? "\u2014" : "Ex.: 120,50 m\xB2"}"${ro}>
|
|
65214
65221
|
</div>
|
|
65215
65222
|
<div class="commercial-field">
|
|
65216
65223
|
<label class="identity-field-label" for="contract">Contrato</label>
|
|
65217
|
-
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="N\xBA / identifica\xE7\xE3o do contrato">
|
|
65224
|
+
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="${ro ? "\u2014" : "N\xBA / identifica\xE7\xE3o do contrato"}"${ro}>
|
|
65218
65225
|
</div>
|
|
65219
65226
|
<div class="commercial-field">
|
|
65220
65227
|
<label class="identity-field-label" for="segment">Segmento</label>
|
|
@@ -65244,18 +65251,24 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
65244
65251
|
const savedActivity = String(saved.activity || "");
|
|
65245
65252
|
const segments = catalog.map((s) => s.segment);
|
|
65246
65253
|
if (savedSegment && !segments.includes(savedSegment)) segments.push(savedSegment);
|
|
65247
|
-
|
|
65248
|
-
segmentEl.
|
|
65254
|
+
const canEdit = this.canEditCommercial();
|
|
65255
|
+
segmentEl.innerHTML = options(segments, savedSegment, canEdit ? "Selecione\u2026" : "\u2014");
|
|
65256
|
+
segmentEl.disabled = !canEdit;
|
|
65249
65257
|
const fillActivities = (segment, selected) => {
|
|
65250
65258
|
if (!segment) {
|
|
65251
|
-
activityEl.innerHTML = options([], "", "Selecione o segmento primeiro");
|
|
65259
|
+
activityEl.innerHTML = options([], "", canEdit ? "Selecione o segmento primeiro" : "\u2014");
|
|
65252
65260
|
activityEl.disabled = true;
|
|
65253
65261
|
return;
|
|
65254
65262
|
}
|
|
65255
|
-
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, "Selecione\u2026");
|
|
65256
|
-
activityEl.disabled =
|
|
65263
|
+
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, canEdit ? "Selecione\u2026" : "\u2014");
|
|
65264
|
+
activityEl.disabled = !canEdit;
|
|
65257
65265
|
};
|
|
65258
65266
|
fillActivities(savedSegment, savedActivity);
|
|
65267
|
+
if (!canEdit) {
|
|
65268
|
+
segmentEl.dataset.locked = "true";
|
|
65269
|
+
activityEl.dataset.locked = "true";
|
|
65270
|
+
return;
|
|
65271
|
+
}
|
|
65259
65272
|
segmentEl.addEventListener("change", () => fillActivities(segmentEl.value, ""));
|
|
65260
65273
|
}
|
|
65261
65274
|
/** RFC-0171: Offset de Temperatura — sempre visível para domain=temperature; editável só para @myio.com.br */
|
|
@@ -66941,7 +66954,7 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66941
66954
|
cursor: default;
|
|
66942
66955
|
}
|
|
66943
66956
|
|
|
66944
|
-
/* Campos comerciais (s\xF3
|
|
66957
|
+
/* Campos comerciais (vis\xEDveis para todos; edit\xE1veis s\xF3 para admin) */
|
|
66945
66958
|
.commercial-block {
|
|
66946
66959
|
margin-top: 14px;
|
|
66947
66960
|
padding-top: 12px;
|
|
@@ -78506,7 +78519,7 @@ var DefaultSettingsFetcher = class _DefaultSettingsFetcher {
|
|
|
78506
78519
|
"label",
|
|
78507
78520
|
"floor",
|
|
78508
78521
|
"identifier",
|
|
78509
|
-
// Campos comerciais (só
|
|
78522
|
+
// Campos comerciais (visíveis para todos; editáveis só para admin no modal)
|
|
78510
78523
|
"abl",
|
|
78511
78524
|
"contract",
|
|
78512
78525
|
"segment",
|
|
@@ -5524,7 +5524,7 @@
|
|
|
5524
5524
|
|
|
5525
5525
|
// package.json
|
|
5526
5526
|
var package_default = {
|
|
5527
|
-
version: "0.1.
|
|
5527
|
+
version: "0.1.578"};
|
|
5528
5528
|
|
|
5529
5529
|
// src/utils/format/energy.ts
|
|
5530
5530
|
function formatPower(value, decimals = 2) {
|
|
@@ -69786,6 +69786,13 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
69786
69786
|
canEditIdentifier() {
|
|
69787
69787
|
return this.isSuperAdmin() || this.config.holdingAdmin === true;
|
|
69788
69788
|
}
|
|
69789
|
+
/**
|
|
69790
|
+
* Campos comerciais (ABL / Contrato / Segmento / Atividade): visíveis para todos,
|
|
69791
|
+
* editáveis só para admin — mesma regra do Identificador (superadmin ou holding admin).
|
|
69792
|
+
*/
|
|
69793
|
+
canEditCommercial() {
|
|
69794
|
+
return this.canEditIdentifier();
|
|
69795
|
+
}
|
|
69789
69796
|
isWellEquipmentDevice() {
|
|
69790
69797
|
return ["CISTERNA", "CISTERNA_ENTRADA"].includes(String(this.config.deviceProfile || "").toUpperCase());
|
|
69791
69798
|
}
|
|
@@ -69811,9 +69818,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
69811
69818
|
if (lastUpdatedEl) {
|
|
69812
69819
|
lastUpdatedEl.textContent = formData.lastUpdatedTime ? this.formatTs(formData.lastUpdatedTime) : "\u2014";
|
|
69813
69820
|
}
|
|
69814
|
-
|
|
69815
|
-
this.initCommercialFields(formData);
|
|
69816
|
-
}
|
|
69821
|
+
this.initCommercialFields(formData);
|
|
69817
69822
|
if (!this.config.gcdrDeviceId && formData.gcdrDeviceId) {
|
|
69818
69823
|
this.config.gcdrDeviceId = formData.gcdrDeviceId;
|
|
69819
69824
|
}
|
|
@@ -70243,7 +70248,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
70243
70248
|
cancelBtn.disabled = isLoading;
|
|
70244
70249
|
}
|
|
70245
70250
|
formInputs.forEach((input) => {
|
|
70246
|
-
input.disabled = isLoading;
|
|
70251
|
+
input.disabled = isLoading || input.dataset.locked === "true";
|
|
70247
70252
|
});
|
|
70248
70253
|
}
|
|
70249
70254
|
formatDomainLabel(domain) {
|
|
@@ -70533,7 +70538,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
70533
70538
|
</div>
|
|
70534
70539
|
|
|
70535
70540
|
</div>
|
|
70536
|
-
${this.
|
|
70541
|
+
${this.getCommercialFieldsHTML()}
|
|
70537
70542
|
</div>
|
|
70538
70543
|
|
|
70539
70544
|
<!-- Central/gateway identity+telemetry \u2014 only for CentralSettingsModal (isGateway);
|
|
@@ -70552,12 +70557,14 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
70552
70557
|
`;
|
|
70553
70558
|
}
|
|
70554
70559
|
/**
|
|
70555
|
-
* Campos comerciais —
|
|
70556
|
-
*
|
|
70560
|
+
* Campos comerciais — visíveis para todos, editáveis só para admin (canEditCommercial).
|
|
70561
|
+
* Sem permissão: ABL/Contrato readonly (o FormData reenvia o valor carregado, sem mudança)
|
|
70562
|
+
* e selects disabled + data-locked (não entram no FormData → o save não toca segment/activity).
|
|
70557
70563
|
* Linha 1: ABL + Contrato (texto). Linha 2: Segmento → Atividade (selects em cascata,
|
|
70558
70564
|
* opções preenchidas em initCommercialFields após carregar o catálogo).
|
|
70559
70565
|
*/
|
|
70560
70566
|
getCommercialFieldsHTML() {
|
|
70567
|
+
const ro = this.canEditCommercial() ? "" : " readonly";
|
|
70561
70568
|
const customerName = String(
|
|
70562
70569
|
this.config.customerName || window.MyIOUtils?.customerName || ""
|
|
70563
70570
|
).trim();
|
|
@@ -70568,11 +70575,11 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
70568
70575
|
<div class="commercial-grid">
|
|
70569
70576
|
<div class="commercial-field">
|
|
70570
70577
|
<label class="identity-field-label" for="abl">ABL</label>
|
|
70571
|
-
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="Ex.: 120,50 m\xB2">
|
|
70578
|
+
<input type="text" id="abl" name="abl" class="identity-input" maxlength="50" placeholder="${ro ? "\u2014" : "Ex.: 120,50 m\xB2"}"${ro}>
|
|
70572
70579
|
</div>
|
|
70573
70580
|
<div class="commercial-field">
|
|
70574
70581
|
<label class="identity-field-label" for="contract">Contrato</label>
|
|
70575
|
-
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="N\xBA / identifica\xE7\xE3o do contrato">
|
|
70582
|
+
<input type="text" id="contract" name="contract" class="identity-input" maxlength="100" placeholder="${ro ? "\u2014" : "N\xBA / identifica\xE7\xE3o do contrato"}"${ro}>
|
|
70576
70583
|
</div>
|
|
70577
70584
|
<div class="commercial-field">
|
|
70578
70585
|
<label class="identity-field-label" for="segment">Segmento</label>
|
|
@@ -70602,18 +70609,24 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
70602
70609
|
const savedActivity = String(saved.activity || "");
|
|
70603
70610
|
const segments = catalog.map((s) => s.segment);
|
|
70604
70611
|
if (savedSegment && !segments.includes(savedSegment)) segments.push(savedSegment);
|
|
70605
|
-
|
|
70606
|
-
segmentEl.
|
|
70612
|
+
const canEdit = this.canEditCommercial();
|
|
70613
|
+
segmentEl.innerHTML = options(segments, savedSegment, canEdit ? "Selecione\u2026" : "\u2014");
|
|
70614
|
+
segmentEl.disabled = !canEdit;
|
|
70607
70615
|
const fillActivities = (segment, selected) => {
|
|
70608
70616
|
if (!segment) {
|
|
70609
|
-
activityEl.innerHTML = options([], "", "Selecione o segmento primeiro");
|
|
70617
|
+
activityEl.innerHTML = options([], "", canEdit ? "Selecione o segmento primeiro" : "\u2014");
|
|
70610
70618
|
activityEl.disabled = true;
|
|
70611
70619
|
return;
|
|
70612
70620
|
}
|
|
70613
|
-
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, "Selecione\u2026");
|
|
70614
|
-
activityEl.disabled =
|
|
70621
|
+
activityEl.innerHTML = options(activitiesForSegment(catalog, segment, selected), selected, canEdit ? "Selecione\u2026" : "\u2014");
|
|
70622
|
+
activityEl.disabled = !canEdit;
|
|
70615
70623
|
};
|
|
70616
70624
|
fillActivities(savedSegment, savedActivity);
|
|
70625
|
+
if (!canEdit) {
|
|
70626
|
+
segmentEl.dataset.locked = "true";
|
|
70627
|
+
activityEl.dataset.locked = "true";
|
|
70628
|
+
return;
|
|
70629
|
+
}
|
|
70617
70630
|
segmentEl.addEventListener("change", () => fillActivities(segmentEl.value, ""));
|
|
70618
70631
|
}
|
|
70619
70632
|
/** RFC-0171: Offset de Temperatura — sempre visível para domain=temperature; editável só para @myio.com.br */
|
|
@@ -72299,7 +72312,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
72299
72312
|
cursor: default;
|
|
72300
72313
|
}
|
|
72301
72314
|
|
|
72302
|
-
/* Campos comerciais (s\xF3
|
|
72315
|
+
/* Campos comerciais (vis\xEDveis para todos; edit\xE1veis s\xF3 para admin) */
|
|
72303
72316
|
.commercial-block {
|
|
72304
72317
|
margin-top: 14px;
|
|
72305
72318
|
padding-top: 12px;
|
|
@@ -83863,7 +83876,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
83863
83876
|
"label",
|
|
83864
83877
|
"floor",
|
|
83865
83878
|
"identifier",
|
|
83866
|
-
// Campos comerciais (só
|
|
83879
|
+
// Campos comerciais (visíveis para todos; editáveis só para admin no modal)
|
|
83867
83880
|
"abl",
|
|
83868
83881
|
"contract",
|
|
83869
83882
|
"segment",
|