myio-js-library 0.1.575 → 0.1.577
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 +1607 -594
- package/dist/index.d.cts +414 -7
- package/dist/index.d.ts +414 -7
- package/dist/index.js +1554 -569
- package/dist/myio-js-library.umd.js +1553 -568
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -232,7 +232,13 @@ __export(src_exports, {
|
|
|
232
232
|
MEASUREMENT_DOMAIN_CONFIG: () => DOMAIN_CONFIG5,
|
|
233
233
|
MENU_SHOPPING_CSS_PREFIX: () => MENU_SHOPPING_CSS_PREFIX,
|
|
234
234
|
METRO_TILE_COLORS: () => METRO_TILE_COLORS,
|
|
235
|
+
MONEY_CONVERTIBLE_GROUPS: () => MONEY_CONVERTIBLE_GROUPS,
|
|
235
236
|
MONEY_DASH: () => DASH,
|
|
237
|
+
MONEY_ESTIMATE_LABEL: () => MONEY_ESTIMATE_LABEL,
|
|
238
|
+
MONEY_HOURLY_MAX_DAYS: () => MONEY_HOURLY_MAX_DAYS,
|
|
239
|
+
MONEY_INCOMPLETE_LABEL: () => MONEY_INCOMPLETE_LABEL,
|
|
240
|
+
MONEY_MAX_SEGMENT_FETCHES: () => MONEY_MAX_SEGMENT_FETCHES,
|
|
241
|
+
MONEY_REPORT_HEADER: () => MONEY_REPORT_HEADER,
|
|
236
242
|
MONEY_REQUIRES_DEVICE_GRANULARITY: () => MONEY_REQUIRES_DEVICE_GRANULARITY,
|
|
237
243
|
MONEY_VARIANCE_HEADER: () => MONEY_VARIANCE_HEADER,
|
|
238
244
|
MOTOR_SORT_OPTIONS: () => MOTOR_SORT_OPTIONS,
|
|
@@ -314,6 +320,7 @@ __export(src_exports, {
|
|
|
314
320
|
SolenoidControlView: () => SolenoidControlView,
|
|
315
321
|
SwitchControlController: () => SwitchControlController,
|
|
316
322
|
SwitchControlView: () => SwitchControlView,
|
|
323
|
+
TARIFF_DEFAULT_TIMEZONE: () => TARIFF_DEFAULT_TIMEZONE,
|
|
317
324
|
TELEMETRY_CONTEXT_CONFIG: () => CONTEXT_CONFIG,
|
|
318
325
|
TELEMETRY_DEFAULT_FILTER_TABS: () => DEFAULT_FILTER_TABS,
|
|
319
326
|
TELEMETRY_DOMAIN_CONFIG: () => DOMAIN_CONFIG6,
|
|
@@ -334,6 +341,7 @@ __export(src_exports, {
|
|
|
334
341
|
TempSensorSummaryTooltip: () => TempSensorSummaryTooltip,
|
|
335
342
|
Temperature: () => Temperature,
|
|
336
343
|
UsersSummaryTooltip: () => UsersSummaryTooltip,
|
|
344
|
+
VALUE_DISPLAY_MODE_STORAGE_PREFIX: () => VALUE_DISPLAY_MODE_STORAGE_PREFIX,
|
|
337
345
|
VALVE_STATE_KEYS: () => VALVE_STATE_KEYS,
|
|
338
346
|
VARIANCE_LABEL_ABOVE: () => VARIANCE_LABEL_ABOVE,
|
|
339
347
|
VARIANCE_LABEL_BELOW: () => VARIANCE_LABEL_BELOW,
|
|
@@ -381,9 +389,12 @@ __export(src_exports, {
|
|
|
381
389
|
buildFinancialRowHTML: () => buildFinancialRowHTML,
|
|
382
390
|
buildGcdrEnergyRoot: () => buildGcdrEnergyRoot,
|
|
383
391
|
buildListItemsThingsboardByUniqueDatasource: () => buildListItemsThingsboardByUniqueDatasource,
|
|
392
|
+
buildMoneyChipHTML: () => buildMoneyChipHTML,
|
|
393
|
+
buildMoneyCoverageMarkerHTML: () => buildMoneyCoverageMarkerHTML,
|
|
384
394
|
buildMoneyVarianceHTML: () => buildMoneyVarianceHTML,
|
|
385
395
|
buildMyioIngestionAuth: () => buildMyioIngestionAuth,
|
|
386
396
|
buildReportItemsList: () => buildReportItemsList,
|
|
397
|
+
buildReportMoneyConfig: () => buildReportMoneyConfig,
|
|
387
398
|
buildTemplateCsv: () => buildTemplateCsv,
|
|
388
399
|
buildTemplateExport: () => buildTemplateExport,
|
|
389
400
|
buildTicketServiceOrchestrator: () => buildTicketServiceOrchestrator,
|
|
@@ -518,6 +529,7 @@ __export(src_exports, {
|
|
|
518
529
|
createSwitchControl: () => createSwitchControl,
|
|
519
530
|
createTariffApiAdapter: () => createTariffApiAdapter,
|
|
520
531
|
createTariffApiClient: () => createTariffApiClient,
|
|
532
|
+
createTariffValuator: () => createTariffValuator,
|
|
521
533
|
createTbEnvelopeStore: () => createTbEnvelopeStore,
|
|
522
534
|
createTelemetryGridComponent: () => createTelemetryGridComponent,
|
|
523
535
|
createTelemetryGridShoppingComponent: () => createTelemetryGridShoppingComponent,
|
|
@@ -558,7 +570,7 @@ __export(src_exports, {
|
|
|
558
570
|
doSchedulesOverlap: () => doSchedulesOverlap,
|
|
559
571
|
downloadAnnotationsTextFile: () => downloadTextFile,
|
|
560
572
|
encodeDeviceProductCode: () => encodeDeviceProductCode,
|
|
561
|
-
escapeAnnotationHtml: () =>
|
|
573
|
+
escapeAnnotationHtml: () => escapeHtml22,
|
|
562
574
|
evaluateDeviceStatus: () => evaluateDeviceStatus,
|
|
563
575
|
expandBandHours: () => expandBandHours,
|
|
564
576
|
expandBandToHourBucketsByYear: () => expandBandToHourBucketsByYear,
|
|
@@ -607,6 +619,7 @@ __export(src_exports, {
|
|
|
607
619
|
formatDuration: () => formatDuration,
|
|
608
620
|
formatEnergy: () => formatEnergy,
|
|
609
621
|
formatHours: () => formatHours2,
|
|
622
|
+
formatItemMoney: () => formatItemMoney,
|
|
610
623
|
formatMoneyBRL: () => formatBRL,
|
|
611
624
|
formatNumberReadable: () => formatNumberReadable,
|
|
612
625
|
formatPower: () => formatPower,
|
|
@@ -747,6 +760,7 @@ __export(src_exports, {
|
|
|
747
760
|
isInRange: () => isInRange,
|
|
748
761
|
isLeapYear: () => isLeapYear,
|
|
749
762
|
isMoneyColumnConfident: () => isMoneyColumnConfident,
|
|
763
|
+
isMoneyConvertibleGroup: () => isMoneyConvertibleGroup,
|
|
750
764
|
isMyioGcdrLoginModalOpen: () => isMyioGcdrLoginModalOpen,
|
|
751
765
|
isOnOffDeviceProfile: () => isOnOffDeviceProfile,
|
|
752
766
|
isSolenoidDevice: () => isSolenoidDevice,
|
|
@@ -771,6 +785,9 @@ __export(src_exports, {
|
|
|
771
785
|
metasGuideComputeChips: () => computeChips,
|
|
772
786
|
metasGuideDeriveTotal: () => deriveTotal,
|
|
773
787
|
minutesToMs: () => minutesToMs,
|
|
788
|
+
moneyCoverageTitle: () => moneyCoverageTitle,
|
|
789
|
+
moneyReasonText: () => moneyReasonText,
|
|
790
|
+
moneyStateChipLabel: () => moneyStateChipLabel,
|
|
774
791
|
msToMinutes: () => msToMinutes,
|
|
775
792
|
myioExportData: () => myioExportData,
|
|
776
793
|
nextManualSeq: () => nextManualSeq,
|
|
@@ -809,6 +826,7 @@ __export(src_exports, {
|
|
|
809
826
|
openGatewayModal: () => openGatewayModal,
|
|
810
827
|
openGenericModal: () => openGenericModal,
|
|
811
828
|
openGoalsPanel: () => openGoalsPanel,
|
|
829
|
+
openGoalsTariffsHub: () => openGoalsTariffsHub,
|
|
812
830
|
openHelpModal: () => openHelpModal,
|
|
813
831
|
openIntegrationsModal: () => openIntegrationsModal,
|
|
814
832
|
openManualDeviceModal: () => openManualDeviceModal,
|
|
@@ -845,10 +863,12 @@ __export(src_exports, {
|
|
|
845
863
|
parseGcdrEntityForest: () => parseGcdrEntityForest,
|
|
846
864
|
parseInputDateToDate: () => parseInputDateToDate,
|
|
847
865
|
parseLogAnnotations: () => parseLogAnnotations,
|
|
866
|
+
parseMoneyCategoryRule: () => parseMoneyCategoryRule,
|
|
848
867
|
periodKey: () => periodKey,
|
|
849
868
|
pickUniqueCustomerCode: () => pickUniqueCustomerCode,
|
|
850
869
|
pumpHistoryFromConsumption: () => pumpHistoryFromConsumption,
|
|
851
870
|
readFreshdeskTicketsFromTB: () => readFreshdeskTicketsFromTB,
|
|
871
|
+
readValueDisplayMode: () => readValueDisplayMode,
|
|
852
872
|
recalculateDeviceStatus: () => recalculateDeviceStatus,
|
|
853
873
|
recomputeDeviceGridPercentages: () => recomputePercentages,
|
|
854
874
|
refreshAlarmBadges: () => refreshAlarmBadges,
|
|
@@ -892,22 +912,25 @@ __export(src_exports, {
|
|
|
892
912
|
resolveBudget: () => resolveBudget,
|
|
893
913
|
resolveCategory: () => resolveCategory,
|
|
894
914
|
resolveClassification: () => resolveClassification,
|
|
915
|
+
resolveEffectiveDisplayMode: () => resolveEffectiveDisplayMode,
|
|
895
916
|
resolveGoalAmount: () => resolveGoalAmount,
|
|
896
917
|
resolveGroup: () => resolveGroup,
|
|
897
918
|
resolveManualDeviceName: () => resolveManualDeviceName,
|
|
919
|
+
resolveMoneyCategory: () => resolveMoneyCategory,
|
|
898
920
|
resolveMoneyRollout: () => resolveMoneyRollout,
|
|
899
921
|
resolveMoneyRowValues: () => resolveMoneyRowValues,
|
|
900
922
|
resolvePercentDecimals: () => resolvePercentDecimals,
|
|
901
923
|
resolveReportItemStates: () => resolveReportItemStates,
|
|
902
924
|
resolveSubcategory: () => resolveSubcategory,
|
|
903
925
|
resolveWithFallback: () => resolveWithFallback,
|
|
926
|
+
roundMoney2: () => roundMoney2,
|
|
904
927
|
routeMoneyRender: () => routeMoneyRender,
|
|
905
928
|
rowsFromTable: () => rowsFromTable,
|
|
906
929
|
schedCreateDateInput: () => createDateInput,
|
|
907
930
|
schedCreateNumberInput: () => createNumberInput,
|
|
908
931
|
schedCreateSelect: () => createSelect,
|
|
909
932
|
schedCreateTimeInput: () => createTimeInput,
|
|
910
|
-
schedEscapeHtml: () =>
|
|
933
|
+
schedEscapeHtml: () => escapeHtml21,
|
|
911
934
|
schedShowConfirmModal: () => showConfirmModal,
|
|
912
935
|
schedShowNotificationModal: () => showNotificationModal,
|
|
913
936
|
selectBreakdownItems: () => selectBreakdownItems,
|
|
@@ -922,6 +945,7 @@ __export(src_exports, {
|
|
|
922
945
|
sortDeviceGridDevices: () => sortDevices,
|
|
923
946
|
strings: () => strings_exports,
|
|
924
947
|
subtractDecimals: () => subtractDecimals,
|
|
948
|
+
sumItemMoney: () => sumItemMoney,
|
|
925
949
|
sumMoneyDecimals: () => sumMoneyDecimals,
|
|
926
950
|
summaryDeviceToTotalsRow: () => summaryDeviceToTotalsRow,
|
|
927
951
|
summaryLastReadingTs: () => summaryLastReadingTs,
|
|
@@ -936,6 +960,7 @@ __export(src_exports, {
|
|
|
936
960
|
toCSV: () => toCSV,
|
|
937
961
|
toFixedSafe: () => toFixedSafe,
|
|
938
962
|
toFreshdeskTicketSummary: () => toSummary,
|
|
963
|
+
toItemMoney: () => toItemMoney,
|
|
939
964
|
truncateAnnotationText: () => truncate2,
|
|
940
965
|
updateDeviceGridStats: () => updateStats,
|
|
941
966
|
updateFreshdeskTicket: () => updateTicket,
|
|
@@ -945,20 +970,23 @@ __export(src_exports, {
|
|
|
945
970
|
validateDeviceProductName: () => validateDeviceProductName,
|
|
946
971
|
validateProfile: () => validateProfile,
|
|
947
972
|
validateTree: () => validateTree,
|
|
973
|
+
valuateDomainMoney: () => valuateDomainMoney,
|
|
974
|
+
valueDisplayModeStorageKey: () => valueDisplayModeStorageKey,
|
|
948
975
|
valveHistoryFromTelemetry: () => valveHistoryFromTelemetry,
|
|
949
976
|
version: () => version,
|
|
950
977
|
waterDeviceStatusIcons: () => waterDeviceStatusIcons,
|
|
951
978
|
wireCategoryToPanel: () => wireCategoryToPanel,
|
|
952
979
|
wireDomainToPanel: () => wireDomainToPanel,
|
|
953
980
|
writeFreshdeskSyncedAtToTB: () => writeFreshdeskSyncedAtToTB,
|
|
954
|
-
writeFreshdeskTicketsToTB: () => writeFreshdeskTicketsToTB
|
|
981
|
+
writeFreshdeskTicketsToTB: () => writeFreshdeskTicketsToTB,
|
|
982
|
+
writeValueDisplayMode: () => writeValueDisplayMode
|
|
955
983
|
});
|
|
956
984
|
module.exports = __toCommonJS(src_exports);
|
|
957
985
|
|
|
958
986
|
// package.json
|
|
959
987
|
var package_default = {
|
|
960
988
|
name: "myio-js-library",
|
|
961
|
-
version: "0.1.
|
|
989
|
+
version: "0.1.577",
|
|
962
990
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
963
991
|
license: "MIT",
|
|
964
992
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -21126,6 +21154,650 @@ function renderEquipmentShortcutHTML(indicators, label = "Bombas") {
|
|
|
21126
21154
|
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("");
|
|
21127
21155
|
}
|
|
21128
21156
|
|
|
21157
|
+
// src/components/financial-goals/moneyFormat.ts
|
|
21158
|
+
var DASH = "\u2014";
|
|
21159
|
+
function toDecimalParts(input) {
|
|
21160
|
+
const s = input.trim();
|
|
21161
|
+
if (!s) return null;
|
|
21162
|
+
const m = /^([+-]?)(\d+)(?:\.(\d+))?$/.exec(s);
|
|
21163
|
+
if (!m) return null;
|
|
21164
|
+
const negative = m[1] === "-";
|
|
21165
|
+
let intDigits = m[2].replace(/^0+(?=\d)/, "");
|
|
21166
|
+
const frac = m[3] || "";
|
|
21167
|
+
let cents = frac.slice(0, 2).padEnd(2, "0");
|
|
21168
|
+
const roundDigit = frac.charAt(2);
|
|
21169
|
+
if (roundDigit && roundDigit >= "5") {
|
|
21170
|
+
const bumped = String(Number(cents) + 1).padStart(2, "0");
|
|
21171
|
+
if (bumped.length > 2) {
|
|
21172
|
+
cents = "00";
|
|
21173
|
+
intDigits = incrementDigits(intDigits);
|
|
21174
|
+
} else {
|
|
21175
|
+
cents = bumped;
|
|
21176
|
+
}
|
|
21177
|
+
}
|
|
21178
|
+
return { negative, intDigits, frac2: cents };
|
|
21179
|
+
}
|
|
21180
|
+
function incrementDigits(digits) {
|
|
21181
|
+
const arr = digits.split("");
|
|
21182
|
+
let i = arr.length - 1;
|
|
21183
|
+
for (; i >= 0; i--) {
|
|
21184
|
+
if (arr[i] === "9") {
|
|
21185
|
+
arr[i] = "0";
|
|
21186
|
+
} else {
|
|
21187
|
+
arr[i] = String(Number(arr[i]) + 1);
|
|
21188
|
+
return arr.join("");
|
|
21189
|
+
}
|
|
21190
|
+
}
|
|
21191
|
+
return "1" + arr.join("");
|
|
21192
|
+
}
|
|
21193
|
+
function groupThousands(intDigits) {
|
|
21194
|
+
return intDigits.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
21195
|
+
}
|
|
21196
|
+
function formatBRL(amount) {
|
|
21197
|
+
if (amount == null) return DASH;
|
|
21198
|
+
const parts = toDecimalParts(String(amount));
|
|
21199
|
+
if (!parts) return DASH;
|
|
21200
|
+
const grouped = groupThousands(parts.intDigits);
|
|
21201
|
+
const sign = parts.negative && !(parts.intDigits === "0" && parts.frac2 === "00") ? "-" : "";
|
|
21202
|
+
return `R$ ${sign}${grouped},${parts.frac2}`;
|
|
21203
|
+
}
|
|
21204
|
+
function signOf(value) {
|
|
21205
|
+
if (value == null || !Number.isFinite(value) || value === 0) return "";
|
|
21206
|
+
return value > 0 ? "+" : "\u2212";
|
|
21207
|
+
}
|
|
21208
|
+
function computeDeltaPct(current, baseline) {
|
|
21209
|
+
if (current == null || baseline == null) return null;
|
|
21210
|
+
const c = Number(String(current).trim());
|
|
21211
|
+
const b = Number(String(baseline).trim());
|
|
21212
|
+
if (!Number.isFinite(c) || !Number.isFinite(b) || b === 0) return null;
|
|
21213
|
+
return (c - b) / Math.abs(b) * 100;
|
|
21214
|
+
}
|
|
21215
|
+
function formatDeltaPct(pct, digits = 1) {
|
|
21216
|
+
if (pct == null || !Number.isFinite(pct)) return DASH;
|
|
21217
|
+
const abs = Math.abs(pct).toFixed(digits).replace(".", ",");
|
|
21218
|
+
const sign = pct > 0 ? "+" : pct < 0 ? "\u2212" : "";
|
|
21219
|
+
return `${sign}${abs}%`;
|
|
21220
|
+
}
|
|
21221
|
+
function formatBRLDelta(amount) {
|
|
21222
|
+
if (amount == null) return DASH;
|
|
21223
|
+
const parts = toDecimalParts(String(amount));
|
|
21224
|
+
if (!parts) return DASH;
|
|
21225
|
+
const isZero = parts.intDigits === "0" && parts.frac2 === "00";
|
|
21226
|
+
const sign = isZero ? "" : parts.negative ? "\u2212" : "+";
|
|
21227
|
+
const grouped = groupThousands(parts.intDigits);
|
|
21228
|
+
return `${sign}R$ ${grouped},${parts.frac2}`;
|
|
21229
|
+
}
|
|
21230
|
+
|
|
21231
|
+
// src/components/financial-goals/tariffValuation.ts
|
|
21232
|
+
var MONEY_HOURLY_MAX_DAYS = 31;
|
|
21233
|
+
var TARIFF_DEFAULT_TIMEZONE = "America/Sao_Paulo";
|
|
21234
|
+
var HOUR_MS2 = 36e5;
|
|
21235
|
+
var QTY_SCALE = 6;
|
|
21236
|
+
var PRICE_SCALE = 6;
|
|
21237
|
+
var AMOUNT_SCALE = QTY_SCALE + PRICE_SCALE;
|
|
21238
|
+
var MONEY_MAX_SEGMENT_FETCHES = 31;
|
|
21239
|
+
function toItemMoney(dm) {
|
|
21240
|
+
if (!dm) return { state: "missing", currency: "BRL", coverage: 0, reason: "no-data" };
|
|
21241
|
+
if (dm.state === "complete" && typeof dm.amount === "string") {
|
|
21242
|
+
const out = { state: "complete", amount: dm.amount, currency: "BRL", coverage: 1 };
|
|
21243
|
+
if (dm.priceVaries) out.priceVaries = true;
|
|
21244
|
+
return out;
|
|
21245
|
+
}
|
|
21246
|
+
if (dm.state === "uncategorized" || dm.state === "not-convertible") {
|
|
21247
|
+
return { state: "uncategorized", currency: "BRL", coverage: 0, reason: dm.reason || "no-category" };
|
|
21248
|
+
}
|
|
21249
|
+
const hourlyOnly = dm.reason === "needs-hourly" || dm.reason === "intraday-tariff-long-period";
|
|
21250
|
+
if (dm.state === "partial" || dm.state === "none" && hourlyOnly) {
|
|
21251
|
+
const out = {
|
|
21252
|
+
state: "partial",
|
|
21253
|
+
currency: "BRL",
|
|
21254
|
+
coverage: typeof dm.coveredRatio === "number" ? dm.coveredRatio : 0
|
|
21255
|
+
};
|
|
21256
|
+
if (dm.reason) out.reason = dm.reason;
|
|
21257
|
+
if (dm.priceVaries) out.priceVaries = true;
|
|
21258
|
+
return out;
|
|
21259
|
+
}
|
|
21260
|
+
return { state: "missing", currency: "BRL", coverage: 0, reason: dm.reason || "no-tariff" };
|
|
21261
|
+
}
|
|
21262
|
+
function sumItemMoney(list) {
|
|
21263
|
+
const items = Array.isArray(list) ? list : [];
|
|
21264
|
+
const total = items.length;
|
|
21265
|
+
if (total === 0) return { state: "none", covered: 0, total: 0 };
|
|
21266
|
+
let acc = 0n;
|
|
21267
|
+
let covered = 0;
|
|
21268
|
+
for (const m of items) {
|
|
21269
|
+
if (!m || m.state !== "complete" || typeof m.amount !== "string") continue;
|
|
21270
|
+
const v = parseScaled(m.amount, AMOUNT_SCALE);
|
|
21271
|
+
if (v == null) continue;
|
|
21272
|
+
acc += v;
|
|
21273
|
+
covered += 1;
|
|
21274
|
+
}
|
|
21275
|
+
if (covered === total) return { state: "complete", amount: formatScaled(acc, AMOUNT_SCALE), covered, total };
|
|
21276
|
+
return { state: covered > 0 ? "partial" : "none", covered, total };
|
|
21277
|
+
}
|
|
21278
|
+
function roundMoney2(amount) {
|
|
21279
|
+
if (typeof amount !== "string") return null;
|
|
21280
|
+
const m = DECIMAL_RE.exec(amount.trim());
|
|
21281
|
+
if (!m) return null;
|
|
21282
|
+
const frac = m[3] || "";
|
|
21283
|
+
let cents = BigInt(m[2]) * 100n + BigInt(frac.slice(0, 2).padEnd(2, "0"));
|
|
21284
|
+
if (frac.charAt(2) >= "5") cents += 1n;
|
|
21285
|
+
const neg = m[1] === "-" && cents !== 0n;
|
|
21286
|
+
return `${neg ? "-" : ""}${(cents / 100n).toString()}.${(cents % 100n).toString().padStart(2, "0")}`;
|
|
21287
|
+
}
|
|
21288
|
+
function moneyStateChipLabel(state6) {
|
|
21289
|
+
if (state6 === "uncategorized") return "Sem categoria";
|
|
21290
|
+
if (state6 === "missing") return "Sem tarifa";
|
|
21291
|
+
if (state6 === "partial") return "Tarifa parcial";
|
|
21292
|
+
return "";
|
|
21293
|
+
}
|
|
21294
|
+
function moneyReasonText(reason) {
|
|
21295
|
+
switch (reason) {
|
|
21296
|
+
case "no-category":
|
|
21297
|
+
return "Dispositivo sem categoria tarif\xE1ria (Lojas / \xC1rea Comum).";
|
|
21298
|
+
case "no-tariff":
|
|
21299
|
+
return "N\xE3o h\xE1 tarifa cadastrada para todo o per\xEDodo.";
|
|
21300
|
+
case "no-data":
|
|
21301
|
+
return "Sem dados de consumo em parte do per\xEDodo.";
|
|
21302
|
+
case "needs-hourly":
|
|
21303
|
+
case "intraday-tariff-long-period":
|
|
21304
|
+
return "Tarifa hor\xE1ria ainda n\xE3o suportada nesta vis\xE3o.";
|
|
21305
|
+
case "too-many-segments":
|
|
21306
|
+
return "Tarifa muda muitas vezes no per\xEDodo; reduza o intervalo.";
|
|
21307
|
+
case "invalid-qty":
|
|
21308
|
+
return "Consumo inv\xE1lido em parte do per\xEDodo.";
|
|
21309
|
+
default:
|
|
21310
|
+
return "";
|
|
21311
|
+
}
|
|
21312
|
+
}
|
|
21313
|
+
var DECIMAL_RE = /^([+-]?)(\d+)(?:\.(\d+))?$/;
|
|
21314
|
+
function parseScaled(s, scale) {
|
|
21315
|
+
const m = DECIMAL_RE.exec(String(s).trim());
|
|
21316
|
+
if (!m) return null;
|
|
21317
|
+
const frac = (m[3] || "").slice(0, scale).padEnd(scale, "0");
|
|
21318
|
+
const v = BigInt(m[2] + frac);
|
|
21319
|
+
return m[1] === "-" ? -v : v;
|
|
21320
|
+
}
|
|
21321
|
+
function formatScaled(v, scale) {
|
|
21322
|
+
const neg = v < 0n;
|
|
21323
|
+
const abs = neg ? -v : v;
|
|
21324
|
+
const digits = abs.toString().padStart(scale + 1, "0");
|
|
21325
|
+
const int = digits.slice(0, digits.length - scale);
|
|
21326
|
+
let frac = digits.slice(digits.length - scale).replace(/0+$/, "");
|
|
21327
|
+
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
21328
|
+
const isZero = abs === 0n;
|
|
21329
|
+
return `${neg && !isZero ? "-" : ""}${int}.${frac}`;
|
|
21330
|
+
}
|
|
21331
|
+
function qtyToScaled(qty) {
|
|
21332
|
+
if (typeof qty !== "number" || !Number.isFinite(qty) || Math.abs(qty) >= 1e15) return null;
|
|
21333
|
+
return parseScaled(qty.toFixed(QTY_SCALE), QTY_SCALE);
|
|
21334
|
+
}
|
|
21335
|
+
function isPriceString(p) {
|
|
21336
|
+
return typeof p === "string" && DECIMAL_RE.test(p.trim());
|
|
21337
|
+
}
|
|
21338
|
+
function makeLocalPartsFn(timezone) {
|
|
21339
|
+
let fmt2 = null;
|
|
21340
|
+
try {
|
|
21341
|
+
fmt2 = new Intl.DateTimeFormat("en-US", {
|
|
21342
|
+
timeZone: timezone,
|
|
21343
|
+
year: "numeric",
|
|
21344
|
+
month: "2-digit",
|
|
21345
|
+
day: "2-digit",
|
|
21346
|
+
hour: "2-digit",
|
|
21347
|
+
hourCycle: "h23"
|
|
21348
|
+
});
|
|
21349
|
+
} catch {
|
|
21350
|
+
fmt2 = null;
|
|
21351
|
+
}
|
|
21352
|
+
return (ts) => {
|
|
21353
|
+
if (fmt2) {
|
|
21354
|
+
const out = {};
|
|
21355
|
+
for (const p of fmt2.formatToParts(new Date(ts))) {
|
|
21356
|
+
if (p.type === "year" || p.type === "month" || p.type === "day" || p.type === "hour") {
|
|
21357
|
+
out[p.type] = Number(p.value);
|
|
21358
|
+
}
|
|
21359
|
+
}
|
|
21360
|
+
return { year: out.year, month: out.month, day: out.day, hour: out.hour % 24 };
|
|
21361
|
+
}
|
|
21362
|
+
const d = new Date(ts - 3 * HOUR_MS2);
|
|
21363
|
+
return { year: d.getUTCFullYear(), month: d.getUTCMonth() + 1, day: d.getUTCDate(), hour: d.getUTCHours() };
|
|
21364
|
+
};
|
|
21365
|
+
}
|
|
21366
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
21367
|
+
function nodePrice(node) {
|
|
21368
|
+
return node && isPriceString(node.price) ? node.price.trim() : null;
|
|
21369
|
+
}
|
|
21370
|
+
function hourPrice(dayNode, hour) {
|
|
21371
|
+
const hourly = dayNode?.hourly;
|
|
21372
|
+
if (!hourly) return null;
|
|
21373
|
+
return nodePrice(hourly[String(hour)]) ?? nodePrice(hourly[pad2(hour)]);
|
|
21374
|
+
}
|
|
21375
|
+
function resolveTreePrice(tree, p) {
|
|
21376
|
+
const mm = pad2(p.month);
|
|
21377
|
+
const dd = pad2(p.day);
|
|
21378
|
+
const mmdd = `${mm}-${dd}`;
|
|
21379
|
+
const monthNode = tree.monthly?.[mm];
|
|
21380
|
+
const dayNodes = [tree.daily?.[mmdd], monthNode?.daily?.[dd], monthNode?.daily?.[mmdd]];
|
|
21381
|
+
for (const dn of dayNodes) {
|
|
21382
|
+
const hp = hourPrice(dn, p.hour);
|
|
21383
|
+
if (hp) return hp;
|
|
21384
|
+
}
|
|
21385
|
+
for (const dn of dayNodes) {
|
|
21386
|
+
const dp = nodePrice(dn);
|
|
21387
|
+
if (dp) return dp;
|
|
21388
|
+
}
|
|
21389
|
+
return nodePrice(monthNode) ?? nodePrice(tree.annual);
|
|
21390
|
+
}
|
|
21391
|
+
function createTariffValuator(options) {
|
|
21392
|
+
const trees = options?.trees || {};
|
|
21393
|
+
const rawLocalParts = makeLocalPartsFn(options?.timezone || TARIFF_DEFAULT_TIMEZONE);
|
|
21394
|
+
const partsCache = /* @__PURE__ */ new Map();
|
|
21395
|
+
const localParts = (ts) => {
|
|
21396
|
+
let p = partsCache.get(ts);
|
|
21397
|
+
if (!p) {
|
|
21398
|
+
if (partsCache.size > 5e4) partsCache.clear();
|
|
21399
|
+
p = rawLocalParts(ts);
|
|
21400
|
+
partsCache.set(ts, p);
|
|
21401
|
+
}
|
|
21402
|
+
return p;
|
|
21403
|
+
};
|
|
21404
|
+
const byYear = {};
|
|
21405
|
+
Object.keys(trees).forEach((cat) => {
|
|
21406
|
+
const map = /* @__PURE__ */ new Map();
|
|
21407
|
+
for (const res of trees[cat] || []) {
|
|
21408
|
+
if (res && typeof res.year === "number" && res.tree) map.set(res.year, res.tree);
|
|
21409
|
+
}
|
|
21410
|
+
byYear[cat] = map;
|
|
21411
|
+
});
|
|
21412
|
+
function hasAnyTariff(category) {
|
|
21413
|
+
const map = byYear[category];
|
|
21414
|
+
return !!map && map.size > 0;
|
|
21415
|
+
}
|
|
21416
|
+
function priceAt(category, ts) {
|
|
21417
|
+
const map = byYear[category];
|
|
21418
|
+
if (!map || !Number.isFinite(ts)) return null;
|
|
21419
|
+
const p = localParts(ts);
|
|
21420
|
+
const tree = map.get(p.year);
|
|
21421
|
+
return tree ? resolveTreePrice(tree, p) : null;
|
|
21422
|
+
}
|
|
21423
|
+
function pricesInside(category, startTs, endTs) {
|
|
21424
|
+
const out = [];
|
|
21425
|
+
const end = Math.max(endTs, startTs + 1);
|
|
21426
|
+
for (let t = startTs; t < end; t += HOUR_MS2) out.push(priceAt(category, t));
|
|
21427
|
+
return out;
|
|
21428
|
+
}
|
|
21429
|
+
function valuate(series, opts) {
|
|
21430
|
+
const needsHourlyReason = opts?.intradayLimited ? "intraday-tariff-long-period" : "needs-hourly";
|
|
21431
|
+
const category = series?.category ?? null;
|
|
21432
|
+
if (!category) return { state: "uncategorized", reason: "no-category" };
|
|
21433
|
+
if (!hasAnyTariff(category)) return { state: "none", reason: "no-tariff", coveredRatio: 0 };
|
|
21434
|
+
const buckets = Array.isArray(series.buckets) ? series.buckets : [];
|
|
21435
|
+
if (buckets.length === 0) return { state: "none", reason: "no-data", coveredRatio: 0 };
|
|
21436
|
+
let acc = 0n;
|
|
21437
|
+
let covered = 0;
|
|
21438
|
+
let firstReason;
|
|
21439
|
+
const distinct = /* @__PURE__ */ new Set();
|
|
21440
|
+
for (const b of buckets) {
|
|
21441
|
+
const qty = qtyToScaled(b?.qty);
|
|
21442
|
+
if (qty == null || !Number.isFinite(b.startTs) || !Number.isFinite(b.endTs)) {
|
|
21443
|
+
firstReason = firstReason || "invalid-qty";
|
|
21444
|
+
continue;
|
|
21445
|
+
}
|
|
21446
|
+
const prices = pricesInside(category, b.startTs, b.endTs);
|
|
21447
|
+
if (prices.some((p) => p == null)) {
|
|
21448
|
+
firstReason = firstReason || "no-tariff";
|
|
21449
|
+
continue;
|
|
21450
|
+
}
|
|
21451
|
+
const unique = new Set(prices);
|
|
21452
|
+
if (unique.size > 1) {
|
|
21453
|
+
firstReason = firstReason || needsHourlyReason;
|
|
21454
|
+
continue;
|
|
21455
|
+
}
|
|
21456
|
+
const price = prices[0];
|
|
21457
|
+
const scaledPrice = parseScaled(price, PRICE_SCALE);
|
|
21458
|
+
if (scaledPrice == null) {
|
|
21459
|
+
firstReason = firstReason || "no-tariff";
|
|
21460
|
+
continue;
|
|
21461
|
+
}
|
|
21462
|
+
distinct.add(formatScaled(scaledPrice, PRICE_SCALE));
|
|
21463
|
+
acc += qty * scaledPrice;
|
|
21464
|
+
covered += 1;
|
|
21465
|
+
}
|
|
21466
|
+
const ratio = covered / buckets.length;
|
|
21467
|
+
const priceVaries = distinct.size > 1;
|
|
21468
|
+
if (covered === buckets.length) {
|
|
21469
|
+
return { state: "complete", amount: formatScaled(acc, AMOUNT_SCALE), coveredRatio: 1, priceVaries };
|
|
21470
|
+
}
|
|
21471
|
+
if (covered === 0) return { state: "none", reason: firstReason || "no-tariff", coveredRatio: 0 };
|
|
21472
|
+
return { state: "partial", reason: firstReason, coveredRatio: ratio, priceVaries };
|
|
21473
|
+
}
|
|
21474
|
+
function sum2(list) {
|
|
21475
|
+
return sumItemMoney(list);
|
|
21476
|
+
}
|
|
21477
|
+
function normPrice(p) {
|
|
21478
|
+
if (p == null) return null;
|
|
21479
|
+
const v = parseScaled(p, PRICE_SCALE);
|
|
21480
|
+
return v == null ? null : formatScaled(v, PRICE_SCALE);
|
|
21481
|
+
}
|
|
21482
|
+
function planSegments(categories, startTs, endTs) {
|
|
21483
|
+
const cats = Array.from(new Set((categories || []).filter(Boolean)));
|
|
21484
|
+
const empty = { startTs, endTs, segments: [], fetchCount: 0, tooMany: false };
|
|
21485
|
+
if (!cats.length || !Number.isFinite(startTs) || !Number.isFinite(endTs) || endTs <= startTs) return empty;
|
|
21486
|
+
const hours = [];
|
|
21487
|
+
const dayKeys = [];
|
|
21488
|
+
const prices = {};
|
|
21489
|
+
cats.forEach((c) => prices[c] = []);
|
|
21490
|
+
for (let t = startTs; t < endTs; t += HOUR_MS2) {
|
|
21491
|
+
const p = localParts(t);
|
|
21492
|
+
hours.push(t);
|
|
21493
|
+
dayKeys.push(`${p.year}-${p.month}-${p.day}`);
|
|
21494
|
+
for (const c of cats) prices[c].push(normPrice(priceAt(c, t)));
|
|
21495
|
+
}
|
|
21496
|
+
const intraday = {};
|
|
21497
|
+
for (const c of cats) {
|
|
21498
|
+
const first = /* @__PURE__ */ new Map();
|
|
21499
|
+
const set = /* @__PURE__ */ new Set();
|
|
21500
|
+
hours.forEach((_, i) => {
|
|
21501
|
+
const dk = dayKeys[i];
|
|
21502
|
+
if (!first.has(dk)) first.set(dk, prices[c][i]);
|
|
21503
|
+
else if (first.get(dk) !== prices[c][i]) set.add(dk);
|
|
21504
|
+
});
|
|
21505
|
+
intraday[c] = set;
|
|
21506
|
+
}
|
|
21507
|
+
const segments = [];
|
|
21508
|
+
let curKey = "";
|
|
21509
|
+
hours.forEach((t, i) => {
|
|
21510
|
+
const parts = cats.map((c) => intraday[c].has(dayKeys[i]) ? "H" : prices[c][i] ?? "-");
|
|
21511
|
+
const key = parts.join("|");
|
|
21512
|
+
if (segments.length && key === curKey) return;
|
|
21513
|
+
if (segments.length) segments[segments.length - 1].endTs = t;
|
|
21514
|
+
curKey = key;
|
|
21515
|
+
const seg = { startTs: t, endTs, prices: {}, states: {}, needsFetch: false };
|
|
21516
|
+
cats.forEach((c, ci) => {
|
|
21517
|
+
const k = parts[ci];
|
|
21518
|
+
if (k === "H") seg.states[c] = "hourly";
|
|
21519
|
+
else if (k === "-") seg.states[c] = "none";
|
|
21520
|
+
else {
|
|
21521
|
+
seg.states[c] = "priced";
|
|
21522
|
+
seg.prices[c] = k;
|
|
21523
|
+
seg.needsFetch = true;
|
|
21524
|
+
}
|
|
21525
|
+
});
|
|
21526
|
+
segments.push(seg);
|
|
21527
|
+
});
|
|
21528
|
+
const fetchCount = segments.filter((s) => s.needsFetch).length;
|
|
21529
|
+
return { startTs, endTs, segments, fetchCount, tooMany: fetchCount > MONEY_MAX_SEGMENT_FETCHES };
|
|
21530
|
+
}
|
|
21531
|
+
function valuatePlan(category, plan, qtyBySegment) {
|
|
21532
|
+
if (!category) return { state: "uncategorized", reason: "no-category" };
|
|
21533
|
+
if (!hasAnyTariff(category)) return { state: "none", reason: "no-tariff", coveredRatio: 0 };
|
|
21534
|
+
const segs = plan?.segments || [];
|
|
21535
|
+
if (!segs.length) return { state: "none", reason: "no-data", coveredRatio: 0 };
|
|
21536
|
+
if (plan.tooMany) return { state: "partial", reason: "too-many-segments", coveredRatio: 0 };
|
|
21537
|
+
const span = Math.max(1, plan.endTs - plan.startTs);
|
|
21538
|
+
let acc = 0n;
|
|
21539
|
+
let coveredMs = 0;
|
|
21540
|
+
let coveredSegs = 0;
|
|
21541
|
+
let firstReason;
|
|
21542
|
+
const distinct = /* @__PURE__ */ new Set();
|
|
21543
|
+
segs.forEach((seg, i) => {
|
|
21544
|
+
const st = seg.states[category];
|
|
21545
|
+
if (st === "hourly") {
|
|
21546
|
+
firstReason = firstReason || "needs-hourly";
|
|
21547
|
+
return;
|
|
21548
|
+
}
|
|
21549
|
+
if (st !== "priced" || !seg.prices[category]) {
|
|
21550
|
+
firstReason = firstReason || "no-tariff";
|
|
21551
|
+
return;
|
|
21552
|
+
}
|
|
21553
|
+
const raw = qtyBySegment?.[i];
|
|
21554
|
+
const qty = raw == null ? null : qtyToScaled(raw);
|
|
21555
|
+
if (qty == null) {
|
|
21556
|
+
firstReason = firstReason || (raw == null ? "no-data" : "invalid-qty");
|
|
21557
|
+
return;
|
|
21558
|
+
}
|
|
21559
|
+
const price = parseScaled(seg.prices[category], PRICE_SCALE);
|
|
21560
|
+
distinct.add(seg.prices[category]);
|
|
21561
|
+
acc += qty * price;
|
|
21562
|
+
coveredMs += seg.endTs - seg.startTs;
|
|
21563
|
+
coveredSegs += 1;
|
|
21564
|
+
});
|
|
21565
|
+
const priceVaries = distinct.size > 1;
|
|
21566
|
+
if (coveredSegs === segs.length) {
|
|
21567
|
+
return { state: "complete", amount: formatScaled(acc, AMOUNT_SCALE), coveredRatio: 1, priceVaries };
|
|
21568
|
+
}
|
|
21569
|
+
if (coveredSegs === 0) {
|
|
21570
|
+
if (firstReason === "needs-hourly") return { state: "partial", reason: firstReason, coveredRatio: 0 };
|
|
21571
|
+
return { state: "none", reason: firstReason || "no-tariff", coveredRatio: 0 };
|
|
21572
|
+
}
|
|
21573
|
+
return { state: "partial", reason: firstReason, coveredRatio: coveredMs / span, priceVaries };
|
|
21574
|
+
}
|
|
21575
|
+
function chooseGranularity(categories, startTs, endTs) {
|
|
21576
|
+
const cats = Array.from(new Set((categories || []).filter(Boolean)));
|
|
21577
|
+
let intraday = false;
|
|
21578
|
+
outer: for (const cat of cats) {
|
|
21579
|
+
let dayKey = "";
|
|
21580
|
+
let dayPrice;
|
|
21581
|
+
for (let t = startTs; t < endTs; t += HOUR_MS2) {
|
|
21582
|
+
const p = localParts(t);
|
|
21583
|
+
const key = `${p.year}-${p.month}-${p.day}`;
|
|
21584
|
+
const price = priceAt(cat, t);
|
|
21585
|
+
if (key !== dayKey) {
|
|
21586
|
+
dayKey = key;
|
|
21587
|
+
dayPrice = price;
|
|
21588
|
+
} else if (price !== dayPrice) {
|
|
21589
|
+
intraday = true;
|
|
21590
|
+
break outer;
|
|
21591
|
+
}
|
|
21592
|
+
}
|
|
21593
|
+
}
|
|
21594
|
+
if (!intraday) return { granularity: "1d", intradayLimited: false };
|
|
21595
|
+
const days = (endTs - startTs) / (24 * HOUR_MS2);
|
|
21596
|
+
if (days <= MONEY_HOURLY_MAX_DAYS) return { granularity: "1h", intradayLimited: false };
|
|
21597
|
+
return { granularity: "1d", intradayLimited: true };
|
|
21598
|
+
}
|
|
21599
|
+
return { priceAt, valuate, sum: sum2, chooseGranularity, planSegments, valuatePlan };
|
|
21600
|
+
}
|
|
21601
|
+
|
|
21602
|
+
// src/components/financial-goals/moneyDisplay.ts
|
|
21603
|
+
var MONEY_ESTIMATE_LABEL = "Custo estimado";
|
|
21604
|
+
var MONEY_REPORT_HEADER = "Custo estimado (R$)";
|
|
21605
|
+
var MONEY_INCOMPLETE_LABEL = "Cobertura incompleta";
|
|
21606
|
+
var VALUE_DISPLAY_MODE_STORAGE_PREFIX = "myio:value-display-mode:v1";
|
|
21607
|
+
function valueDisplayModeStorageKey(tbUserId, customerTbId) {
|
|
21608
|
+
return `${VALUE_DISPLAY_MODE_STORAGE_PREFIX}:${tbUserId || "anon"}:${customerTbId || "default"}`;
|
|
21609
|
+
}
|
|
21610
|
+
function readValueDisplayMode(storage, key) {
|
|
21611
|
+
try {
|
|
21612
|
+
return storage?.getItem(key) === "money" ? "money" : "physical";
|
|
21613
|
+
} catch {
|
|
21614
|
+
return "physical";
|
|
21615
|
+
}
|
|
21616
|
+
}
|
|
21617
|
+
function writeValueDisplayMode(storage, key, mode) {
|
|
21618
|
+
try {
|
|
21619
|
+
if (!storage) return false;
|
|
21620
|
+
storage.setItem(key, mode === "money" ? "money" : "physical");
|
|
21621
|
+
return true;
|
|
21622
|
+
} catch {
|
|
21623
|
+
return false;
|
|
21624
|
+
}
|
|
21625
|
+
}
|
|
21626
|
+
function resolveEffectiveDisplayMode(args) {
|
|
21627
|
+
return args.requested === "money" && args.eligible === true && args.available === true ? "money" : "physical";
|
|
21628
|
+
}
|
|
21629
|
+
var MONEY_CONVERTIBLE_GROUPS = {
|
|
21630
|
+
energy: ["lojas", "areacomum"],
|
|
21631
|
+
water: ["lojas", "areacomum", "banheiros"]
|
|
21632
|
+
};
|
|
21633
|
+
var normGroup = (g) => String(g ?? "").trim().toLowerCase().replace(/[\s_-]+/g, "");
|
|
21634
|
+
function isMoneyConvertibleGroup(domain, group) {
|
|
21635
|
+
const list = MONEY_CONVERTIBLE_GROUPS[domain];
|
|
21636
|
+
return !!list && list.includes(normGroup(group));
|
|
21637
|
+
}
|
|
21638
|
+
function parseMoneyCategoryRule(raw) {
|
|
21639
|
+
let v = raw;
|
|
21640
|
+
if (typeof v === "string") {
|
|
21641
|
+
try {
|
|
21642
|
+
v = JSON.parse(v);
|
|
21643
|
+
} catch {
|
|
21644
|
+
return null;
|
|
21645
|
+
}
|
|
21646
|
+
}
|
|
21647
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return null;
|
|
21648
|
+
const o = v;
|
|
21649
|
+
if (o.source != null && o.source !== "classification") return null;
|
|
21650
|
+
const list = (x) => Array.isArray(x) ? x.map((s) => String(s).trim() === "*" ? "*" : normGroup(s)).filter(Boolean) : [];
|
|
21651
|
+
const SPECIFIC = list(o.SPECIFIC);
|
|
21652
|
+
const COMMON_AREA = list(o.COMMON_AREA);
|
|
21653
|
+
if (!SPECIFIC.length && !COMMON_AREA.length) return null;
|
|
21654
|
+
return { source: "classification", SPECIFIC, COMMON_AREA };
|
|
21655
|
+
}
|
|
21656
|
+
function resolveMoneyCategory(rule, group) {
|
|
21657
|
+
if (!rule) return null;
|
|
21658
|
+
const g = normGroup(group);
|
|
21659
|
+
if (!g) return null;
|
|
21660
|
+
if (rule.SPECIFIC.includes(g)) return "SPECIFIC";
|
|
21661
|
+
if (rule.COMMON_AREA.includes(g)) return "COMMON_AREA";
|
|
21662
|
+
if (rule.SPECIFIC.includes("*")) return "SPECIFIC";
|
|
21663
|
+
if (rule.COMMON_AREA.includes("*")) return "COMMON_AREA";
|
|
21664
|
+
return null;
|
|
21665
|
+
}
|
|
21666
|
+
function qtyOf(map, key) {
|
|
21667
|
+
if (!map) return void 0;
|
|
21668
|
+
const v = map instanceof Map ? map.get(key) : map[key];
|
|
21669
|
+
return typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
21670
|
+
}
|
|
21671
|
+
function yearsSpanned(startTs, endTs, timezone) {
|
|
21672
|
+
const yearOf = (ts) => {
|
|
21673
|
+
try {
|
|
21674
|
+
return Number(new Intl.DateTimeFormat("en-US", { timeZone: timezone, year: "numeric" }).format(new Date(ts)));
|
|
21675
|
+
} catch {
|
|
21676
|
+
return new Date(ts - 3 * 36e5).getUTCFullYear();
|
|
21677
|
+
}
|
|
21678
|
+
};
|
|
21679
|
+
const a = yearOf(startTs);
|
|
21680
|
+
const b = yearOf(Math.max(startTs, endTs - 1));
|
|
21681
|
+
const out = [];
|
|
21682
|
+
for (let y = a; y <= b; y++) out.push(y);
|
|
21683
|
+
return out;
|
|
21684
|
+
}
|
|
21685
|
+
var WIRE_DOMAIN = { energy: "ENERGY", water: "WATER" };
|
|
21686
|
+
async function valuateDomainMoney(opts) {
|
|
21687
|
+
const timezone = opts.timezone || TARIFF_DEFAULT_TIMEZONE;
|
|
21688
|
+
const devices = (opts.devices || []).filter((d) => d && d.key && isMoneyConvertibleGroup(opts.domain, d.group));
|
|
21689
|
+
const categoryByKey = /* @__PURE__ */ new Map();
|
|
21690
|
+
for (const d of devices) categoryByKey.set(d.key, resolveMoneyCategory(opts.rule, d.group));
|
|
21691
|
+
const categories = Array.from(new Set(Array.from(categoryByKey.values()).filter(Boolean)));
|
|
21692
|
+
const trees = {};
|
|
21693
|
+
const years = yearsSpanned(opts.startTs, opts.endTs, timezone);
|
|
21694
|
+
await Promise.all(
|
|
21695
|
+
categories.flatMap(
|
|
21696
|
+
(category) => years.map(async (year) => {
|
|
21697
|
+
let res = null;
|
|
21698
|
+
try {
|
|
21699
|
+
res = await opts.loadTree({ domain: WIRE_DOMAIN[opts.domain], category, year });
|
|
21700
|
+
} catch {
|
|
21701
|
+
res = null;
|
|
21702
|
+
}
|
|
21703
|
+
if (res && res.tree && Object.keys(res.tree).length > 0) {
|
|
21704
|
+
(trees[category] = trees[category] || []).push({ ...res, year });
|
|
21705
|
+
}
|
|
21706
|
+
})
|
|
21707
|
+
)
|
|
21708
|
+
);
|
|
21709
|
+
const valuator = createTariffValuator({ trees, timezone });
|
|
21710
|
+
const plan = valuator.planSegments(categories, opts.startTs, opts.endTs);
|
|
21711
|
+
const qtyBySeg = plan.segments.map(() => null);
|
|
21712
|
+
let segmentFetches = 0;
|
|
21713
|
+
if (plan.segments.length === 1 && plan.segments[0].needsFetch) {
|
|
21714
|
+
qtyBySeg[0] = opts.periodTotals;
|
|
21715
|
+
} else if (!plan.tooMany && typeof opts.fetchSegmentTotals === "function") {
|
|
21716
|
+
for (let i = 0; i < plan.segments.length; i++) {
|
|
21717
|
+
const seg = plan.segments[i];
|
|
21718
|
+
if (!seg.needsFetch) continue;
|
|
21719
|
+
segmentFetches += 1;
|
|
21720
|
+
try {
|
|
21721
|
+
qtyBySeg[i] = await opts.fetchSegmentTotals(seg.startTs, seg.endTs);
|
|
21722
|
+
} catch {
|
|
21723
|
+
qtyBySeg[i] = null;
|
|
21724
|
+
}
|
|
21725
|
+
}
|
|
21726
|
+
}
|
|
21727
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
21728
|
+
for (const d of devices) {
|
|
21729
|
+
const qtys = plan.segments.map((_, i) => qtyOf(qtyBySeg[i], d.key));
|
|
21730
|
+
byKey.set(d.key, toItemMoney(valuator.valuatePlan(categoryByKey.get(d.key) ?? null, plan, qtys)));
|
|
21731
|
+
}
|
|
21732
|
+
return {
|
|
21733
|
+
domain: opts.domain,
|
|
21734
|
+
startTs: opts.startTs,
|
|
21735
|
+
endTs: opts.endTs,
|
|
21736
|
+
byKey,
|
|
21737
|
+
categoryByKey,
|
|
21738
|
+
coverage: sumItemMoney(Array.from(byKey.values())),
|
|
21739
|
+
valuator,
|
|
21740
|
+
plan,
|
|
21741
|
+
segmentFetches
|
|
21742
|
+
};
|
|
21743
|
+
}
|
|
21744
|
+
function buildReportMoneyConfig(result, opts = {}) {
|
|
21745
|
+
const keys = opts.deviceKeys && opts.deviceKeys.length ? opts.deviceKeys : Array.from(result.byKey.keys());
|
|
21746
|
+
const perDevice = {};
|
|
21747
|
+
const listed = [];
|
|
21748
|
+
for (const k of keys) {
|
|
21749
|
+
const m = result.byKey.get(k);
|
|
21750
|
+
if (!m) continue;
|
|
21751
|
+
listed.push(m);
|
|
21752
|
+
perDevice[k] = m.state === "complete" ? roundMoney2(m.amount) : null;
|
|
21753
|
+
}
|
|
21754
|
+
const sum2 = sumItemMoney(listed);
|
|
21755
|
+
const complete = sum2.state === "complete";
|
|
21756
|
+
return {
|
|
21757
|
+
overlay: {
|
|
21758
|
+
state: "available",
|
|
21759
|
+
currency: "BRL",
|
|
21760
|
+
coverageComplete: complete,
|
|
21761
|
+
uncategorizedDevices: []
|
|
21762
|
+
},
|
|
21763
|
+
perDevice,
|
|
21764
|
+
total: complete ? roundMoney2(sum2.amount) : null,
|
|
21765
|
+
// The report may list a subset (one group): its total is round(Σ raw) of THOSE rows.
|
|
21766
|
+
totalFor: (ids) => {
|
|
21767
|
+
const s = sumItemMoney((ids || []).map((k) => result.byKey.get(k) || { state: "missing" }));
|
|
21768
|
+
return s.state === "complete" ? roundMoney2(s.amount) : null;
|
|
21769
|
+
},
|
|
21770
|
+
headerLabel: MONEY_REPORT_HEADER,
|
|
21771
|
+
period: opts.period ? { startISO: opts.period.startISO ?? null, endISO: opts.period.endISO ?? null } : { startISO: new Date(result.startTs).toISOString(), endISO: new Date(result.endTs).toISOString() },
|
|
21772
|
+
valuateBucket: (deviceKey, startTs, endTs, qty) => {
|
|
21773
|
+
const cat = result.categoryByKey.get(deviceKey);
|
|
21774
|
+
if (cat === void 0) return null;
|
|
21775
|
+
return toItemMoney(result.valuator.valuate({ deviceKey, category: cat, buckets: [{ startTs, endTs, qty }] }));
|
|
21776
|
+
}
|
|
21777
|
+
};
|
|
21778
|
+
}
|
|
21779
|
+
var esc = (s) => String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
21780
|
+
function formatItemMoney(money) {
|
|
21781
|
+
if (!money || money.state !== "complete" || typeof money.amount !== "string") return null;
|
|
21782
|
+
const s = formatBRL(money.amount);
|
|
21783
|
+
return s === "\u2014" ? null : s;
|
|
21784
|
+
}
|
|
21785
|
+
function moneyCoverageTitle(money) {
|
|
21786
|
+
if (!money) return "";
|
|
21787
|
+
const label = moneyStateChipLabel(money.state);
|
|
21788
|
+
const why = moneyReasonText(money.reason);
|
|
21789
|
+
return [label, why].filter(Boolean).join(" \u2014 ");
|
|
21790
|
+
}
|
|
21791
|
+
function buildMoneyChipHTML(money) {
|
|
21792
|
+
const label = money ? moneyStateChipLabel(money.state) : "";
|
|
21793
|
+
if (!label) return "";
|
|
21794
|
+
return `<span class="myio-money-chip" data-money-state="${esc(money.state)}" title="${esc(moneyCoverageTitle(money))}" style="display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font:600 10px Nunito,sans-serif;background:#fef3c7;color:#92400e;vertical-align:middle;white-space:nowrap;">${esc(label)}</span>`;
|
|
21795
|
+
}
|
|
21796
|
+
function buildMoneyCoverageMarkerHTML(sum2) {
|
|
21797
|
+
if (!sum2 || !sum2.total) return "";
|
|
21798
|
+
return `<span class="myio-money-coverage" data-money-coverage="incomplete" title="Total exibido em unidade f\xEDsica: nem todos os dispositivos t\xEAm custo estimado completo." style="display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font:600 10px Nunito,sans-serif;background:#fef3c7;color:#92400e;white-space:nowrap;">${MONEY_INCOMPLETE_LABEL} (${sum2.covered} de ${sum2.total})</span>`;
|
|
21799
|
+
}
|
|
21800
|
+
|
|
21129
21801
|
// src/components/cards/main-view/v5.2.0/template-card-v5.js
|
|
21130
21802
|
var LABEL_CHAR_LIMIT2 = 18;
|
|
21131
21803
|
var ENERGY_DEVICE_TYPES = getTypesByCategory("energy");
|
|
@@ -21213,7 +21885,10 @@ function renderCardComponentV5({
|
|
|
21213
21885
|
// status neutro (não marca offline nem pisca enquanto carrega)
|
|
21214
21886
|
dataLoading = false,
|
|
21215
21887
|
// ED-1354: indicadores B1/B2/S (bombas MOTOR + solenoide) no card do poço
|
|
21216
|
-
equipmentIndicators
|
|
21888
|
+
equipmentIndicators,
|
|
21889
|
+
// RFC-0241 Part B: 'money' → "Custo estimado" em R$ quando money.state === 'complete'
|
|
21890
|
+
displayMode,
|
|
21891
|
+
money
|
|
21217
21892
|
} = entityObject;
|
|
21218
21893
|
const rawProfile = String(deviceProfile || legacyDeviceType || "");
|
|
21219
21894
|
const isManualDevice = /_MANUAL$/i.test(rawProfile);
|
|
@@ -21466,6 +22141,16 @@ function renderCardComponentV5({
|
|
|
21466
22141
|
ingestionId: ingestionId || entityId
|
|
21467
22142
|
// Store ingestionId for API calls
|
|
21468
22143
|
};
|
|
22144
|
+
const moneyValueHTML = (() => {
|
|
22145
|
+
if (displayMode !== "money" || dataLoading || isTankDevice2) return null;
|
|
22146
|
+
if (!isEnergyDevice2(deviceType) && !isWaterDeviceType(deviceType)) return null;
|
|
22147
|
+
const physical = formatCardValue(cardEntity.lastValue, deviceType);
|
|
22148
|
+
const brl = formatItemMoney(money);
|
|
22149
|
+
if (brl) {
|
|
22150
|
+
return `<span class="consumption-value" data-money="complete" title="Custo estimado \u2014 ${physical}">${brl}</span><span class="myio-money-label" style="margin-left:4px;font:600 9px Nunito,sans-serif;opacity:.7;white-space:nowrap;">Custo estimado</span>`;
|
|
22151
|
+
}
|
|
22152
|
+
return `<span class="consumption-value">${physical}</span>${buildMoneyChipHTML(money)}`;
|
|
22153
|
+
})();
|
|
21469
22154
|
if (enableSelection && MyIOSelectionStore) {
|
|
21470
22155
|
MyIOSelectionStore.registerEntity(cardEntity);
|
|
21471
22156
|
}
|
|
@@ -21792,7 +22477,7 @@ function renderCardComponentV5({
|
|
|
21792
22477
|
<span class="flash-icon ${shouldFlashIcon2 ? "flash" : ""}">
|
|
21793
22478
|
${icon2}
|
|
21794
22479
|
</span>
|
|
21795
|
-
${dataLoading ? `<span class="consumption-value myio-value-loading" title="Carregando dados de telemetria" aria-busy="true"><span class="myio-value-spinner" aria-hidden="true"></span>Carregando\u2026</span>` : `<span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>`}${!dataLoading && showTempWarning ? `<span class="myio-temp-warn-icon" title="${tempValueTitle}" aria-label="Leitura atrasada">\u26A0\uFE0F</span>` : ""}
|
|
22480
|
+
${moneyValueHTML !== null ? moneyValueHTML : dataLoading ? `<span class="consumption-value myio-value-loading" title="Carregando dados de telemetria" aria-busy="true"><span class="myio-value-spinner" aria-hidden="true"></span>Carregando\u2026</span>` : `<span class="consumption-value"${showNoTempReading ? ' style="color:#9ca3af;font-weight:500;font-size:0.85em;"' : ""}${tempValueTitle ? ` title="${tempValueTitle}"` : ""}>${formatCardValue(cardEntity.lastValue, deviceType)}</span>`}${!dataLoading && showTempWarning ? `<span class="myio-temp-warn-icon" title="${tempValueTitle}" aria-label="Leitura atrasada">\u26A0\uFE0F</span>` : ""}
|
|
21796
22481
|
</div>
|
|
21797
22482
|
</div>
|
|
21798
22483
|
${dataLoading ? "" : isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#16a34a"}; font-weight: 600; cursor: help;" title="${tempDeviationPercent.title}">${tempDeviationPercent.text}</span>` : ""}
|
|
@@ -32477,8 +33162,8 @@ var EnergyDataFetcher = class {
|
|
|
32477
33162
|
// src/components/premium-modals/internal/engines/CsvExporter.ts
|
|
32478
33163
|
var toCsv = (rows, locale = "pt-BR", sep = ";") => {
|
|
32479
33164
|
const fmt2 = new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
32480
|
-
const
|
|
32481
|
-
return rows.map((r) => r.map((c) => `"${
|
|
33165
|
+
const esc11 = (v) => (typeof v === "number" ? fmt2.format(v) : String(v)).replace(/"/g, '""');
|
|
33166
|
+
return rows.map((r) => r.map((c) => `"${esc11(c)}"`).join(sep)).join("\r\n");
|
|
32482
33167
|
};
|
|
32483
33168
|
|
|
32484
33169
|
// src/components/premium-modals/energy/types.ts
|
|
@@ -36848,14 +37533,14 @@ var DeviceReportModal = class {
|
|
|
36848
37533
|
// Header: "Relatório - <identifier> - <label>" + nome do device (sutil, com copiar).
|
|
36849
37534
|
// O customer já aparece no footer premium. Texto escapado — o shell usa innerHTML no título.
|
|
36850
37535
|
buildHeaderTitleHTML() {
|
|
36851
|
-
const
|
|
36852
|
-
const base =
|
|
37536
|
+
const esc11 = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
37537
|
+
const base = esc11(
|
|
36853
37538
|
`Relat\xF3rio - ${this.params.identifier || "SEM IDENTIFICADOR"} - ${this.params.label || "SEM ETIQUETA"}`
|
|
36854
37539
|
);
|
|
36855
37540
|
const deviceName = String(this.params.deviceName || "").trim();
|
|
36856
37541
|
const deviceHTML = deviceName ? `<span class="myio-dr-devname" style="margin-left:10px;font-size:0.72em;font-weight:400;opacity:.75;display:inline-flex;align-items:center;gap:4px;vertical-align:middle;">
|
|
36857
|
-
${
|
|
36858
|
-
<button type="button" class="myio-dr-copy" data-copy="${
|
|
37542
|
+
${esc11(deviceName)}
|
|
37543
|
+
<button type="button" class="myio-dr-copy" data-copy="${esc11(deviceName)}" title="Copiar nome do dispositivo"
|
|
36859
37544
|
aria-label="Copiar nome do dispositivo"
|
|
36860
37545
|
style="border:none;background:transparent;color:inherit;cursor:pointer;padding:0 2px;line-height:1;opacity:.9;display:inline-flex;">
|
|
36861
37546
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
|
|
@@ -38651,80 +39336,6 @@ function attachFilterOrderingModal(props) {
|
|
|
38651
39336
|
};
|
|
38652
39337
|
}
|
|
38653
39338
|
|
|
38654
|
-
// src/components/financial-goals/moneyFormat.ts
|
|
38655
|
-
var DASH = "\u2014";
|
|
38656
|
-
function toDecimalParts(input) {
|
|
38657
|
-
const s = input.trim();
|
|
38658
|
-
if (!s) return null;
|
|
38659
|
-
const m = /^([+-]?)(\d+)(?:\.(\d+))?$/.exec(s);
|
|
38660
|
-
if (!m) return null;
|
|
38661
|
-
const negative = m[1] === "-";
|
|
38662
|
-
let intDigits = m[2].replace(/^0+(?=\d)/, "");
|
|
38663
|
-
const frac = m[3] || "";
|
|
38664
|
-
let cents = frac.slice(0, 2).padEnd(2, "0");
|
|
38665
|
-
const roundDigit = frac.charAt(2);
|
|
38666
|
-
if (roundDigit && roundDigit >= "5") {
|
|
38667
|
-
const bumped = String(Number(cents) + 1).padStart(2, "0");
|
|
38668
|
-
if (bumped.length > 2) {
|
|
38669
|
-
cents = "00";
|
|
38670
|
-
intDigits = incrementDigits(intDigits);
|
|
38671
|
-
} else {
|
|
38672
|
-
cents = bumped;
|
|
38673
|
-
}
|
|
38674
|
-
}
|
|
38675
|
-
return { negative, intDigits, frac2: cents };
|
|
38676
|
-
}
|
|
38677
|
-
function incrementDigits(digits) {
|
|
38678
|
-
const arr = digits.split("");
|
|
38679
|
-
let i = arr.length - 1;
|
|
38680
|
-
for (; i >= 0; i--) {
|
|
38681
|
-
if (arr[i] === "9") {
|
|
38682
|
-
arr[i] = "0";
|
|
38683
|
-
} else {
|
|
38684
|
-
arr[i] = String(Number(arr[i]) + 1);
|
|
38685
|
-
return arr.join("");
|
|
38686
|
-
}
|
|
38687
|
-
}
|
|
38688
|
-
return "1" + arr.join("");
|
|
38689
|
-
}
|
|
38690
|
-
function groupThousands(intDigits) {
|
|
38691
|
-
return intDigits.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
38692
|
-
}
|
|
38693
|
-
function formatBRL(amount) {
|
|
38694
|
-
if (amount == null) return DASH;
|
|
38695
|
-
const parts = toDecimalParts(String(amount));
|
|
38696
|
-
if (!parts) return DASH;
|
|
38697
|
-
const grouped = groupThousands(parts.intDigits);
|
|
38698
|
-
const sign = parts.negative && !(parts.intDigits === "0" && parts.frac2 === "00") ? "-" : "";
|
|
38699
|
-
return `R$ ${sign}${grouped},${parts.frac2}`;
|
|
38700
|
-
}
|
|
38701
|
-
function signOf(value) {
|
|
38702
|
-
if (value == null || !Number.isFinite(value) || value === 0) return "";
|
|
38703
|
-
return value > 0 ? "+" : "\u2212";
|
|
38704
|
-
}
|
|
38705
|
-
function computeDeltaPct(current, baseline) {
|
|
38706
|
-
if (current == null || baseline == null) return null;
|
|
38707
|
-
const c = Number(String(current).trim());
|
|
38708
|
-
const b = Number(String(baseline).trim());
|
|
38709
|
-
if (!Number.isFinite(c) || !Number.isFinite(b) || b === 0) return null;
|
|
38710
|
-
return (c - b) / Math.abs(b) * 100;
|
|
38711
|
-
}
|
|
38712
|
-
function formatDeltaPct(pct, digits = 1) {
|
|
38713
|
-
if (pct == null || !Number.isFinite(pct)) return DASH;
|
|
38714
|
-
const abs = Math.abs(pct).toFixed(digits).replace(".", ",");
|
|
38715
|
-
const sign = pct > 0 ? "+" : pct < 0 ? "\u2212" : "";
|
|
38716
|
-
return `${sign}${abs}%`;
|
|
38717
|
-
}
|
|
38718
|
-
function formatBRLDelta(amount) {
|
|
38719
|
-
if (amount == null) return DASH;
|
|
38720
|
-
const parts = toDecimalParts(String(amount));
|
|
38721
|
-
if (!parts) return DASH;
|
|
38722
|
-
const isZero = parts.intDigits === "0" && parts.frac2 === "00";
|
|
38723
|
-
const sign = isZero ? "" : parts.negative ? "\u2212" : "+";
|
|
38724
|
-
const grouped = groupThousands(parts.intDigits);
|
|
38725
|
-
return `${sign}R$ ${grouped},${parts.frac2}`;
|
|
38726
|
-
}
|
|
38727
|
-
|
|
38728
39339
|
// src/components/financial-goals/moneyTypes.ts
|
|
38729
39340
|
var MONEY_REQUIRES_DEVICE_GRANULARITY = "MONEY_REQUIRES_DEVICE_GRANULARITY";
|
|
38730
39341
|
function normalizeMoneyBlock(raw, rawBudget) {
|
|
@@ -39034,11 +39645,11 @@ function coveragePercentLabel(pricedHours, totalHours) {
|
|
|
39034
39645
|
const txt = Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1).replace(".", ",");
|
|
39035
39646
|
return `${txt}%`;
|
|
39036
39647
|
}
|
|
39037
|
-
function
|
|
39648
|
+
function esc2(s) {
|
|
39038
39649
|
return String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
39039
39650
|
}
|
|
39040
39651
|
function deviceDisplayName(d) {
|
|
39041
|
-
return
|
|
39652
|
+
return esc2(d.label || d.code || d.deviceId || "Dispositivo");
|
|
39042
39653
|
}
|
|
39043
39654
|
function unavailableHTML(reason, offerDeepLink) {
|
|
39044
39655
|
const isGranularity2 = reason === MONEY_REQUIRES_DEVICE_GRANULARITY;
|
|
@@ -39053,8 +39664,8 @@ function devicesHTML(devices) {
|
|
|
39053
39664
|
if (!devices.length) return "";
|
|
39054
39665
|
const items = devices.map((d) => {
|
|
39055
39666
|
const name = deviceDisplayName(d);
|
|
39056
|
-
const code = d.code ? `<span class="myio-cov__device-code">${
|
|
39057
|
-
return `<li><button type="button" class="myio-cov__device" data-cov-device="${
|
|
39667
|
+
const code = d.code ? `<span class="myio-cov__device-code">${esc2(d.code)}</span>` : "";
|
|
39668
|
+
return `<li><button type="button" class="myio-cov__device" data-cov-device="${esc2(d.deviceId)}"><span class="myio-cov__device-label">${name}</span>` + code + `<span class="myio-cov__device-cta">Categorizar \u2192</span></button></li>`;
|
|
39058
39669
|
}).join("");
|
|
39059
39670
|
return `<div class="myio-cov__section-title">Dispositivos sem categoria de tarifa</div><ul class="myio-cov__devices">${items}</ul>`;
|
|
39060
39671
|
}
|
|
@@ -39506,7 +40117,7 @@ var AllReportModal = class {
|
|
|
39506
40117
|
this.domainConfig = DOMAIN_CONFIG2[domain];
|
|
39507
40118
|
this.granularity = params.granularity ?? (domain === "temperature" ? "1h" : "1d");
|
|
39508
40119
|
this.debugEnabled = params.debug === 1;
|
|
39509
|
-
this.moneyColumn = createReportMoneyColumn(
|
|
40120
|
+
this.moneyColumn = createReportMoneyColumn(this.activeMoney());
|
|
39510
40121
|
if (this.moneyColumn.enabled && typeof document !== "undefined") {
|
|
39511
40122
|
injectCoverageStyles(document);
|
|
39512
40123
|
}
|
|
@@ -39584,6 +40195,82 @@ var AllReportModal = class {
|
|
|
39584
40195
|
// RFC-0228 A7 — per-consumer realized-vs-goal R$ variance column. Disabled (all
|
|
39585
40196
|
// fragments '') when params.money.perDeviceGoal is absent → byte-identical.
|
|
39586
40197
|
varianceColumn;
|
|
40198
|
+
/**
|
|
40199
|
+
* RFC-0241 rev. 2 — the money config valid for the loaded period. When the caller
|
|
40200
|
+
* declared the period its R$ were computed for (`money.period`) and the report loads a
|
|
40201
|
+
* different one, per-device/total R$ are withheld (overlay `unavailable`) — never a
|
|
40202
|
+
* dashboard-period R$ next to another period's kWh. Tolerance: 24 h per edge (the
|
|
40203
|
+
* dashboard "until now" vs the picker's end of day).
|
|
40204
|
+
*/
|
|
40205
|
+
activeMoney() {
|
|
40206
|
+
const m = this.params.money ?? null;
|
|
40207
|
+
if (!m || !m.period || !this.exportPeriod?.startISO || !this.exportPeriod?.endISO) return m;
|
|
40208
|
+
const DAY = 24 * 3600 * 1e3;
|
|
40209
|
+
const near = (a, b) => {
|
|
40210
|
+
const x = Date.parse(String(a || ""));
|
|
40211
|
+
const y = Date.parse(String(b || ""));
|
|
40212
|
+
return Number.isFinite(x) && Number.isFinite(y) && Math.abs(x - y) <= DAY;
|
|
40213
|
+
};
|
|
40214
|
+
if (near(m.period.startISO, this.exportPeriod.startISO) && near(m.period.endISO, this.exportPeriod.endISO)) {
|
|
40215
|
+
return m;
|
|
40216
|
+
}
|
|
40217
|
+
return {
|
|
40218
|
+
...m,
|
|
40219
|
+
overlay: { state: "unavailable", reason: "PERIOD_MISMATCH" },
|
|
40220
|
+
perDevice: {},
|
|
40221
|
+
total: null,
|
|
40222
|
+
totalFor: void 0,
|
|
40223
|
+
valuateBucket: void 0
|
|
40224
|
+
};
|
|
40225
|
+
}
|
|
40226
|
+
/** RFC-0241 rev. 2 — R$ of one series bucket (Diário/Horário), or null when money is off. */
|
|
40227
|
+
bucketMoney(id, ts, gran, qty) {
|
|
40228
|
+
const vb = this.moneyColumn.enabled ? this.activeMoney()?.valuateBucket : void 0;
|
|
40229
|
+
if (!vb || this.isTemperature) return null;
|
|
40230
|
+
const span = gran === "1h" ? 3600 * 1e3 : 24 * 3600 * 1e3;
|
|
40231
|
+
return vb(id, ts, ts + span, qty) || { state: "uncategorized" };
|
|
40232
|
+
}
|
|
40233
|
+
/** Money cell for CSV (comma decimal, 2dp) — '' when not complete (never 0). */
|
|
40234
|
+
csvMoney(amount) {
|
|
40235
|
+
const r = roundMoney2(amount ?? null);
|
|
40236
|
+
return r ? r.replace(".", ",") : "";
|
|
40237
|
+
}
|
|
40238
|
+
/** Header of the R$ column (A6 default for RFC-0228 callers; Part B passes "Custo estimado (R$)"). */
|
|
40239
|
+
moneyHeaderLabel() {
|
|
40240
|
+
return this.params.money?.headerLabel || "Custo projetado (R$)";
|
|
40241
|
+
}
|
|
40242
|
+
/**
|
|
40243
|
+
* CSV footer for the R$ column: the total (BigInt cents, DEC-8 row sum) only when every
|
|
40244
|
+
* row has an amount; otherwise "Cobertura incompleta (n de m)" — never a partial sum.
|
|
40245
|
+
*/
|
|
40246
|
+
moneyTotalCsvRow(rows) {
|
|
40247
|
+
const label = `${this.moneyHeaderLabel()} \u2014 total`;
|
|
40248
|
+
const amount = this.moneyTotalAmount(rows);
|
|
40249
|
+
if (amount) return [label, "", this.csvMoney(amount)];
|
|
40250
|
+
const covered = rows.filter((r) => this.rowMoney(r.id)).length;
|
|
40251
|
+
return [label, "", `Cobertura incompleta (${covered} de ${rows.length})`];
|
|
40252
|
+
}
|
|
40253
|
+
/**
|
|
40254
|
+
* Honest R$ total of `rows`: `totalFor(ids)` (round Σ raw of exactly these rows, RFC-0241)
|
|
40255
|
+
* when provided, else the A6 resolution (backend total / 2dp row sum). null = incomplete.
|
|
40256
|
+
*/
|
|
40257
|
+
moneyTotalAmount(rows) {
|
|
40258
|
+
const m = this.activeMoney();
|
|
40259
|
+
if (!m || !this.moneyColumn.enabled) return null;
|
|
40260
|
+
if (typeof m.totalFor === "function") {
|
|
40261
|
+
if (m.overlay?.state !== "available") return null;
|
|
40262
|
+
const ids = rows.map((r) => r.id).filter((id) => !!id);
|
|
40263
|
+
return ids.length === rows.length ? m.totalFor(ids) : null;
|
|
40264
|
+
}
|
|
40265
|
+
const total = this.moneyColumn.resolveTotal(rows.map((r) => this.rowMoney(r.id)));
|
|
40266
|
+
return total && total.kind === "amount" ? total.amount : null;
|
|
40267
|
+
}
|
|
40268
|
+
/** Per-device period R$ (2dp string) of the loaded period, or null. */
|
|
40269
|
+
rowMoney(id) {
|
|
40270
|
+
if (!id) return null;
|
|
40271
|
+
const v = this.activeMoney()?.perDevice?.[id];
|
|
40272
|
+
return typeof v === "string" && v.trim() ? v : null;
|
|
40273
|
+
}
|
|
39587
40274
|
// Debug logging helper
|
|
39588
40275
|
debugLog(message, data) {
|
|
39589
40276
|
if (this.debugEnabled) {
|
|
@@ -39958,6 +40645,7 @@ var AllReportModal = class {
|
|
|
39958
40645
|
const { startISO, endISO } = this.dateRangePicker.getDates();
|
|
39959
40646
|
this.debugLog("\u{1F4C5} Date range selected", { startISO, endISO });
|
|
39960
40647
|
this.exportPeriod = { startISO, endISO };
|
|
40648
|
+
if (this.params.money) this.moneyColumn = createReportMoneyColumn(this.activeMoney());
|
|
39961
40649
|
this.hourlySeriesCache = null;
|
|
39962
40650
|
this.deviceSeriesCache.clear();
|
|
39963
40651
|
this.temperatureStats.clear();
|
|
@@ -40142,10 +40830,17 @@ var AllReportModal = class {
|
|
|
40142
40830
|
// the overlay is confidently priced (DEC-8), otherwise a coverage state label.
|
|
40143
40831
|
computeMoneyKpi() {
|
|
40144
40832
|
if (!this.moneyColumn.enabled) return null;
|
|
40145
|
-
const
|
|
40833
|
+
const money = this.activeMoney();
|
|
40834
|
+
if (money && typeof money.totalFor === "function") {
|
|
40835
|
+
const label2 = money.headerLabel || "Custo projetado (R$)";
|
|
40836
|
+
if (money.overlay?.state !== "available") return { value: "Indispon\xEDvel", label: label2 };
|
|
40837
|
+
const amount = this.moneyTotalAmount(this.data);
|
|
40838
|
+
return { value: amount ? formatBRL(amount) : "Cobertura incompleta", label: label2 };
|
|
40839
|
+
}
|
|
40840
|
+
const rowValues = this.data.map((r) => r.id ? this.activeMoney()?.perDevice?.[r.id] : null);
|
|
40146
40841
|
const total = this.moneyColumn.resolveTotal(rowValues);
|
|
40147
40842
|
if (!total) return null;
|
|
40148
|
-
const label = this.
|
|
40843
|
+
const label = this.activeMoney()?.headerLabel || "Custo projetado (R$)";
|
|
40149
40844
|
if (total.kind === "amount") {
|
|
40150
40845
|
return { value: total.formatted, label };
|
|
40151
40846
|
}
|
|
@@ -40361,6 +41056,19 @@ var AllReportModal = class {
|
|
|
40361
41056
|
timeZone: "America/Sao_Paulo"
|
|
40362
41057
|
}) : new Date(ts).toLocaleDateString("pt-BR", { timeZone: "America/Sao_Paulo" });
|
|
40363
41058
|
const valueLabel = this.isTemperature ? gran === "1h" ? "Temperatura (\xB0C)" : "M\xE9dia do dia (\xB0C)" : this.domainConfig.label;
|
|
41059
|
+
if (this.bucketMoney(id, points[0].timestamp, gran, points[0].value)) {
|
|
41060
|
+
const money = points.map((p) => this.bucketMoney(id, p.timestamp, gran, p.value));
|
|
41061
|
+
const cell = (m) => m && m.state === "complete" && m.amount ? formatBRL(m.amount) : `<span class="rp-muted" title="Sem custo estimado para este intervalo">\u2014</span>`;
|
|
41062
|
+
const sub = sumItemMoney(money);
|
|
41063
|
+
const subCell = sub.state === "complete" && sub.amount ? formatBRL(sub.amount) : `<span class="rp-muted">Cobertura incompleta (${sub.covered} de ${sub.total})</span>`;
|
|
41064
|
+
box.innerHTML = `
|
|
41065
|
+
<table>
|
|
41066
|
+
<thead><tr><th>${gran === "1h" ? "Data/Hora" : "Dia"}</th><th class="num">${valueLabel}</th><th class="num">${this.moneyHeaderLabel()}</th></tr></thead>
|
|
41067
|
+
<tbody>${points.map((p, i) => `<tr><td>${fmtTs(p.timestamp)}</td><td class="num">${fmtPt(p.value)}</td><td class="num" data-money-cell="1">${cell(money[i])}</td></tr>`).join("")}</tbody>
|
|
41068
|
+
<tfoot><tr><td><strong>Subtotal</strong></td><td class="num"><strong>${fmtPt(points.reduce((s, p) => s + p.value, 0))}</strong></td><td class="num" data-money-subtotal="1"><strong>${subCell}</strong></td></tr></tfoot>
|
|
41069
|
+
</table>`;
|
|
41070
|
+
return;
|
|
41071
|
+
}
|
|
40364
41072
|
box.innerHTML = `
|
|
40365
41073
|
<table>
|
|
40366
41074
|
<thead><tr><th>${gran === "1h" ? "Data/Hora" : "Dia"}</th><th class="num">${valueLabel}</th></tr></thead>
|
|
@@ -40664,6 +41372,11 @@ var AllReportModal = class {
|
|
|
40664
41372
|
// Data rows
|
|
40665
41373
|
...sortedData.map((row) => [row.identifier, row.name, row.consumption.toFixed(2).replace(".", ",")])
|
|
40666
41374
|
];
|
|
41375
|
+
if (this.moneyColumn.enabled) {
|
|
41376
|
+
csvData[0].push(this.moneyHeaderLabel());
|
|
41377
|
+
sortedData.forEach((row, i) => csvData[i + 1].push(this.csvMoney(this.rowMoney(row.id))));
|
|
41378
|
+
csvData.push([], this.moneyTotalCsvRow(sortedData));
|
|
41379
|
+
}
|
|
40667
41380
|
const csvContent = toCsv(csvData);
|
|
40668
41381
|
this.downloadCSV(csvContent, `relatorio-geral-lojas-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`);
|
|
40669
41382
|
}
|
|
@@ -40744,16 +41457,31 @@ var AllReportModal = class {
|
|
|
40744
41457
|
const csvData = [
|
|
40745
41458
|
["Identificador", "Nome", "Data/Hora", `Consumo (${this.domainConfig.unit})`]
|
|
40746
41459
|
];
|
|
41460
|
+
const withMoney = this.moneyColumn.enabled && !!this.activeMoney()?.valuateBucket;
|
|
41461
|
+
if (withMoney) csvData[0].push(this.moneyHeaderLabel());
|
|
41462
|
+
let moneyRows = 0;
|
|
41463
|
+
let moneyComplete = 0;
|
|
40747
41464
|
for (const row of sortedData) {
|
|
40748
41465
|
const points = row.id && series.get(row.id) || [];
|
|
40749
41466
|
for (const p of points) {
|
|
40750
|
-
|
|
41467
|
+
const line = [row.identifier, row.name, fmtTs(p.timestamp), p.value.toFixed(2).replace(".", ",")];
|
|
41468
|
+
if (withMoney) {
|
|
41469
|
+
const m = this.bucketMoney(row.id, p.timestamp, "1h", p.value);
|
|
41470
|
+
const ok = m?.state === "complete" ? this.csvMoney(m.amount) : "";
|
|
41471
|
+
moneyRows += 1;
|
|
41472
|
+
if (ok) moneyComplete += 1;
|
|
41473
|
+
line.push(ok);
|
|
41474
|
+
}
|
|
41475
|
+
csvData.push(line);
|
|
40751
41476
|
}
|
|
40752
41477
|
}
|
|
40753
41478
|
if (csvData.length === 1) {
|
|
40754
41479
|
this.showError("Nenhum dado hor\xE1rio dispon\xEDvel para o per\xEDodo selecionado.");
|
|
40755
41480
|
return;
|
|
40756
41481
|
}
|
|
41482
|
+
if (withMoney && moneyComplete < moneyRows) {
|
|
41483
|
+
csvData.push([], [`${this.moneyHeaderLabel()}`, "", "", "", `Cobertura incompleta (${moneyComplete} de ${moneyRows})`]);
|
|
41484
|
+
}
|
|
40757
41485
|
const csvContent = toCsv(csvData);
|
|
40758
41486
|
this.downloadCSV(
|
|
40759
41487
|
csvContent,
|
|
@@ -40824,7 +41552,11 @@ var AllReportModal = class {
|
|
|
40824
41552
|
val: this.isTemperature && r.noData ? null : r.consumption,
|
|
40825
41553
|
perc: this.isTemperature ? void 0 : grandTotal > 0 ? r.consumption / grandTotal * 100 : 0
|
|
40826
41554
|
};
|
|
40827
|
-
if (!this.isTemperature)
|
|
41555
|
+
if (!this.isTemperature) {
|
|
41556
|
+
if (!this.moneyColumn.enabled) return base;
|
|
41557
|
+
const v = this.rowMoney(r.id);
|
|
41558
|
+
return { ...base, extraCells: [v ? formatBRL(v) : ""] };
|
|
41559
|
+
}
|
|
40828
41560
|
const off = r.id && !r.noData ? this.temperatureOffsetFor(r.id) : 0;
|
|
40829
41561
|
return {
|
|
40830
41562
|
...base,
|
|
@@ -40866,7 +41598,9 @@ var AllReportModal = class {
|
|
|
40866
41598
|
}
|
|
40867
41599
|
// Colunas do PDF/XLS = colunas da tela. Temperatura: Sensor | Média | Mín | Máx (sem %).
|
|
40868
41600
|
exportColumns() {
|
|
40869
|
-
if (!this.isTemperature)
|
|
41601
|
+
if (!this.isTemperature) {
|
|
41602
|
+
return this.moneyColumn.enabled ? { extraColumns: [{ label: this.moneyHeaderLabel(), pdfW: 40 }] } : null;
|
|
41603
|
+
}
|
|
40870
41604
|
return {
|
|
40871
41605
|
nameLabel: "Sensor",
|
|
40872
41606
|
valueLabel: "M\xE9dia (\xB0C)",
|
|
@@ -41425,10 +42159,10 @@ var WaterTankModalView = class {
|
|
|
41425
42159
|
*/
|
|
41426
42160
|
render() {
|
|
41427
42161
|
const { params } = this.config;
|
|
41428
|
-
const
|
|
41429
|
-
if (!document.getElementById(
|
|
42162
|
+
const STYLE_ID24 = "myio-water-tank-modal-styles";
|
|
42163
|
+
if (!document.getElementById(STYLE_ID24)) {
|
|
41430
42164
|
const style = document.createElement("style");
|
|
41431
|
-
style.id =
|
|
42165
|
+
style.id = STYLE_ID24;
|
|
41432
42166
|
style.textContent = `
|
|
41433
42167
|
@media (max-width: 640px) {
|
|
41434
42168
|
.myio-water-tank-modal { width: 100vw !important; max-width: 100vw !important; max-height: 100vh !important; border-radius: 0 !important; }
|
|
@@ -53348,7 +54082,7 @@ var IMPORTANCE_COLORS2 = {
|
|
|
53348
54082
|
5: "#ff7675"
|
|
53349
54083
|
};
|
|
53350
54084
|
var ORDERED_TYPES = ["observation", "pending", "maintenance", "activity"];
|
|
53351
|
-
function
|
|
54085
|
+
function esc3(s) {
|
|
53352
54086
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
53353
54087
|
}
|
|
53354
54088
|
function fmtDt(iso) {
|
|
@@ -53378,11 +54112,11 @@ function renderCard(ann) {
|
|
|
53378
54112
|
<span class="adm-annot-imp-badge" style="background:${ic};color:${darkText ? "#fff" : "#333"}" title="${IMPORTANCE_LABELS2[ann.importance]}">${stars}</span>
|
|
53379
54113
|
${ann.archived ? '<span class="adm-annot-archived-badge">Arquivada</span>' : ""}
|
|
53380
54114
|
</div>
|
|
53381
|
-
<div class="adm-annot-card-text">${
|
|
54115
|
+
<div class="adm-annot-card-text">${esc3(ann.text)}</div>
|
|
53382
54116
|
${ann.dueDate ? `<div class="adm-annot-due">\u23F0 Prazo: ${new Date(ann.dueDate).toLocaleDateString("pt-BR")}</div>` : ""}
|
|
53383
54117
|
<div class="adm-annot-card-meta">
|
|
53384
54118
|
<div class="adm-annot-avatar">${ini}</div>
|
|
53385
|
-
<span class="adm-annot-author">${
|
|
54119
|
+
<span class="adm-annot-author">${esc3(ann.createdBy)}</span>
|
|
53386
54120
|
<span class="adm-annot-date">${fmtDt(ann.createdAt)}</span>
|
|
53387
54121
|
</div>
|
|
53388
54122
|
${!ann.archived ? `<div class="adm-annot-actions">
|
|
@@ -53410,7 +54144,7 @@ function renderForm(editAnn) {
|
|
|
53410
54144
|
<div class="adm-annot-form" data-edit-id="${editAnn?.id ?? ""}">
|
|
53411
54145
|
<div class="adm-annot-form-title">${editAnn ? "\u270F\uFE0F Editar Anota\xE7\xE3o" : "\u270F\uFE0F Nova Anota\xE7\xE3o"}</div>
|
|
53412
54146
|
<textarea class="adm-annot-textarea" id="admAnnotText" maxlength="255"
|
|
53413
|
-
placeholder="Digite sua anota\xE7\xE3o (m\xE1x. 255 caracteres)...">${editAnn ?
|
|
54147
|
+
placeholder="Digite sua anota\xE7\xE3o (m\xE1x. 255 caracteres)...">${editAnn ? esc3(editAnn.text) : ""}</textarea>
|
|
53414
54148
|
<div class="adm-annot-char-count"><span id="admAnnotCC">${editAnn ? editAnn.text.length : 0}</span> / 255</div>
|
|
53415
54149
|
<div class="adm-annot-form-row">
|
|
53416
54150
|
<div class="adm-annot-form-field">
|
|
@@ -53796,7 +54530,7 @@ function initials2(name) {
|
|
|
53796
54530
|
const parts = name.trim().split(/\s+/);
|
|
53797
54531
|
return parts.length >= 2 ? (parts[0][0] + parts[parts.length - 1][0]).toUpperCase() : name.substring(0, 2).toUpperCase();
|
|
53798
54532
|
}
|
|
53799
|
-
function
|
|
54533
|
+
function esc4(s) {
|
|
53800
54534
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
53801
54535
|
}
|
|
53802
54536
|
function buildTooltipHtml(annotations) {
|
|
@@ -53817,11 +54551,11 @@ function buildTooltipHtml(annotations) {
|
|
|
53817
54551
|
<span class="annot-tooltip__type-badge" style="background:${tc}18;color:${tc};border:1px solid ${tc}40">${TYPE_LABELS2[ann.type]}</span>
|
|
53818
54552
|
<span class="annot-tooltip__stars" style="color:${ic}">${stars}</span>
|
|
53819
54553
|
</div>
|
|
53820
|
-
<div class="annot-tooltip__text">${
|
|
54554
|
+
<div class="annot-tooltip__text">${esc4(ann.text)}</div>
|
|
53821
54555
|
${ann.dueDate ? `<div class="annot-tooltip__due">\u23F0 Prazo: ${new Date(ann.dueDate).toLocaleDateString("pt-BR")}</div>` : ""}
|
|
53822
54556
|
<div class="annot-tooltip__meta">
|
|
53823
54557
|
<span class="annot-tooltip__avatar">${ini}</span>
|
|
53824
|
-
<span class="annot-tooltip__author">${
|
|
54558
|
+
<span class="annot-tooltip__author">${esc4(ann.createdBy)}</span>
|
|
53825
54559
|
<span class="annot-tooltip__date">${fmtDt2(ann.createdAt)}</span>
|
|
53826
54560
|
</div>
|
|
53827
54561
|
</div>`;
|
|
@@ -64512,10 +65246,10 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
64512
65246
|
// Styles
|
|
64513
65247
|
// ==========================================================================
|
|
64514
65248
|
injectStyles() {
|
|
64515
|
-
const
|
|
64516
|
-
if (document.getElementById(
|
|
65249
|
+
const STYLE_ID24 = "myio-tickets-tab-styles";
|
|
65250
|
+
if (document.getElementById(STYLE_ID24)) return;
|
|
64517
65251
|
const style = document.createElement("style");
|
|
64518
|
-
style.id =
|
|
65252
|
+
style.id = STYLE_ID24;
|
|
64519
65253
|
style.textContent = `
|
|
64520
65254
|
/* ===== TicketsTab layout ===== */
|
|
64521
65255
|
.ct-tab {
|
|
@@ -66204,8 +66938,8 @@ var SettingsModalView = class _SettingsModalView {
|
|
|
66204
66938
|
const segmentEl = this.modal.querySelector("#segment");
|
|
66205
66939
|
const activityEl = this.modal.querySelector("#activity");
|
|
66206
66940
|
if (!segmentEl || !activityEl) return;
|
|
66207
|
-
const
|
|
66208
|
-
const options = (values, selected, placeholder) => `<option value="">${placeholder}</option>` + values.map((v) => `<option value="${
|
|
66941
|
+
const esc11 = (s) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
66942
|
+
const options = (values, selected, placeholder) => `<option value="">${placeholder}</option>` + values.map((v) => `<option value="${esc11(v)}"${v === selected ? " selected" : ""}>${esc11(v)}</option>`).join("");
|
|
66209
66943
|
const catalog = await loadStoreSegmentCatalog(this.config.segmentCatalog);
|
|
66210
66944
|
const savedSegment = String(saved.segment || "");
|
|
66211
66945
|
const savedActivity = String(saved.activity || "");
|
|
@@ -72688,7 +73422,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
72688
73422
|
if (this.metaTipEl) this.metaTipEl.style.display = "none";
|
|
72689
73423
|
}
|
|
72690
73424
|
buildMetaTipHtml(type, card) {
|
|
72691
|
-
const
|
|
73425
|
+
const esc11 = _WelcomeModalView.escapeMetaHtml;
|
|
72692
73426
|
const chip = _WelcomeModalView.metaChip;
|
|
72693
73427
|
const meta = card.metaCounts || {};
|
|
72694
73428
|
const details = card.metaDetails || {};
|
|
@@ -72698,7 +73432,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
72698
73432
|
).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
|
|
72699
73433
|
const frame = (icon2, label, body) => `<div class="myio-welcome-meta-tip__header">
|
|
72700
73434
|
<span class="myio-welcome-meta-tip__icon">${icon2}</span>
|
|
72701
|
-
<span class="myio-welcome-meta-tip__title">${label} (${
|
|
73435
|
+
<span class="myio-welcome-meta-tip__title">${label} (${esc11(card.title)})</span>
|
|
72702
73436
|
<span class="myio-welcome-meta-tip__timestamp">${stamp}</span>
|
|
72703
73437
|
<button type="button" class="myio-welcome-meta-tip__close" title="Fechar">\u2715</button>
|
|
72704
73438
|
</div>
|
|
@@ -72726,8 +73460,8 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
72726
73460
|
const chips = Object.entries(byState).map(([s, n]) => chip(`${s}: ${n}`)).join("");
|
|
72727
73461
|
const rows = alarms.slice(0, 10).map(
|
|
72728
73462
|
(a) => row(
|
|
72729
|
-
|
|
72730
|
-
[a.severity, a.state].filter(Boolean).map(
|
|
73463
|
+
esc11(a.deviceName ? `${a.deviceName} \u2014 ${a.title || "Alarme"}` : a.title || "Alarme"),
|
|
73464
|
+
[a.severity, a.state].filter(Boolean).map(esc11).join(" \xB7 ")
|
|
72731
73465
|
)
|
|
72732
73466
|
).join("");
|
|
72733
73467
|
return frame(
|
|
@@ -72751,7 +73485,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
72751
73485
|
const rows = annotations.slice(0, 10).map((a) => {
|
|
72752
73486
|
const when = a.createdAt ? new Date(a.createdAt).toLocaleDateString("pt-BR") : "";
|
|
72753
73487
|
const text2 = a.text.length > 90 ? `${a.text.slice(0, 90)}\u2026` : a.text;
|
|
72754
|
-
return row(
|
|
73488
|
+
return row(esc11(a.deviceLabel || "Dispositivo"), `${esc11(text2)}${when ? ` \xB7 ${esc11(when)}` : ""}`);
|
|
72755
73489
|
}).join("");
|
|
72756
73490
|
return frame(
|
|
72757
73491
|
"\u{1F4CB}",
|
|
@@ -72762,7 +73496,7 @@ var WelcomeModalView = class _WelcomeModalView {
|
|
|
72762
73496
|
if (type === "users") {
|
|
72763
73497
|
if (meta.users === null) return frame("\u{1F465}", "Usu\xE1rios", loadingBody);
|
|
72764
73498
|
const users = details.users || [];
|
|
72765
|
-
const rows = users.slice(0, 10).map((u) => row(
|
|
73499
|
+
const rows = users.slice(0, 10).map((u) => row(esc11(u.name), esc11(u.email || ""))).join("");
|
|
72766
73500
|
return frame(
|
|
72767
73501
|
"\u{1F465}",
|
|
72768
73502
|
"Usu\xE1rios",
|
|
@@ -83128,7 +83862,7 @@ var PRESETS = [
|
|
|
83128
83862
|
{ id: "custom", label: "Personalizado" }
|
|
83129
83863
|
];
|
|
83130
83864
|
var STEPS = ["Dispositivos", "Per\xEDodo", "Telemetrias", "Resumo"];
|
|
83131
|
-
var
|
|
83865
|
+
var esc5 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
83132
83866
|
var norm = (s) => String(s ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
83133
83867
|
var fmtN = (n) => n.toLocaleString("pt-BR");
|
|
83134
83868
|
var pad = (n) => String(n).padStart(2, "0");
|
|
@@ -83516,8 +84250,8 @@ var DemandPanelV2 = class {
|
|
|
83516
84250
|
highlight(text2) {
|
|
83517
84251
|
const q = norm(this.s.search).trim();
|
|
83518
84252
|
const i = q ? norm(text2).indexOf(q) : -1;
|
|
83519
|
-
if (i < 0) return
|
|
83520
|
-
return
|
|
84253
|
+
if (i < 0) return esc5(text2);
|
|
84254
|
+
return esc5(text2.slice(0, i)) + `<mark class="dp2-mark">${esc5(text2.slice(i, i + q.length))}</mark>` + esc5(text2.slice(i + q.length));
|
|
83521
84255
|
}
|
|
83522
84256
|
deviceRow(d, mode) {
|
|
83523
84257
|
const picked = this.s.selected.includes(d.tbDeviceId);
|
|
@@ -83525,13 +84259,13 @@ var DemandPanelV2 = class {
|
|
|
83525
84259
|
const cat = this.categoryOf.get(d.tbDeviceId);
|
|
83526
84260
|
const chip = this.chips.find((c) => c.key === cat);
|
|
83527
84261
|
const dup = (this.labelCount.get(d.label) || 0) > 1;
|
|
83528
|
-
const action = mode === "result" ? picked ? '<span class="dp2-added">\u2713 Adicionado</span>' : `<button class="dp2-btn sm" type="button" data-action="add" data-id="${
|
|
84262
|
+
const action = mode === "result" ? picked ? '<span class="dp2-added">\u2713 Adicionado</span>' : `<button class="dp2-btn sm" type="button" data-action="add" data-id="${esc5(d.tbDeviceId)}" ${el2.ok ? "" : "disabled"} aria-label="Adicionar ${esc5(d.label)}">+ Adicionar</button>` : `<button class="dp2-btn sm" type="button" data-action="remove" data-id="${esc5(d.tbDeviceId)}" aria-label="Remover ${esc5(d.label)}">\u2715 Remover</button>`;
|
|
83529
84263
|
return `<div class="dp2-item ${el2.ok ? "" : "blocked"}">
|
|
83530
|
-
<img class="dp2-ico" src="${
|
|
84264
|
+
<img class="dp2-ico" src="${esc5(deviceIconUrl(d.deviceProfile))}" alt="" loading="lazy">
|
|
83531
84265
|
<div style="min-width:0">
|
|
83532
|
-
<div class="dp2-name">${mode === "result" ? this.highlight(d.label) :
|
|
83533
|
-
<div class="dp2-sub">${chip ? `<span class="dp2-tag">${
|
|
83534
|
-
${mode === "result" ? this.highlight(d.name) :
|
|
84266
|
+
<div class="dp2-name">${mode === "result" ? this.highlight(d.label) : esc5(d.label)}${dup && d.identifier ? ` <small class="dp2-info">\xB7 ${esc5(d.identifier)}</small>` : ""}</div>
|
|
84267
|
+
<div class="dp2-sub">${chip ? `<span class="dp2-tag">${esc5(chip.label)}</span>` : ""}${el2.text ? `<span class="dp2-tag ${el2.cls}" title="${esc5(el2.title)}">${el2.text}</span>` : ""}
|
|
84268
|
+
${mode === "result" ? this.highlight(d.name) : esc5(d.name)}${d.identifier ? " \xB7 " + esc5(d.identifier) : ""}</div>
|
|
83535
84269
|
</div>
|
|
83536
84270
|
<div>${action}</div>
|
|
83537
84271
|
</div>`;
|
|
@@ -83549,8 +84283,8 @@ var DemandPanelV2 = class {
|
|
|
83549
84283
|
this.el.body.innerHTML = `<div class="dp2-s1">
|
|
83550
84284
|
<section class="dp2-col" aria-label="Buscar medidores">
|
|
83551
84285
|
<div class="dp2-col-head">
|
|
83552
|
-
<input class="dp2-search" data-role="search" type="search" placeholder="\u{1F50E} Buscar por nome, identificador ou tipo\u2026" value="${
|
|
83553
|
-
<div class="dp2-chips" role="group" aria-label="Filtrar por tipo">${chips.map((c) => `<button class="dp2-chip" type="button" data-action="category" data-key="${
|
|
84286
|
+
<input class="dp2-search" data-role="search" type="search" placeholder="\u{1F50E} Buscar por nome, identificador ou tipo\u2026" value="${esc5(this.s.search)}" aria-label="Buscar medidores">
|
|
84287
|
+
<div class="dp2-chips" role="group" aria-label="Filtrar por tipo">${chips.map((c) => `<button class="dp2-chip" type="button" data-action="category" data-key="${esc5(c.key)}" aria-pressed="${this.s.category === c.key}">${c.icon ? esc5(c.icon) + " " : ""}${esc5(c.label)} \xB7 ${c.count}</button>`).join("")}</div>
|
|
83554
84288
|
<h3><span>${fmtN(results.length)} resultado(s)</span>
|
|
83555
84289
|
<button class="dp2-btn link" type="button" data-action="add-all" ${addable ? "" : "disabled"}>+ Adicionar todos (${addable})</button></h3>
|
|
83556
84290
|
</div>
|
|
@@ -83589,7 +84323,7 @@ var DemandPanelV2 = class {
|
|
|
83589
84323
|
<div class="dp2-card"><h3 tabindex="-1" data-role="step-title">Per\xEDodo</h3>
|
|
83590
84324
|
<div class="dp2-chips" style="margin-bottom:12px">${PRESETS.map((p) => {
|
|
83591
84325
|
const off = p.id !== "custom" && presetTooLong(p.id);
|
|
83592
|
-
return `<button class="dp2-chip" type="button" data-action="preset" data-preset="${p.id}" aria-pressed="${preset === p.id}" ${off ? `disabled title="at\xE9 ${maxDays} dia(s) com intervalos de ${
|
|
84326
|
+
return `<button class="dp2-chip" type="button" data-action="preset" data-preset="${p.id}" aria-pressed="${preset === p.id}" ${off ? `disabled title="at\xE9 ${maxDays} dia(s) com intervalos de ${esc5(r.label)}"` : ""}>${p.label}</button>`;
|
|
83593
84327
|
}).join("")}</div>
|
|
83594
84328
|
<div class="dp2-row">
|
|
83595
84329
|
<label class="dp2-field">In\xEDcio<input type="datetime-local" data-role="start" min="${MIN_PERIOD_START}T00:00" value="${Number.isFinite(start) ? toLocalDateTimeInput(start) : ""}"></label>
|
|
@@ -83602,24 +84336,24 @@ var DemandPanelV2 = class {
|
|
|
83602
84336
|
const d = limits?.maxDaysByResolution[x.id];
|
|
83603
84337
|
return `<button class="dp2-chip" type="button" data-action="resolution" data-res="${x.id}" aria-pressed="${this.s.resolution === x.id}">${x.label}${d != null ? ` <small>(at\xE9 ${d} d)</small>` : ""}</button>`;
|
|
83604
84338
|
}).join("")}</div>
|
|
83605
|
-
<p class="dp2-info" style="margin:10px 0 0">Cada linha do relat\xF3rio \xE9 um intervalo com <b>${
|
|
83606
|
-
${this.s.telemetries.has("consumption") ? `Com <b>Pot\xEAncia Total</b>, o arquivo traz tamb\xE9m a <b>${
|
|
84339
|
+
<p class="dp2-info" style="margin:10px 0 0">Cada linha do relat\xF3rio \xE9 um intervalo com <b>${esc5(BUCKET_STATS_LABEL)}</b> de cada telemetria. Os intervalos contam a partir do in\xEDcio do per\xEDodo${this.s.resolution === "1d" ? " (com 1 dia, cada linha \xE9 um dia do calend\xE1rio)" : ""}.
|
|
84340
|
+
${this.s.telemetries.has("consumption") ? `Com <b>Pot\xEAncia Total</b>, o arquivo traz tamb\xE9m a <b>${esc5(this.demandLabel())}</b>, em janelas de 15 min alinhadas ao rel\xF3gio.` : ""}</p>
|
|
83607
84341
|
${valid && !tooLong ? `<p class="dp2-info" style="margin:6px 0 0">${fmtN(bucketCount(start, end, this.s.resolution))} intervalo(s) por medidor.</p>` : ""}
|
|
83608
|
-
${tooLong ? `<div class="dp2-fix"><span class="dp2-err">O per\xEDodo \xE9 longo demais para intervalos de ${
|
|
83609
|
-
${fit ? `<button class="dp2-btn sm primary" type="button" data-action="resolution" data-res="${fit}">Usar ${
|
|
84342
|
+
${tooLong ? `<div class="dp2-fix"><span class="dp2-err">O per\xEDodo \xE9 longo demais para intervalos de ${esc5(r.label)} (m\xE1ximo ${maxDays} dia(s)).</span>
|
|
84343
|
+
${fit ? `<button class="dp2-btn sm primary" type="button" data-action="resolution" data-res="${fit}">Usar ${esc5(RESOLUTION_BY_ID[fit].label)}</button>` : ""}
|
|
83610
84344
|
<button class="dp2-btn sm" type="button" data-action="shorten">Encurtar para os \xFAltimos ${maxDays} dia(s)</button></div>` : ""}
|
|
83611
84345
|
${misaligned ? `<div class="dp2-fix"><span class="dp2-err">Com intervalos de 1 dia, o in\xEDcio precisa ser \xE0 meia-noite.</span>
|
|
83612
|
-
<button class="dp2-btn sm primary" type="button" data-action="snap-midnight">Come\xE7ar em ${
|
|
84346
|
+
<button class="dp2-btn sm primary" type="button" data-action="snap-midnight">Come\xE7ar em ${esc5(formatLocalDateTime(localMidnightOf(start)))}</button></div>` : ""}
|
|
83613
84347
|
</div>
|
|
83614
|
-
${otherErrs.length ? `<p class="dp2-err">${otherErrs.map(
|
|
84348
|
+
${otherErrs.length ? `<p class="dp2-err">${otherErrs.map(esc5).join("<br>")}</p>` : ""}`;
|
|
83615
84349
|
}
|
|
83616
84350
|
renderStep3() {
|
|
83617
84351
|
this.el.body.innerHTML = `<div class="dp2-tgrid">${TELEMETRY_GROUPS.map((g) => {
|
|
83618
84352
|
const all = g.items.every((t) => this.s.telemetries.has(t.key));
|
|
83619
|
-
return `<div class="dp2-card"><h3><span>${g.icon} ${
|
|
84353
|
+
return `<div class="dp2-card"><h3><span>${g.icon} ${esc5(g.label)}</span>
|
|
83620
84354
|
<button class="dp2-btn link" type="button" data-action="group-all" data-gid="${g.id}">${all ? "Desmarcar" : "Marcar"} todos</button></h3>
|
|
83621
84355
|
${g.items.map((t) => `<label class="dp2-check"><input type="checkbox" data-role="tel" data-key="${t.key}" ${this.s.telemetries.has(t.key) ? "checked" : ""}>
|
|
83622
|
-
${
|
|
84356
|
+
${esc5(t.label)}<span class="u">${this.p.supportMode ? esc5(t.key) + " \xB7 " : ""}${esc5(t.unit)}</span></label>`).join("")}
|
|
83623
84357
|
</div>`;
|
|
83624
84358
|
}).join("")}</div>
|
|
83625
84359
|
<p class="dp2-info">${this.s.telemetries.size} de ${TELEMETRY_CATALOG.length} telemetrias. Mesmo cat\xE1logo da modal "Telemetrias Instant\xE2neas e Pico de Demanda".</p>`;
|
|
@@ -83639,14 +84373,14 @@ var DemandPanelV2 = class {
|
|
|
83639
84373
|
let validation = "";
|
|
83640
84374
|
if (v.state === "loading") validation = '<div class="dp2-info">\u23F3 Validando o pedido no servidor\u2026</div>';
|
|
83641
84375
|
else if (v.state === "error") {
|
|
83642
|
-
validation = `<div class="dp2-err">N\xE3o foi poss\xEDvel validar agora: ${
|
|
84376
|
+
validation = `<div class="dp2-err">N\xE3o foi poss\xEDvel validar agora: ${esc5(v.error)}
|
|
83643
84377
|
<button class="dp2-btn link" type="button" data-action="revalidate">Tentar de novo</button></div>`;
|
|
83644
84378
|
} else if (vr) {
|
|
83645
84379
|
const warns = (vr.warnings || []).map((w) => {
|
|
83646
84380
|
const dev = w.deviceId;
|
|
83647
|
-
return `<li>${
|
|
84381
|
+
return `<li>${esc5(warningText(w.code, w.message) + (dev ? this.devicesSuffix({ devices: [{ deviceId: dev }] }) : ""))}</li>`;
|
|
83648
84382
|
}).join("");
|
|
83649
|
-
const reuse = vr.reusable ? `<div class="dp2-banner info" style="margin-top:8px">\u267B J\xE1 existe um relat\xF3rio id\xEAntico${vr.reusable.generatedAt ? ` gerado em ${
|
|
84383
|
+
const reuse = vr.reusable ? `<div class="dp2-banner info" style="margin-top:8px">\u267B J\xE1 existe um relat\xF3rio id\xEAntico${vr.reusable.generatedAt ? ` gerado em ${esc5(formatLocalDateTime(Date.parse(vr.reusable.generatedAt)))}` : ""}${vr.reusable.generatedBy?.userId ? ` por ${esc5(vr.reusable.generatedBy.userId)}` : ""}. Confirmar reaproveita o arquivo (sem custo de cota).
|
|
83650
84384
|
<label class="dp2-check" style="margin-top:6px"><input type="checkbox" data-role="force" ${this.s.force ? "checked" : ""}> Gerar novamente mesmo assim</label></div>` : "";
|
|
83651
84385
|
validation = `${vr.ok ? '<div class="dp2-info">\u2713 Pedido validado no servidor.</div>' : ""}
|
|
83652
84386
|
${warns ? `<ul class="dp2-info" style="margin:6px 0 0;padding-left:18px">${warns}</ul>` : ""}${reuse}`;
|
|
@@ -83654,12 +84388,12 @@ var DemandPanelV2 = class {
|
|
|
83654
84388
|
this.el.body.innerHTML = `
|
|
83655
84389
|
<div class="dp2-card"><h3 tabindex="-1" data-role="step-title">Resumo do pedido</h3>
|
|
83656
84390
|
<dl class="dp2-sum">
|
|
83657
|
-
<dt>Solicitante</dt><dd>${
|
|
83658
|
-
<dt>Medidores (${req.devices.length})</dt><dd><div class="dp2-pills">${req.devices.map((d) => `<span class="dp2-pill">${
|
|
84391
|
+
<dt>Solicitante</dt><dd>${esc5(this.p.user.name)}</dd>
|
|
84392
|
+
<dt>Medidores (${req.devices.length})</dt><dd><div class="dp2-pills">${req.devices.map((d) => `<span class="dp2-pill">${esc5(labelOf(d))}</span>`).join("")}</div></dd>
|
|
83659
84393
|
<dt>Per\xEDodo</dt><dd>${formatLocalDateTime(start)} \u2192 ${formatLocalDateTime(end)} <span class="dp2-info">(${fmtDuration(end - start)}, hor\xE1rio de Bras\xEDlia${req.period.preset === "today" || req.period.preset === "thisMonth" ? `, calculado \xE0s ${formatLocalDateTime(snap.takenAt).slice(11)}` : ""})</span></dd>
|
|
83660
|
-
<dt>Resolu\xE7\xE3o</dt><dd>${
|
|
83661
|
-
<dt>Telemetrias (${req.telemetries.length})</dt><dd><div class="dp2-pills">${req.telemetries.map((t) => `<span class="dp2-pill">${
|
|
83662
|
-
${req.telemetries.some((t) => t.key === "consumption") ? `<div class="dp2-info" style="margin-top:4px">Inclui a ${
|
|
84394
|
+
<dt>Resolu\xE7\xE3o</dt><dd>${esc5(this.resolutionLabel(req.resolution))} <span class="dp2-info">(${esc5(BUCKET_STATS_LABEL)})</span></dd>
|
|
84395
|
+
<dt>Telemetrias (${req.telemetries.length})</dt><dd><div class="dp2-pills">${req.telemetries.map((t) => `<span class="dp2-pill">${esc5(t.label)} \xB7 ${esc5(t.unit)}</span>`).join("")}</div>
|
|
84396
|
+
${req.telemetries.some((t) => t.key === "consumption") ? `<div class="dp2-info" style="margin-top:4px">Inclui a ${esc5(this.demandLabel())}.</div>` : ""}</dd>
|
|
83663
84397
|
<dt>Tamanho</dt><dd><span class="dp2-size ${cls}">${txt}</span> <span class="dp2-info">\u2248 ${fmtN(pts)} pontos</span>
|
|
83664
84398
|
<details class="dp2-details"><summary>Detalhes</summary><span class="dp2-info">${fmtN(est.buckets)} intervalos \xD7 ${req.devices.length} medidores \xD7 ${req.telemetries.length} telemetrias${this.limits()?.maxPoints != null ? ` \xB7 limite ${fmtN(this.limits().maxPoints)}` : ""}</span></details></dd>
|
|
83665
84399
|
<dt>Entrega</dt><dd>Arquivos XLSX, CSV e JSON <span class="dp2-info">(dispon\xEDveis por 3 dias; o resumo fica por 1 ano)</span></dd>
|
|
@@ -83667,15 +84401,15 @@ var DemandPanelV2 = class {
|
|
|
83667
84401
|
<div style="margin-top:12px">${validation}</div>
|
|
83668
84402
|
<p class="dp2-info" style="margin:12px 0 0">Seu pedido fica registrado (quem, quando, o qu\xEA) e \xE9 processado em segundo plano. <b>Voc\xEA pode fechar este painel</b> e acompanhar em Relat\xF3rios.</p>
|
|
83669
84403
|
</div>
|
|
83670
|
-
${this.p.supportMode ? `<div class="dp2-card"><h3>Pedido que ser\xE1 registrado (suporte)</h3><pre class="dp2-json">${
|
|
83671
|
-
${errs.length ? `<p class="dp2-err">${errs.map(
|
|
84404
|
+
${this.p.supportMode ? `<div class="dp2-card"><h3>Pedido que ser\xE1 registrado (suporte)</h3><pre class="dp2-json">${esc5(JSON.stringify(req, null, 2))}</pre></div>` : ""}
|
|
84405
|
+
${errs.length ? `<p class="dp2-err">${errs.map(esc5).join("<br>")}</p>` : ""}`;
|
|
83672
84406
|
}
|
|
83673
84407
|
renderNav() {
|
|
83674
84408
|
const errs = this.stepErrors(this.s.step);
|
|
83675
84409
|
const hints = ["", `${this.s.selected.length} medidor(es) na lista`, "Escolha o per\xEDodo e a resolu\xE7\xE3o", `${this.s.telemetries.size} telemetria(s)`, "Revise e confirme"];
|
|
83676
84410
|
this.el.nav.innerHTML = `
|
|
83677
84411
|
<button class="dp2-btn" type="button" data-action="back" ${this.s.step === 1 ? "disabled" : ""}>\u2190 Voltar</button>
|
|
83678
|
-
<span class="hint">${
|
|
84412
|
+
<span class="hint">${esc5(hints[this.s.step])}</span>
|
|
83679
84413
|
${this.s.step === 4 ? `<button class="dp2-btn primary" type="button" data-action="confirm" ${errs.length || this.s.submitting || this.s.validation.state !== "ok" ? "disabled" : ""}>${this.s.submitting ? "Enviando\u2026" : "\u2713 Confirmar e enviar"}</button>` : `<button class="dp2-btn primary" type="button" data-action="next" ${errs.length ? "disabled" : ""}>Pr\xF3ximo \u2192</button>`}`;
|
|
83680
84414
|
}
|
|
83681
84415
|
jobTitle(e) {
|
|
@@ -83693,7 +84427,7 @@ var DemandPanelV2 = class {
|
|
|
83693
84427
|
return;
|
|
83694
84428
|
}
|
|
83695
84429
|
if (s.listState === "error") {
|
|
83696
|
-
this.el.body.innerHTML = `<div class="dp2-empty">N\xE3o foi poss\xEDvel carregar os relat\xF3rios (${
|
|
84430
|
+
this.el.body.innerHTML = `<div class="dp2-empty">N\xE3o foi poss\xEDvel carregar os relat\xF3rios (${esc5(s.listError)}).<br><button class="dp2-btn" type="button" data-action="reload">Tentar de novo</button></div>`;
|
|
83697
84431
|
return;
|
|
83698
84432
|
}
|
|
83699
84433
|
const orphans = this.p.supportMode ? s.active.filter((j) => !s.keys.includes(envelopeKey(j.jobId))) : [];
|
|
@@ -83711,43 +84445,43 @@ var DemandPanelV2 = class {
|
|
|
83711
84445
|
const note = (cls, text2) => `<div class="${cls}" style="margin-top:6px">${text2}</div>`;
|
|
83712
84446
|
const queue = st === "queued" && j?.queue?.position ? ` (N\xBA ${j.queue.position})` : "";
|
|
83713
84447
|
const peak = j?.totals?.largestDevicePeak;
|
|
83714
|
-
const peakTxt = peak && (peak.kw != null || peak.w != null) ? `Maior pico individual: <b>${
|
|
83715
|
-
return `<article class="dp2-job" aria-label="${
|
|
84448
|
+
const peakTxt = peak && (peak.kw != null || peak.w != null) ? `Maior pico individual: <b>${esc5(fmtN(Number(peak.kw ?? peak.w / 1e3)))} kW</b>${peak.label ? ` \xB7 ${esc5(peak.label)}` : ""}${peak.at ? ` \xB7 ${esc5(when(peak.at))}` : ""}` : "";
|
|
84449
|
+
return `<article class="dp2-job" aria-label="${esc5(this.jobTitle(e))}">
|
|
83716
84450
|
<div class="dp2-job-top">
|
|
83717
|
-
<span class="dp2-job-title">${
|
|
84451
|
+
<span class="dp2-job-title">${esc5(this.jobTitle(e))}</span>
|
|
83718
84452
|
<span class="dp2-status ${st}">${JOB_STATE_LABEL[st]}${queue}${st === "running" ? ` ${progress}%` : ""}</span>
|
|
83719
84453
|
<span style="flex:1"></span>
|
|
83720
|
-
<span class="dp2-info">${
|
|
84454
|
+
<span class="dp2-info">${esc5(e.requestedBy.name)} \xB7 ${when(e.requestedAt)}</span>
|
|
83721
84455
|
</div>
|
|
83722
84456
|
${st === "queued" || st === "running" ? `<div class="dp2-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${progress}"><span style="width:${progress}%"></span></div>` : ""}
|
|
83723
|
-
${st === "queued" && j?.queue?.estimatedStartAt ? note("dp2-info", `In\xEDcio estimado: ${
|
|
83724
|
-
${st === "failed" ? note("dp2-err", `${
|
|
83725
|
-
${st === "rejected" ? note("dp2-err", `${
|
|
84457
|
+
${st === "queued" && j?.queue?.estimatedStartAt ? note("dp2-info", `In\xEDcio estimado: ${esc5(when(j.queue.estimatedStartAt))}`) : ""}
|
|
84458
|
+
${st === "failed" ? note("dp2-err", `${esc5(failureText(j?.error?.code))}${this.p.supportMode && j?.error ? ` <small>(${esc5(j.error.code)}: ${esc5(j.error.message)})</small>` : ""}`) : ""}
|
|
84459
|
+
${st === "rejected" ? note("dp2-err", `${esc5(rejectionText(v.code, v.reason, v.message))}${this.p.supportMode ? ` <small>(${esc5(v.code)}${v.reason ? " \xB7 " + esc5(v.reason) : ""})</small>` : ""}`) : ""}
|
|
83726
84460
|
${st === "not_received" ? note("dp2-err", "O pedido est\xE1 registrado, mas o processamento n\xE3o o recebeu. Reenviar \xE9 seguro: n\xE3o gera relat\xF3rio duplicado.") : ""}
|
|
83727
84461
|
${st === "query_unavailable" ? note("dp2-info", "N\xE3o foi poss\xEDvel consultar o andamento agora \u2014 tentaremos de novo.") : ""}
|
|
83728
84462
|
${st === "old_request" ? note("dp2-info", 'Pedido antigo, sem registro de processamento. Use "Duplicar e editar".') : ""}
|
|
83729
84463
|
${st === "result_expired" ? note("dp2-info", "O relat\xF3rio foi conclu\xEDdo, mas os arquivos j\xE1 expiraram (ficam 3 dias).") : ""}
|
|
83730
84464
|
${st === "purged" ? note("dp2-info", "O conte\xFAdo deste relat\xF3rio foi removido.") : ""}
|
|
83731
|
-
${st === "succeeded" && j?.reused ? note("dp2-info", `\u267B Resultado reaproveitado${j.generatedAt ? ` \u2014 gerado em ${
|
|
84465
|
+
${st === "succeeded" && j?.reused ? note("dp2-info", `\u267B Resultado reaproveitado${j.generatedAt ? ` \u2014 gerado em ${esc5(when(j.generatedAt))}` : ""}${j.generatedBy?.userId ? ` por ${esc5(j.generatedBy.userId)}` : ""}.`) : ""}
|
|
83732
84466
|
${st === "succeeded" && peakTxt ? note("dp2-info", peakTxt) : ""}
|
|
83733
|
-
${st === "succeeded" && j?.expiresAt ? note("dp2-info", `Arquivos dispon\xEDveis at\xE9 ${
|
|
84467
|
+
${st === "succeeded" && j?.expiresAt ? note("dp2-info", `Arquivos dispon\xEDveis at\xE9 ${esc5(when(j.expiresAt))}.`) : ""}
|
|
83734
84468
|
${s.auditPending.has(e.jobId) ? '<div class="dp2-audit-warn">\u26A0 A a\xE7\xE3o foi aceita, mas o registro de auditoria falhou \u2014 ser\xE1 reconciliado.</div>' : ""}
|
|
83735
84469
|
<div class="dp2-job-actions">
|
|
83736
|
-
${st === "succeeded" ? `<button class="dp2-btn sm primary" type="button" data-action="download" data-kind="xlsx" data-job="${
|
|
83737
|
-
<button class="dp2-btn sm" type="button" data-action="download" data-kind="csv" data-job="${
|
|
83738
|
-
<button class="dp2-btn sm" type="button" data-action="download" data-kind="json" data-job="${
|
|
83739
|
-
${st === "queued" || st === "running" ? `<button class="dp2-btn sm" type="button" data-action="cancel" data-job="${
|
|
83740
|
-
${v.canResend ? `<button class="dp2-btn sm primary" type="button" data-action="resend" data-job="${
|
|
83741
|
-
${["failed", "cancelled", "succeeded", "result_expired", "purged", "old_request", "rejected"].includes(st) ? `<button class="dp2-btn sm" type="button" data-action="clone" data-job="${
|
|
83742
|
-
${this.p.supportMode ? `<button class="dp2-btn link" type="button" data-action="details" data-job="${
|
|
83743
|
-
</div>
|
|
83744
|
-
${this.p.supportMode && s.openDetails.has(e.jobId) ? `<pre class="dp2-json">${
|
|
84470
|
+
${st === "succeeded" ? `<button class="dp2-btn sm primary" type="button" data-action="download" data-kind="xlsx" data-job="${esc5(e.jobId)}">\u2B07 XLSX</button>
|
|
84471
|
+
<button class="dp2-btn sm" type="button" data-action="download" data-kind="csv" data-job="${esc5(e.jobId)}">CSV</button>
|
|
84472
|
+
<button class="dp2-btn sm" type="button" data-action="download" data-kind="json" data-job="${esc5(e.jobId)}">JSON</button>` : ""}
|
|
84473
|
+
${st === "queued" || st === "running" ? `<button class="dp2-btn sm" type="button" data-action="cancel" data-job="${esc5(e.jobId)}" ${busy}>\u2715 Cancelar</button>` : ""}
|
|
84474
|
+
${v.canResend ? `<button class="dp2-btn sm primary" type="button" data-action="resend" data-job="${esc5(e.jobId)}" ${busy}>\u21BB Reenviar</button>` : ""}
|
|
84475
|
+
${["failed", "cancelled", "succeeded", "result_expired", "purged", "old_request", "rejected"].includes(st) ? `<button class="dp2-btn sm" type="button" data-action="clone" data-job="${esc5(e.jobId)}">\u29C9 Duplicar e editar</button>` : ""}
|
|
84476
|
+
${this.p.supportMode ? `<button class="dp2-btn link" type="button" data-action="details" data-job="${esc5(e.jobId)}">${s.openDetails.has(e.jobId) ? "Ocultar" : "Detalhes /"} auditoria</button>` : ""}
|
|
84477
|
+
</div>
|
|
84478
|
+
${this.p.supportMode && s.openDetails.has(e.jobId) ? `<pre class="dp2-json">${esc5(JSON.stringify(e, null, 2))}</pre>` : ""}
|
|
83745
84479
|
</article>`;
|
|
83746
84480
|
}).join("");
|
|
83747
84481
|
const orphanCards = orphans.map((j) => `<article class="dp2-job ghost"><div class="dp2-job-top">
|
|
83748
|
-
<span class="dp2-job-title">Job sem registro no ThingsBoard (O-6)</span><span class="dp2-status ${j.status}">${
|
|
83749
|
-
<span style="flex:1"></span><span class="dp2-info">${
|
|
83750
|
-
<div class="dp2-info" style="margin-top:4px"><code>${
|
|
84482
|
+
<span class="dp2-job-title">Job sem registro no ThingsBoard (O-6)</span><span class="dp2-status ${j.status}">${esc5(JOB_STATE_LABEL[j.status] ?? j.status)}</span>
|
|
84483
|
+
<span style="flex:1"></span><span class="dp2-info">${esc5(j.requestedBy?.userId ?? "")} \xB7 ${when(j.createdAt)}</span></div>
|
|
84484
|
+
<div class="dp2-info" style="margin-top:4px"><code>${esc5(j.jobId)}</code></div></article>`).join("");
|
|
83751
84485
|
this.el.body.innerHTML = cards + orphanCards;
|
|
83752
84486
|
}
|
|
83753
84487
|
/* ------------------------------------------------------------------ data flows */
|
|
@@ -84594,6 +85328,7 @@ var groupReportHandler = {
|
|
|
84594
85328
|
} : {};
|
|
84595
85329
|
const theme = visual.palette ?? base.theme;
|
|
84596
85330
|
const customerName = visual.customerName || base.customerName;
|
|
85331
|
+
const money = context.getReportMoney?.(d) || null;
|
|
84597
85332
|
return () => {
|
|
84598
85333
|
openDashboardPopupAllReport({
|
|
84599
85334
|
...base,
|
|
@@ -84602,7 +85337,8 @@ var groupReportHandler = {
|
|
|
84602
85337
|
group: item.id,
|
|
84603
85338
|
itemsList,
|
|
84604
85339
|
...theme ? { theme } : {},
|
|
84605
|
-
...customerName ? { customerName } : {}
|
|
85340
|
+
...customerName ? { customerName } : {},
|
|
85341
|
+
...money ? { money } : {}
|
|
84606
85342
|
});
|
|
84607
85343
|
};
|
|
84608
85344
|
}
|
|
@@ -85137,11 +85873,21 @@ function createDashboardReportsHubContext(opts) {
|
|
|
85137
85873
|
})
|
|
85138
85874
|
};
|
|
85139
85875
|
};
|
|
85876
|
+
const getReportMoney = (domain) => {
|
|
85877
|
+
if (domain === "temperature" || typeof orch.getReportMoney !== "function") return null;
|
|
85878
|
+
try {
|
|
85879
|
+
return orch.getReportMoney(domain) || null;
|
|
85880
|
+
} catch (err) {
|
|
85881
|
+
log.warn("getReportMoney failed:", err?.message || err);
|
|
85882
|
+
return null;
|
|
85883
|
+
}
|
|
85884
|
+
};
|
|
85140
85885
|
return {
|
|
85141
85886
|
domains,
|
|
85142
85887
|
getGroups,
|
|
85143
85888
|
ensureDomainLoaded,
|
|
85144
85889
|
getAllReportBase,
|
|
85890
|
+
getReportMoney,
|
|
85145
85891
|
...validRange || idealRange ? { temperature: { ...validRange ? { validRange } : {}, ...idealRange ? { idealRange } : {} } } : {},
|
|
85146
85892
|
...demandPossible ? { getDemandPanelParams } : {}
|
|
85147
85893
|
};
|
|
@@ -85180,7 +85926,7 @@ var GOAL_DOMAIN_CONFIG = {
|
|
|
85180
85926
|
};
|
|
85181
85927
|
var MONTH_KEYS = Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, "0"));
|
|
85182
85928
|
var HOUR_KEYS = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0"));
|
|
85183
|
-
var
|
|
85929
|
+
var pad22 = (n) => String(n).padStart(2, "0");
|
|
85184
85930
|
function daysInMonth(year, month) {
|
|
85185
85931
|
if (month === 2) {
|
|
85186
85932
|
const leap = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
@@ -85194,9 +85940,18 @@ function buildYearOptions() {
|
|
|
85194
85940
|
for (let y = now + 2; y >= now - 2; y--) out.push(y);
|
|
85195
85941
|
return out;
|
|
85196
85942
|
}
|
|
85197
|
-
function
|
|
85943
|
+
function esc6(s) {
|
|
85198
85944
|
return String(s == null ? "" : s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
85199
85945
|
}
|
|
85946
|
+
function resolveThemeVars(theme) {
|
|
85947
|
+
if (!theme || typeof theme !== "object") return null;
|
|
85948
|
+
try {
|
|
85949
|
+
const vars = typeof theme.cssVars === "function" ? theme.cssVars() : theme;
|
|
85950
|
+
return vars && typeof vars === "object" ? vars : null;
|
|
85951
|
+
} catch (_) {
|
|
85952
|
+
return null;
|
|
85953
|
+
}
|
|
85954
|
+
}
|
|
85200
85955
|
function openGoalsPanel(params) {
|
|
85201
85956
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
85202
85957
|
throw new Error("GoalsPanel requires a browser environment");
|
|
@@ -85210,6 +85965,8 @@ function openGoalsPanel(params) {
|
|
|
85210
85965
|
const container = p.container || document.body;
|
|
85211
85966
|
const locale = p.locale === "en-US" ? "en-US" : "pt-BR";
|
|
85212
85967
|
const styles = p.styles || {};
|
|
85968
|
+
const tenantId = p.tenantId ? String(p.tenantId) : null;
|
|
85969
|
+
const themeVars = resolveThemeVars(p.theme);
|
|
85213
85970
|
if (!customerId) throw new Error("customerId is required");
|
|
85214
85971
|
if (!apiKey) throw new Error("apiKey (X-API-Key gcdr_cust_*) is required");
|
|
85215
85972
|
if (!rawBaseUrl) throw new Error("baseUrl (GCDR host) is required");
|
|
@@ -85217,7 +85974,8 @@ function openGoalsPanel(params) {
|
|
|
85217
85974
|
const theme = {
|
|
85218
85975
|
accent: styles.accent || styles.primaryColor || "#059669",
|
|
85219
85976
|
accentSoft: styles.accentSoft || "rgba(5,150,105,0.10)",
|
|
85220
|
-
|
|
85977
|
+
// Header: styles explícito > paleta do dashboard (--myio-brand-700) > esmeralda.
|
|
85978
|
+
primary: styles.primaryColor || styles.accent || (themeVars && typeof themeVars["--myio-brand-700"] === "string" ? themeVars["--myio-brand-700"] : null) || "#059669",
|
|
85221
85979
|
violet: styles.violet || "#6c5ce7",
|
|
85222
85980
|
danger: styles.errorColor || "#dc2626",
|
|
85223
85981
|
amber: styles.warningColor || "#d97706",
|
|
@@ -85225,7 +85983,7 @@ function openGoalsPanel(params) {
|
|
|
85225
85983
|
fontFamily: styles.fontFamily || "'Nunito', system-ui, sans-serif",
|
|
85226
85984
|
zIndex: styles.zIndex || 1e6
|
|
85227
85985
|
};
|
|
85228
|
-
const
|
|
85986
|
+
const MODAL_ID8 = "goals-gcdr-modal";
|
|
85229
85987
|
const ROOT_ID2 = "myio-goals-gcdr-root";
|
|
85230
85988
|
const state6 = {
|
|
85231
85989
|
domain: DOMAINS2.includes(p.domain) ? p.domain : "ENERGY",
|
|
@@ -85287,11 +86045,14 @@ function openGoalsPanel(params) {
|
|
|
85287
86045
|
try {
|
|
85288
86046
|
res = await fetch(url, {
|
|
85289
86047
|
method,
|
|
85290
|
-
headers:
|
|
85291
|
-
|
|
85292
|
-
|
|
85293
|
-
|
|
85294
|
-
|
|
86048
|
+
headers: Object.assign(
|
|
86049
|
+
{
|
|
86050
|
+
"X-API-Key": apiKey,
|
|
86051
|
+
"Content-Type": "application/json",
|
|
86052
|
+
Accept: "application/json"
|
|
86053
|
+
},
|
|
86054
|
+
tenantId ? { "X-Tenant-ID": tenantId } : {}
|
|
86055
|
+
),
|
|
85295
86056
|
body: o.body !== void 0 ? JSON.stringify(o.body) : void 0
|
|
85296
86057
|
});
|
|
85297
86058
|
} catch (e) {
|
|
@@ -85373,7 +86134,7 @@ function openGoalsPanel(params) {
|
|
|
85373
86134
|
function dailyFromTree(tree, monthKey, dayCount) {
|
|
85374
86135
|
const out = {};
|
|
85375
86136
|
for (let d = 1; d <= dayCount; d++) {
|
|
85376
|
-
const dd =
|
|
86137
|
+
const dd = pad22(d);
|
|
85377
86138
|
const node = tree && tree.daily && tree.daily[`${monthKey}-${dd}`];
|
|
85378
86139
|
out[dd] = node && typeof node.value === "number" ? String(node.value) : "";
|
|
85379
86140
|
}
|
|
@@ -85423,7 +86184,7 @@ function openGoalsPanel(params) {
|
|
|
85423
86184
|
if (state6.level === "month") return MONTH_KEYS;
|
|
85424
86185
|
if (state6.level === "day") {
|
|
85425
86186
|
const c = state6.selectedMonth ? daysInMonth(state6.year, Number(state6.selectedMonth)) : 0;
|
|
85426
|
-
return Array.from({ length: c }, (_, i) =>
|
|
86187
|
+
return Array.from({ length: c }, (_, i) => pad22(i + 1));
|
|
85427
86188
|
}
|
|
85428
86189
|
return HOUR_KEYS;
|
|
85429
86190
|
}
|
|
@@ -85649,7 +86410,7 @@ function openGoalsPanel(params) {
|
|
|
85649
86410
|
const dayValue = avg ? 22 : 3200;
|
|
85650
86411
|
const hourValue = avg ? 22 : 150;
|
|
85651
86412
|
const lines = ["bucket,value"];
|
|
85652
|
-
for (let m = 1; m <= 12; m++) lines.push(`${state6.year}-${
|
|
86413
|
+
for (let m = 1; m <= 12; m++) lines.push(`${state6.year}-${pad22(m)},${monthlyValue}`);
|
|
85653
86414
|
lines.push(`${state6.year}-03-15,${dayValue}`);
|
|
85654
86415
|
lines.push(`${state6.year}-03-15T08,${hourValue}`);
|
|
85655
86416
|
return lines.join("\n");
|
|
@@ -85658,7 +86419,7 @@ function openGoalsPanel(params) {
|
|
|
85658
86419
|
const value = sampleHourValue();
|
|
85659
86420
|
const day = `${state6.year}-03-15`;
|
|
85660
86421
|
const lines = ["bucket,value"];
|
|
85661
|
-
for (let h3 = 0; h3 < 24; h3++) lines.push(`${day}T${
|
|
86422
|
+
for (let h3 = 0; h3 < 24; h3++) lines.push(`${day}T${pad22(h3)},${value}`);
|
|
85662
86423
|
return lines.join("\n");
|
|
85663
86424
|
}
|
|
85664
86425
|
function downloadCsv(csv, suffix) {
|
|
@@ -85744,6 +86505,11 @@ function openGoalsPanel(params) {
|
|
|
85744
86505
|
rootEl.className = "myio-goals-overlay";
|
|
85745
86506
|
rootEl.setAttribute("role", "dialog");
|
|
85746
86507
|
rootEl.setAttribute("aria-modal", "true");
|
|
86508
|
+
if (themeVars) {
|
|
86509
|
+
Object.entries(themeVars).forEach(([k, v]) => {
|
|
86510
|
+
if (k.startsWith("--") && typeof v === "string") rootEl.style.setProperty(k, v);
|
|
86511
|
+
});
|
|
86512
|
+
}
|
|
85747
86513
|
container.appendChild(rootEl);
|
|
85748
86514
|
injectStyles26();
|
|
85749
86515
|
rootEl.addEventListener("click", onClick);
|
|
@@ -85891,7 +86657,7 @@ function openGoalsPanel(params) {
|
|
|
85891
86657
|
const headerHTML = ModalHeader.generateInlineHTML({
|
|
85892
86658
|
icon: "\u{1F3AF}",
|
|
85893
86659
|
title: i18n2.modalTitle,
|
|
85894
|
-
modalId:
|
|
86660
|
+
modalId: MODAL_ID8,
|
|
85895
86661
|
theme: "dark",
|
|
85896
86662
|
isMaximized: false,
|
|
85897
86663
|
showThemeToggle: false,
|
|
@@ -85915,7 +86681,7 @@ function openGoalsPanel(params) {
|
|
|
85915
86681
|
</div>
|
|
85916
86682
|
${state6.importOpen ? renderImportModal() : ""}
|
|
85917
86683
|
`;
|
|
85918
|
-
ModalHeader.setupHandlers({ modalId:
|
|
86684
|
+
ModalHeader.setupHandlers({ modalId: MODAL_ID8, onClose: () => closeModal2() });
|
|
85919
86685
|
attachCoverageTooltip();
|
|
85920
86686
|
}
|
|
85921
86687
|
function renderToolbar() {
|
|
@@ -85990,13 +86756,13 @@ function openGoalsPanel(params) {
|
|
|
85990
86756
|
const g = state6.goals || {};
|
|
85991
86757
|
const parts = [];
|
|
85992
86758
|
if (hasCoverageGaps(g.coverageGaps)) {
|
|
85993
|
-
parts.push(`<p style="margin:0 0 8px;">${
|
|
86759
|
+
parts.push(`<p style="margin:0 0 8px;">${esc6(buildCoverageWarningTextPtBR(g.coverageGaps, "GERAL"))}</p>`);
|
|
85994
86760
|
}
|
|
85995
86761
|
(Array.isArray(g.devices) ? g.devices : []).forEach((d) => {
|
|
85996
86762
|
if (!hasCoverageGaps(d && d.coverageGaps)) return;
|
|
85997
86763
|
const label = d.label || d.code || "medidor";
|
|
85998
86764
|
parts.push(
|
|
85999
|
-
`<p style="margin:0 0 8px;">${
|
|
86765
|
+
`<p style="margin:0 0 8px;">${esc6(buildCoverageWarningTextPtBR(d.coverageGaps, `do medidor ${label}`))}</p>`
|
|
86000
86766
|
);
|
|
86001
86767
|
});
|
|
86002
86768
|
return `<div style="font-size:12px;line-height:1.55;color:#334155;">${parts.join("")}</div>`;
|
|
@@ -86036,7 +86802,7 @@ function openGoalsPanel(params) {
|
|
|
86036
86802
|
html += `<div class="myio-goals-alert myio-goals-alert-amber">${icon2("alert")} ${i18n2.versionConflict}</div>`;
|
|
86037
86803
|
}
|
|
86038
86804
|
if (state6.saveError && !state6.conflict) {
|
|
86039
|
-
html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${
|
|
86805
|
+
html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc6(state6.saveError)}</div>`;
|
|
86040
86806
|
}
|
|
86041
86807
|
if (state6.saved && !state6.saveError) {
|
|
86042
86808
|
html += `<div class="myio-goals-alert myio-goals-alert-green">${icon2("check")} ${i18n2.saveSuccess}</div>`;
|
|
@@ -86051,7 +86817,7 @@ function openGoalsPanel(params) {
|
|
|
86051
86817
|
return `
|
|
86052
86818
|
<div class="myio-goals-center myio-goals-center-col">
|
|
86053
86819
|
${icon2("alert-lg")}
|
|
86054
|
-
<p>${
|
|
86820
|
+
<p>${esc6(state6.error)}</p>
|
|
86055
86821
|
<button class="myio-goals-btn myio-goals-btn-outline" data-action="retry">${i18n2.retry}</button>
|
|
86056
86822
|
</div>`;
|
|
86057
86823
|
}
|
|
@@ -86141,7 +86907,7 @@ function openGoalsPanel(params) {
|
|
|
86141
86907
|
const cellLabel = state6.level === "month" ? i18n2.months[key] : state6.level === "day" ? i18n2.dayCell.replace("{day}", Number(key)) : `${key}:00`;
|
|
86142
86908
|
const canDrill = state6.level !== "hour";
|
|
86143
86909
|
const labelEl = canDrill ? `<button class="myio-goals-cell-drill" data-action="${state6.level === "month" ? "open-month" : "open-day"}" data-key="${key}" title="${i18n2.drill.openTitle}">${cellLabel} ${icon2("chevron-sm")}</button>` : `<span class="myio-goals-cell-label">${cellLabel}</span>`;
|
|
86144
|
-
const val = state6.draft[key] !== void 0 ?
|
|
86910
|
+
const val = state6.draft[key] !== void 0 ? esc6(state6.draft[key]) : "";
|
|
86145
86911
|
const minAttr = cfg.allowsNegative ? "" : 'min="0"';
|
|
86146
86912
|
return `
|
|
86147
86913
|
<div class="myio-goals-cell">
|
|
@@ -86209,7 +86975,7 @@ function openGoalsPanel(params) {
|
|
|
86209
86975
|
const actor = ev.actor ? `${String(ev.actor).slice(0, 8)}\u2026` : i18n2.history.system;
|
|
86210
86976
|
const extra = ev.bucketCount - (ev.details ? ev.details.length : 0);
|
|
86211
86977
|
const chips = (ev.details || []).slice(0, DETAIL_PREVIEW).map(
|
|
86212
|
-
(d) => `<span class="myio-goals-tl-chip"><span class="myio-goals-tl-ref">${
|
|
86978
|
+
(d) => `<span class="myio-goals-tl-chip"><span class="myio-goals-tl-ref">${esc6(formatRef(d.ref))}</span>${d.value === null ? "\u2014" : fmt2(d.value)}</span>`
|
|
86213
86979
|
).join("");
|
|
86214
86980
|
const more = extra > 0 ? `<span class="myio-goals-tl-more">${i18n2.history.moreDetails.replace("{n}", extra)}</span>` : "";
|
|
86215
86981
|
return `
|
|
@@ -86219,7 +86985,7 @@ function openGoalsPanel(params) {
|
|
|
86219
86985
|
<span class="myio-goals-tl-title">${i18n2.history.source[ev.source] || i18n2.history.source.EDIT}</span>
|
|
86220
86986
|
<span class="myio-goals-tl-ver">v${ev.version}</span>
|
|
86221
86987
|
</div>
|
|
86222
|
-
<p class="myio-goals-tl-meta" title="${
|
|
86988
|
+
<p class="myio-goals-tl-meta" title="${esc6(new Date(ev.changedAt).toLocaleString(locale))}">${esc6(actor)} \xB7 ${esc6(timeAgo(ev.changedAt))}</p>
|
|
86223
86989
|
<p class="myio-goals-tl-records">${i18n2.history.records.replace("{n}", ev.bucketCount)} \xB7 ${i18n2.levels[ev.actionLevel] || ev.actionLevel}</p>
|
|
86224
86990
|
${chips || more ? `<div class="myio-goals-tl-chips">${chips}${more}</div>` : ""}
|
|
86225
86991
|
</li>`;
|
|
@@ -86266,7 +87032,7 @@ ${state6.year}-03-15T08,15`;
|
|
|
86266
87032
|
let html = `
|
|
86267
87033
|
<div class="myio-goals-import-hint">
|
|
86268
87034
|
<p>${i18n2.import.formatHint}</p>
|
|
86269
|
-
<code>${
|
|
87035
|
+
<code>${esc6(sample)}</code>
|
|
86270
87036
|
</div>`;
|
|
86271
87037
|
if (!applied) {
|
|
86272
87038
|
html += `
|
|
@@ -86280,16 +87046,16 @@ ${state6.year}-03-15T08,15`;
|
|
|
86280
87046
|
<input type="file" id="myio-goals-csv-file" accept=".csv,.txt,text/csv,text/plain" style="display:none" />
|
|
86281
87047
|
</div>
|
|
86282
87048
|
</div>
|
|
86283
|
-
<textarea id="myio-goals-csv-textarea" rows="8" spellcheck="false" placeholder="${
|
|
87049
|
+
<textarea id="myio-goals-csv-textarea" rows="8" spellcheck="false" placeholder="${esc6(`bucket,value
|
|
86284
87050
|
${state6.year},100000
|
|
86285
87051
|
${state6.year}-03,9000
|
|
86286
87052
|
${state6.year}-03-15,310
|
|
86287
|
-
${state6.year}-03-15T08,15`)}">${
|
|
87053
|
+
${state6.year}-03-15T08,15`)}">${esc6(state6.csv)}</textarea>
|
|
86288
87054
|
<p class="myio-goals-microhint">${i18n2.import.unitNote.replace("{unit}", unitLabel2())}</p>
|
|
86289
87055
|
</div>`;
|
|
86290
87056
|
}
|
|
86291
87057
|
if (state6.saveError && state6.conflictVersion === null) {
|
|
86292
|
-
html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${
|
|
87058
|
+
html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc6(state6.saveError)}</div>`;
|
|
86293
87059
|
}
|
|
86294
87060
|
if (state6.conflictVersion !== null) {
|
|
86295
87061
|
html += `<div class="myio-goals-alert myio-goals-alert-amber">${icon2("alert")} ${i18n2.import.conflict}</div>`;
|
|
@@ -86318,7 +87084,7 @@ ${state6.year}-03-15T08,15`)}">${esc5(state6.csv)}</textarea>
|
|
|
86318
87084
|
<div class="myio-goals-import-diags">
|
|
86319
87085
|
<p class="myio-goals-import-diags-title">${i18n2.import.diagnosticsTitle}</p>
|
|
86320
87086
|
<ul>${result.diagnostics.map(
|
|
86321
|
-
(d) => `<li>${icon2("alert-sm")} <span><span class="myio-goals-diag-line">${i18n2.import.line.replace("{line}", d.line)}</span>${d.bucket ? ` <span class="myio-goals-diag-bucket">[${
|
|
87087
|
+
(d) => `<li>${icon2("alert-sm")} <span><span class="myio-goals-diag-line">${i18n2.import.line.replace("{line}", d.line)}</span>${d.bucket ? ` <span class="myio-goals-diag-bucket">[${esc6(d.bucket)}]</span>` : ""} ${esc6(d.reason)}</span></li>`
|
|
86322
87088
|
).join("")}</ul>
|
|
86323
87089
|
</div>`;
|
|
86324
87090
|
}
|
|
@@ -86326,7 +87092,7 @@ ${state6.year}-03-15T08,15`)}">${esc5(state6.csv)}</textarea>
|
|
|
86326
87092
|
html += `
|
|
86327
87093
|
<div class="myio-goals-import-log">
|
|
86328
87094
|
<p class="myio-goals-import-log-title">${i18n2.import.logTitle}</p>
|
|
86329
|
-
<ul>${result.log.map((line) => `<li>${
|
|
87095
|
+
<ul>${result.log.map((line) => `<li>${esc6(line)}</li>`).join("")}</ul>
|
|
86330
87096
|
</div>`;
|
|
86331
87097
|
}
|
|
86332
87098
|
html += `</div>`;
|
|
@@ -93353,18 +94119,18 @@ var COLUMN_SUMMARY_CSS = `
|
|
|
93353
94119
|
var _cssInjected2 = false;
|
|
93354
94120
|
function injectCSS10() {
|
|
93355
94121
|
if (_cssInjected2 || typeof document === "undefined") return;
|
|
93356
|
-
const
|
|
93357
|
-
if (document.getElementById(
|
|
94122
|
+
const STYLE_ID24 = "myio-column-summary-tooltip-css";
|
|
94123
|
+
if (document.getElementById(STYLE_ID24)) {
|
|
93358
94124
|
_cssInjected2 = true;
|
|
93359
94125
|
return;
|
|
93360
94126
|
}
|
|
93361
94127
|
const style = document.createElement("style");
|
|
93362
|
-
style.id =
|
|
94128
|
+
style.id = STYLE_ID24;
|
|
93363
94129
|
style.textContent = COLUMN_SUMMARY_CSS;
|
|
93364
94130
|
document.head.appendChild(style);
|
|
93365
94131
|
_cssInjected2 = true;
|
|
93366
94132
|
}
|
|
93367
|
-
function
|
|
94133
|
+
function esc7(value) {
|
|
93368
94134
|
return String(value == null ? "" : value).replace(
|
|
93369
94135
|
/[&<>"]/g,
|
|
93370
94136
|
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]
|
|
@@ -93414,7 +94180,7 @@ function buildPieSvg(visible, total) {
|
|
|
93414
94180
|
const val = Number(v.d.value) || 0;
|
|
93415
94181
|
return `<svg class="myio-col-summary__pie" viewBox="0 0 220 220">
|
|
93416
94182
|
<circle class="myio-col-summary__slice" data-idx="${v.idx}" cx="110" cy="110" r="100"
|
|
93417
|
-
fill="${sliceColor(v.idx)}"><title>${
|
|
94183
|
+
fill="${sliceColor(v.idx)}"><title>${esc7(v.d.name)} \u2014 ${esc7(fmt2(val))} (${fmtPct2(
|
|
93418
94184
|
val,
|
|
93419
94185
|
total,
|
|
93420
94186
|
pd
|
|
@@ -93429,7 +94195,7 @@ function buildPieSvg(visible, total) {
|
|
|
93429
94195
|
const a1 = acc / total * 360;
|
|
93430
94196
|
return `<path class="myio-col-summary__slice" data-idx="${v.idx}"
|
|
93431
94197
|
d="${arcPath(110, 110, 100, a0, a1)}" fill="${sliceColor(v.idx)}"
|
|
93432
|
-
><title>${
|
|
94198
|
+
><title>${esc7(v.d.name)} \u2014 ${esc7(fmt2(val))} (${fmtPct2(val, total, pd)})</title></path>`;
|
|
93433
94199
|
}).join("");
|
|
93434
94200
|
return `<svg class="myio-col-summary__pie" viewBox="0 0 220 220">${paths}</svg>`;
|
|
93435
94201
|
}
|
|
@@ -93443,8 +94209,8 @@ function buildLegend(total) {
|
|
|
93443
94209
|
return `<div class="myio-col-summary__legend-row${isExcl ? " is-excluded" : ""}" data-idx="${idx}"
|
|
93444
94210
|
title="Clique para ${isExcl ? "incluir" : "remover"} da pizza">
|
|
93445
94211
|
<span class="myio-col-summary__legend-dot" style="background:${sliceColor(idx)};"></span>
|
|
93446
|
-
<span class="myio-col-summary__legend-name">${
|
|
93447
|
-
<span class="myio-col-summary__legend-val">${
|
|
94212
|
+
<span class="myio-col-summary__legend-name">${esc7(d.name)}</span>
|
|
94213
|
+
<span class="myio-col-summary__legend-val">${esc7(fmt2(val))}</span>
|
|
93448
94214
|
<span class="myio-col-summary__legend-pct">${pct}</span>
|
|
93449
94215
|
</div>`;
|
|
93450
94216
|
}).join("");
|
|
@@ -93465,25 +94231,25 @@ function buildAverageInner() {
|
|
|
93465
94231
|
const dash = "\u2014";
|
|
93466
94232
|
const periodRow = data.periodLabel ? `<div class="myio-col-summary__kpi">
|
|
93467
94233
|
<span class="myio-col-summary__kpi-label">Per\xEDodo</span>
|
|
93468
|
-
<span class="myio-col-summary__kpi-value">${
|
|
94234
|
+
<span class="myio-col-summary__kpi-value">${esc7(data.periodLabel)}</span>
|
|
93469
94235
|
</div>` : "";
|
|
93470
94236
|
const note = "M\xE9dia, m\xEDnima e m\xE1xima consideram apenas dispositivos online (com leitura).";
|
|
93471
94237
|
const kpis = `<div class="myio-col-summary__kpis">
|
|
93472
94238
|
${periodRow}
|
|
93473
94239
|
<div class="myio-col-summary__kpi">
|
|
93474
94240
|
<span class="myio-col-summary__kpi-label">Dispositivos
|
|
93475
|
-
<span class="myio-col-summary__info" title="${
|
|
94241
|
+
<span class="myio-col-summary__info" title="${esc7(note)}" aria-label="${esc7(note)}"
|
|
93476
94242
|
style="display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;margin-left:4px;border-radius:50%;background:#3e1a7d;color:#fff;font-size:9px;font-weight:700;font-style:italic;font-family:Georgia,serif;cursor:help;vertical-align:middle;">i</span>
|
|
93477
94243
|
</span>
|
|
93478
94244
|
<span class="myio-col-summary__kpi-value">${online.length} online \xB7 ${offline.length} offline</span>
|
|
93479
94245
|
</div>
|
|
93480
94246
|
<div class="myio-col-summary__kpi">
|
|
93481
|
-
<span class="myio-col-summary__kpi-label">${
|
|
93482
|
-
<span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${avg === null ? dash :
|
|
94247
|
+
<span class="myio-col-summary__kpi-label">${esc7(measure)} m\xE9dia</span>
|
|
94248
|
+
<span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${avg === null ? dash : esc7(fmt2(avg))}</span>
|
|
93483
94249
|
</div>
|
|
93484
94250
|
<div class="myio-col-summary__kpi">
|
|
93485
94251
|
<span class="myio-col-summary__kpi-label">M\xEDnima \xB7 M\xE1xima</span>
|
|
93486
|
-
<span class="myio-col-summary__kpi-value">${minV ?
|
|
94252
|
+
<span class="myio-col-summary__kpi-value">${minV ? esc7(fmt2(Number(minV.d.value))) : dash} \xB7 ${maxV ? esc7(fmt2(Number(maxV.d.value))) : dash}</span>
|
|
93487
94253
|
</div>
|
|
93488
94254
|
</div>`;
|
|
93489
94255
|
if (!data.devices.length) {
|
|
@@ -93492,12 +94258,12 @@ function buildAverageInner() {
|
|
|
93492
94258
|
const near3 = avg === null ? [] : online.slice().sort((a, b) => Math.abs(Number(a.d.value) - avg) - Math.abs(Number(b.d.value) - avg)).slice(0, 3);
|
|
93493
94259
|
const row = (v) => `
|
|
93494
94260
|
<div class="myio-col-summary__row">
|
|
93495
|
-
<span class="myio-col-summary__name" title="${
|
|
93496
|
-
<span class="myio-col-summary__val">${
|
|
94261
|
+
<span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
|
|
94262
|
+
<span class="myio-col-summary__val">${esc7(fmt2(Number(v.d.value) || 0))}</span>
|
|
93497
94263
|
</div>`;
|
|
93498
94264
|
const offRow = (v) => `
|
|
93499
94265
|
<div class="myio-col-summary__row">
|
|
93500
|
-
<span class="myio-col-summary__name" title="${
|
|
94266
|
+
<span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
|
|
93501
94267
|
<span class="myio-col-summary__val" style="color:#94a3b8;">sem leitura</span>
|
|
93502
94268
|
</div>`;
|
|
93503
94269
|
const group = (label, list, r = row) => list.length ? `<div class="myio-col-summary__group">
|
|
@@ -93514,8 +94280,8 @@ function buildAverageInner() {
|
|
|
93514
94280
|
</div>
|
|
93515
94281
|
</div>
|
|
93516
94282
|
<div class="myio-col-summary__footer">
|
|
93517
|
-
<span class="myio-col-summary__footer-label">${
|
|
93518
|
-
<span class="myio-col-summary__footer-value">${avg === null ? dash :
|
|
94283
|
+
<span class="myio-col-summary__footer-label">${esc7(measure)} m\xE9dia \xB7 ${online.length} online</span>
|
|
94284
|
+
<span class="myio-col-summary__footer-value">${avg === null ? dash : esc7(fmt2(avg))}</span>
|
|
93519
94285
|
</div>`;
|
|
93520
94286
|
}
|
|
93521
94287
|
function buildInner() {
|
|
@@ -93528,7 +94294,7 @@ function buildInner() {
|
|
|
93528
94294
|
const avg = count ? total / count : 0;
|
|
93529
94295
|
const periodRow = data.periodLabel ? `<div class="myio-col-summary__kpi">
|
|
93530
94296
|
<span class="myio-col-summary__kpi-label">Per\xEDodo</span>
|
|
93531
|
-
<span class="myio-col-summary__kpi-value">${
|
|
94297
|
+
<span class="myio-col-summary__kpi-value">${esc7(data.periodLabel)}</span>
|
|
93532
94298
|
</div>` : "";
|
|
93533
94299
|
const kpis = `<div class="myio-col-summary__kpis">
|
|
93534
94300
|
${periodRow}
|
|
@@ -93538,13 +94304,13 @@ function buildInner() {
|
|
|
93538
94304
|
</div>
|
|
93539
94305
|
<div class="myio-col-summary__kpi">
|
|
93540
94306
|
<span class="myio-col-summary__kpi-label">Consumo m\xE9dio</span>
|
|
93541
|
-
<span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${
|
|
94307
|
+
<span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${esc7(
|
|
93542
94308
|
fmt2(avg)
|
|
93543
94309
|
)}</span>
|
|
93544
94310
|
</div>
|
|
93545
94311
|
<div class="myio-col-summary__kpi">
|
|
93546
94312
|
<span class="myio-col-summary__kpi-label">Consumo total</span>
|
|
93547
|
-
<span class="myio-col-summary__kpi-value">${
|
|
94313
|
+
<span class="myio-col-summary__kpi-value">${esc7(fmt2(total))}</span>
|
|
93548
94314
|
</div>
|
|
93549
94315
|
</div>`;
|
|
93550
94316
|
if (!data.devices.length) {
|
|
@@ -93558,8 +94324,8 @@ function buildInner() {
|
|
|
93558
94324
|
).slice(0, 3);
|
|
93559
94325
|
const row = (v) => `
|
|
93560
94326
|
<div class="myio-col-summary__row">
|
|
93561
|
-
<span class="myio-col-summary__name" title="${
|
|
93562
|
-
<span class="myio-col-summary__val">${
|
|
94327
|
+
<span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
|
|
94328
|
+
<span class="myio-col-summary__val">${esc7(fmt2(Number(v.d.value) || 0))}</span>
|
|
93563
94329
|
<span class="myio-col-summary__pct">${fmtPct2(Number(v.d.value) || 0, total, pd)}</span>
|
|
93564
94330
|
</div>`;
|
|
93565
94331
|
const group = (label, list) => list.length ? `<div class="myio-col-summary__group">
|
|
@@ -93582,7 +94348,7 @@ function buildInner() {
|
|
|
93582
94348
|
</div>
|
|
93583
94349
|
<div class="myio-col-summary__footer">
|
|
93584
94350
|
<span class="myio-col-summary__footer-label">Consumo Total \xB7 ${count} dispositivos</span>
|
|
93585
|
-
<span class="myio-col-summary__footer-value">${
|
|
94351
|
+
<span class="myio-col-summary__footer-value">${esc7(fmt2(total))}</span>
|
|
93586
94352
|
</div>`;
|
|
93587
94353
|
}
|
|
93588
94354
|
function setHighlight(idx) {
|
|
@@ -101362,7 +102128,7 @@ function injectStyles12(doc) {
|
|
|
101362
102128
|
`;
|
|
101363
102129
|
(doc.head || doc.documentElement).appendChild(s);
|
|
101364
102130
|
}
|
|
101365
|
-
function
|
|
102131
|
+
function esc8(v) {
|
|
101366
102132
|
return String(v ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
101367
102133
|
}
|
|
101368
102134
|
function fmtPct3(pct) {
|
|
@@ -101383,8 +102149,8 @@ function renderDeltaChip(delta) {
|
|
|
101383
102149
|
const tone = delta.tone === "good" ? "good" : delta.tone === "bad" ? "bad" : "neutral";
|
|
101384
102150
|
const arrow = delta.arrow === "up" ? "\u2191" : delta.arrow === "down" ? "\u2193" : "\u2248";
|
|
101385
102151
|
const pctTxt = fmtPct3(Math.abs(Number(delta.pct)));
|
|
101386
|
-
const txt = delta.text ? ` ${
|
|
101387
|
-
return `<span class="myio-gbt__chip myio-gbt__chip--${tone}">${arrow} ${
|
|
102152
|
+
const txt = delta.text ? ` ${esc8(delta.text)}` : "";
|
|
102153
|
+
return `<span class="myio-gbt__chip myio-gbt__chip--${tone}">${arrow} ${esc8(pctTxt)}${txt}</span>`;
|
|
101388
102154
|
}
|
|
101389
102155
|
function renderRow(row, level) {
|
|
101390
102156
|
const hasChildren = Array.isArray(row.children) && row.children.length > 0;
|
|
@@ -101392,12 +102158,12 @@ function renderRow(row, level) {
|
|
|
101392
102158
|
const id = `gbtr-${++_rowSeq}`;
|
|
101393
102159
|
const pct = row.pct;
|
|
101394
102160
|
const caret = hasChildren ? `<button class="myio-gbt__caret${open ? " is-open" : ""}" data-caret="${id}" title="Expandir/recolher">\u25B8</button>` : `<span class="myio-gbt__caret-spacer"></span>`;
|
|
101395
|
-
const swatch = row.color ? `<span class="myio-gbt__swatch" style="background:${
|
|
101396
|
-
const icon2 = row.icon ? `<span class="myio-gbt__icon">${
|
|
102161
|
+
const swatch = row.color ? `<span class="myio-gbt__swatch" style="background:${esc8(row.color)}"></span>` : "";
|
|
102162
|
+
const icon2 = row.icon ? `<span class="myio-gbt__icon">${esc8(row.icon)}</span>` : "";
|
|
101397
102163
|
const chipHtml = row.delta ? renderDeltaChip(row.delta) : "";
|
|
101398
|
-
const pctHtml = !row.delta && pct != null && isFinite(pct) ? `<span class="myio-gbt__pct">${
|
|
102164
|
+
const pctHtml = !row.delta && pct != null && isFinite(pct) ? `<span class="myio-gbt__pct">${esc8(fmtPct3(pct))}</span>` : "";
|
|
101399
102165
|
const rowClass = level > 0 ? "myio-gbt__row myio-gbt__row--child" : "myio-gbt__row";
|
|
101400
|
-
let html = `<div class="${rowClass}">` + caret + swatch + icon2 + `<span class="myio-gbt__label">${
|
|
102166
|
+
let html = `<div class="${rowClass}">` + caret + swatch + icon2 + `<span class="myio-gbt__label">${esc8(row.label)}</span><span class="myio-gbt__value">${esc8(row.valueText)}</span>` + chipHtml + pctHtml + `</div>`;
|
|
101401
102167
|
if (hasChildren) {
|
|
101402
102168
|
const childHtml = row.children.map((c) => renderRow(c, level + 1)).join("");
|
|
101403
102169
|
html += `<div class="myio-gbt__children${open ? " is-open" : ""}" data-children="${id}">${childHtml}</div>`;
|
|
@@ -101480,8 +102246,8 @@ function createGoalsBarTooltip(opts) {
|
|
|
101480
102246
|
<div class="myio-gbt__card">
|
|
101481
102247
|
<div class="myio-gbt__header">
|
|
101482
102248
|
<div class="myio-gbt__title-wrap">
|
|
101483
|
-
<div class="myio-gbt__title">${
|
|
101484
|
-
${data.subtitle ? `<div class="myio-gbt__subtitle">${
|
|
102249
|
+
<div class="myio-gbt__title">${esc8(data.title)}</div>
|
|
102250
|
+
${data.subtitle ? `<div class="myio-gbt__subtitle">${esc8(data.subtitle)}</div>` : ""}
|
|
101485
102251
|
</div>
|
|
101486
102252
|
<button class="myio-gbt__btn myio-gbt__btn--pin${pinned ? " is-pinned" : ""}" data-action="pin" title="${pinned ? "Desafixar" : "Fixar na tela"}">\u{1F4CC}</button>
|
|
101487
102253
|
<button class="myio-gbt__btn myio-gbt__btn--close" data-action="close" title="Fechar">\u2715</button>
|
|
@@ -102490,19 +103256,19 @@ function _updateCoverageHint(topDoc) {
|
|
|
102490
103256
|
const deviceCount = data.granularity === "DEVICE" ? data.devices?.length ?? 0 : 0;
|
|
102491
103257
|
hint.textContent = `\u26A0 Meta incompleta para este dom\xEDnio/ano` + (deviceCount > 0 ? ` \xB7 Por medidor (${deviceCount})` : "") + ` \u2014 passe o mouse para detalhes`;
|
|
102492
103258
|
tabs.insertAdjacentElement("afterend", hint);
|
|
102493
|
-
const
|
|
103259
|
+
const esc11 = (s) => String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
102494
103260
|
try {
|
|
102495
103261
|
_coverageDetach = InfoTooltip.attach(hint, () => {
|
|
102496
103262
|
const d = _getGoalsData(_currentDomain);
|
|
102497
103263
|
const parts = [];
|
|
102498
103264
|
if (hasCoverageGaps(d?.coverageGaps)) {
|
|
102499
|
-
parts.push(`<p style="margin:0 0 8px;">${
|
|
103265
|
+
parts.push(`<p style="margin:0 0 8px;">${esc11(buildCoverageWarningTextPtBR(d?.coverageGaps, "GERAL"))}</p>`);
|
|
102500
103266
|
}
|
|
102501
103267
|
(d?.devices || []).forEach((dev) => {
|
|
102502
103268
|
if (!hasCoverageGaps(dev?.coverageGaps)) return;
|
|
102503
103269
|
const label = dev.label || dev.code || "medidor";
|
|
102504
103270
|
parts.push(
|
|
102505
|
-
`<p style="margin:0 0 8px;">${
|
|
103271
|
+
`<p style="margin:0 0 8px;">${esc11(buildCoverageWarningTextPtBR(dev.coverageGaps, `do medidor ${label}`))}</p>`
|
|
102506
103272
|
);
|
|
102507
103273
|
});
|
|
102508
103274
|
return {
|
|
@@ -105162,6 +105928,15 @@ var HUB_OPTIONS = [
|
|
|
105162
105928
|
desc: "Unidades e casas decimais",
|
|
105163
105929
|
superAdminOnly: false
|
|
105164
105930
|
},
|
|
105931
|
+
{
|
|
105932
|
+
// RFC-0241 — MyIO (@myio.com.br) ou admin do usuário; gate via `permissions`.
|
|
105933
|
+
action: "goals-tariffs",
|
|
105934
|
+
icon: "\u{1F3AF}",
|
|
105935
|
+
title: "Metas e Tarifas",
|
|
105936
|
+
desc: "Metas de consumo e tarifas (R$/kWh, R$/m\xB3)",
|
|
105937
|
+
superAdminOnly: false,
|
|
105938
|
+
requiresPermission: true
|
|
105939
|
+
},
|
|
105165
105940
|
{
|
|
105166
105941
|
action: "integration",
|
|
105167
105942
|
icon: "\u{1F517}",
|
|
@@ -105348,7 +106123,7 @@ function resolveHubThemeVars(explicit) {
|
|
|
105348
106123
|
return vars && typeof vars === "object" ? vars : null;
|
|
105349
106124
|
}
|
|
105350
106125
|
function openSettingsHubModal(options) {
|
|
105351
|
-
const { customerName = "", isSuperAdmin: isSuperAdmin2 = false, handlers } = options;
|
|
106126
|
+
const { customerName = "", isSuperAdmin: isSuperAdmin2 = false, handlers, permissions = {} } = options;
|
|
105352
106127
|
const doc = options.targetDocument || resolveTopDocument();
|
|
105353
106128
|
if (!doc.getElementById(STYLE_ID12)) {
|
|
105354
106129
|
const style = doc.createElement("style");
|
|
@@ -105358,7 +106133,7 @@ function openSettingsHubModal(options) {
|
|
|
105358
106133
|
}
|
|
105359
106134
|
doc.getElementById(MODAL_ID2)?.remove();
|
|
105360
106135
|
const visibleOptions = HUB_OPTIONS.filter(
|
|
105361
|
-
(opt) => typeof handlers[opt.action] === "function" && (!opt.superAdminOnly || isSuperAdmin2)
|
|
106136
|
+
(opt) => typeof handlers[opt.action] === "function" && (!opt.superAdminOnly || isSuperAdmin2) && (!opt.requiresPermission || permissions[opt.action] === true)
|
|
105362
106137
|
);
|
|
105363
106138
|
const cardsHtml = visibleOptions.map(
|
|
105364
106139
|
(opt) => `
|
|
@@ -105413,6 +106188,201 @@ function openSettingsHubModal(options) {
|
|
|
105413
106188
|
return { close: closeModal2 };
|
|
105414
106189
|
}
|
|
105415
106190
|
|
|
106191
|
+
// src/components/goals-tariffs-hub/openGoalsTariffsHub.ts
|
|
106192
|
+
var ROUTE_DELAY_MS2 = 200;
|
|
106193
|
+
var MODAL_ID3 = "myio-goals-tariffs-hub";
|
|
106194
|
+
var STYLE_ID13 = "myio-goals-tariffs-hub-styles";
|
|
106195
|
+
var AREAS = [
|
|
106196
|
+
{
|
|
106197
|
+
area: "manage",
|
|
106198
|
+
icon: "\u{1F6E0}\uFE0F",
|
|
106199
|
+
title: "Gest\xE3o de Metas",
|
|
106200
|
+
desc: (entity) => `Criar, atualizar e importar metas por ${entity} (planilha, hist\xF3rico de vers\xF5es, margem).`
|
|
106201
|
+
},
|
|
106202
|
+
{
|
|
106203
|
+
area: "compare",
|
|
106204
|
+
icon: "\u{1F4CA}",
|
|
106205
|
+
title: "Metas \xD7 Consumo",
|
|
106206
|
+
desc: () => "Comparar o consumo real com as metas, num \xFAnico painel."
|
|
106207
|
+
},
|
|
106208
|
+
{
|
|
106209
|
+
area: "tariffs",
|
|
106210
|
+
icon: "\u{1F4B2}",
|
|
106211
|
+
title: "Tarifas",
|
|
106212
|
+
desc: () => "Tarifas de energia e \xE1gua (R$/kWh, R$/m\xB3) por categoria e per\xEDodo."
|
|
106213
|
+
}
|
|
106214
|
+
];
|
|
106215
|
+
var HUB_CSS2 = `
|
|
106216
|
+
.myio-gt-hub {
|
|
106217
|
+
position: fixed; inset: 0; z-index: 999999;
|
|
106218
|
+
display: flex; align-items: center; justify-content: center;
|
|
106219
|
+
opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
|
|
106220
|
+
font-family: 'Nunito', system-ui, sans-serif;
|
|
106221
|
+
}
|
|
106222
|
+
.myio-gt-hub.show { opacity: 1; pointer-events: auto; }
|
|
106223
|
+
.myio-gt-hub__overlay {
|
|
106224
|
+
position: absolute; inset: 0;
|
|
106225
|
+
background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px);
|
|
106226
|
+
}
|
|
106227
|
+
.myio-gt-hub__content {
|
|
106228
|
+
position: relative; z-index: 2; background: #FFFFFF; border-radius: 12px;
|
|
106229
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
|
|
106230
|
+
width: min(720px, calc(100% - 32px)); max-height: 90vh; overflow: hidden;
|
|
106231
|
+
display: flex; flex-direction: column;
|
|
106232
|
+
transform: translateY(10px) scale(0.98); transition: transform 0.2s ease;
|
|
106233
|
+
}
|
|
106234
|
+
.myio-gt-hub.show .myio-gt-hub__content { transform: translateY(0) scale(1); }
|
|
106235
|
+
.myio-gt-hub__header {
|
|
106236
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
106237
|
+
padding: 12px 16px; background: var(--myio-brand-700, #3e1a7d);
|
|
106238
|
+
color: var(--myio-accent-text, #FFFFFF);
|
|
106239
|
+
}
|
|
106240
|
+
.myio-gt-hub__header h3 { margin: 0; font-size: 15px; font-weight: 700; }
|
|
106241
|
+
.myio-gt-hub__close {
|
|
106242
|
+
background: transparent; border: none; color: inherit; font-size: 22px; line-height: 1;
|
|
106243
|
+
cursor: pointer; padding: 2px 6px; border-radius: 4px;
|
|
106244
|
+
}
|
|
106245
|
+
.myio-gt-hub__close:hover { background: rgba(255, 255, 255, 0.15); }
|
|
106246
|
+
.myio-gt-hub__body {
|
|
106247
|
+
display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
106248
|
+
gap: 12px; padding: 18px; overflow-y: auto;
|
|
106249
|
+
}
|
|
106250
|
+
.myio-gt-hub__card {
|
|
106251
|
+
display: flex; flex-direction: column; gap: 8px; padding: 20px 18px;
|
|
106252
|
+
border: 1px solid #E2E8F0; border-radius: 12px; background: #FFFFFF;
|
|
106253
|
+
cursor: pointer; text-align: left; font-family: inherit;
|
|
106254
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
106255
|
+
}
|
|
106256
|
+
.myio-gt-hub__card:hover, .myio-gt-hub__card:focus-visible {
|
|
106257
|
+
border-color: var(--myio-brand-700, #3e1a7d);
|
|
106258
|
+
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); outline: none;
|
|
106259
|
+
}
|
|
106260
|
+
.myio-gt-hub__icon { font-size: 26px; }
|
|
106261
|
+
.myio-gt-hub__title { font-size: 14px; font-weight: 700; color: #1E293B; }
|
|
106262
|
+
.myio-gt-hub__desc { font-size: 12px; font-weight: 600; color: #64748B; line-height: 1.35; }
|
|
106263
|
+
`;
|
|
106264
|
+
function escapeHtml13(value) {
|
|
106265
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
106266
|
+
}
|
|
106267
|
+
function resolveTopDocument2() {
|
|
106268
|
+
try {
|
|
106269
|
+
return (window.top || window).document;
|
|
106270
|
+
} catch {
|
|
106271
|
+
return document;
|
|
106272
|
+
}
|
|
106273
|
+
}
|
|
106274
|
+
function resolveThemeVars2(explicit) {
|
|
106275
|
+
const theme = explicit || (typeof window !== "undefined" ? window.MyIOUtils?.theme : void 0);
|
|
106276
|
+
if (!theme) return null;
|
|
106277
|
+
try {
|
|
106278
|
+
const vars = typeof theme.cssVars === "function" ? theme.cssVars() : theme;
|
|
106279
|
+
return vars && typeof vars === "object" ? vars : null;
|
|
106280
|
+
} catch {
|
|
106281
|
+
return null;
|
|
106282
|
+
}
|
|
106283
|
+
}
|
|
106284
|
+
function openGoalsTariffsHub(options) {
|
|
106285
|
+
const handlers = options.handlers || {};
|
|
106286
|
+
const doc = options.targetDocument || resolveTopDocument2();
|
|
106287
|
+
const title = options.title || "\u{1F3AF} Metas e Tarifas";
|
|
106288
|
+
const entity = options.entityLabel || "shopping";
|
|
106289
|
+
const reportError = options.onError || ((err, area) => {
|
|
106290
|
+
console.error(`[GoalsTariffsHub] handler '${area}' falhou:`, err);
|
|
106291
|
+
});
|
|
106292
|
+
if (!doc.getElementById(STYLE_ID13)) {
|
|
106293
|
+
const style = doc.createElement("style");
|
|
106294
|
+
style.id = STYLE_ID13;
|
|
106295
|
+
style.textContent = HUB_CSS2;
|
|
106296
|
+
doc.head.appendChild(style);
|
|
106297
|
+
}
|
|
106298
|
+
doc.getElementById(MODAL_ID3)?.remove();
|
|
106299
|
+
const visible = AREAS.filter((a) => typeof handlers[a.area] === "function");
|
|
106300
|
+
const cardsHtml = visible.map((a) => {
|
|
106301
|
+
const desc = options.descriptions?.[a.area] ?? a.desc(entity);
|
|
106302
|
+
return `
|
|
106303
|
+
<button type="button" class="myio-gt-hub__card" data-area="${a.area}">
|
|
106304
|
+
<span class="myio-gt-hub__icon">${a.icon}</span>
|
|
106305
|
+
<span class="myio-gt-hub__title">${a.title}</span>
|
|
106306
|
+
<span class="myio-gt-hub__desc">${escapeHtml13(desc)}</span>
|
|
106307
|
+
</button>`;
|
|
106308
|
+
}).join("");
|
|
106309
|
+
const modal = doc.createElement("div");
|
|
106310
|
+
modal.id = MODAL_ID3;
|
|
106311
|
+
modal.className = "myio-gt-hub";
|
|
106312
|
+
modal.innerHTML = `
|
|
106313
|
+
<div class="myio-gt-hub__overlay"></div>
|
|
106314
|
+
<div class="myio-gt-hub__content" role="dialog" aria-modal="true" aria-label="${escapeHtml13(title)}">
|
|
106315
|
+
<div class="myio-gt-hub__header">
|
|
106316
|
+
<h3>${escapeHtml13(title)}</h3>
|
|
106317
|
+
<button type="button" class="myio-gt-hub__close" aria-label="Fechar">×</button>
|
|
106318
|
+
</div>
|
|
106319
|
+
<div class="myio-gt-hub__body">${cardsHtml}
|
|
106320
|
+
</div>
|
|
106321
|
+
</div>
|
|
106322
|
+
`;
|
|
106323
|
+
doc.body.appendChild(modal);
|
|
106324
|
+
const themeVars = resolveThemeVars2(options.theme);
|
|
106325
|
+
if (themeVars) {
|
|
106326
|
+
Object.entries(themeVars).forEach(([k, v]) => {
|
|
106327
|
+
if (k.startsWith("--") && typeof v === "string") modal.style.setProperty(k, v);
|
|
106328
|
+
});
|
|
106329
|
+
}
|
|
106330
|
+
let footer = null;
|
|
106331
|
+
if (options.footer) {
|
|
106332
|
+
try {
|
|
106333
|
+
footer = createModalFooter({
|
|
106334
|
+
customerName: options.footer.customerName || "",
|
|
106335
|
+
libVersion: options.footer.libVersion ? { current: options.footer.libVersion } : false,
|
|
106336
|
+
libVersionMode: "static",
|
|
106337
|
+
themeMode: "light"
|
|
106338
|
+
});
|
|
106339
|
+
modal.querySelector(".myio-gt-hub__content")?.appendChild(footer.element);
|
|
106340
|
+
} catch {
|
|
106341
|
+
footer = null;
|
|
106342
|
+
}
|
|
106343
|
+
}
|
|
106344
|
+
const raf = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 0);
|
|
106345
|
+
raf(() => modal.classList.add("show"));
|
|
106346
|
+
let closed = false;
|
|
106347
|
+
const escHandler = (e) => {
|
|
106348
|
+
if (e.key === "Escape") close();
|
|
106349
|
+
};
|
|
106350
|
+
function close() {
|
|
106351
|
+
if (closed) return;
|
|
106352
|
+
closed = true;
|
|
106353
|
+
doc.removeEventListener("keydown", escHandler);
|
|
106354
|
+
modal.classList.remove("show");
|
|
106355
|
+
setTimeout(() => {
|
|
106356
|
+
footer?.destroy?.();
|
|
106357
|
+
modal.remove();
|
|
106358
|
+
}, 200);
|
|
106359
|
+
try {
|
|
106360
|
+
options.onClose?.();
|
|
106361
|
+
} catch {
|
|
106362
|
+
}
|
|
106363
|
+
}
|
|
106364
|
+
modal.querySelector(".myio-gt-hub__overlay")?.addEventListener("click", close);
|
|
106365
|
+
modal.querySelector(".myio-gt-hub__close")?.addEventListener("click", close);
|
|
106366
|
+
doc.addEventListener("keydown", escHandler);
|
|
106367
|
+
modal.querySelectorAll(".myio-gt-hub__card").forEach((btn) => {
|
|
106368
|
+
btn.addEventListener("click", () => {
|
|
106369
|
+
const area = btn.dataset.area;
|
|
106370
|
+
close();
|
|
106371
|
+
setTimeout(() => {
|
|
106372
|
+
try {
|
|
106373
|
+
const out = handlers[area]?.();
|
|
106374
|
+
if (out && typeof out.then === "function") {
|
|
106375
|
+
out.catch((err) => reportError(err, area));
|
|
106376
|
+
}
|
|
106377
|
+
} catch (err) {
|
|
106378
|
+
reportError(err, area);
|
|
106379
|
+
}
|
|
106380
|
+
}, ROUTE_DELAY_MS2);
|
|
106381
|
+
});
|
|
106382
|
+
});
|
|
106383
|
+
return { close };
|
|
106384
|
+
}
|
|
106385
|
+
|
|
105416
106386
|
// src/components/pricing-panel/helpers.ts
|
|
105417
106387
|
var DOMAIN_LABEL = {
|
|
105418
106388
|
energy: "Energia",
|
|
@@ -105452,7 +106422,7 @@ function parseBRL(raw) {
|
|
|
105452
106422
|
const n = Number(s);
|
|
105453
106423
|
return Number.isFinite(n) ? n : NaN;
|
|
105454
106424
|
}
|
|
105455
|
-
function
|
|
106425
|
+
function pad23(n) {
|
|
105456
106426
|
return String(n).padStart(2, "0");
|
|
105457
106427
|
}
|
|
105458
106428
|
function daysInMonth2(periodKey2) {
|
|
@@ -105463,7 +106433,7 @@ function entryBounds(entry) {
|
|
|
105463
106433
|
if (entry.periodType === "month") {
|
|
105464
106434
|
if (!entry.periodKey || !/^\d{4}-\d{2}$/.test(entry.periodKey)) return null;
|
|
105465
106435
|
const last = daysInMonth2(entry.periodKey);
|
|
105466
|
-
return { start: `${entry.periodKey}-01`, end: `${entry.periodKey}-${
|
|
106436
|
+
return { start: `${entry.periodKey}-01`, end: `${entry.periodKey}-${pad23(last)}` };
|
|
105467
106437
|
}
|
|
105468
106438
|
if (entry.periodType === "range") {
|
|
105469
106439
|
if (!entry.start || !entry.end) return null;
|
|
@@ -105998,6 +106968,13 @@ function tariffQuery(sel, granularity) {
|
|
|
105998
106968
|
if (granularity) qs.set("granularity", granularity);
|
|
105999
106969
|
return qs.toString();
|
|
106000
106970
|
}
|
|
106971
|
+
function unwrapGcdrEnvelope(body) {
|
|
106972
|
+
if (body && typeof body === "object" && !Array.isArray(body)) {
|
|
106973
|
+
const b = body;
|
|
106974
|
+
if (b.success === true && b.data && typeof b.data === "object") return b.data;
|
|
106975
|
+
}
|
|
106976
|
+
return body;
|
|
106977
|
+
}
|
|
106001
106978
|
function parseETagVersion(headers) {
|
|
106002
106979
|
const raw = headers.get("ETag") || headers.get("etag");
|
|
106003
106980
|
if (!raw) return void 0;
|
|
@@ -106041,7 +107018,7 @@ var TariffApiClient = class {
|
|
|
106041
107018
|
const body = await this.readBody(res);
|
|
106042
107019
|
if (!res.ok) throw this.toError(res, body);
|
|
106043
107020
|
const etagVersion = parseETagVersion(res.headers);
|
|
106044
|
-
const parsed = body || {};
|
|
107021
|
+
const parsed = unwrapGcdrEnvelope(body) || {};
|
|
106045
107022
|
return {
|
|
106046
107023
|
customerId: sel.customerId,
|
|
106047
107024
|
domain: sel.domain,
|
|
@@ -106089,7 +107066,8 @@ var TariffApiClient = class {
|
|
|
106089
107066
|
const body = await this.readBody(res);
|
|
106090
107067
|
if (!res.ok) throw this.toError(res, body);
|
|
106091
107068
|
const etagVersion = parseETagVersion(res.headers);
|
|
106092
|
-
const
|
|
107069
|
+
const data = unwrapGcdrEnvelope(body);
|
|
107070
|
+
const v = (data && data.version) ?? etagVersion;
|
|
106093
107071
|
return typeof v === "number" ? { version: v } : {};
|
|
106094
107072
|
}
|
|
106095
107073
|
async write(method, sel, body, expectedVersion) {
|
|
@@ -106108,7 +107086,8 @@ var TariffApiClient = class {
|
|
|
106108
107086
|
const parsed = await this.readBody(res);
|
|
106109
107087
|
if (!res.ok) throw this.toError(res, parsed);
|
|
106110
107088
|
const etagVersion = parseETagVersion(res.headers);
|
|
106111
|
-
const
|
|
107089
|
+
const data = unwrapGcdrEnvelope(parsed);
|
|
107090
|
+
const v = (data && data.version) ?? etagVersion;
|
|
106112
107091
|
return { version: typeof v === "number" ? v : (expectedVersion ?? 0) + 1 };
|
|
106113
107092
|
}
|
|
106114
107093
|
async readBody(res) {
|
|
@@ -106203,7 +107182,7 @@ function daysInMonthYear(year, month) {
|
|
|
106203
107182
|
if (month === 2 && isLeapYear(year)) return 29;
|
|
106204
107183
|
return MONTH_DAYS[month - 1];
|
|
106205
107184
|
}
|
|
106206
|
-
function
|
|
107185
|
+
function pad24(n) {
|
|
106207
107186
|
return String(n).padStart(2, "0");
|
|
106208
107187
|
}
|
|
106209
107188
|
function assertValidCivilDate(date) {
|
|
@@ -106214,7 +107193,7 @@ function assertValidCivilDate(date) {
|
|
|
106214
107193
|
const d = Number(m[3]);
|
|
106215
107194
|
if (mo < 1 || mo > 12) throw new Error(`Invalid month in date: ${date}`);
|
|
106216
107195
|
if (d < 1 || d > daysInMonthYear(y, mo)) {
|
|
106217
|
-
throw new Error(`Invalid day for ${y}-${
|
|
107196
|
+
throw new Error(`Invalid day for ${y}-${pad24(mo)} (leap=${isLeapYear(y)}): ${date}`);
|
|
106218
107197
|
}
|
|
106219
107198
|
}
|
|
106220
107199
|
function* eachDate(start, end) {
|
|
@@ -106223,7 +107202,7 @@ function* eachDate(start, end) {
|
|
|
106223
107202
|
const t1 = Date.UTC(ye, me - 1, de);
|
|
106224
107203
|
for (let t = Date.UTC(ys, ms - 1, ds); t <= t1; t += 864e5) {
|
|
106225
107204
|
const dt = new Date(t);
|
|
106226
|
-
yield `${dt.getUTCFullYear()}-${
|
|
107205
|
+
yield `${dt.getUTCFullYear()}-${pad24(dt.getUTCMonth() + 1)}-${pad24(dt.getUTCDate())}`;
|
|
106227
107206
|
}
|
|
106228
107207
|
}
|
|
106229
107208
|
function normalizeBand(input) {
|
|
@@ -106287,7 +107266,7 @@ function bandToPanelEntry(band, customerId) {
|
|
|
106287
107266
|
function expandDayToHourBuckets(date, price) {
|
|
106288
107267
|
assertValidCivilDate(date);
|
|
106289
107268
|
const out = [];
|
|
106290
|
-
for (let h3 = 0; h3 < 24; h3++) out.push({ level: "HOUR", ref: `${date}T${
|
|
107269
|
+
for (let h3 = 0; h3 < 24; h3++) out.push({ level: "HOUR", ref: `${date}T${pad24(h3)}`, price });
|
|
106291
107270
|
return out;
|
|
106292
107271
|
}
|
|
106293
107272
|
function expandBandHours(date, startHour, endHour, price) {
|
|
@@ -106296,7 +107275,7 @@ function expandBandHours(date, startHour, endHour, price) {
|
|
|
106296
107275
|
throw new Error(`Invalid hour band ${startHour}-${endHour} for ${date}`);
|
|
106297
107276
|
}
|
|
106298
107277
|
const out = [];
|
|
106299
|
-
for (let h3 = startHour; h3 <= endHour; h3++) out.push({ level: "HOUR", ref: `${date}T${
|
|
107278
|
+
for (let h3 = startHour; h3 <= endHour; h3++) out.push({ level: "HOUR", ref: `${date}T${pad24(h3)}`, price });
|
|
106300
107279
|
return out;
|
|
106301
107280
|
}
|
|
106302
107281
|
function bandDateBounds(band) {
|
|
@@ -106304,7 +107283,7 @@ function bandDateBounds(band) {
|
|
|
106304
107283
|
case "month": {
|
|
106305
107284
|
if (!band.periodKey) throw new Error("month band missing periodKey");
|
|
106306
107285
|
const [y, m] = band.periodKey.split("-").map(Number);
|
|
106307
|
-
return { start: `${band.periodKey}-01`, end: `${band.periodKey}-${
|
|
107286
|
+
return { start: `${band.periodKey}-01`, end: `${band.periodKey}-${pad24(daysInMonthYear(y, m))}` };
|
|
106308
107287
|
}
|
|
106309
107288
|
case "range": {
|
|
106310
107289
|
if (!band.start || !band.end) throw new Error("range band missing start/end");
|
|
@@ -106448,7 +107427,7 @@ function collapseTreeToBands(tree, dims) {
|
|
|
106448
107427
|
} else if (typeof node.price === "string") {
|
|
106449
107428
|
const last = daysInMonthYear(dims.year, Number(mm));
|
|
106450
107429
|
for (let d = 1; d <= last; d++) {
|
|
106451
|
-
dayBands.push({ ...dimOnly, periodType: "day", date: `${dims.year}-${mm}-${
|
|
107430
|
+
dayBands.push({ ...dimOnly, periodType: "day", date: `${dims.year}-${mm}-${pad24(d)}`, price: node.price });
|
|
106452
107431
|
}
|
|
106453
107432
|
}
|
|
106454
107433
|
}
|
|
@@ -106571,18 +107550,18 @@ function createTariffApiAdapter(client, opts) {
|
|
|
106571
107550
|
}
|
|
106572
107551
|
|
|
106573
107552
|
// src/components/pricing-panel/openPricingPanel.ts
|
|
106574
|
-
var
|
|
106575
|
-
function
|
|
107553
|
+
var MODAL_ID4 = "myio-pricing-panel";
|
|
107554
|
+
function escapeHtml14(value) {
|
|
106576
107555
|
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
106577
107556
|
}
|
|
106578
|
-
function
|
|
107557
|
+
function resolveTopDocument3() {
|
|
106579
107558
|
try {
|
|
106580
107559
|
return (window.top || window).document;
|
|
106581
107560
|
} catch {
|
|
106582
107561
|
return document;
|
|
106583
107562
|
}
|
|
106584
107563
|
}
|
|
106585
|
-
function
|
|
107564
|
+
function resolveThemeVars3(explicit) {
|
|
106586
107565
|
const theme = explicit || (typeof window !== "undefined" ? window.MyIOUtils?.theme : void 0);
|
|
106587
107566
|
if (!theme) return null;
|
|
106588
107567
|
const vars = typeof theme.cssVars === "function" ? theme.cssVars() : theme;
|
|
@@ -106627,7 +107606,7 @@ function fmtTimestamp(iso) {
|
|
|
106627
107606
|
return d.toLocaleString("pt-BR");
|
|
106628
107607
|
}
|
|
106629
107608
|
function openPricingPanel(params) {
|
|
106630
|
-
const doc = params.targetDocument ||
|
|
107609
|
+
const doc = params.targetDocument || resolveTopDocument3();
|
|
106631
107610
|
const author = params.currentUserEmail || "";
|
|
106632
107611
|
const storePrefix = params.storageKeyPrefix || "myio";
|
|
106633
107612
|
const keyEntries = entriesKey(storePrefix);
|
|
@@ -106647,9 +107626,10 @@ function openPricingPanel(params) {
|
|
|
106647
107626
|
}
|
|
106648
107627
|
};
|
|
106649
107628
|
injectPricingPanelStyles(doc);
|
|
106650
|
-
doc.getElementById(
|
|
106651
|
-
const allowed = isPricingAllowed(params.currentUserEmail, isSuperAdmin());
|
|
107629
|
+
doc.getElementById(MODAL_ID4)?.remove();
|
|
107630
|
+
const allowed = typeof params.allowed === "boolean" ? params.allowed : isPricingAllowed(params.currentUserEmail, isSuperAdmin());
|
|
106652
107631
|
const customers = params.customers || [];
|
|
107632
|
+
const lockCustomer = params.lockCustomer === true && customers.length > 0;
|
|
106653
107633
|
const tariffApi = params.tariffApi;
|
|
106654
107634
|
let adapter = null;
|
|
106655
107635
|
if (allowed && tariffApi) {
|
|
@@ -106665,10 +107645,10 @@ function openPricingPanel(params) {
|
|
|
106665
107645
|
let entries = allowed ? adapter ? (params.initialEntries || []).map((e) => ({ ...e })) : mergeEntries(loadJson(doc, keyEntries, []), params.initialEntries || [], author) : [];
|
|
106666
107646
|
let auditLog = allowed && !adapter ? loadJson(doc, keyAudit, []) : [];
|
|
106667
107647
|
const modal = doc.createElement("div");
|
|
106668
|
-
modal.id =
|
|
107648
|
+
modal.id = MODAL_ID4;
|
|
106669
107649
|
modal.className = "myio-pricing";
|
|
106670
107650
|
function applyTheme() {
|
|
106671
|
-
const themeVars =
|
|
107651
|
+
const themeVars = resolveThemeVars3(params.theme);
|
|
106672
107652
|
if (!themeVars) return;
|
|
106673
107653
|
Object.entries(themeVars).forEach(([k, v]) => {
|
|
106674
107654
|
if (k.startsWith("--") && typeof v === "string") modal.style.setProperty(k, v);
|
|
@@ -106727,7 +107707,7 @@ function openPricingPanel(params) {
|
|
|
106727
107707
|
}
|
|
106728
107708
|
const initDomain = params.domain || "energy";
|
|
106729
107709
|
const initCategory = params.category || "lojas";
|
|
106730
|
-
const customerOptions = customers.map((c) => `<option value="${
|
|
107710
|
+
const customerOptions = customers.map((c) => `<option value="${escapeHtml14(resolveCustomerId(c))}">${escapeHtml14(c.title)}</option>`).join("");
|
|
106731
107711
|
modal.innerHTML = `
|
|
106732
107712
|
<div class="myio-pricing__overlay"></div>
|
|
106733
107713
|
<div class="myio-pricing__content">
|
|
@@ -106744,7 +107724,7 @@ function openPricingPanel(params) {
|
|
|
106744
107724
|
<!-- TAB: Definir pre\xE7os -->
|
|
106745
107725
|
<div class="myio-pricing__panel" data-panel="define">
|
|
106746
107726
|
<div class="myio-pricing__form">
|
|
106747
|
-
<div class="myio-pricing__field myio-pricing__field--full">
|
|
107727
|
+
<div class="myio-pricing__field myio-pricing__field--full" data-testid="pricing-customer-field"${lockCustomer ? ' style="display:none;"' : ""}>
|
|
106748
107728
|
<label class="myio-pricing__label" for="myio-pricing-customer">Customer (shopping)</label>
|
|
106749
107729
|
<select class="myio-pricing__select" id="myio-pricing-customer" data-testid="pricing-customer">
|
|
106750
107730
|
${customerOptions}
|
|
@@ -106942,9 +107922,9 @@ function openPricingPanel(params) {
|
|
|
106942
107922
|
const pushAudit = (rec) => {
|
|
106943
107923
|
if (rec) auditLog = [rec, ...auditLog];
|
|
106944
107924
|
};
|
|
106945
|
-
const badge = (domain, category) => `<span class="myio-pricing__badge${domain === "water" ? " myio-pricing__badge--water" : ""}">${
|
|
107925
|
+
const badge = (domain, category) => `<span class="myio-pricing__badge${domain === "water" ? " myio-pricing__badge--water" : ""}">${escapeHtml14(
|
|
106946
107926
|
DOMAIN_LABEL[domain]
|
|
106947
|
-
)} \xB7 ${
|
|
107927
|
+
)} \xB7 ${escapeHtml14(CATEGORY_LABEL[category])}</span>`;
|
|
106948
107928
|
const renderList2 = () => {
|
|
106949
107929
|
const customerId = customerSel.value;
|
|
106950
107930
|
const rows = entries.filter((e) => e.customerId === customerId).sort((a, b) => {
|
|
@@ -106957,15 +107937,15 @@ function openPricingPanel(params) {
|
|
|
106957
107937
|
const boundsKey = b ? `${b.start}__${b.end}` : "";
|
|
106958
107938
|
return `
|
|
106959
107939
|
<li class="myio-pricing__item">
|
|
106960
|
-
<span class="myio-pricing__item-period">${badge(e.domain, e.category)} ${
|
|
107940
|
+
<span class="myio-pricing__item-period">${badge(e.domain, e.category)} ${escapeHtml14(
|
|
106961
107941
|
formatPeriodLabel(e)
|
|
106962
107942
|
)}</span>
|
|
106963
|
-
<span class="myio-pricing__item-price">${
|
|
107943
|
+
<span class="myio-pricing__item-price">${escapeHtml14(formatBRL2(e.pricePerKwh))} ${escapeHtml14(
|
|
106964
107944
|
unitLabel(e.domain)
|
|
106965
107945
|
)}</span>
|
|
106966
|
-
<button class="myio-pricing__remove" data-remove="${
|
|
107946
|
+
<button class="myio-pricing__remove" data-remove="${escapeHtml14(e.domain)}|${escapeHtml14(
|
|
106967
107947
|
e.category
|
|
106968
|
-
)}|${
|
|
107948
|
+
)}|${escapeHtml14(boundsKey)}" aria-label="Remover" type="button">\u2715</button>
|
|
106969
107949
|
</li>`;
|
|
106970
107950
|
}).join("");
|
|
106971
107951
|
emptyEl.style.display = rows.length ? "none" : "";
|
|
@@ -107064,8 +108044,8 @@ function openPricingPanel(params) {
|
|
|
107064
108044
|
kpiEl.innerHTML = cards.map(
|
|
107065
108045
|
(c) => `
|
|
107066
108046
|
<div class="myio-pricing__kpi">
|
|
107067
|
-
<div class="myio-pricing__kpi-value">${
|
|
107068
|
-
<div class="myio-pricing__kpi-label">${
|
|
108047
|
+
<div class="myio-pricing__kpi-value">${escapeHtml14(c.value)}</div>
|
|
108048
|
+
<div class="myio-pricing__kpi-label">${escapeHtml14(c.label)}</div>
|
|
107069
108049
|
</div>`
|
|
107070
108050
|
).join("");
|
|
107071
108051
|
renderReport();
|
|
@@ -107084,11 +108064,11 @@ function openPricingPanel(params) {
|
|
|
107084
108064
|
reportBody.innerHTML = rows.length ? rows.map(
|
|
107085
108065
|
(e) => `
|
|
107086
108066
|
<tr>
|
|
107087
|
-
<td>${
|
|
107088
|
-
<td>${
|
|
107089
|
-
<td>${
|
|
107090
|
-
<td>${
|
|
107091
|
-
<td>${
|
|
108067
|
+
<td>${escapeHtml14(customerTitle(e.customerId))}</td>
|
|
108068
|
+
<td>${escapeHtml14(DOMAIN_LABEL[e.domain])}</td>
|
|
108069
|
+
<td>${escapeHtml14(CATEGORY_LABEL[e.category])}</td>
|
|
108070
|
+
<td>${escapeHtml14(formatPeriodLabel(e))}</td>
|
|
108071
|
+
<td>${escapeHtml14(formatBRL2(e.pricePerKwh))} ${escapeHtml14(unitLabel(e.domain))}</td>
|
|
107092
108072
|
</tr>`
|
|
107093
108073
|
).join("") : `<tr><td colspan="5" style="text-align:center;color:var(--myio-text-muted,#6b7280);padding:24px;">Nenhum pre\xE7o para o filtro selecionado.</td></tr>`;
|
|
107094
108074
|
}
|
|
@@ -107098,15 +108078,15 @@ function openPricingPanel(params) {
|
|
|
107098
108078
|
return `
|
|
107099
108079
|
<li class="myio-pricing__history-item">
|
|
107100
108080
|
<div class="myio-pricing__history-head">
|
|
107101
|
-
<span class="myio-pricing__action myio-pricing__action--${
|
|
108081
|
+
<span class="myio-pricing__action myio-pricing__action--${escapeHtml14(rec.action)}">${escapeHtml14(
|
|
107102
108082
|
rec.action
|
|
107103
108083
|
)}</span>
|
|
107104
108084
|
${badge(rec.domain, rec.category)}
|
|
107105
|
-
<span>${
|
|
108085
|
+
<span>${escapeHtml14(rec.periodLabel)}${escapeHtml14(priceInfo)}</span>
|
|
107106
108086
|
</div>
|
|
107107
|
-
<div class="myio-pricing__history-meta">${
|
|
108087
|
+
<div class="myio-pricing__history-meta">${escapeHtml14(customerTitle(rec.customerId))} \xB7 ${escapeHtml14(
|
|
107108
108088
|
rec.by || "\u2014"
|
|
107109
|
-
)} \xB7 ${
|
|
108089
|
+
)} \xB7 ${escapeHtml14(fmtTimestamp(rec.at))}</div>
|
|
107110
108090
|
</li>`;
|
|
107111
108091
|
}).join("");
|
|
107112
108092
|
historyEmpty.style.display = auditLog.length ? "none" : "";
|
|
@@ -107293,11 +108273,16 @@ var GoalsMoneyClient = class {
|
|
|
107293
108273
|
const v = (body && body.version) ?? etagVersion;
|
|
107294
108274
|
return typeof v === "number" ? { version: v } : {};
|
|
107295
108275
|
}
|
|
108276
|
+
/**
|
|
108277
|
+
* Parse the body and unwrap GCDR's `{ success: true, data, meta }` success
|
|
108278
|
+
* envelope (bare shape still accepted). Error envelopes stay intact for
|
|
108279
|
+
* `toError`.
|
|
108280
|
+
*/
|
|
107296
108281
|
async readBody(res) {
|
|
107297
108282
|
try {
|
|
107298
108283
|
const text2 = await res.text();
|
|
107299
108284
|
if (!text2) return null;
|
|
107300
|
-
return JSON.parse(text2);
|
|
108285
|
+
return unwrapGcdrEnvelope(JSON.parse(text2));
|
|
107301
108286
|
} catch {
|
|
107302
108287
|
return null;
|
|
107303
108288
|
}
|
|
@@ -107805,11 +108790,11 @@ function deviceCategoryToPanelTerm(cat) {
|
|
|
107805
108790
|
function panelTermToDeviceCategory(term) {
|
|
107806
108791
|
return term == null ? null : panelCategoryToWire(term);
|
|
107807
108792
|
}
|
|
107808
|
-
function
|
|
108793
|
+
function esc9(s) {
|
|
107809
108794
|
return String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
107810
108795
|
}
|
|
107811
108796
|
function categoryOptionsHTML(selected) {
|
|
107812
|
-
const opt = (value, label, isSel) => `<option value="${value}"${isSel ? " selected" : ""}>${
|
|
108797
|
+
const opt = (value, label, isSel) => `<option value="${value}"${isSel ? " selected" : ""}>${esc9(label)}</option>`;
|
|
107813
108798
|
return opt("", NONE_LABEL, selected == null) + opt("COMMON_AREA", deviceCategoryLabel("COMMON_AREA"), selected === "COMMON_AREA") + opt("SPECIFIC", deviceCategoryLabel("SPECIFIC"), selected === "SPECIFIC");
|
|
107814
108799
|
}
|
|
107815
108800
|
function openDeviceCategoryPanel(params) {
|
|
@@ -107846,8 +108831,8 @@ function openDeviceCategoryPanel(params) {
|
|
|
107846
108831
|
<select class="myio-devcat__filter" data-devcat-filter="1" aria-label="Filtrar por categoria">
|
|
107847
108832
|
<option value="all">Todas as categorias</option>
|
|
107848
108833
|
<option value="uncategorized">Sem categoria</option>
|
|
107849
|
-
<option value="COMMON_AREA">${
|
|
107850
|
-
<option value="SPECIFIC">${
|
|
108834
|
+
<option value="COMMON_AREA">${esc9(deviceCategoryLabel("COMMON_AREA"))}</option>
|
|
108835
|
+
<option value="SPECIFIC">${esc9(deviceCategoryLabel("SPECIFIC"))}</option>
|
|
107851
108836
|
</select>
|
|
107852
108837
|
<label class="myio-devcat__filter" style="display:flex;align-items:center;gap:6px;cursor:pointer;">
|
|
107853
108838
|
<input type="checkbox" data-devcat-selectall="1" /> Selecionar vis\xEDveis
|
|
@@ -107856,9 +108841,9 @@ function openDeviceCategoryPanel(params) {
|
|
|
107856
108841
|
<div class="myio-devcat__bulkbar" data-devcat-bulkbar="1">
|
|
107857
108842
|
<span data-devcat-bulkcount="1">0 selecionados</span>
|
|
107858
108843
|
<select data-devcat-bulkcat="1" aria-label="Categoria para os selecionados">
|
|
107859
|
-
<option value="">${
|
|
107860
|
-
<option value="COMMON_AREA">${
|
|
107861
|
-
<option value="SPECIFIC">${
|
|
108844
|
+
<option value="">${esc9(NONE_LABEL)}</option>
|
|
108845
|
+
<option value="COMMON_AREA">${esc9(deviceCategoryLabel("COMMON_AREA"))}</option>
|
|
108846
|
+
<option value="SPECIFIC">${esc9(deviceCategoryLabel("SPECIFIC"))}</option>
|
|
107862
108847
|
</select>
|
|
107863
108848
|
<button type="button" class="myio-devcat__bulk-apply" data-devcat-bulkapply="1">Aplicar a selecionados</button>
|
|
107864
108849
|
</div>
|
|
@@ -107888,16 +108873,16 @@ function openDeviceCategoryPanel(params) {
|
|
|
107888
108873
|
return rows.filter((r) => matchesFilter(r) && matchesSearch(r));
|
|
107889
108874
|
}
|
|
107890
108875
|
function rowHTML(r) {
|
|
107891
|
-
const name =
|
|
107892
|
-
const code = r.code ? `<span class="myio-devcat__row-code">${
|
|
108876
|
+
const name = esc9(r.label || r.code || r.deviceId);
|
|
108877
|
+
const code = r.code ? `<span class="myio-devcat__row-code">${esc9(r.code)}</span>` : "";
|
|
107893
108878
|
const checked = selected.has(r.deviceId) ? " checked" : "";
|
|
107894
108879
|
const focused = r.deviceId === params.focusDeviceId ? ' data-focused="1"' : "";
|
|
107895
108880
|
const catAttr = r.tariffCategory == null ? "null" : r.tariffCategory;
|
|
107896
|
-
return `<div class="myio-devcat__row" data-devcat-row="${
|
|
108881
|
+
return `<div class="myio-devcat__row" data-devcat-row="${esc9(r.deviceId)}" data-cat="${catAttr}"${focused}><input type="checkbox" class="myio-devcat__row-check" data-devcat-rowcheck="${esc9(
|
|
107897
108882
|
r.deviceId
|
|
107898
|
-
)}"${checked} aria-label="Selecionar ${name}" /><div class="myio-devcat__row-main"><span class="myio-devcat__row-label" title="${name}">${name}</span>` + code + `</div><select class="myio-devcat__row-select" data-devcat-rowselect="${
|
|
108883
|
+
)}"${checked} aria-label="Selecionar ${name}" /><div class="myio-devcat__row-main"><span class="myio-devcat__row-label" title="${name}">${name}</span>` + code + `</div><select class="myio-devcat__row-select" data-devcat-rowselect="${esc9(
|
|
107899
108884
|
r.deviceId
|
|
107900
|
-
)}" aria-label="Categoria de ${name}">${categoryOptionsHTML(r.tariffCategory)}</select><div class="myio-devcat__row-conflict" data-devcat-conflict="${
|
|
108885
|
+
)}" aria-label="Categoria de ${name}">${categoryOptionsHTML(r.tariffCategory)}</select><div class="myio-devcat__row-conflict" data-devcat-conflict="${esc9(r.deviceId)}"></div></div>`;
|
|
107901
108886
|
}
|
|
107902
108887
|
function render3() {
|
|
107903
108888
|
const vis = visibleRows();
|
|
@@ -108057,7 +109042,7 @@ function openDeviceCategoryPanel(params) {
|
|
|
108057
109042
|
rows = await port.listDevices({ customerId, domain: params.domain });
|
|
108058
109043
|
} catch (err) {
|
|
108059
109044
|
rows = [];
|
|
108060
|
-
body.innerHTML = `<div class="myio-devcat__empty">N\xE3o foi poss\xEDvel carregar os dispositivos: ${
|
|
109045
|
+
body.innerHTML = `<div class="myio-devcat__empty">N\xE3o foi poss\xEDvel carregar os dispositivos: ${esc9(
|
|
108061
109046
|
err?.message || "erro"
|
|
108062
109047
|
)}</div>`;
|
|
108063
109048
|
countEl.textContent = "";
|
|
@@ -115442,11 +116427,11 @@ function refreshIncidentBadges(opts) {
|
|
|
115442
116427
|
}
|
|
115443
116428
|
|
|
115444
116429
|
// src/components/premium-modals/standard-modal/openStandardModal.ts
|
|
115445
|
-
var
|
|
116430
|
+
var STYLE_ID14 = "myio-stdmodal-styles";
|
|
115446
116431
|
var FONT_LINK_ID3 = "myio-dialog-font-nunito";
|
|
115447
116432
|
var BASE_Z_INDEX3 = 10700;
|
|
115448
116433
|
var openCount3 = 0;
|
|
115449
|
-
function
|
|
116434
|
+
function escapeHtml15(v) {
|
|
115450
116435
|
return String(v).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
115451
116436
|
}
|
|
115452
116437
|
function injectStyles13() {
|
|
@@ -115457,9 +116442,9 @@ function injectStyles13() {
|
|
|
115457
116442
|
link.href = "https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap";
|
|
115458
116443
|
document.head.appendChild(link);
|
|
115459
116444
|
}
|
|
115460
|
-
if (document.getElementById(
|
|
116445
|
+
if (document.getElementById(STYLE_ID14)) return;
|
|
115461
116446
|
const style = document.createElement("style");
|
|
115462
|
-
style.id =
|
|
116447
|
+
style.id = STYLE_ID14;
|
|
115463
116448
|
style.textContent = `
|
|
115464
116449
|
.myio-stdmodal-overlay {
|
|
115465
116450
|
position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
|
|
@@ -115500,10 +116485,10 @@ function openStandardModal(params) {
|
|
|
115500
116485
|
overlay.className = "myio-stdmodal-overlay";
|
|
115501
116486
|
overlay.style.zIndex = String(BASE_Z_INDEX3 + openCount3);
|
|
115502
116487
|
overlay.innerHTML = `
|
|
115503
|
-
<div class="myio-stdmodal" role="dialog" aria-modal="true" aria-label="${
|
|
116488
|
+
<div class="myio-stdmodal" role="dialog" aria-modal="true" aria-label="${escapeHtml15(params.title)}" style="width:${width}">
|
|
115504
116489
|
${ModalHeader.generateHTML({
|
|
115505
116490
|
icon: params.icon,
|
|
115506
|
-
title:
|
|
116491
|
+
title: escapeHtml15(params.title),
|
|
115507
116492
|
modalId,
|
|
115508
116493
|
showThemeToggle: false,
|
|
115509
116494
|
showMaximize: false,
|
|
@@ -115512,7 +116497,7 @@ function openStandardModal(params) {
|
|
|
115512
116497
|
})}
|
|
115513
116498
|
<div class="myio-stdmodal__body"></div>
|
|
115514
116499
|
${buttons.length ? `<div class="myio-stdmodal__footer">${buttons.map(
|
|
115515
|
-
(b, i) => `<button type="button" class="myio-stdmodal__btn myio-stdmodal__btn--${b.variant ?? "secondary"}" data-index="${i}" data-value="${
|
|
116500
|
+
(b, i) => `<button type="button" class="myio-stdmodal__btn myio-stdmodal__btn--${b.variant ?? "secondary"}" data-index="${i}" data-value="${escapeHtml15(b.value)}">${escapeHtml15(b.label)}</button>`
|
|
115516
116501
|
).join("")}</div>` : ""}
|
|
115517
116502
|
</div>`;
|
|
115518
116503
|
const root = overlay.querySelector(".myio-stdmodal");
|
|
@@ -115593,7 +116578,7 @@ var VALUE_COLUMN = {
|
|
|
115593
116578
|
};
|
|
115594
116579
|
var MAX_IMPORT_ROWS = 5e3;
|
|
115595
116580
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
115596
|
-
var
|
|
116581
|
+
var pad25 = (n) => String(n).padStart(2, "0");
|
|
115597
116582
|
function isImportableKey(d) {
|
|
115598
116583
|
const slave = Number(d?.slaveId);
|
|
115599
116584
|
return !!d?.centralId && UUID_RE.test(String(d.centralId)) && Number.isInteger(slave) && slave >= 1;
|
|
@@ -115611,14 +116596,14 @@ function daysBetween(start, end) {
|
|
|
115611
116596
|
const cur = new Date(Date.UTC(y1, m1 - 1, d1));
|
|
115612
116597
|
const last = Date.UTC(y2, m2 - 1, d2);
|
|
115613
116598
|
while (cur.getTime() <= last && out.length < 400) {
|
|
115614
|
-
out.push(`${cur.getUTCFullYear()}-${
|
|
116599
|
+
out.push(`${cur.getUTCFullYear()}-${pad25(cur.getUTCMonth() + 1)}-${pad25(cur.getUTCDate())}`);
|
|
115615
116600
|
cur.setUTCDate(cur.getUTCDate() + 1);
|
|
115616
116601
|
}
|
|
115617
116602
|
return out;
|
|
115618
116603
|
}
|
|
115619
116604
|
function nowSaoPaulo(now) {
|
|
115620
116605
|
const d = new Date(now - 3 * 3600 * 1e3);
|
|
115621
|
-
return { date: `${d.getUTCFullYear()}-${
|
|
116606
|
+
return { date: `${d.getUTCFullYear()}-${pad25(d.getUTCMonth() + 1)}-${pad25(d.getUTCDate())}`, hour: d.getUTCHours() };
|
|
115622
116607
|
}
|
|
115623
116608
|
function buildTemplateCsv(domain, devices, start, end, now = Date.now()) {
|
|
115624
116609
|
const valueCol = VALUE_COLUMN[domain];
|
|
@@ -115626,14 +116611,14 @@ function buildTemplateCsv(domain, devices, start, end, now = Date.now()) {
|
|
|
115626
116611
|
if (domain === "energy") header.push("value_reactive_kvarh");
|
|
115627
116612
|
const today = nowSaoPaulo(now);
|
|
115628
116613
|
const lines = [header.join(";")];
|
|
115629
|
-
const
|
|
116614
|
+
const esc11 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
|
|
115630
116615
|
const { ok } = splitImportableDevices(devices);
|
|
115631
116616
|
for (const dev of ok) {
|
|
115632
116617
|
for (const date of daysBetween(start, end)) {
|
|
115633
116618
|
if (date > today.date) break;
|
|
115634
116619
|
for (let h3 = 0; h3 < 24; h3++) {
|
|
115635
116620
|
if (date === today.date && h3 >= today.hour) break;
|
|
115636
|
-
const cols = [String(dev.centralId), String(Number(dev.slaveId)),
|
|
116621
|
+
const cols = [String(dev.centralId), String(Number(dev.slaveId)), esc11(dev.label || ""), date, `${pad25(h3)}:00`, ""];
|
|
115637
116622
|
if (domain === "energy") cols.push("");
|
|
115638
116623
|
lines.push(cols.join(";"));
|
|
115639
116624
|
}
|
|
@@ -115678,26 +116663,26 @@ function parseCsv(text2) {
|
|
|
115678
116663
|
function normalizeDate(v) {
|
|
115679
116664
|
if (typeof v === "number" && Number.isFinite(v) && v > 2e4 && v < 8e4) {
|
|
115680
116665
|
const d = new Date(Date.UTC(1899, 11, 30) + Math.floor(v) * 864e5);
|
|
115681
|
-
return `${d.getUTCFullYear()}-${
|
|
116666
|
+
return `${d.getUTCFullYear()}-${pad25(d.getUTCMonth() + 1)}-${pad25(d.getUTCDate())}`;
|
|
115682
116667
|
}
|
|
115683
116668
|
const s = String(v ?? "").trim();
|
|
115684
116669
|
let m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(s);
|
|
115685
|
-
if (m) return `${m[1]}-${
|
|
116670
|
+
if (m) return `${m[1]}-${pad25(+m[2])}-${pad25(+m[3])}`;
|
|
115686
116671
|
m = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(s);
|
|
115687
|
-
if (m) return `${m[3]}-${
|
|
116672
|
+
if (m) return `${m[3]}-${pad25(+m[2])}-${pad25(+m[1])}`;
|
|
115688
116673
|
return null;
|
|
115689
116674
|
}
|
|
115690
116675
|
function normalizeHour(v) {
|
|
115691
116676
|
if (typeof v === "number" && Number.isFinite(v) && v >= 0 && v < 1) {
|
|
115692
116677
|
const mins = Math.round(v * 24 * 60);
|
|
115693
|
-
return mins % 60 === 0 ? `${
|
|
116678
|
+
return mins % 60 === 0 ? `${pad25(mins / 60)}:00` : null;
|
|
115694
116679
|
}
|
|
115695
116680
|
const s = String(v ?? "").trim();
|
|
115696
116681
|
const m = /^(\d{1,2})(?::(\d{2})(?::(\d{2}))?)?$/.exec(s);
|
|
115697
116682
|
if (!m) return null;
|
|
115698
116683
|
const h3 = Number(m[1]);
|
|
115699
116684
|
if (h3 > 23 || Number(m[2] || 0) !== 0 || Number(m[3] || 0) !== 0) return null;
|
|
115700
|
-
return `${
|
|
116685
|
+
return `${pad25(h3)}:00`;
|
|
115701
116686
|
}
|
|
115702
116687
|
function parseDecimal(v) {
|
|
115703
116688
|
if (typeof v === "number") return Number.isFinite(v) ? v : NaN;
|
|
@@ -115806,7 +116791,7 @@ var TOTAL_COLUMN = {
|
|
|
115806
116791
|
var ACCUMULATED_SOURCE_PREFIX = "acumulado";
|
|
115807
116792
|
var MAX_PERIOD_DAYS = 366;
|
|
115808
116793
|
var MILLI = 1e3;
|
|
115809
|
-
var
|
|
116794
|
+
var pad26 = (n) => String(n).padStart(2, "0");
|
|
115810
116795
|
function closedHoursInPeriod(start, end, now = Date.now()) {
|
|
115811
116796
|
const today = nowSaoPaulo(now);
|
|
115812
116797
|
const out = [];
|
|
@@ -115879,7 +116864,7 @@ function accumulatedRows(domain, entries, profile = DEFAULT_DISTRIBUTION_PROFILE
|
|
|
115879
116864
|
gateway_id: e.gateway_id,
|
|
115880
116865
|
slave_id: e.slave_id,
|
|
115881
116866
|
date: slots[i].date,
|
|
115882
|
-
hour: `${
|
|
116867
|
+
hour: `${pad26(slots[i].hour)}:00`,
|
|
115883
116868
|
[valueCol]: value
|
|
115884
116869
|
});
|
|
115885
116870
|
});
|
|
@@ -115894,10 +116879,10 @@ function accumulatedRows(domain, entries, profile = DEFAULT_DISTRIBUTION_PROFILE
|
|
|
115894
116879
|
}
|
|
115895
116880
|
function buildAccumulatedTemplateCsv(domain, devices, start, end) {
|
|
115896
116881
|
const lines = [["gateway_id", "slave_id", "device_name", "start_date", "end_date", TOTAL_COLUMN[domain]].join(";")];
|
|
115897
|
-
const
|
|
116882
|
+
const esc11 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
|
|
115898
116883
|
for (const dev of devices || []) {
|
|
115899
116884
|
if (!isImportableKey(dev)) continue;
|
|
115900
|
-
lines.push([String(dev.centralId), String(Number(dev.slaveId)),
|
|
116885
|
+
lines.push([String(dev.centralId), String(Number(dev.slaveId)), esc11(dev.label || ""), start, end, ""].join(";"));
|
|
115901
116886
|
}
|
|
115902
116887
|
return { csv: "\uFEFF" + lines.join("\r\n") + "\r\n", rows: lines.length - 1 };
|
|
115903
116888
|
}
|
|
@@ -116086,15 +117071,15 @@ function fmtSaoPaulo(iso) {
|
|
|
116086
117071
|
const p = (n) => String(n).padStart(2, "0");
|
|
116087
117072
|
return `${p(d.getUTCDate())}/${p(d.getUTCMonth() + 1)}/${d.getUTCFullYear()} ${p(d.getUTCHours())}:00`;
|
|
116088
117073
|
}
|
|
116089
|
-
var
|
|
116090
|
-
function
|
|
117074
|
+
var STYLE_ID15 = "myio-tlmimport-styles";
|
|
117075
|
+
function esc10(v) {
|
|
116091
117076
|
return String(v ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
116092
117077
|
}
|
|
116093
117078
|
var fmtNum = (n, d = 0) => Number.isFinite(Number(n)) ? Number(n).toLocaleString("pt-BR", { minimumFractionDigits: d, maximumFractionDigits: d }) : "\u2014";
|
|
116094
117079
|
function injectStyles14() {
|
|
116095
|
-
if (document.getElementById(
|
|
117080
|
+
if (document.getElementById(STYLE_ID15)) return;
|
|
116096
117081
|
const style = document.createElement("style");
|
|
116097
|
-
style.id =
|
|
117082
|
+
style.id = STYLE_ID15;
|
|
116098
117083
|
style.textContent = `
|
|
116099
117084
|
.tlmi { --tlmi-ac: #3e1a7d; --tlmi-ac-soft: #f1ecfa; --tlmi-ok: #16a34a; --tlmi-warn: #d97706; --tlmi-err: #dc2626;
|
|
116100
117085
|
display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: #1e293b; }
|
|
@@ -116150,7 +117135,7 @@ function injectStyles14() {
|
|
|
116150
117135
|
document.head.appendChild(style);
|
|
116151
117136
|
}
|
|
116152
117137
|
function issuesTable(errors, limit = 100) {
|
|
116153
|
-
const rows = errors.slice(0, limit).map((e) => `<tr><td>${
|
|
117138
|
+
const rows = errors.slice(0, limit).map((e) => `<tr><td>${esc10(e.line)}</td><td>${esc10(e.reason)}</td></tr>`).join("");
|
|
116154
117139
|
const more = errors.length > limit ? `<p class="tlmi-muted">\u2026 e mais ${errors.length - limit} erro(s).</p>` : "";
|
|
116155
117140
|
return `<div class="tlmi-errors"><table><thead><tr><th>Linha</th><th>Problema</th></tr></thead><tbody>${rows}</tbody></table></div>${more}`;
|
|
116156
117141
|
}
|
|
@@ -116228,10 +117213,10 @@ function openTelemetryImportModal(params) {
|
|
|
116228
117213
|
}
|
|
116229
117214
|
function apiErrorBanner() {
|
|
116230
117215
|
if (!s.apiError) return "";
|
|
116231
|
-
return `<div class="tlmi-banner err" role="alert">${
|
|
117216
|
+
return `<div class="tlmi-banner err" role="alert">${esc10(s.apiError)}${s.apiDetail ? `<div class="tlmi-tech">${esc10(s.apiDetail)}</div>` : ""}</div>`;
|
|
116232
117217
|
}
|
|
116233
117218
|
function step1() {
|
|
116234
|
-
const warn = missingKey.length ? `<div class="tlmi-banner warn">${missingKey.length} dispositivo(s) sem central/endere\xE7o cadastrados ficam fora do modelo: ${
|
|
117219
|
+
const warn = missingKey.length ? `<div class="tlmi-banner warn">${missingKey.length} dispositivo(s) sem central/endere\xE7o cadastrados ficam fora do modelo: ${esc10(
|
|
116235
117220
|
missingKey.slice(0, 5).map((d) => d.label).join(", ")
|
|
116236
117221
|
)}${missingKey.length > 5 ? "\u2026" : ""}</div>` : "";
|
|
116237
117222
|
const model = (value, title, hint) => `
|
|
@@ -116258,16 +117243,16 @@ function openTelemetryImportModal(params) {
|
|
|
116258
117243
|
${warn}
|
|
116259
117244
|
<div class="tlmi-card"><h3>${s.model === "accumulated" ? "Per\xEDodo" : "Modelo da planilha"}</h3>
|
|
116260
117245
|
<div class="tlmi-row">
|
|
116261
|
-
<label class="tlmi-field">In\xEDcio<input type="date" data-field="start" value="${
|
|
116262
|
-
<label class="tlmi-field">Fim<input type="date" data-field="end" value="${
|
|
117246
|
+
<label class="tlmi-field">In\xEDcio<input type="date" data-field="start" value="${esc10(s.period.start)}" /></label>
|
|
117247
|
+
<label class="tlmi-field">Fim<input type="date" data-field="end" value="${esc10(s.period.end)}" /></label>
|
|
116263
117248
|
<button class="tlmi-btn" type="button" data-action="template" ${importable.length ? "" : "disabled"}>\u2B07 Baixar modelo (CSV)</button>
|
|
116264
117249
|
</div>
|
|
116265
117250
|
<p class="tlmi-muted" style="margin-top:8px">${importable.length} dispositivo(s) no modelo. ${s.model === "accumulated" ? "Para digitar na tela, clique em <strong>Avan\xE7ar</strong>." : "J\xE1 tem a planilha preenchida? Clique em <strong>Avan\xE7ar</strong>."}</p>
|
|
116266
117251
|
</div>`;
|
|
116267
117252
|
}
|
|
116268
117253
|
function step2() {
|
|
116269
|
-
const summary = s.fileName ? s.parseError ? `<div class="tlmi-banner err">${
|
|
116270
|
-
<div class="tlmi-kpi"><span>Arquivo</span><strong style="font-size:13px">${
|
|
117254
|
+
const summary = s.fileName ? s.parseError ? `<div class="tlmi-banner err">${esc10(s.parseError)}</div>` : `<div class="tlmi-kpis">
|
|
117255
|
+
<div class="tlmi-kpi"><span>Arquivo</span><strong style="font-size:13px">${esc10(s.fileName)}</strong></div>
|
|
116271
117256
|
<div class="tlmi-kpi"><span>Linhas para importar</span><strong>${fmtNum(s.rows.length)}</strong></div>
|
|
116272
117257
|
<div class="tlmi-kpi"><span>Em branco (ignoradas)</span><strong>${fmtNum(s.skippedEmpty)}</strong></div>
|
|
116273
117258
|
<div class="tlmi-kpi"><span>Com erro</span><strong style="color:${s.localErrors.length ? "#dc2626" : "#16a34a"}">${fmtNum(s.localErrors.length)}</strong></div>
|
|
@@ -116307,12 +117292,12 @@ function openTelemetryImportModal(params) {
|
|
|
116307
117292
|
}
|
|
116308
117293
|
function step2Accumulated() {
|
|
116309
117294
|
const fromFile = !!s.fileName && !s.parseError;
|
|
116310
|
-
const form = fromFile ? `<p class="tlmi-muted">Usando <strong>${
|
|
116311
|
-
<button class="tlmi-btn" type="button" data-action="use-form">Preencher na tela</button></p>` : `<p class="tlmi-muted" style="margin-bottom:8px">Per\xEDodo: ${
|
|
117295
|
+
const form = fromFile ? `<p class="tlmi-muted">Usando <strong>${esc10(s.fileName)}</strong>.
|
|
117296
|
+
<button class="tlmi-btn" type="button" data-action="use-form">Preencher na tela</button></p>` : `<p class="tlmi-muted" style="margin-bottom:8px">Per\xEDodo: ${esc10(s.period.start)} a ${esc10(s.period.end)}. Deixe em branco o que n\xE3o quer importar.</p>
|
|
116312
117297
|
<div class="tlmi-acc"><table><thead><tr><th>Dispositivo</th><th>Total (${txt.unit})</th></tr></thead><tbody>
|
|
116313
117298
|
${importable.map(
|
|
116314
|
-
(d, i) => `<tr><td>${
|
|
116315
|
-
<td><input inputmode="decimal" data-total="${i}" aria-label="Total de ${
|
|
117299
|
+
(d, i) => `<tr><td>${esc10(d.label)}</td>
|
|
117300
|
+
<td><input inputmode="decimal" data-total="${i}" aria-label="Total de ${esc10(d.label)}" value="${esc10(s.formTotals[i] ?? "")}" /></td></tr>`
|
|
116316
117301
|
).join("")}
|
|
116317
117302
|
</tbody></table></div>`;
|
|
116318
117303
|
return `
|
|
@@ -116325,7 +117310,7 @@ function openTelemetryImportModal(params) {
|
|
|
116325
117310
|
<input type="file" accept=".xlsx,.xls,.csv" data-field="file" hidden />
|
|
116326
117311
|
\u{1F4C4} Clique ou arraste a planilha aqui (.xlsx ou .csv)
|
|
116327
117312
|
</label>
|
|
116328
|
-
${s.parseError ? `<div class="tlmi-banner err" style="margin-top:10px">${
|
|
117313
|
+
${s.parseError ? `<div class="tlmi-banner err" style="margin-top:10px">${esc10(s.parseError)}</div>` : ""}
|
|
116329
117314
|
</div>
|
|
116330
117315
|
<div data-role="acc-summary" style="display:flex;flex-direction:column;gap:12px">${accSummaryHtml()}</div>`;
|
|
116331
117316
|
}
|
|
@@ -116351,7 +117336,7 @@ function openTelemetryImportModal(params) {
|
|
|
116351
117336
|
<div class="tlmi-kpi"><span>Total (${txt.unit})</span><strong>${fmtNum(p.totalValue, 2)}</strong></div>
|
|
116352
117337
|
<div class="tlmi-kpi"><span>Leituras substitu\xEDdas</span><strong>${fmtNum(p.existingReadingsInTarget)}</strong></div>
|
|
116353
117338
|
</div>
|
|
116354
|
-
<p class="tlmi-muted">Per\xEDodo (hor\xE1rio de Bras\xEDlia): ${
|
|
117339
|
+
<p class="tlmi-muted">Per\xEDodo (hor\xE1rio de Bras\xEDlia): ${esc10(period)}</p>
|
|
116355
117340
|
${reactiveWarn}
|
|
116356
117341
|
${real > 0 ? `<div class="tlmi-banner warn"><strong>${fmtNum(real)} leitura(s) reais do medidor</strong> ser\xE3o substitu\xEDdas pelos valores da planilha.
|
|
116357
117342
|
<label class="tlmi-check" style="margin-top:6px"><input type="checkbox" data-field="confirmReal" ${s.confirmReal ? "checked" : ""} />
|
|
@@ -116370,7 +117355,7 @@ function openTelemetryImportModal(params) {
|
|
|
116370
117355
|
<div class="tlmi-muted" style="margin-top:4px">Dispositivos manuais continuam aparecendo sem comunica\xE7\xE3o no status:
|
|
116371
117356
|
o status conta s\xF3 leitura medida. Os totais e os cards usam os dados importados.</div></div>`;
|
|
116372
117357
|
} else if (j.status === "failed") {
|
|
116373
|
-
banner = `<div class="tlmi-banner err">A importa\xE7\xE3o falhou${j.error ? `: ${
|
|
117358
|
+
banner = `<div class="tlmi-banner err">A importa\xE7\xE3o falhou${j.error ? `: ${esc10(j.error)}` : "."}</div>`;
|
|
116374
117359
|
} else if (j.status === "cancelled") {
|
|
116375
117360
|
banner = '<div class="tlmi-banner warn">Importa\xE7\xE3o cancelada. As leituras anteriores foram mantidas.</div>';
|
|
116376
117361
|
} else if (j.status === "reverted") {
|
|
@@ -116382,14 +117367,14 @@ function openTelemetryImportModal(params) {
|
|
|
116382
117367
|
<span class="tlmi-muted">${s.confirmRevert ? "Remove as horas importadas e devolve as leituras apagadas. Clique de novo para confirmar." : "Use para remover uma importa\xE7\xE3o errada ou de teste."}</span>
|
|
116383
117368
|
</div>` : "";
|
|
116384
117369
|
return `
|
|
116385
|
-
<div class="tlmi-card"><h3>Importa\xE7\xE3o <span style="font-weight:600;color:#64748b">${
|
|
117370
|
+
<div class="tlmi-card"><h3>Importa\xE7\xE3o <span style="font-weight:600;color:#64748b">${esc10(statusText)}</span></h3>
|
|
116386
117371
|
<div class="tlmi-progress" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100"><i style="width:${pct}%"></i></div>
|
|
116387
117372
|
<div class="tlmi-kpis" style="margin-top:12px">
|
|
116388
117373
|
<div class="tlmi-kpi"><span>Progresso</span><strong>${fmtNum(pct)}%</strong></div>
|
|
116389
117374
|
<div class="tlmi-kpi"><span>Leituras removidas</span><strong>${fmtNum(j.deleted)}</strong></div>
|
|
116390
117375
|
<div class="tlmi-kpi"><span>Leituras gravadas</span><strong>${fmtNum(j.inserted)}</strong></div>
|
|
116391
117376
|
</div>
|
|
116392
|
-
${j.phase && !terminal ? `<p class="tlmi-muted" style="margin-top:8px">Etapa: ${
|
|
117377
|
+
${j.phase && !terminal ? `<p class="tlmi-muted" style="margin-top:8px">Etapa: ${esc10(j.phase)}</p>` : ""}
|
|
116393
117378
|
${!terminal && j.status !== "reverting" ? `<div style="margin-top:12px"><button class="tlmi-btn" type="button" data-action="cancel" ${s.busy ? "disabled" : ""}>Cancelar importa\xE7\xE3o</button>
|
|
116394
117379
|
<span class="tlmi-muted" style="margin-left:8px">Voc\xEA pode fechar esta janela; a importa\xE7\xE3o continua.</span></div>` : ""}
|
|
116395
117380
|
${revert}
|
|
@@ -116699,8 +117684,8 @@ function siglaFromManualAsset(assetName) {
|
|
|
116699
117684
|
return /^[A-Z0-9_]+$/.test(sigla) ? sigla : null;
|
|
116700
117685
|
}
|
|
116701
117686
|
function nextManualSeq(domain, sigla, existingNames) {
|
|
116702
|
-
const
|
|
116703
|
-
const re = new RegExp(`^${
|
|
117687
|
+
const esc11 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
117688
|
+
const re = new RegExp(`^${esc11(NAME_PREFIX[domain])}${esc11(sigla)}_LOJA_(\\d+)_MANUAL$`, "i");
|
|
116704
117689
|
const max = existingNames.reduce((acc, n) => {
|
|
116705
117690
|
const m = re.exec(String(n || "").trim());
|
|
116706
117691
|
return m ? Math.max(acc, Number(m[1])) : acc;
|
|
@@ -116845,14 +117830,14 @@ var DOMAIN_TEXT2 = {
|
|
|
116845
117830
|
energy: { title: "Novo medidor de energia manual", icon: "\u26A1", noun: "Medidor de energia" },
|
|
116846
117831
|
water: { title: "Novo hidr\xF4metro manual", icon: "\u{1F4A7}", noun: "Hidr\xF4metro" }
|
|
116847
117832
|
};
|
|
116848
|
-
var
|
|
116849
|
-
function
|
|
117833
|
+
var STYLE_ID16 = "myio-manualdev-styles";
|
|
117834
|
+
function escapeHtml16(v) {
|
|
116850
117835
|
return String(v ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
116851
117836
|
}
|
|
116852
117837
|
function injectStyles15() {
|
|
116853
|
-
if (document.getElementById(
|
|
117838
|
+
if (document.getElementById(STYLE_ID16)) return;
|
|
116854
117839
|
const style = document.createElement("style");
|
|
116855
|
-
style.id =
|
|
117840
|
+
style.id = STYLE_ID16;
|
|
116856
117841
|
style.textContent = `
|
|
116857
117842
|
.myio-manualdev { display: flex; flex-direction: column; gap: 16px; }
|
|
116858
117843
|
.myio-manualdev__hint { margin: 0; font-size: 13px; color: #6b7280; line-height: 1.5; }
|
|
@@ -116907,18 +117892,18 @@ function formHtml(domain, values, error, detail) {
|
|
|
116907
117892
|
return `
|
|
116908
117893
|
<form class="myio-manualdev" novalidate>
|
|
116909
117894
|
<p class="myio-manualdev__hint">Cadastre um ponto de leitura manual. Ele aparece nesta lista e n\xE3o entra nos totais nem nos relat\xF3rios.</p>
|
|
116910
|
-
<span class="myio-manualdev__type">${t.icon} ${
|
|
117895
|
+
<span class="myio-manualdev__type">${t.icon} ${escapeHtml16(t.noun)} manual</span>
|
|
116911
117896
|
<label class="myio-manualdev__field">
|
|
116912
117897
|
<span class="myio-manualdev__label">Etiqueta</span>
|
|
116913
117898
|
<input class="myio-manualdev__input" name="label" maxlength="80" autocomplete="off"
|
|
116914
|
-
placeholder="Ex.: Burger King" value="${
|
|
117899
|
+
placeholder="Ex.: Burger King" value="${escapeHtml16(values.label)}" />
|
|
116915
117900
|
</label>
|
|
116916
117901
|
<label class="myio-manualdev__field">
|
|
116917
117902
|
<span class="myio-manualdev__label">Identificador</span>
|
|
116918
117903
|
<input class="myio-manualdev__input" name="identifier" maxlength="40" autocomplete="off"
|
|
116919
|
-
placeholder="Ex.: STB01010" value="${
|
|
117904
|
+
placeholder="Ex.: STB01010" value="${escapeHtml16(values.identifier)}" />
|
|
116920
117905
|
</label>
|
|
116921
|
-
${error ? `<p class="myio-manualdev__error" role="alert">${
|
|
117906
|
+
${error ? `<p class="myio-manualdev__error" role="alert">${escapeHtml16(error)}${detail ? `<small class="myio-manualdev__detail">${escapeHtml16(detail)}</small>` : ""}</p>` : ""}
|
|
116922
117907
|
<button type="submit" hidden></button>
|
|
116923
117908
|
</form>`;
|
|
116924
117909
|
}
|
|
@@ -116926,13 +117911,13 @@ function successHtml(domain, r, tech) {
|
|
|
116926
117911
|
return `
|
|
116927
117912
|
<div class="myio-manualdev__ok">
|
|
116928
117913
|
<div class="myio-manualdev__ok-icon">\u2705</div>
|
|
116929
|
-
<p class="myio-manualdev__ok-title">${
|
|
116930
|
-
<p class="myio-manualdev__ok-text"><strong>${
|
|
117914
|
+
<p class="myio-manualdev__ok-title">${escapeHtml16(DOMAIN_TEXT2[domain].noun)} criado</p>
|
|
117915
|
+
<p class="myio-manualdev__ok-text"><strong>${escapeHtml16(r.label)}</strong> \xB7 ${escapeHtml16(r.identifier)}</p>
|
|
116931
117916
|
${tech ? `<div class="myio-manualdev__tech">
|
|
116932
|
-
device <code>${
|
|
116933
|
-
profile <code>${
|
|
116934
|
-
asset <code>${
|
|
116935
|
-
id <code>${
|
|
117917
|
+
device <code>${escapeHtml16(r.name)}</code><br/>
|
|
117918
|
+
profile <code>${escapeHtml16(r.deviceProfile)}</code><br/>
|
|
117919
|
+
asset <code>${escapeHtml16(r.assetName)}</code><br/>
|
|
117920
|
+
id <code>${escapeHtml16(r.deviceId)}</code>
|
|
116936
117921
|
</div>` : ""}
|
|
116937
117922
|
</div>`;
|
|
116938
117923
|
}
|
|
@@ -116947,20 +117932,20 @@ var STEP_ICON = {
|
|
|
116947
117932
|
};
|
|
116948
117933
|
function stepsHtml(steps) {
|
|
116949
117934
|
return `<ol class="myio-manualdev__steps">${steps.map(
|
|
116950
|
-
(s) => `<li class="myio-manualdev__step" data-status="${
|
|
117935
|
+
(s) => `<li class="myio-manualdev__step" data-status="${escapeHtml16(s.status)}">
|
|
116951
117936
|
<span aria-hidden="true">${STEP_ICON[s.status] || "\u25CB"}</span>
|
|
116952
|
-
<span class="myio-manualdev__step-sys">${
|
|
116953
|
-
<span>${
|
|
117937
|
+
<span class="myio-manualdev__step-sys">${escapeHtml16(s.system)}</span>
|
|
117938
|
+
<span>${escapeHtml16(s.title)}${s.message ? `<small class="myio-manualdev__step-msg">${escapeHtml16(s.message)}</small>` : ""}</span>
|
|
116954
117939
|
</li>`
|
|
116955
117940
|
).join("")}</ol>`;
|
|
116956
117941
|
}
|
|
116957
117942
|
function notesHtml(plan) {
|
|
116958
|
-
const block = (plan.blockers || []).map((b) => `<p class="myio-manualdev__note myio-manualdev__note--block" role="alert">\u26D4 ${
|
|
116959
|
-
const warn = (plan.warnings || []).map((w) => `<p class="myio-manualdev__note myio-manualdev__note--warn">\u26A0\uFE0F ${
|
|
117943
|
+
const block = (plan.blockers || []).map((b) => `<p class="myio-manualdev__note myio-manualdev__note--block" role="alert">\u26D4 ${escapeHtml16(b)}</p>`);
|
|
117944
|
+
const warn = (plan.warnings || []).map((w) => `<p class="myio-manualdev__note myio-manualdev__note--warn">\u26A0\uFE0F ${escapeHtml16(w)}</p>`);
|
|
116960
117945
|
return [...block, ...warn].join("");
|
|
116961
117946
|
}
|
|
116962
117947
|
function rowsHtml(rows) {
|
|
116963
|
-
return `<table class="myio-manualdev__summary"><tbody>${rows.map((r) => `<tr><th>${
|
|
117948
|
+
return `<table class="myio-manualdev__summary"><tbody>${rows.map((r) => `<tr><th>${escapeHtml16(r.label)}</th><td>${escapeHtml16(r.value)}</td></tr>`).join("")}</tbody></table>`;
|
|
116964
117949
|
}
|
|
116965
117950
|
function moreHtml(inner, open = false) {
|
|
116966
117951
|
return `<details class="myio-manualdev__more"${open ? " open" : ""}>
|
|
@@ -116980,7 +117965,7 @@ function planHtml(plan) {
|
|
|
116980
117965
|
function progressHtml(steps, message, ok, open = false) {
|
|
116981
117966
|
return `
|
|
116982
117967
|
<div class="myio-manualdev">
|
|
116983
|
-
${ok === void 0 ? '<p class="myio-manualdev__hint">Criando o dispositivo\u2026 n\xE3o feche esta janela.</p>' : `<p class="myio-manualdev__note ${ok ? "myio-manualdev__note--warn" : "myio-manualdev__note--block"}" role="status">${
|
|
117968
|
+
${ok === void 0 ? '<p class="myio-manualdev__hint">Criando o dispositivo\u2026 n\xE3o feche esta janela.</p>' : `<p class="myio-manualdev__note ${ok ? "myio-manualdev__note--warn" : "myio-manualdev__note--block"}" role="status">${escapeHtml16(
|
|
116984
117969
|
message || (ok ? "Conclu\xEDdo com avisos." : "N\xE3o foi poss\xEDvel concluir.")
|
|
116985
117970
|
)}</p>`}
|
|
116986
117971
|
${moreHtml(stepsHtml(steps), open)}
|
|
@@ -119254,9 +120239,9 @@ function openMyioGcdrLoginModal(options) {
|
|
|
119254
120239
|
}
|
|
119255
120240
|
|
|
119256
120241
|
// src/components/img-gallery/ScrollableTabs.ts
|
|
119257
|
-
var
|
|
120242
|
+
var STYLE_ID17 = "myio-tabs-styles";
|
|
119258
120243
|
var FONT_LINK_ID4 = "myio-dialog-font-nunito";
|
|
119259
|
-
function
|
|
120244
|
+
function escapeHtml17(value) {
|
|
119260
120245
|
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
119261
120246
|
}
|
|
119262
120247
|
function injectStyles16() {
|
|
@@ -119267,9 +120252,9 @@ function injectStyles16() {
|
|
|
119267
120252
|
link.href = "https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap";
|
|
119268
120253
|
document.head.appendChild(link);
|
|
119269
120254
|
}
|
|
119270
|
-
if (document.getElementById(
|
|
120255
|
+
if (document.getElementById(STYLE_ID17)) return;
|
|
119271
120256
|
const style = document.createElement("style");
|
|
119272
|
-
style.id =
|
|
120257
|
+
style.id = STYLE_ID17;
|
|
119273
120258
|
style.textContent = `
|
|
119274
120259
|
.myio-tabs {
|
|
119275
120260
|
display: flex;
|
|
@@ -119392,7 +120377,7 @@ function createScrollableTabs(options) {
|
|
|
119392
120377
|
btn.setAttribute("role", "tab");
|
|
119393
120378
|
btn.dataset.key = t.key;
|
|
119394
120379
|
if (t.disabled) btn.disabled = true;
|
|
119395
|
-
btn.innerHTML = `${t.icon ? `<span aria-hidden="true">${t.icon}</span>` : ""}<span>${
|
|
120380
|
+
btn.innerHTML = `${t.icon ? `<span aria-hidden="true">${t.icon}</span>` : ""}<span>${escapeHtml17(t.label)}</span>`;
|
|
119396
120381
|
styleTab(btn, t.key === active);
|
|
119397
120382
|
btn.addEventListener("click", () => {
|
|
119398
120383
|
if (t.disabled || t.key === active) return;
|
|
@@ -119477,9 +120462,9 @@ function createScrollableTabs(options) {
|
|
|
119477
120462
|
}
|
|
119478
120463
|
|
|
119479
120464
|
// src/components/img-gallery/ImgGallery.ts
|
|
119480
|
-
var
|
|
120465
|
+
var STYLE_ID18 = "myio-gallery-styles";
|
|
119481
120466
|
var FONT_LINK_ID5 = "myio-dialog-font-nunito";
|
|
119482
|
-
function
|
|
120467
|
+
function escapeHtml18(value) {
|
|
119483
120468
|
return String(value == null ? "" : value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
119484
120469
|
}
|
|
119485
120470
|
var PRM = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -119491,9 +120476,9 @@ function injectStyles17() {
|
|
|
119491
120476
|
link.href = "https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap";
|
|
119492
120477
|
document.head.appendChild(link);
|
|
119493
120478
|
}
|
|
119494
|
-
if (document.getElementById(
|
|
120479
|
+
if (document.getElementById(STYLE_ID18)) return;
|
|
119495
120480
|
const style = document.createElement("style");
|
|
119496
|
-
style.id =
|
|
120481
|
+
style.id = STYLE_ID18;
|
|
119497
120482
|
style.textContent = `
|
|
119498
120483
|
.myio-gallery {
|
|
119499
120484
|
font-family: 'Nunito', system-ui, sans-serif;
|
|
@@ -119703,10 +120688,10 @@ function createImgGallery(options) {
|
|
|
119703
120688
|
root.appendChild(grid);
|
|
119704
120689
|
function detailsHtml(img) {
|
|
119705
120690
|
const lines = [];
|
|
119706
|
-
if (img.filename) lines.push(`<span title="${
|
|
119707
|
-
if (typeof img.sizeBytes === "number") lines.push(`<span>${
|
|
120691
|
+
if (img.filename) lines.push(`<span title="${escapeHtml18(img.filename)}">${escapeHtml18(img.filename)}</span>`);
|
|
120692
|
+
if (typeof img.sizeBytes === "number") lines.push(`<span>${escapeHtml18(formatSize(img.sizeBytes))}</span>`);
|
|
119708
120693
|
const dims = typeof img.width === "number" && typeof img.height === "number" ? `${img.width} \xD7 ${img.height}px` : "";
|
|
119709
|
-
lines.push(`<span data-dims>${
|
|
120694
|
+
lines.push(`<span data-dims>${escapeHtml18(dims)}</span>`);
|
|
119710
120695
|
return lines.join("");
|
|
119711
120696
|
}
|
|
119712
120697
|
function renderDescription(body, img, index) {
|
|
@@ -134212,7 +135197,7 @@ function createCustomerCardV1(params) {
|
|
|
134212
135197
|
}
|
|
134213
135198
|
|
|
134214
135199
|
// src/components/cards/customer-goals/v1.0.0/styles.ts
|
|
134215
|
-
var
|
|
135200
|
+
var STYLE_ID19 = "myio-customer-goals-card-css";
|
|
134216
135201
|
var CSS4 = `
|
|
134217
135202
|
.myio-cgc{
|
|
134218
135203
|
--cgc-surface:#ffffff;
|
|
@@ -134313,9 +135298,9 @@ var CSS4 = `
|
|
|
134313
135298
|
`;
|
|
134314
135299
|
function injectCustomerGoalsCardStyles() {
|
|
134315
135300
|
if (typeof document === "undefined") return;
|
|
134316
|
-
if (document.getElementById(
|
|
135301
|
+
if (document.getElementById(STYLE_ID19)) return;
|
|
134317
135302
|
const tag = document.createElement("style");
|
|
134318
|
-
tag.id =
|
|
135303
|
+
tag.id = STYLE_ID19;
|
|
134319
135304
|
tag.textContent = CSS4;
|
|
134320
135305
|
document.head.appendChild(tag);
|
|
134321
135306
|
}
|
|
@@ -137165,7 +138150,7 @@ var WATER_FIXTURES = {
|
|
|
137165
138150
|
var DEFAULT_FIXTURES = ENERGY_FIXTURES;
|
|
137166
138151
|
|
|
137167
138152
|
// src/components/metas-guide/openMetasGuide.ts
|
|
137168
|
-
var
|
|
138153
|
+
var STYLE_ID20 = "myio-metas-guide-styles";
|
|
137169
138154
|
var ROOT_ID = "myio-metas-guide-root";
|
|
137170
138155
|
var FALLBACK_THEME = {
|
|
137171
138156
|
accent: "#6c5ce7",
|
|
@@ -137173,7 +138158,7 @@ var FALLBACK_THEME = {
|
|
|
137173
138158
|
accentText: "#ffffff",
|
|
137174
138159
|
mode: "light"
|
|
137175
138160
|
};
|
|
137176
|
-
function
|
|
138161
|
+
function escapeHtml19(value) {
|
|
137177
138162
|
return String(value ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
137178
138163
|
}
|
|
137179
138164
|
var nfInt = new Intl.NumberFormat("pt-BR", { maximumFractionDigits: 0 });
|
|
@@ -137201,7 +138186,7 @@ function legendHtml() {
|
|
|
137201
138186
|
[SERIES_COLORS.orcado, "Or\xE7ado"]
|
|
137202
138187
|
];
|
|
137203
138188
|
return `<div class="myio-mg-legend">${items.map(
|
|
137204
|
-
([c, l]) => `<span class="myio-mg-legend__item"><span class="myio-mg-legend__dot" style="background:${c}" aria-hidden="true"></span>${
|
|
138189
|
+
([c, l]) => `<span class="myio-mg-legend__item"><span class="myio-mg-legend__dot" style="background:${c}" aria-hidden="true"></span>${escapeHtml19(
|
|
137205
138190
|
l
|
|
137206
138191
|
)}</span>`
|
|
137207
138192
|
).join("")}</div>`;
|
|
@@ -137241,7 +138226,7 @@ function miniChartSvg(s) {
|
|
|
137241
138226
|
const pts = data.map((v, i) => `${(i * bandW + bandW / 2).toFixed(1)},${y(v).toFixed(1)}`).join(" ");
|
|
137242
138227
|
return `<polyline points="${pts}" fill="none" stroke="${color}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"></polyline>`;
|
|
137243
138228
|
};
|
|
137244
|
-
return `<svg class="myio-mg-chart" viewBox="0 0 ${W} ${H}" role="img" aria-label="Gr\xE1fico ilustrativo de ${
|
|
138229
|
+
return `<svg class="myio-mg-chart" viewBox="0 0 ${W} ${H}" role="img" aria-label="Gr\xE1fico ilustrativo de ${escapeHtml19(
|
|
137245
138230
|
s.name
|
|
137246
138231
|
)}" preserveAspectRatio="none">
|
|
137247
138232
|
${bars}
|
|
@@ -137258,8 +138243,8 @@ function kpiRowHtml(s, unit) {
|
|
|
137258
138243
|
];
|
|
137259
138244
|
return `<div class="myio-mg-kpis">${kpis.map(
|
|
137260
138245
|
([label, val, color]) => `<div class="myio-mg-kpi">
|
|
137261
|
-
<span class="myio-mg-kpi__label" style="color:${color}">${
|
|
137262
|
-
<span class="myio-mg-kpi__value">${fmtInt(val)} <small>${
|
|
138246
|
+
<span class="myio-mg-kpi__label" style="color:${color}">${escapeHtml19(label)}</span>
|
|
138247
|
+
<span class="myio-mg-kpi__value">${fmtInt(val)} <small>${escapeHtml19(unit)}</small></span>
|
|
137263
138248
|
</div>`
|
|
137264
138249
|
).join("")}</div>`;
|
|
137265
138250
|
}
|
|
@@ -137267,7 +138252,7 @@ function chipsHtml(s) {
|
|
|
137267
138252
|
const c = computeChips(s);
|
|
137268
138253
|
const chip = (label, ratio) => {
|
|
137269
138254
|
const cls = ratio > 0 ? "is-up" : ratio < 0 ? "is-down" : "is-flat";
|
|
137270
|
-
return `<span class="myio-mg-chip ${cls}">${
|
|
138255
|
+
return `<span class="myio-mg-chip ${cls}">${escapeHtml19(label)} <strong>${escapeHtml19(
|
|
137271
138256
|
fmtPct4(ratio)
|
|
137272
138257
|
)}</strong></span>`;
|
|
137273
138258
|
};
|
|
@@ -137282,7 +138267,7 @@ function miniCardHtml(s, unit, opts) {
|
|
|
137282
138267
|
const showKpis = opts?.kpis !== false;
|
|
137283
138268
|
const showChips = opts?.chips !== false;
|
|
137284
138269
|
return `<div class="myio-mg-card">
|
|
137285
|
-
<h5 class="myio-mg-card__title">${
|
|
138270
|
+
<h5 class="myio-mg-card__title">${escapeHtml19(s.name)}</h5>
|
|
137286
138271
|
${showChart ? legendHtml() + miniChartSvg(s) : ""}
|
|
137287
138272
|
${showKpis ? kpiRowHtml(s, unit) : ""}
|
|
137288
138273
|
${showChips ? chipsHtml(s) : ""}
|
|
@@ -137292,7 +138277,7 @@ function miniSidebarHtml(shoppings, unit, prevY, curY) {
|
|
|
137292
138277
|
const total = deriveTotal({ shoppings });
|
|
137293
138278
|
const row = (name, a, r, o, m, isTotal) => `
|
|
137294
138279
|
<div class="myio-mg-side__row${isTotal ? " is-total" : ""}">
|
|
137295
|
-
<span class="myio-mg-side__name">${
|
|
138280
|
+
<span class="myio-mg-side__name">${escapeHtml19(name)}</span>
|
|
137296
138281
|
<span class="myio-mg-side__vals">
|
|
137297
138282
|
<b style="color:${SERIES_COLORS.aMinus1}">${fmtInt(a)}</b>
|
|
137298
138283
|
<b style="color:${SERIES_COLORS.realizado}">${fmtInt(r)}</b>
|
|
@@ -137303,7 +138288,7 @@ function miniSidebarHtml(shoppings, unit, prevY, curY) {
|
|
|
137303
138288
|
return `<div class="myio-mg-side">
|
|
137304
138289
|
<div class="myio-mg-side__head">
|
|
137305
138290
|
<span>Resumo por shopping</span>
|
|
137306
|
-
<span class="myio-mg-side__unit">${
|
|
138291
|
+
<span class="myio-mg-side__unit">${escapeHtml19(unit)}</span>
|
|
137307
138292
|
</div>
|
|
137308
138293
|
<div class="myio-mg-side__cols">
|
|
137309
138294
|
<span>Shopping</span>
|
|
@@ -137330,10 +138315,10 @@ function miniToolbarHtml(prevY, curY, highlight) {
|
|
|
137330
138315
|
</div>`;
|
|
137331
138316
|
}
|
|
137332
138317
|
function bannerHtml(text2) {
|
|
137333
|
-
return `<p class="myio-mg-banner">${
|
|
138318
|
+
return `<p class="myio-mg-banner">${escapeHtml19(text2)}</p>`;
|
|
137334
138319
|
}
|
|
137335
138320
|
function paras(sentences) {
|
|
137336
|
-
return `<div class="myio-mg-copy">${sentences.map((s) => `<p>${
|
|
138321
|
+
return `<div class="myio-mg-copy">${sentences.map((s) => `<p>${escapeHtml19(s)}</p>`).join("")}</div>`;
|
|
137337
138322
|
}
|
|
137338
138323
|
function buildSections(ctx) {
|
|
137339
138324
|
const { energy, water, curY, prevY } = ctx;
|
|
@@ -137358,8 +138343,8 @@ function buildSections(ctx) {
|
|
|
137358
138343
|
"A r\xE9gua da meta muda por dom\xEDnio: em Energia a refer\xEAncia \xE9 a ENTRADA; em \xC1gua, os hidr\xF4metros.",
|
|
137359
138344
|
"Os n\xFAmeros e a unidade de cada card acompanham o dom\xEDnio selecionado."
|
|
137360
138345
|
]) + miniToolbarHtml(prevY, curY, "domain") + `<div class="myio-mg-two">
|
|
137361
|
-
<div><div class="myio-mg-two__tag">\u26A1 Energia \xB7 ${
|
|
137362
|
-
<div><div class="myio-mg-two__tag">\u{1F4A7} \xC1gua \xB7 ${
|
|
138346
|
+
<div><div class="myio-mg-two__tag">\u26A1 Energia \xB7 ${escapeHtml19(energy.unit)}</div>${miniCardHtml(e0, energy.unit, { chips: false })}</div>
|
|
138347
|
+
<div><div class="myio-mg-two__tag">\u{1F4A7} \xC1gua \xB7 ${escapeHtml19(water.unit)}</div>${miniCardHtml(w0, water.unit, { chips: false })}</div>
|
|
137363
138348
|
</div>`
|
|
137364
138349
|
},
|
|
137365
138350
|
{
|
|
@@ -137430,7 +138415,7 @@ function buildSections(ctx) {
|
|
|
137430
138415
|
]) + `<div class="myio-mg-order">
|
|
137431
138416
|
<span class="myio-mg-order__btn">Data de Inaugura\xE7\xE3o \u2191 \xB7 \u2699\uFE0F</span>
|
|
137432
138417
|
<span class="myio-mg-order__btn">\u25BD Filtros</span>
|
|
137433
|
-
</div><ul class="myio-mg-order__list">${energy.shoppings.slice().sort((a, b) => a.inaugurationDate.localeCompare(b.inaugurationDate)).map((s) => `<li><b>${
|
|
138418
|
+
</div><ul class="myio-mg-order__list">${energy.shoppings.slice().sort((a, b) => a.inaugurationDate.localeCompare(b.inaugurationDate)).map((s) => `<li><b>${escapeHtml19(s.name)}</b> <span>inaugurado em ${escapeHtml19(s.inaugurationDate)}</span></li>`).join("")}</ul>`
|
|
137434
138419
|
},
|
|
137435
138420
|
{
|
|
137436
138421
|
id: "engine",
|
|
@@ -137459,9 +138444,9 @@ function buildSections(ctx) {
|
|
|
137459
138444
|
];
|
|
137460
138445
|
}
|
|
137461
138446
|
function injectStyles19() {
|
|
137462
|
-
if (document.getElementById(
|
|
138447
|
+
if (document.getElementById(STYLE_ID20)) return;
|
|
137463
138448
|
const style = document.createElement("style");
|
|
137464
|
-
style.id =
|
|
138449
|
+
style.id = STYLE_ID20;
|
|
137465
138450
|
style.textContent = `
|
|
137466
138451
|
#${ROOT_ID}{position:fixed;inset:0;z-index:100001;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.6);backdrop-filter:blur(4px);font-family:'Nunito',system-ui,sans-serif;}
|
|
137467
138452
|
#${ROOT_ID} *{box-sizing:border-box;}
|
|
@@ -137569,9 +138554,9 @@ function openMetasGuide(options = {}) {
|
|
|
137569
138554
|
root.innerHTML = `
|
|
137570
138555
|
<div class="myio-mg-modal${theme.mode === "dark" ? " is-dark" : ""}" role="dialog" aria-modal="true"
|
|
137571
138556
|
aria-labelledby="myio-mg-title"
|
|
137572
|
-
style="--mg-accent:${
|
|
138557
|
+
style="--mg-accent:${escapeHtml19(theme.accent)};--mg-accent-dark:${escapeHtml19(
|
|
137573
138558
|
theme.accentDark
|
|
137574
|
-
)};--mg-accent-text:${
|
|
138559
|
+
)};--mg-accent-text:${escapeHtml19(theme.accentText)};">
|
|
137575
138560
|
<div class="myio-mg-header">
|
|
137576
138561
|
<div class="myio-mg-header__l">
|
|
137577
138562
|
<span class="myio-mg-header__logo" aria-hidden="true">\u{1F393}</span>
|
|
@@ -151565,10 +152550,10 @@ var AlarmsNotificationsPanelView = class {
|
|
|
151565
152550
|
const renderListPanel = (group, items, sel) => {
|
|
151566
152551
|
if (items.length === 0) return '<div class="afm-empty">Nenhum item encontrado</div>';
|
|
151567
152552
|
return items.map((item) => {
|
|
151568
|
-
const
|
|
152553
|
+
const esc11 = this.esc(item);
|
|
151569
152554
|
return `<label class="afm-check-item">
|
|
151570
|
-
<input type="checkbox" class="afm-checkbox" data-group="${group}" data-value="${
|
|
151571
|
-
<span class="afm-check-label">${
|
|
152555
|
+
<input type="checkbox" class="afm-checkbox" data-group="${group}" data-value="${esc11}"${sel.has(item) ? " checked" : ""}>
|
|
152556
|
+
<span class="afm-check-label">${esc11}</span>
|
|
151572
152557
|
</label>`;
|
|
151573
152558
|
}).join("");
|
|
151574
152559
|
};
|
|
@@ -155667,8 +156652,8 @@ function renderDowntimeList(downtimeList) {
|
|
|
155667
156652
|
<div class="downtime-item">
|
|
155668
156653
|
<span class="rank">${index + 1}</span>
|
|
155669
156654
|
<div class="item-info">
|
|
155670
|
-
<span class="item-name">${
|
|
155671
|
-
<span class="item-location">${
|
|
156655
|
+
<span class="item-name">${escapeHtml20(item.name)}</span>
|
|
156656
|
+
<span class="item-location">${escapeHtml20(item.location)}</span>
|
|
155672
156657
|
</div>
|
|
155673
156658
|
<div class="item-metrics">
|
|
155674
156659
|
<span class="downtime-hours">${item.downtime}h</span>
|
|
@@ -155681,7 +156666,7 @@ function renderDowntimeList(downtimeList) {
|
|
|
155681
156666
|
`
|
|
155682
156667
|
).join("");
|
|
155683
156668
|
}
|
|
155684
|
-
function
|
|
156669
|
+
function escapeHtml20(text2) {
|
|
155685
156670
|
const div = document.createElement("div");
|
|
155686
156671
|
div.textContent = text2;
|
|
155687
156672
|
return div.innerHTML;
|
|
@@ -160264,7 +161249,7 @@ function removeSchedulingSharedStyles() {
|
|
|
160264
161249
|
}
|
|
160265
161250
|
|
|
160266
161251
|
// src/components/scheduling-shared/view-helpers.ts
|
|
160267
|
-
function
|
|
161252
|
+
function escapeHtml21(str) {
|
|
160268
161253
|
const div = document.createElement("div");
|
|
160269
161254
|
div.textContent = str;
|
|
160270
161255
|
return div.innerHTML;
|
|
@@ -160425,7 +161410,7 @@ function showConfirmModal(container, title, message) {
|
|
|
160425
161410
|
overlay.innerHTML = `
|
|
160426
161411
|
<div class="${SCHED_CSS_PREFIX}__modal-backdrop"></div>
|
|
160427
161412
|
<div class="${SCHED_CSS_PREFIX}__modal-content">
|
|
160428
|
-
<h3>${
|
|
161413
|
+
<h3>${escapeHtml21(title)}</h3>
|
|
160429
161414
|
<p>${message}</p>
|
|
160430
161415
|
<div class="${SCHED_CSS_PREFIX}__modal-actions">
|
|
160431
161416
|
<button class="${SCHED_CSS_PREFIX}__modal-btn-cancel">Cancelar</button>
|
|
@@ -160459,8 +161444,8 @@ function showNotificationModal(container, type, message, autoCloseMs = 6e3) {
|
|
|
160459
161444
|
overlay.innerHTML = `
|
|
160460
161445
|
<div class="${SCHED_CSS_PREFIX}__modal-backdrop"></div>
|
|
160461
161446
|
<div class="${SCHED_CSS_PREFIX}__modal-content">
|
|
160462
|
-
<h3>${
|
|
160463
|
-
<p>${
|
|
161447
|
+
<h3>${escapeHtml21(title)}</h3>
|
|
161448
|
+
<p>${escapeHtml21(message)}</p>
|
|
160464
161449
|
<div class="${SCHED_CSS_PREFIX}__modal-actions">
|
|
160465
161450
|
<button class="${SCHED_CSS_PREFIX}__modal-btn-close">Fechar</button>
|
|
160466
161451
|
</div>
|
|
@@ -164446,7 +165431,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
|
|
|
164446
165431
|
const docTitle = buildActivationReportTitle(deviceName, opts.customerName);
|
|
164447
165432
|
const issuedAt = formatIssuedAt(/* @__PURE__ */ new Date(), locale);
|
|
164448
165433
|
const utilization = data.totalHours > 0 ? (data.totalOnMinutes / (data.totalHours * 60) * 100).toFixed(1) : "0.0";
|
|
164449
|
-
const
|
|
165434
|
+
const esc11 = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
164450
165435
|
const htmlContent = `
|
|
164451
165436
|
<!DOCTYPE html>
|
|
164452
165437
|
<html lang="pt-BR">
|
|
@@ -164498,14 +165483,14 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
|
|
|
164498
165483
|
<div class="brand">MyIO BAS</div>
|
|
164499
165484
|
<h1>Relat\xF3rio de Acionamentos</h1>
|
|
164500
165485
|
<div class="meta">
|
|
164501
|
-
<div><b>Dispositivo:</b> ${
|
|
165486
|
+
<div><b>Dispositivo:</b> ${esc11(deviceName)}</div>
|
|
164502
165487
|
<div><b>Per\xEDodo:</b> ${periodStart} \u2014 ${periodEnd}</div>
|
|
164503
165488
|
</div>
|
|
164504
165489
|
</div>
|
|
164505
165490
|
${customerName ? `
|
|
164506
165491
|
<div class="customer-badge">
|
|
164507
165492
|
<div class="label">Cliente</div>
|
|
164508
|
-
<div class="value">${
|
|
165493
|
+
<div class="value">${esc11(customerName)}</div>
|
|
164509
165494
|
</div>` : ""}
|
|
164510
165495
|
</div>
|
|
164511
165496
|
|
|
@@ -164516,7 +165501,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
|
|
|
164516
165501
|
</div>
|
|
164517
165502
|
<div class="summary-card accent-green">
|
|
164518
165503
|
<div class="summary-value">${formatDurationMinutes(data.totalOnMinutes)}</div>
|
|
164519
|
-
<div class="summary-label">Tempo ${
|
|
165504
|
+
<div class="summary-label">Tempo ${esc11(labelOn)}</div>
|
|
164520
165505
|
</div>
|
|
164521
165506
|
<div class="summary-card accent-amber">
|
|
164522
165507
|
<div class="summary-value">${utilization}%</div>
|
|
@@ -164544,7 +165529,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
|
|
|
164544
165529
|
<tr>
|
|
164545
165530
|
<td>${formatDateForExport(seg.startTime, locale)}</td>
|
|
164546
165531
|
<td>${formatDateForExport(seg.endTime, locale)}</td>
|
|
164547
|
-
<td><span class="pill ${seg.state === "on" ? "pill-on" : "pill-off"}">${seg.state === "on" ?
|
|
165532
|
+
<td><span class="pill ${seg.state === "on" ? "pill-on" : "pill-off"}">${seg.state === "on" ? esc11(labelOn) : esc11(labelOff)}</span></td>
|
|
164548
165533
|
<td>${formatDurationMinutes(seg.durationMinutes)}</td>
|
|
164549
165534
|
<td>${seg.source === "manual" ? "Manual" : seg.source === "schedule" ? "Agendamento" : seg.source === "automation" ? "Automa\xE7\xE3o" : "Desconhecido"}</td>
|
|
164550
165535
|
</tr>
|
|
@@ -164553,7 +165538,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
|
|
|
164553
165538
|
</table>
|
|
164554
165539
|
|
|
164555
165540
|
<div class="footer">
|
|
164556
|
-
<span class="issued">Emitido em ${issuedAt}</span>${customerName ? ` · ${
|
|
165541
|
+
<span class="issued">Emitido em ${issuedAt}</span>${customerName ? ` · ${esc11(customerName)}` : ""} · <span class="brand">MyIO BAS</span>
|
|
164557
165542
|
</div>
|
|
164558
165543
|
</body>
|
|
164559
165544
|
</html>
|
|
@@ -166667,7 +167652,7 @@ function injectAmbienteModalStyles() {
|
|
|
166667
167652
|
}
|
|
166668
167653
|
|
|
166669
167654
|
// src/components/ambiente-detail-modal/AmbienteDetailModal.ts
|
|
166670
|
-
var
|
|
167655
|
+
var MODAL_ID5 = "ambiente-detail";
|
|
166671
167656
|
function formatTemperature3(value) {
|
|
166672
167657
|
if (value === null || value === void 0 || isNaN(value)) return "-";
|
|
166673
167658
|
return value.toLocaleString("pt-BR", {
|
|
@@ -166908,7 +167893,7 @@ function renderModalHTML(data, source, config2) {
|
|
|
166908
167893
|
const headerHTML = ModalHeader.generateHTML({
|
|
166909
167894
|
icon: "\u{1F3E2}",
|
|
166910
167895
|
title: data.label,
|
|
166911
|
-
modalId:
|
|
167896
|
+
modalId: MODAL_ID5,
|
|
166912
167897
|
theme: config2.themeMode || "dark",
|
|
166913
167898
|
isMaximized: false,
|
|
166914
167899
|
showThemeToggle: false,
|
|
@@ -166957,7 +167942,7 @@ function createAmbienteDetailModal(data, source, config2 = {}) {
|
|
|
166957
167942
|
}
|
|
166958
167943
|
});
|
|
166959
167944
|
ModalHeader.setupHandlers({
|
|
166960
|
-
modalId:
|
|
167945
|
+
modalId: MODAL_ID5,
|
|
166961
167946
|
onClose: close
|
|
166962
167947
|
});
|
|
166963
167948
|
footerCloseBtn?.addEventListener("click", close);
|
|
@@ -170259,9 +171244,9 @@ var GCDRSyncController = class {
|
|
|
170259
171244
|
var TEAL = "#0a6d5e";
|
|
170260
171245
|
var TEAL_DARK = "#084f44";
|
|
170261
171246
|
var TEAL_LIGHT = "#0d8570";
|
|
170262
|
-
var
|
|
171247
|
+
var MODAL_ID6 = "myio-gcdr-sync-modal";
|
|
170263
171248
|
var STYLES2 = `
|
|
170264
|
-
#${
|
|
171249
|
+
#${MODAL_ID6} {
|
|
170265
171250
|
position: fixed;
|
|
170266
171251
|
inset: 0;
|
|
170267
171252
|
background: rgba(0, 0, 0, 0.60);
|
|
@@ -170273,7 +171258,7 @@ var STYLES2 = `
|
|
|
170273
171258
|
justify-content: center;
|
|
170274
171259
|
font-family: 'Nunito', system-ui, sans-serif;
|
|
170275
171260
|
}
|
|
170276
|
-
#${
|
|
171261
|
+
#${MODAL_ID6} .gcdr-card {
|
|
170277
171262
|
background: #fff;
|
|
170278
171263
|
color: #1a1a1a;
|
|
170279
171264
|
border-radius: 16px;
|
|
@@ -170284,7 +171269,7 @@ var STYLES2 = `
|
|
|
170284
171269
|
flex-direction: column;
|
|
170285
171270
|
overflow: hidden;
|
|
170286
171271
|
}
|
|
170287
|
-
#${
|
|
171272
|
+
#${MODAL_ID6} .gcdr-header {
|
|
170288
171273
|
background: ${TEAL};
|
|
170289
171274
|
color: #fff;
|
|
170290
171275
|
padding: 20px 24px 16px;
|
|
@@ -170293,25 +171278,25 @@ var STYLES2 = `
|
|
|
170293
171278
|
gap: 12px;
|
|
170294
171279
|
flex-shrink: 0;
|
|
170295
171280
|
}
|
|
170296
|
-
#${
|
|
171281
|
+
#${MODAL_ID6} .gcdr-header-icon {
|
|
170297
171282
|
font-size: 24px;
|
|
170298
171283
|
flex-shrink: 0;
|
|
170299
171284
|
}
|
|
170300
|
-
#${
|
|
171285
|
+
#${MODAL_ID6} .gcdr-header-text {
|
|
170301
171286
|
flex: 1;
|
|
170302
171287
|
}
|
|
170303
|
-
#${
|
|
171288
|
+
#${MODAL_ID6} .gcdr-header-title {
|
|
170304
171289
|
font-size: 18px;
|
|
170305
171290
|
font-weight: 700;
|
|
170306
171291
|
line-height: 1.2;
|
|
170307
171292
|
margin: 0;
|
|
170308
171293
|
}
|
|
170309
|
-
#${
|
|
171294
|
+
#${MODAL_ID6} .gcdr-header-sub {
|
|
170310
171295
|
font-size: 13px;
|
|
170311
171296
|
opacity: 0.80;
|
|
170312
171297
|
margin: 4px 0 0;
|
|
170313
171298
|
}
|
|
170314
|
-
#${
|
|
171299
|
+
#${MODAL_ID6} .gcdr-close-btn {
|
|
170315
171300
|
background: none;
|
|
170316
171301
|
border: none;
|
|
170317
171302
|
color: #fff;
|
|
@@ -170324,13 +171309,13 @@ var STYLES2 = `
|
|
|
170324
171309
|
transition: opacity 0.15s;
|
|
170325
171310
|
flex-shrink: 0;
|
|
170326
171311
|
}
|
|
170327
|
-
#${
|
|
170328
|
-
#${
|
|
171312
|
+
#${MODAL_ID6} .gcdr-close-btn:hover { opacity: 1; }
|
|
171313
|
+
#${MODAL_ID6} .gcdr-body {
|
|
170329
171314
|
padding: 24px;
|
|
170330
171315
|
overflow-y: auto;
|
|
170331
171316
|
flex: 1;
|
|
170332
171317
|
}
|
|
170333
|
-
#${
|
|
171318
|
+
#${MODAL_ID6} .gcdr-footer {
|
|
170334
171319
|
padding: 16px 24px;
|
|
170335
171320
|
border-top: 1px solid #e8ecef;
|
|
170336
171321
|
display: flex;
|
|
@@ -170338,7 +171323,7 @@ var STYLES2 = `
|
|
|
170338
171323
|
justify-content: flex-end;
|
|
170339
171324
|
flex-shrink: 0;
|
|
170340
171325
|
}
|
|
170341
|
-
#${
|
|
171326
|
+
#${MODAL_ID6} .gcdr-btn {
|
|
170342
171327
|
padding: 10px 20px;
|
|
170343
171328
|
border-radius: 8px;
|
|
170344
171329
|
font-size: 14px;
|
|
@@ -170350,53 +171335,53 @@ var STYLES2 = `
|
|
|
170350
171335
|
align-items: center;
|
|
170351
171336
|
gap: 6px;
|
|
170352
171337
|
}
|
|
170353
|
-
#${
|
|
170354
|
-
#${
|
|
171338
|
+
#${MODAL_ID6} .gcdr-btn:active { transform: scale(0.97); }
|
|
171339
|
+
#${MODAL_ID6} .gcdr-btn-primary {
|
|
170355
171340
|
background: ${TEAL};
|
|
170356
171341
|
color: #fff;
|
|
170357
171342
|
}
|
|
170358
|
-
#${
|
|
170359
|
-
#${
|
|
171343
|
+
#${MODAL_ID6} .gcdr-btn-primary:hover { background: ${TEAL_LIGHT}; }
|
|
171344
|
+
#${MODAL_ID6} .gcdr-btn-secondary {
|
|
170360
171345
|
background: #f0f4f3;
|
|
170361
171346
|
color: ${TEAL_DARK};
|
|
170362
171347
|
border: 1px solid #d0dbd9;
|
|
170363
171348
|
}
|
|
170364
|
-
#${
|
|
170365
|
-
#${
|
|
171349
|
+
#${MODAL_ID6} .gcdr-btn-secondary:hover { background: #e0ecea; }
|
|
171350
|
+
#${MODAL_ID6} .gcdr-btn-danger {
|
|
170366
171351
|
background: #d32f2f;
|
|
170367
171352
|
color: #fff;
|
|
170368
171353
|
}
|
|
170369
|
-
#${
|
|
170370
|
-
#${
|
|
171354
|
+
#${MODAL_ID6} .gcdr-btn-danger:hover { background: #b71c1c; }
|
|
171355
|
+
#${MODAL_ID6} .gcdr-counts {
|
|
170371
171356
|
display: grid;
|
|
170372
171357
|
grid-template-columns: repeat(3, 1fr);
|
|
170373
171358
|
gap: 12px;
|
|
170374
171359
|
margin-bottom: 20px;
|
|
170375
171360
|
}
|
|
170376
|
-
#${
|
|
171361
|
+
#${MODAL_ID6} .gcdr-count-card {
|
|
170377
171362
|
background: #f8faf9;
|
|
170378
171363
|
border: 1px solid #e0eceb;
|
|
170379
171364
|
border-radius: 10px;
|
|
170380
171365
|
padding: 14px 12px;
|
|
170381
171366
|
text-align: center;
|
|
170382
171367
|
}
|
|
170383
|
-
#${
|
|
171368
|
+
#${MODAL_ID6} .gcdr-count-num {
|
|
170384
171369
|
font-size: 28px;
|
|
170385
171370
|
font-weight: 700;
|
|
170386
171371
|
line-height: 1;
|
|
170387
171372
|
margin-bottom: 4px;
|
|
170388
171373
|
}
|
|
170389
|
-
#${
|
|
171374
|
+
#${MODAL_ID6} .gcdr-count-label {
|
|
170390
171375
|
font-size: 12px;
|
|
170391
171376
|
color: #666;
|
|
170392
171377
|
text-transform: uppercase;
|
|
170393
171378
|
letter-spacing: 0.04em;
|
|
170394
171379
|
}
|
|
170395
|
-
#${
|
|
170396
|
-
#${
|
|
170397
|
-
#${
|
|
170398
|
-
#${
|
|
170399
|
-
#${
|
|
171380
|
+
#${MODAL_ID6} .gcdr-count-create { color: ${TEAL}; }
|
|
171381
|
+
#${MODAL_ID6} .gcdr-count-update { color: #e67e00; }
|
|
171382
|
+
#${MODAL_ID6} .gcdr-count-skip { color: #888; }
|
|
171383
|
+
#${MODAL_ID6} .gcdr-count-recreate { color: #9c27b0; }
|
|
171384
|
+
#${MODAL_ID6} .gcdr-info-box {
|
|
170400
171385
|
background: #f0f9f7;
|
|
170401
171386
|
border: 1px solid #c3e6e2;
|
|
170402
171387
|
border-radius: 8px;
|
|
@@ -170405,7 +171390,7 @@ var STYLES2 = `
|
|
|
170405
171390
|
color: #1a4a45;
|
|
170406
171391
|
line-height: 1.5;
|
|
170407
171392
|
}
|
|
170408
|
-
#${
|
|
171393
|
+
#${MODAL_ID6} .gcdr-error-box {
|
|
170409
171394
|
background: #fff0f0;
|
|
170410
171395
|
border: 1px solid #ffb3b3;
|
|
170411
171396
|
border-radius: 8px;
|
|
@@ -170417,7 +171402,7 @@ var STYLES2 = `
|
|
|
170417
171402
|
gap: 10px;
|
|
170418
171403
|
align-items: flex-start;
|
|
170419
171404
|
}
|
|
170420
|
-
#${
|
|
171405
|
+
#${MODAL_ID6} .gcdr-section-title {
|
|
170421
171406
|
font-size: 14px;
|
|
170422
171407
|
font-weight: 600;
|
|
170423
171408
|
color: #333;
|
|
@@ -170426,7 +171411,7 @@ var STYLES2 = `
|
|
|
170426
171411
|
align-items: center;
|
|
170427
171412
|
gap: 6px;
|
|
170428
171413
|
}
|
|
170429
|
-
#${
|
|
171414
|
+
#${MODAL_ID6} .gcdr-action-list {
|
|
170430
171415
|
list-style: none;
|
|
170431
171416
|
margin: 0 0 12px;
|
|
170432
171417
|
padding: 0;
|
|
@@ -170435,7 +171420,7 @@ var STYLES2 = `
|
|
|
170435
171420
|
border: 1px solid #e8ecef;
|
|
170436
171421
|
border-radius: 8px;
|
|
170437
171422
|
}
|
|
170438
|
-
#${
|
|
171423
|
+
#${MODAL_ID6} .gcdr-action-item {
|
|
170439
171424
|
padding: 8px 12px;
|
|
170440
171425
|
display: flex;
|
|
170441
171426
|
align-items: center;
|
|
@@ -170443,8 +171428,8 @@ var STYLES2 = `
|
|
|
170443
171428
|
font-size: 13px;
|
|
170444
171429
|
border-bottom: 1px solid #f0f4f3;
|
|
170445
171430
|
}
|
|
170446
|
-
#${
|
|
170447
|
-
#${
|
|
171431
|
+
#${MODAL_ID6} .gcdr-action-item:last-child { border-bottom: none; }
|
|
171432
|
+
#${MODAL_ID6} .gcdr-badge {
|
|
170448
171433
|
padding: 2px 7px;
|
|
170449
171434
|
border-radius: 4px;
|
|
170450
171435
|
font-size: 10px;
|
|
@@ -170453,10 +171438,10 @@ var STYLES2 = `
|
|
|
170453
171438
|
letter-spacing: 0.05em;
|
|
170454
171439
|
flex-shrink: 0;
|
|
170455
171440
|
}
|
|
170456
|
-
#${
|
|
170457
|
-
#${
|
|
170458
|
-
#${
|
|
170459
|
-
#${
|
|
171441
|
+
#${MODAL_ID6} .gcdr-badge-create { background: #e6f4f1; color: ${TEAL_DARK}; }
|
|
171442
|
+
#${MODAL_ID6} .gcdr-badge-update { background: #fff3e0; color: #e67e00; }
|
|
171443
|
+
#${MODAL_ID6} .gcdr-badge-recreate { background: #f3e5f5; color: #7b1fa2; }
|
|
171444
|
+
#${MODAL_ID6} .gcdr-progress-overlay {
|
|
170460
171445
|
position: absolute;
|
|
170461
171446
|
inset: 0;
|
|
170462
171447
|
background: rgba(255,255,255,0.92);
|
|
@@ -170470,17 +171455,17 @@ var STYLES2 = `
|
|
|
170470
171455
|
text-align: center;
|
|
170471
171456
|
z-index: 10;
|
|
170472
171457
|
}
|
|
170473
|
-
#${
|
|
171458
|
+
#${MODAL_ID6} .gcdr-progress-title {
|
|
170474
171459
|
font-size: 16px;
|
|
170475
171460
|
font-weight: 600;
|
|
170476
171461
|
color: ${TEAL_DARK};
|
|
170477
171462
|
}
|
|
170478
|
-
#${
|
|
171463
|
+
#${MODAL_ID6} .gcdr-progress-entity {
|
|
170479
171464
|
font-size: 13px;
|
|
170480
171465
|
color: #555;
|
|
170481
171466
|
min-height: 20px;
|
|
170482
171467
|
}
|
|
170483
|
-
#${
|
|
171468
|
+
#${MODAL_ID6} .gcdr-progress-bar-wrap {
|
|
170484
171469
|
width: 100%;
|
|
170485
171470
|
max-width: 360px;
|
|
170486
171471
|
background: #e0ece9;
|
|
@@ -170488,46 +171473,46 @@ var STYLES2 = `
|
|
|
170488
171473
|
height: 8px;
|
|
170489
171474
|
overflow: hidden;
|
|
170490
171475
|
}
|
|
170491
|
-
#${
|
|
171476
|
+
#${MODAL_ID6} .gcdr-progress-bar {
|
|
170492
171477
|
height: 100%;
|
|
170493
171478
|
background: ${TEAL};
|
|
170494
171479
|
border-radius: 99px;
|
|
170495
171480
|
transition: width 0.3s ease;
|
|
170496
171481
|
width: 0%;
|
|
170497
171482
|
}
|
|
170498
|
-
#${
|
|
171483
|
+
#${MODAL_ID6} .gcdr-progress-counter {
|
|
170499
171484
|
font-size: 12px;
|
|
170500
171485
|
color: #888;
|
|
170501
171486
|
}
|
|
170502
|
-
#${
|
|
171487
|
+
#${MODAL_ID6} .gcdr-result-counts {
|
|
170503
171488
|
display: grid;
|
|
170504
171489
|
grid-template-columns: repeat(3, 1fr);
|
|
170505
171490
|
gap: 12px;
|
|
170506
171491
|
margin-bottom: 20px;
|
|
170507
171492
|
}
|
|
170508
|
-
#${
|
|
171493
|
+
#${MODAL_ID6} .gcdr-result-card {
|
|
170509
171494
|
background: #f8faf9;
|
|
170510
171495
|
border: 1px solid #e0eceb;
|
|
170511
171496
|
border-radius: 10px;
|
|
170512
171497
|
padding: 14px 12px;
|
|
170513
171498
|
text-align: center;
|
|
170514
171499
|
}
|
|
170515
|
-
#${
|
|
171500
|
+
#${MODAL_ID6} .gcdr-result-num {
|
|
170516
171501
|
font-size: 28px;
|
|
170517
171502
|
font-weight: 700;
|
|
170518
171503
|
line-height: 1;
|
|
170519
171504
|
margin-bottom: 4px;
|
|
170520
171505
|
}
|
|
170521
|
-
#${
|
|
171506
|
+
#${MODAL_ID6} .gcdr-result-label {
|
|
170522
171507
|
font-size: 12px;
|
|
170523
171508
|
color: #666;
|
|
170524
171509
|
text-transform: uppercase;
|
|
170525
171510
|
letter-spacing: 0.04em;
|
|
170526
171511
|
}
|
|
170527
|
-
#${
|
|
170528
|
-
#${
|
|
170529
|
-
#${
|
|
170530
|
-
#${
|
|
171512
|
+
#${MODAL_ID6} .gcdr-result-ok { color: ${TEAL}; }
|
|
171513
|
+
#${MODAL_ID6} .gcdr-result-fail { color: #d32f2f; }
|
|
171514
|
+
#${MODAL_ID6} .gcdr-result-skip { color: #888; }
|
|
171515
|
+
#${MODAL_ID6} .gcdr-fail-list {
|
|
170531
171516
|
background: #fff5f5;
|
|
170532
171517
|
border: 1px solid #ffcdd2;
|
|
170533
171518
|
border-radius: 8px;
|
|
@@ -170535,23 +171520,23 @@ var STYLES2 = `
|
|
|
170535
171520
|
max-height: 160px;
|
|
170536
171521
|
overflow-y: auto;
|
|
170537
171522
|
}
|
|
170538
|
-
#${
|
|
171523
|
+
#${MODAL_ID6} .gcdr-fail-item {
|
|
170539
171524
|
font-size: 12px;
|
|
170540
171525
|
color: #b71c1c;
|
|
170541
171526
|
padding: 4px 0;
|
|
170542
171527
|
border-bottom: 1px solid #ffebee;
|
|
170543
171528
|
}
|
|
170544
|
-
#${
|
|
171529
|
+
#${MODAL_ID6} .gcdr-fail-item:last-child { border-bottom: none; }
|
|
170545
171530
|
`;
|
|
170546
171531
|
function injectStyles23() {
|
|
170547
|
-
if (document.getElementById(`${
|
|
171532
|
+
if (document.getElementById(`${MODAL_ID6}-styles`)) return;
|
|
170548
171533
|
const style = document.createElement("style");
|
|
170549
|
-
style.id = `${
|
|
171534
|
+
style.id = `${MODAL_ID6}-styles`;
|
|
170550
171535
|
style.textContent = STYLES2;
|
|
170551
171536
|
document.head.appendChild(style);
|
|
170552
171537
|
}
|
|
170553
171538
|
function removeExistingModal() {
|
|
170554
|
-
const existing = document.getElementById(
|
|
171539
|
+
const existing = document.getElementById(MODAL_ID6);
|
|
170555
171540
|
existing?.remove();
|
|
170556
171541
|
}
|
|
170557
171542
|
function badgeHtml(type) {
|
|
@@ -170663,7 +171648,7 @@ async function openGCDRSyncModal(params) {
|
|
|
170663
171648
|
return;
|
|
170664
171649
|
}
|
|
170665
171650
|
const overlay = document.createElement("div");
|
|
170666
|
-
overlay.id =
|
|
171651
|
+
overlay.id = MODAL_ID6;
|
|
170667
171652
|
const card = document.createElement("div");
|
|
170668
171653
|
card.className = "gcdr-card";
|
|
170669
171654
|
card.style.position = "relative";
|
|
@@ -170893,13 +171878,13 @@ async function openGCDRSyncModal(params) {
|
|
|
170893
171878
|
}
|
|
170894
171879
|
|
|
170895
171880
|
// src/components/premium-modals/alarm-bundle-map/openAlarmBundleMapModal.ts
|
|
170896
|
-
var
|
|
171881
|
+
var MODAL_ID7 = "myio-alarm-bundle-map-modal";
|
|
170897
171882
|
var GCDR_INTEGRATION_API_KEY = "gcdr_cust_tb_integration_key_2026";
|
|
170898
171883
|
var TEAL2 = "#0a6d5e";
|
|
170899
171884
|
var TEAL_DARK2 = "#084f44";
|
|
170900
171885
|
var TEAL_LIGHT2 = "#0d8570";
|
|
170901
171886
|
var STYLES3 = `
|
|
170902
|
-
#${
|
|
171887
|
+
#${MODAL_ID7} {
|
|
170903
171888
|
position: fixed;
|
|
170904
171889
|
inset: 0;
|
|
170905
171890
|
background: rgba(0, 0, 0, 0.60);
|
|
@@ -170911,7 +171896,7 @@ var STYLES3 = `
|
|
|
170911
171896
|
justify-content: center;
|
|
170912
171897
|
font-family: 'Nunito', system-ui, sans-serif;
|
|
170913
171898
|
}
|
|
170914
|
-
#${
|
|
171899
|
+
#${MODAL_ID7} .abm-card {
|
|
170915
171900
|
background: #fff;
|
|
170916
171901
|
color: #1a1a1a;
|
|
170917
171902
|
border-radius: 16px;
|
|
@@ -170922,12 +171907,12 @@ var STYLES3 = `
|
|
|
170922
171907
|
flex-direction: column;
|
|
170923
171908
|
overflow: hidden;
|
|
170924
171909
|
}
|
|
170925
|
-
#${
|
|
171910
|
+
#${MODAL_ID7} .abm-card.is-maximized {
|
|
170926
171911
|
width: 100vw !important; max-width: 100vw !important;
|
|
170927
171912
|
height: 100vh !important; max-height: 100vh !important; border-radius: 0;
|
|
170928
171913
|
}
|
|
170929
|
-
#${
|
|
170930
|
-
#${
|
|
171914
|
+
#${MODAL_ID7} .myio-premium-chrome-header .abm-view-toggle { margin-left: 0; margin-right: 6px; }
|
|
171915
|
+
#${MODAL_ID7} .abm-header {
|
|
170931
171916
|
background: ${TEAL2};
|
|
170932
171917
|
color: #fff;
|
|
170933
171918
|
padding: 18px 24px 14px;
|
|
@@ -170936,123 +171921,123 @@ var STYLES3 = `
|
|
|
170936
171921
|
gap: 12px;
|
|
170937
171922
|
flex-shrink: 0;
|
|
170938
171923
|
}
|
|
170939
|
-
#${
|
|
170940
|
-
#${
|
|
170941
|
-
#${
|
|
171924
|
+
#${MODAL_ID7} .abm-header-icon { font-size: 22px; flex-shrink: 0; }
|
|
171925
|
+
#${MODAL_ID7} .abm-header-text { flex: 1; }
|
|
171926
|
+
#${MODAL_ID7} .abm-header-title {
|
|
170942
171927
|
font-size: 17px; font-weight: 700; line-height: 1.2; margin: 0;
|
|
170943
171928
|
}
|
|
170944
|
-
#${
|
|
171929
|
+
#${MODAL_ID7} .abm-header-sub {
|
|
170945
171930
|
font-size: 12px; opacity: 0.80; margin: 3px 0 0;
|
|
170946
171931
|
}
|
|
170947
|
-
#${
|
|
171932
|
+
#${MODAL_ID7} .abm-close-btn {
|
|
170948
171933
|
background: none; border: none; color: #fff;
|
|
170949
171934
|
font-size: 20px; cursor: pointer; padding: 4px 8px;
|
|
170950
171935
|
border-radius: 6px; line-height: 1; opacity: 0.80; transition: opacity 0.15s; flex-shrink: 0;
|
|
170951
171936
|
}
|
|
170952
|
-
#${
|
|
170953
|
-
#${
|
|
171937
|
+
#${MODAL_ID7} .abm-close-btn:hover { opacity: 1; }
|
|
171938
|
+
#${MODAL_ID7} .abm-body {
|
|
170954
171939
|
padding: 20px 24px; overflow-y: auto; flex: 1;
|
|
170955
171940
|
}
|
|
170956
|
-
#${
|
|
171941
|
+
#${MODAL_ID7} .abm-footer {
|
|
170957
171942
|
padding: 14px 24px; border-top: 1px solid #e8ecef;
|
|
170958
171943
|
display: flex; gap: 12px; justify-content: flex-end; flex-shrink: 0;
|
|
170959
171944
|
}
|
|
170960
|
-
#${
|
|
171945
|
+
#${MODAL_ID7} .abm-btn {
|
|
170961
171946
|
padding: 9px 18px; border-radius: 8px; font-size: 14px;
|
|
170962
171947
|
font-weight: 600; cursor: pointer; border: none;
|
|
170963
171948
|
transition: background 0.15s;
|
|
170964
171949
|
display: inline-flex; align-items: center; gap: 6px;
|
|
170965
171950
|
}
|
|
170966
|
-
#${
|
|
171951
|
+
#${MODAL_ID7} .abm-btn-secondary {
|
|
170967
171952
|
background: #f0f4f3; color: ${TEAL_DARK2}; border: 1px solid #d0dbd9;
|
|
170968
171953
|
}
|
|
170969
|
-
#${
|
|
170970
|
-
#${
|
|
171954
|
+
#${MODAL_ID7} .abm-btn-secondary:hover { background: #e0ecea; }
|
|
171955
|
+
#${MODAL_ID7} .abm-error-box {
|
|
170971
171956
|
background: #fff0f0; border: 1px solid #ffb3b3; border-radius: 8px;
|
|
170972
171957
|
padding: 14px 16px; font-size: 14px; color: #b71c1c;
|
|
170973
171958
|
line-height: 1.5; display: flex; gap: 10px; align-items: flex-start;
|
|
170974
171959
|
}
|
|
170975
|
-
#${
|
|
171960
|
+
#${MODAL_ID7} .abm-empty-box {
|
|
170976
171961
|
background: #f0f9f7; border: 1px solid #c3e6e2; border-radius: 8px;
|
|
170977
171962
|
padding: 16px; font-size: 14px; color: #1a4a45; line-height: 1.5;
|
|
170978
171963
|
text-align: center;
|
|
170979
171964
|
}
|
|
170980
|
-
#${
|
|
171965
|
+
#${MODAL_ID7} .abm-loading {
|
|
170981
171966
|
text-align: center; padding: 32px; color: #555; font-size: 14px;
|
|
170982
171967
|
}
|
|
170983
|
-
#${
|
|
171968
|
+
#${MODAL_ID7} .abm-summary-bar {
|
|
170984
171969
|
display: flex; gap: 20px; margin-bottom: 18px;
|
|
170985
171970
|
padding: 12px 16px; background: #f8faf9;
|
|
170986
171971
|
border: 1px solid #e0eceb; border-radius: 10px;
|
|
170987
171972
|
}
|
|
170988
|
-
#${
|
|
170989
|
-
#${
|
|
171973
|
+
#${MODAL_ID7} .abm-summary-item { text-align: center; flex: 1; }
|
|
171974
|
+
#${MODAL_ID7} .abm-summary-num {
|
|
170990
171975
|
font-size: 22px; font-weight: 700; color: ${TEAL2}; line-height: 1;
|
|
170991
171976
|
}
|
|
170992
|
-
#${
|
|
171977
|
+
#${MODAL_ID7} .abm-summary-label {
|
|
170993
171978
|
font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.04em;
|
|
170994
171979
|
margin-top: 2px;
|
|
170995
171980
|
}
|
|
170996
|
-
#${
|
|
170997
|
-
#${
|
|
171981
|
+
#${MODAL_ID7} .abm-asset-group { margin-bottom: 16px; }
|
|
171982
|
+
#${MODAL_ID7} .abm-asset-label {
|
|
170998
171983
|
font-size: 11px; font-weight: 700; color: #888;
|
|
170999
171984
|
text-transform: uppercase; letter-spacing: 0.07em;
|
|
171000
171985
|
margin-bottom: 6px; padding-left: 2px;
|
|
171001
171986
|
}
|
|
171002
|
-
#${
|
|
171987
|
+
#${MODAL_ID7} .abm-device-card {
|
|
171003
171988
|
border: 1px solid #e0eceb; border-radius: 10px;
|
|
171004
171989
|
margin-bottom: 8px; overflow: hidden;
|
|
171005
171990
|
}
|
|
171006
|
-
#${
|
|
171991
|
+
#${MODAL_ID7} .abm-device-header {
|
|
171007
171992
|
display: flex; align-items: center; gap: 10px;
|
|
171008
171993
|
padding: 10px 14px; background: #f8faf9;
|
|
171009
171994
|
border-bottom: 1px solid #e0eceb;
|
|
171010
171995
|
}
|
|
171011
|
-
#${
|
|
171996
|
+
#${MODAL_ID7} .abm-device-name {
|
|
171012
171997
|
flex: 1; font-size: 14px; font-weight: 600; color: #1a1a1a;
|
|
171013
171998
|
}
|
|
171014
|
-
#${
|
|
171999
|
+
#${MODAL_ID7} .abm-device-type {
|
|
171015
172000
|
font-size: 11px; font-weight: 600; padding: 2px 8px;
|
|
171016
172001
|
border-radius: 4px; background: #e6f4f1; color: ${TEAL_DARK2};
|
|
171017
172002
|
text-transform: uppercase; letter-spacing: 0.04em;
|
|
171018
172003
|
}
|
|
171019
|
-
#${
|
|
171020
|
-
#${
|
|
172004
|
+
#${MODAL_ID7} .abm-rule-list { padding: 0; list-style: none; margin: 0; }
|
|
172005
|
+
#${MODAL_ID7} .abm-rule-item {
|
|
171021
172006
|
padding: 10px 14px; border-bottom: 1px solid #f0f4f3;
|
|
171022
172007
|
font-size: 13px;
|
|
171023
172008
|
}
|
|
171024
|
-
#${
|
|
171025
|
-
#${
|
|
172009
|
+
#${MODAL_ID7} .abm-rule-item:last-child { border-bottom: none; }
|
|
172010
|
+
#${MODAL_ID7} .abm-rule-name {
|
|
171026
172011
|
font-weight: 600; color: #333; margin-bottom: 4px;
|
|
171027
172012
|
display: flex; align-items: center; gap: 6px;
|
|
171028
172013
|
}
|
|
171029
|
-
#${
|
|
172014
|
+
#${MODAL_ID7} .abm-rule-detail {
|
|
171030
172015
|
color: #555; line-height: 1.6;
|
|
171031
172016
|
display: flex; flex-wrap: wrap; gap: 4px 12px;
|
|
171032
172017
|
}
|
|
171033
|
-
#${
|
|
172018
|
+
#${MODAL_ID7} .abm-rule-chip {
|
|
171034
172019
|
display: inline-flex; align-items: center; gap: 3px;
|
|
171035
172020
|
font-size: 12px; background: #f0f4f3; border-radius: 4px;
|
|
171036
172021
|
padding: 1px 7px; color: #444;
|
|
171037
172022
|
}
|
|
171038
|
-
#${
|
|
172023
|
+
#${MODAL_ID7} .abm-day-chip {
|
|
171039
172024
|
font-size: 10px; font-weight: 700; padding: 1px 5px;
|
|
171040
172025
|
border-radius: 3px; background: ${TEAL2}; color: #fff;
|
|
171041
172026
|
}
|
|
171042
|
-
#${
|
|
172027
|
+
#${MODAL_ID7} .abm-day-chip.off {
|
|
171043
172028
|
background: #e8ecef; color: #aaa;
|
|
171044
172029
|
}
|
|
171045
|
-
#${
|
|
172030
|
+
#${MODAL_ID7} .abm-rule-name {
|
|
171046
172031
|
justify-content: space-between;
|
|
171047
172032
|
}
|
|
171048
|
-
#${
|
|
172033
|
+
#${MODAL_ID7} .abm-edit-rule-btn {
|
|
171049
172034
|
background: none; border: none; cursor: pointer;
|
|
171050
172035
|
font-size: 13px; padding: 2px 5px; border-radius: 4px;
|
|
171051
172036
|
color: #888; line-height: 1; transition: background 0.12s, color 0.12s;
|
|
171052
172037
|
flex-shrink: 0;
|
|
171053
172038
|
}
|
|
171054
|
-
#${
|
|
171055
|
-
#${
|
|
172039
|
+
#${MODAL_ID7} .abm-edit-rule-btn:hover { background: #e6f4f1; color: ${TEAL2}; }
|
|
172040
|
+
#${MODAL_ID7} .abm-edit-form {
|
|
171056
172041
|
margin-top: 8px; padding: 10px 12px;
|
|
171057
172042
|
background: #f4fbf9; border: 1px solid #c3e6e2; border-radius: 8px;
|
|
171058
172043
|
display: flex; flex-direction: column; gap: 10px;
|
|
@@ -171060,136 +172045,136 @@ var STYLES3 = `
|
|
|
171060
172045
|
ele s\xF3 ocupava a largura do conte\xFAdo. For\xE7a ocupar a linha inteira. */
|
|
171061
172046
|
flex: 1 1 100%; width: 100%; box-sizing: border-box;
|
|
171062
172047
|
}
|
|
171063
|
-
#${
|
|
172048
|
+
#${MODAL_ID7} .abm-ef-row {
|
|
171064
172049
|
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
|
|
171065
172050
|
}
|
|
171066
|
-
#${
|
|
172051
|
+
#${MODAL_ID7} .abm-ef-label {
|
|
171067
172052
|
font-size: 11px; font-weight: 600; color: #555; min-width: 60px; flex-shrink: 0;
|
|
171068
172053
|
}
|
|
171069
|
-
#${
|
|
172054
|
+
#${MODAL_ID7} .abm-ef-input {
|
|
171070
172055
|
border: 1px solid #b0d8d2; border-radius: 5px; padding: 4px 8px;
|
|
171071
172056
|
font-size: 13px; color: #1a1a1a; background: #fff;
|
|
171072
172057
|
outline: none; transition: border-color 0.15s;
|
|
171073
172058
|
}
|
|
171074
|
-
#${
|
|
171075
|
-
#${
|
|
171076
|
-
#${
|
|
171077
|
-
#${
|
|
171078
|
-
#${
|
|
172059
|
+
#${MODAL_ID7} .abm-ef-input:focus { border-color: ${TEAL2}; }
|
|
172060
|
+
#${MODAL_ID7} .abm-ef-input--value { width: 80px; }
|
|
172061
|
+
#${MODAL_ID7} .abm-ef-input--time { width: 88px; }
|
|
172062
|
+
#${MODAL_ID7} .abm-ef-days { display: flex; gap: 4px; flex-wrap: wrap; }
|
|
172063
|
+
#${MODAL_ID7} .abm-ef-day-btn {
|
|
171079
172064
|
font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
|
|
171080
172065
|
cursor: pointer; border: 1px solid #b0d8d2; background: #e8ecef; color: #aaa;
|
|
171081
172066
|
transition: background 0.12s, color 0.12s;
|
|
171082
172067
|
}
|
|
171083
|
-
#${
|
|
171084
|
-
#${
|
|
171085
|
-
#${
|
|
172068
|
+
#${MODAL_ID7} .abm-ef-day-btn.on { background: ${TEAL2}; color: #fff; border-color: ${TEAL2}; }
|
|
172069
|
+
#${MODAL_ID7} .abm-ef-actions { display: flex; gap: 8px; justify-content: flex-end; }
|
|
172070
|
+
#${MODAL_ID7} .abm-ef-save-btn {
|
|
171086
172071
|
padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 700;
|
|
171087
172072
|
cursor: pointer; border: none; background: ${TEAL2}; color: #fff;
|
|
171088
172073
|
transition: background 0.15s;
|
|
171089
172074
|
}
|
|
171090
|
-
#${
|
|
171091
|
-
#${
|
|
171092
|
-
#${
|
|
172075
|
+
#${MODAL_ID7} .abm-ef-save-btn:hover { background: ${TEAL_LIGHT2}; }
|
|
172076
|
+
#${MODAL_ID7} .abm-ef-save-btn:disabled { opacity: 0.55; cursor: not-allowed; }
|
|
172077
|
+
#${MODAL_ID7} .abm-ef-cancel-btn {
|
|
171093
172078
|
padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
|
|
171094
172079
|
cursor: pointer; background: #e8ecef; color: #555; border: 1px solid #ccc;
|
|
171095
172080
|
transition: background 0.15s;
|
|
171096
172081
|
}
|
|
171097
|
-
#${
|
|
171098
|
-
#${
|
|
172082
|
+
#${MODAL_ID7} .abm-ef-cancel-btn:hover { background: #d8dfe0; }
|
|
172083
|
+
#${MODAL_ID7} .abm-ef-error {
|
|
171099
172084
|
font-size: 11px; color: #c0392b; font-weight: 600;
|
|
171100
172085
|
}
|
|
171101
|
-
#${
|
|
172086
|
+
#${MODAL_ID7} .abm-view-toggle {
|
|
171102
172087
|
display: flex; gap: 0; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; overflow: hidden;
|
|
171103
172088
|
margin-left: auto; flex-shrink: 0;
|
|
171104
172089
|
}
|
|
171105
|
-
#${
|
|
172090
|
+
#${MODAL_ID7} .abm-view-btn {
|
|
171106
172091
|
background: none; border: none; color: rgba(255,255,255,0.7); font-size: 12px; font-weight: 600;
|
|
171107
172092
|
padding: 5px 12px; cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap;
|
|
171108
172093
|
}
|
|
171109
|
-
#${
|
|
171110
|
-
#${
|
|
171111
|
-
#${
|
|
172094
|
+
#${MODAL_ID7} .abm-view-btn.active { background: rgba(255,255,255,0.25); color: #fff; }
|
|
172095
|
+
#${MODAL_ID7} .abm-view-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: #fff; }
|
|
172096
|
+
#${MODAL_ID7} .abm-restore-btn {
|
|
171112
172097
|
background: none; border: none; cursor: pointer; font-size: 13px;
|
|
171113
172098
|
padding: 2px 4px; border-radius: 4px; color: #e67e22; line-height: 1;
|
|
171114
172099
|
flex-shrink: 0; transition: background 0.12s;
|
|
171115
172100
|
title: "Restaurar valor padr\xE3o";
|
|
171116
172101
|
}
|
|
171117
|
-
#${
|
|
171118
|
-
#${
|
|
172102
|
+
#${MODAL_ID7} .abm-restore-btn:hover { background: #fef0e4; }
|
|
172103
|
+
#${MODAL_ID7} .abm-override-badge {
|
|
171119
172104
|
font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
|
|
171120
172105
|
background: #e67e22; color: #fff; letter-spacing: 0.03em;
|
|
171121
172106
|
}
|
|
171122
|
-
#${
|
|
172107
|
+
#${MODAL_ID7} .abm-rule-group {
|
|
171123
172108
|
border: 1px solid #e0eceb; border-radius: 10px; margin-bottom: 16px; overflow: hidden;
|
|
171124
172109
|
}
|
|
171125
|
-
#${
|
|
172110
|
+
#${MODAL_ID7} .abm-rule-group-header {
|
|
171126
172111
|
display: flex; align-items: center; gap: 10px;
|
|
171127
172112
|
padding: 10px 14px; background: #f0f9f7; border-bottom: 1px solid #e0eceb;
|
|
171128
172113
|
}
|
|
171129
|
-
#${
|
|
171130
|
-
#${
|
|
171131
|
-
#${
|
|
172114
|
+
#${MODAL_ID7} .abm-rule-group-name { flex: 1; font-size: 14px; font-weight: 600; color: #1a1a1a; }
|
|
172115
|
+
#${MODAL_ID7} .abm-rule-group-devices { padding: 0; list-style: none; margin: 0; }
|
|
172116
|
+
#${MODAL_ID7} .abm-rule-group-device {
|
|
171132
172117
|
padding: 8px 14px; border-bottom: 1px solid #f0f4f3;
|
|
171133
172118
|
font-size: 13px; color: #555; display: flex; align-items: center; gap: 8px;
|
|
171134
172119
|
}
|
|
171135
|
-
#${
|
|
171136
|
-
#${
|
|
172120
|
+
#${MODAL_ID7} .abm-rule-group-device:last-child { border-bottom: none; }
|
|
172121
|
+
#${MODAL_ID7} .abm-rule-description {
|
|
171137
172122
|
font-size: 12px; color: #777; font-style: italic;
|
|
171138
172123
|
margin: 2px 0 6px; line-height: 1.4;
|
|
171139
172124
|
}
|
|
171140
|
-
#${
|
|
172125
|
+
#${MODAL_ID7} .abm-ef-input--desc {
|
|
171141
172126
|
flex: 1; min-width: 0; resize: vertical;
|
|
171142
172127
|
font-family: inherit; line-height: 1.4;
|
|
171143
172128
|
}
|
|
171144
172129
|
/* Override value chip in por-regra device row */
|
|
171145
|
-
#${
|
|
172130
|
+
#${MODAL_ID7} .abm-override-value {
|
|
171146
172131
|
font-size: 12px; font-weight: 600; color: #e67e22;
|
|
171147
172132
|
background: #fef3e8; border-radius: 4px; padding: 1px 6px;
|
|
171148
172133
|
}
|
|
171149
172134
|
/* Collapse/expand */
|
|
171150
|
-
#${
|
|
171151
|
-
#${
|
|
171152
|
-
#${
|
|
171153
|
-
#${
|
|
172135
|
+
#${MODAL_ID7} .abm-device-card.collapsed .abm-rule-list { display: none; }
|
|
172136
|
+
#${MODAL_ID7} .abm-rule-group.collapsed .abm-rule-group-devices,
|
|
172137
|
+
#${MODAL_ID7} .abm-rule-group.collapsed .abm-rule-detail-wrap { display: none; }
|
|
172138
|
+
#${MODAL_ID7} .abm-chevron {
|
|
171154
172139
|
font-size: 11px; color: #94a3b8; transition: transform 0.18s; flex-shrink: 0; user-select: none;
|
|
171155
172140
|
}
|
|
171156
|
-
#${
|
|
171157
|
-
#${
|
|
171158
|
-
#${
|
|
171159
|
-
#${
|
|
171160
|
-
#${
|
|
171161
|
-
#${
|
|
172141
|
+
#${MODAL_ID7} .abm-device-card.collapsed .abm-chevron,
|
|
172142
|
+
#${MODAL_ID7} .abm-rule-group.collapsed .abm-chevron { transform: rotate(-90deg); }
|
|
172143
|
+
#${MODAL_ID7} .abm-device-header { cursor: pointer; }
|
|
172144
|
+
#${MODAL_ID7} .abm-device-header:hover { background: #f0f9f7; }
|
|
172145
|
+
#${MODAL_ID7} .abm-rule-group-header { cursor: pointer; }
|
|
172146
|
+
#${MODAL_ID7} .abm-rule-group-header:hover { background: #e6f4f1; }
|
|
171162
172147
|
/* Alarm badge */
|
|
171163
|
-
#${
|
|
172148
|
+
#${MODAL_ID7} .abm-alarm-badge {
|
|
171164
172149
|
display: inline-flex; align-items: center; gap: 3px;
|
|
171165
172150
|
background: #fee2e2; color: #b91c1c; border-radius: 10px;
|
|
171166
172151
|
font-size: 10px; font-weight: 700; padding: 1px 7px; flex-shrink: 0;
|
|
171167
172152
|
}
|
|
171168
|
-
#${
|
|
172153
|
+
#${MODAL_ID7} .abm-alarm-badge.zero { background: #f0f9f7; color: #6b7280; }
|
|
171169
172154
|
/* Filter bar */
|
|
171170
|
-
#${
|
|
172155
|
+
#${MODAL_ID7} .abm-filter-bar {
|
|
171171
172156
|
display: flex; gap: 8px; align-items: center; margin-bottom: 14px;
|
|
171172
172157
|
padding: 10px 12px; background: #f8faf9; border: 1px solid #e0eceb; border-radius: 8px;
|
|
171173
172158
|
}
|
|
171174
|
-
#${
|
|
172159
|
+
#${MODAL_ID7} .abm-filter-input {
|
|
171175
172160
|
flex: 1; border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px;
|
|
171176
172161
|
font-size: 12px; outline: none; transition: border-color 0.15s;
|
|
171177
172162
|
}
|
|
171178
|
-
#${
|
|
171179
|
-
#${
|
|
172163
|
+
#${MODAL_ID7} .abm-filter-input:focus { border-color: ${TEAL2}; }
|
|
172164
|
+
#${MODAL_ID7} .abm-filter-select {
|
|
171180
172165
|
border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 8px;
|
|
171181
172166
|
font-size: 12px; outline: none; min-width: 140px; max-width: 220px;
|
|
171182
172167
|
background: #fff; cursor: pointer;
|
|
171183
172168
|
}
|
|
171184
|
-
#${
|
|
172169
|
+
#${MODAL_ID7} .abm-filter-count {
|
|
171185
172170
|
font-size: 11px; color: #64748b; white-space: nowrap; flex-shrink: 0;
|
|
171186
172171
|
}
|
|
171187
|
-
#${
|
|
172172
|
+
#${MODAL_ID7} .abm-filter-clear {
|
|
171188
172173
|
background: none; border: 1px solid #e0eceb; border-radius: 6px; cursor: pointer;
|
|
171189
172174
|
font-size: 11px; color: #64748b; padding: 4px 8px; white-space: nowrap; flex-shrink: 0;
|
|
171190
172175
|
transition: background 0.12s;
|
|
171191
172176
|
}
|
|
171192
|
-
#${
|
|
172177
|
+
#${MODAL_ID7} .abm-filter-clear:hover { background: #f0f4f3; color: #1e293b; }
|
|
171193
172178
|
/* Confirmation modal \u2014 value edit overwrite warning */
|
|
171194
172179
|
.abm-confirm-overlay {
|
|
171195
172180
|
position: fixed; inset: 0;
|
|
@@ -171226,14 +172211,14 @@ var STYLES3 = `
|
|
|
171226
172211
|
.abm-confirm-btn--confirm:hover { background: #cf6d17; }
|
|
171227
172212
|
`;
|
|
171228
172213
|
function injectStyles24() {
|
|
171229
|
-
if (document.getElementById(`${
|
|
172214
|
+
if (document.getElementById(`${MODAL_ID7}-styles`)) return;
|
|
171230
172215
|
const style = document.createElement("style");
|
|
171231
|
-
style.id = `${
|
|
172216
|
+
style.id = `${MODAL_ID7}-styles`;
|
|
171232
172217
|
style.textContent = STYLES3;
|
|
171233
172218
|
document.head.appendChild(style);
|
|
171234
172219
|
}
|
|
171235
172220
|
function removeExistingModal2() {
|
|
171236
|
-
document.getElementById(
|
|
172221
|
+
document.getElementById(MODAL_ID7)?.remove();
|
|
171237
172222
|
}
|
|
171238
172223
|
function escHtml5(str) {
|
|
171239
172224
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -171920,7 +172905,7 @@ async function openAlarmBundleMapModal(params) {
|
|
|
171920
172905
|
}
|
|
171921
172906
|
const baseUrl = params.gcdrApiBaseUrl;
|
|
171922
172907
|
const overlay = document.createElement("div");
|
|
171923
|
-
overlay.id =
|
|
172908
|
+
overlay.id = MODAL_ID7;
|
|
171924
172909
|
const card = document.createElement("div");
|
|
171925
172910
|
card.className = "abm-card";
|
|
171926
172911
|
overlay.appendChild(card);
|
|
@@ -173074,11 +174059,11 @@ function _esc(s) {
|
|
|
173074
174059
|
const str = s == null ? "" : String(s);
|
|
173075
174060
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
173076
174061
|
}
|
|
173077
|
-
var
|
|
174062
|
+
var STYLE_ID21 = "ntw-styles";
|
|
173078
174063
|
function _injectStyles2() {
|
|
173079
|
-
if (document.getElementById(
|
|
174064
|
+
if (document.getElementById(STYLE_ID21)) return;
|
|
173080
174065
|
const s = document.createElement("style");
|
|
173081
|
-
s.id =
|
|
174066
|
+
s.id = STYLE_ID21;
|
|
173082
174067
|
s.textContent = NTW_CSS;
|
|
173083
174068
|
document.head.appendChild(s);
|
|
173084
174069
|
}
|
|
@@ -175779,7 +176764,7 @@ var IMPORTANCE_COLORS4 = {
|
|
|
175779
176764
|
// red
|
|
175780
176765
|
};
|
|
175781
176766
|
var ITEM_TEXT_MAX = 120;
|
|
175782
|
-
function
|
|
176767
|
+
function escapeHtml22(input) {
|
|
175783
176768
|
if (input == null) return "";
|
|
175784
176769
|
return String(input).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
175785
176770
|
}
|
|
@@ -175817,24 +176802,24 @@ function renderAnnotationItemCard(device, annotation, searchTerm) {
|
|
|
175817
176802
|
const domainIcon = DOMAIN_ICONS3[device.domain] ?? DOMAIN_ICONS3.unknown;
|
|
175818
176803
|
const typeIcon = TYPE_ICONS[annotation.type] ?? "\xB7";
|
|
175819
176804
|
const importance = Math.max(1, Math.min(5, annotation.importance || 1));
|
|
175820
|
-
const textEscaped =
|
|
175821
|
-
const deviceLabelEscaped =
|
|
175822
|
-
const author =
|
|
175823
|
-
const when =
|
|
176805
|
+
const textEscaped = escapeHtml22(truncate2(annotation.text || "", ITEM_TEXT_MAX));
|
|
176806
|
+
const deviceLabelEscaped = escapeHtml22(device.label || device.name || device.deviceId);
|
|
176807
|
+
const author = escapeHtml22(annotation.createdBy?.name || "sem autor");
|
|
176808
|
+
const when = escapeHtml22(formatRelative(annotation.createdAt));
|
|
175824
176809
|
const overdueTag = isOverdue(annotation) ? '<span class="myio-annotations-overdue">Vencida</span>' : "";
|
|
175825
176810
|
const text2 = searchTerm ? highlightMatches(textEscaped, searchTerm) : textEscaped;
|
|
175826
176811
|
const deviceLabel = searchTerm ? highlightMatches(deviceLabelEscaped, searchTerm) : deviceLabelEscaped;
|
|
175827
|
-
const identifierEscaped = device.identifier ?
|
|
176812
|
+
const identifierEscaped = device.identifier ? escapeHtml22(device.identifier) : "";
|
|
175828
176813
|
const identifierHighlighted = searchTerm && identifierEscaped ? highlightMatches(identifierEscaped, searchTerm) : identifierEscaped;
|
|
175829
176814
|
const identifierTag = device.identifier ? `<span class="myio-annotations-item-device">${identifierHighlighted}</span>` : "";
|
|
175830
176815
|
return `
|
|
175831
176816
|
<button
|
|
175832
176817
|
class="myio-annotations-item"
|
|
175833
176818
|
type="button"
|
|
175834
|
-
data-device-id="${
|
|
175835
|
-
data-annotation-id="${
|
|
176819
|
+
data-device-id="${escapeHtml22(device.deviceId)}"
|
|
176820
|
+
data-annotation-id="${escapeHtml22(annotation.id)}"
|
|
175836
176821
|
tabindex="0"
|
|
175837
|
-
aria-label="${
|
|
176822
|
+
aria-label="${escapeHtml22(annotation.text)} \u2014 ${deviceLabel}"
|
|
175838
176823
|
>
|
|
175839
176824
|
<span class="myio-annotations-item-icon" aria-hidden="true">${typeIcon}</span>
|
|
175840
176825
|
<div class="myio-annotations-item-body">
|
|
@@ -176811,8 +177796,8 @@ var HeaderAnnotationsPanel = class _HeaderAnnotationsPanel {
|
|
|
176811
177796
|
// group header
|
|
176812
177797
|
render: () => `
|
|
176813
177798
|
<header class="myio-annotations-group-header ${groupClass}">
|
|
176814
|
-
${g.icon ? `<span class="myio-annotations-group-icon" aria-hidden="true">${
|
|
176815
|
-
<span class="myio-annotations-group-label">${
|
|
177799
|
+
${g.icon ? `<span class="myio-annotations-group-icon" aria-hidden="true">${escapeHtml22(g.icon)}</span>` : ""}
|
|
177800
|
+
<span class="myio-annotations-group-label">${escapeHtml22(g.label)}</span>
|
|
176816
177801
|
<span class="myio-annotations-group-count">${g.totalAnnotations}</span>
|
|
176817
177802
|
</header>`
|
|
176818
177803
|
});
|
|
@@ -176937,9 +177922,9 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
|
|
|
176937
177922
|
}
|
|
176938
177923
|
_renderToolbar(filteredCount, totalCount) {
|
|
176939
177924
|
const sortOptions = SORT_OPTIONS.map(
|
|
176940
|
-
(o) => `<option value="${o.key}" ${o.key === this.sortBy ? "selected" : ""}>${
|
|
177925
|
+
(o) => `<option value="${o.key}" ${o.key === this.sortBy ? "selected" : ""}>${escapeHtml22(o.label)}</option>`
|
|
176941
177926
|
).join("");
|
|
176942
|
-
const term =
|
|
177927
|
+
const term = escapeHtml22(this.filter.searchTerm || "");
|
|
176943
177928
|
const filtersActiveCount = this._activeFilterCount();
|
|
176944
177929
|
const filterIndicator = filtersActiveCount > 0 ? `<span class="myio-annotations-group-count">${filtersActiveCount}</span>` : "";
|
|
176945
177930
|
const showingHtml = filteredCount === totalCount ? `${totalCount} anota\xE7\xF5es` : `${filteredCount} de ${totalCount} anota\xE7\xF5es`;
|
|
@@ -176980,13 +177965,13 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
|
|
|
176980
177965
|
const typesHtml = FILTER_TYPE_OPTIONS.map(
|
|
176981
177966
|
(t) => `<label class="myio-annotations-filter-chip ${this.filter.types.has(t.id) ? "is-on" : ""}">
|
|
176982
177967
|
<input type="checkbox" data-filter="type" value="${t.id}" ${this.filter.types.has(t.id) ? "checked" : ""} />
|
|
176983
|
-
<span>${t.icon} ${
|
|
177968
|
+
<span>${t.icon} ${escapeHtml22(t.label)}</span>
|
|
176984
177969
|
</label>`
|
|
176985
177970
|
).join("");
|
|
176986
177971
|
const statusHtml = FILTER_STATUS_OPTIONS.map(
|
|
176987
177972
|
(s) => `<label class="myio-annotations-filter-chip ${this.filter.statuses.has(s.id) ? "is-on" : ""}">
|
|
176988
177973
|
<input type="checkbox" data-filter="status" value="${s.id}" ${this.filter.statuses.has(s.id) ? "checked" : ""} />
|
|
176989
|
-
<span>${
|
|
177974
|
+
<span>${escapeHtml22(s.label)}</span>
|
|
176990
177975
|
</label>`
|
|
176991
177976
|
).join("");
|
|
176992
177977
|
const impHtml = [1, 2, 3, 4, 5].map(
|
|
@@ -177063,12 +178048,12 @@ ${this._renderToolbar(filteredCount, totalAllUnfiltered)}
|
|
|
177063
178048
|
return `
|
|
177064
178049
|
<section class="${groupClass}">
|
|
177065
178050
|
<header class="myio-annotations-group-header" role="button" tabindex="0"
|
|
177066
|
-
data-group-toggle="${
|
|
178051
|
+
data-group-toggle="${escapeHtml22(group.key)}"
|
|
177067
178052
|
aria-expanded="${!isCollapsed}"
|
|
177068
178053
|
title="${isCollapsed ? "Expandir grupo" : "Recolher grupo"}">
|
|
177069
178054
|
<span class="myio-annotations-group-chevron" aria-hidden="true">${isCollapsed ? "\u25B6" : "\u25BC"}</span>
|
|
177070
|
-
${group.icon ? `<span class="myio-annotations-group-icon" aria-hidden="true">${
|
|
177071
|
-
<span class="myio-annotations-group-label">${
|
|
178055
|
+
${group.icon ? `<span class="myio-annotations-group-icon" aria-hidden="true">${escapeHtml22(group.icon)}</span>` : ""}
|
|
178056
|
+
<span class="myio-annotations-group-label">${escapeHtml22(group.label)}</span>
|
|
177072
178057
|
<span class="myio-annotations-group-count">${group.totalAnnotations}</span>
|
|
177073
178058
|
</header>
|
|
177074
178059
|
${itemsHtml}
|
|
@@ -177610,7 +178595,7 @@ function prefixForProductType(productType) {
|
|
|
177610
178595
|
if (entry) return entry.prefix;
|
|
177611
178596
|
return `T${productType}`;
|
|
177612
178597
|
}
|
|
177613
|
-
function
|
|
178598
|
+
function pad27(n) {
|
|
177614
178599
|
return String(n).padStart(2, "0");
|
|
177615
178600
|
}
|
|
177616
178601
|
function pad4(n) {
|
|
@@ -177618,9 +178603,9 @@ function pad4(n) {
|
|
|
177618
178603
|
}
|
|
177619
178604
|
function deviceProductCodeToName(value) {
|
|
177620
178605
|
const prefix = prefixForProductType(value.productType);
|
|
177621
|
-
const yy =
|
|
177622
|
-
const mm =
|
|
177623
|
-
const dd =
|
|
178606
|
+
const yy = pad27(value.year % 100);
|
|
178607
|
+
const mm = pad27(value.month);
|
|
178608
|
+
const dd = pad27(value.day);
|
|
177624
178609
|
const unit = value.seq3 * 254 + value.seq;
|
|
177625
178610
|
return `${prefix} ${yy}${mm}${dd}-${pad4(unit)}`;
|
|
177626
178611
|
}
|
|
@@ -177729,7 +178714,7 @@ function validateDeviceProductCode(code) {
|
|
|
177729
178714
|
}
|
|
177730
178715
|
|
|
177731
178716
|
// src/components/cards/central-status/v1.0.0/styles.ts
|
|
177732
|
-
var
|
|
178717
|
+
var STYLE_ID22 = "myio-central-status-card-styles";
|
|
177733
178718
|
var CSS5 = `
|
|
177734
178719
|
.myio-cscard{
|
|
177735
178720
|
--cscard-surface:#ffffff;
|
|
@@ -178032,9 +179017,9 @@ var CSS5 = `
|
|
|
178032
179017
|
`;
|
|
178033
179018
|
function injectCentralStatusCardStyles() {
|
|
178034
179019
|
if (typeof document === "undefined") return;
|
|
178035
|
-
if (document.getElementById(
|
|
179020
|
+
if (document.getElementById(STYLE_ID22)) return;
|
|
178036
179021
|
const tag = document.createElement("style");
|
|
178037
|
-
tag.id =
|
|
179022
|
+
tag.id = STYLE_ID22;
|
|
178038
179023
|
tag.textContent = CSS5;
|
|
178039
179024
|
document.head.appendChild(tag);
|
|
178040
179025
|
}
|
|
@@ -178094,7 +179079,7 @@ function deriveCentralConnectivity(ev, opts) {
|
|
|
178094
179079
|
}
|
|
178095
179080
|
|
|
178096
179081
|
// src/components/cards/central-status/v1.0.0/TimelineModal.ts
|
|
178097
|
-
var
|
|
179082
|
+
var STYLE_ID23 = "myio-cscard-timeline-styles";
|
|
178098
179083
|
var DEFAULT_PERIODS = [1, 7, 30, 90];
|
|
178099
179084
|
function escAttr5(s) {
|
|
178100
179085
|
return String(s ?? "").replace(
|
|
@@ -178103,9 +179088,9 @@ function escAttr5(s) {
|
|
|
178103
179088
|
);
|
|
178104
179089
|
}
|
|
178105
179090
|
function injectTimelineModalStyles() {
|
|
178106
|
-
if (typeof document === "undefined" || document.getElementById(
|
|
179091
|
+
if (typeof document === "undefined" || document.getElementById(STYLE_ID23)) return;
|
|
178107
179092
|
const tag = document.createElement("style");
|
|
178108
|
-
tag.id =
|
|
179093
|
+
tag.id = STYLE_ID23;
|
|
178109
179094
|
tag.textContent = `
|
|
178110
179095
|
.myio-tlmodal{
|
|
178111
179096
|
--tl-online:#3b82f6;
|
|
@@ -179400,7 +180385,13 @@ var version = package_default.version || "0.0.0";
|
|
|
179400
180385
|
MEASUREMENT_DOMAIN_CONFIG,
|
|
179401
180386
|
MENU_SHOPPING_CSS_PREFIX,
|
|
179402
180387
|
METRO_TILE_COLORS,
|
|
180388
|
+
MONEY_CONVERTIBLE_GROUPS,
|
|
179403
180389
|
MONEY_DASH,
|
|
180390
|
+
MONEY_ESTIMATE_LABEL,
|
|
180391
|
+
MONEY_HOURLY_MAX_DAYS,
|
|
180392
|
+
MONEY_INCOMPLETE_LABEL,
|
|
180393
|
+
MONEY_MAX_SEGMENT_FETCHES,
|
|
180394
|
+
MONEY_REPORT_HEADER,
|
|
179404
180395
|
MONEY_REQUIRES_DEVICE_GRANULARITY,
|
|
179405
180396
|
MONEY_VARIANCE_HEADER,
|
|
179406
180397
|
MOTOR_SORT_OPTIONS,
|
|
@@ -179482,6 +180473,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179482
180473
|
SolenoidControlView,
|
|
179483
180474
|
SwitchControlController,
|
|
179484
180475
|
SwitchControlView,
|
|
180476
|
+
TARIFF_DEFAULT_TIMEZONE,
|
|
179485
180477
|
TELEMETRY_CONTEXT_CONFIG,
|
|
179486
180478
|
TELEMETRY_DEFAULT_FILTER_TABS,
|
|
179487
180479
|
TELEMETRY_DOMAIN_CONFIG,
|
|
@@ -179502,6 +180494,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179502
180494
|
TempSensorSummaryTooltip,
|
|
179503
180495
|
Temperature,
|
|
179504
180496
|
UsersSummaryTooltip,
|
|
180497
|
+
VALUE_DISPLAY_MODE_STORAGE_PREFIX,
|
|
179505
180498
|
VALVE_STATE_KEYS,
|
|
179506
180499
|
VARIANCE_LABEL_ABOVE,
|
|
179507
180500
|
VARIANCE_LABEL_BELOW,
|
|
@@ -179549,9 +180542,12 @@ var version = package_default.version || "0.0.0";
|
|
|
179549
180542
|
buildFinancialRowHTML,
|
|
179550
180543
|
buildGcdrEnergyRoot,
|
|
179551
180544
|
buildListItemsThingsboardByUniqueDatasource,
|
|
180545
|
+
buildMoneyChipHTML,
|
|
180546
|
+
buildMoneyCoverageMarkerHTML,
|
|
179552
180547
|
buildMoneyVarianceHTML,
|
|
179553
180548
|
buildMyioIngestionAuth,
|
|
179554
180549
|
buildReportItemsList,
|
|
180550
|
+
buildReportMoneyConfig,
|
|
179555
180551
|
buildTemplateCsv,
|
|
179556
180552
|
buildTemplateExport,
|
|
179557
180553
|
buildTicketServiceOrchestrator,
|
|
@@ -179686,6 +180682,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179686
180682
|
createSwitchControl,
|
|
179687
180683
|
createTariffApiAdapter,
|
|
179688
180684
|
createTariffApiClient,
|
|
180685
|
+
createTariffValuator,
|
|
179689
180686
|
createTbEnvelopeStore,
|
|
179690
180687
|
createTelemetryGridComponent,
|
|
179691
180688
|
createTelemetryGridShoppingComponent,
|
|
@@ -179775,6 +180772,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179775
180772
|
formatDuration,
|
|
179776
180773
|
formatEnergy,
|
|
179777
180774
|
formatHours,
|
|
180775
|
+
formatItemMoney,
|
|
179778
180776
|
formatMoneyBRL,
|
|
179779
180777
|
formatNumberReadable,
|
|
179780
180778
|
formatPower,
|
|
@@ -179915,6 +180913,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179915
180913
|
isInRange,
|
|
179916
180914
|
isLeapYear,
|
|
179917
180915
|
isMoneyColumnConfident,
|
|
180916
|
+
isMoneyConvertibleGroup,
|
|
179918
180917
|
isMyioGcdrLoginModalOpen,
|
|
179919
180918
|
isOnOffDeviceProfile,
|
|
179920
180919
|
isSolenoidDevice,
|
|
@@ -179939,6 +180938,9 @@ var version = package_default.version || "0.0.0";
|
|
|
179939
180938
|
metasGuideComputeChips,
|
|
179940
180939
|
metasGuideDeriveTotal,
|
|
179941
180940
|
minutesToMs,
|
|
180941
|
+
moneyCoverageTitle,
|
|
180942
|
+
moneyReasonText,
|
|
180943
|
+
moneyStateChipLabel,
|
|
179942
180944
|
msToMinutes,
|
|
179943
180945
|
myioExportData,
|
|
179944
180946
|
nextManualSeq,
|
|
@@ -179977,6 +180979,7 @@ var version = package_default.version || "0.0.0";
|
|
|
179977
180979
|
openGatewayModal,
|
|
179978
180980
|
openGenericModal,
|
|
179979
180981
|
openGoalsPanel,
|
|
180982
|
+
openGoalsTariffsHub,
|
|
179980
180983
|
openHelpModal,
|
|
179981
180984
|
openIntegrationsModal,
|
|
179982
180985
|
openManualDeviceModal,
|
|
@@ -180013,10 +181016,12 @@ var version = package_default.version || "0.0.0";
|
|
|
180013
181016
|
parseGcdrEntityForest,
|
|
180014
181017
|
parseInputDateToDate,
|
|
180015
181018
|
parseLogAnnotations,
|
|
181019
|
+
parseMoneyCategoryRule,
|
|
180016
181020
|
periodKey,
|
|
180017
181021
|
pickUniqueCustomerCode,
|
|
180018
181022
|
pumpHistoryFromConsumption,
|
|
180019
181023
|
readFreshdeskTicketsFromTB,
|
|
181024
|
+
readValueDisplayMode,
|
|
180020
181025
|
recalculateDeviceStatus,
|
|
180021
181026
|
recomputeDeviceGridPercentages,
|
|
180022
181027
|
refreshAlarmBadges,
|
|
@@ -180060,15 +181065,18 @@ var version = package_default.version || "0.0.0";
|
|
|
180060
181065
|
resolveBudget,
|
|
180061
181066
|
resolveCategory,
|
|
180062
181067
|
resolveClassification,
|
|
181068
|
+
resolveEffectiveDisplayMode,
|
|
180063
181069
|
resolveGoalAmount,
|
|
180064
181070
|
resolveGroup,
|
|
180065
181071
|
resolveManualDeviceName,
|
|
181072
|
+
resolveMoneyCategory,
|
|
180066
181073
|
resolveMoneyRollout,
|
|
180067
181074
|
resolveMoneyRowValues,
|
|
180068
181075
|
resolvePercentDecimals,
|
|
180069
181076
|
resolveReportItemStates,
|
|
180070
181077
|
resolveSubcategory,
|
|
180071
181078
|
resolveWithFallback,
|
|
181079
|
+
roundMoney2,
|
|
180072
181080
|
routeMoneyRender,
|
|
180073
181081
|
rowsFromTable,
|
|
180074
181082
|
schedCreateDateInput,
|
|
@@ -180090,6 +181098,7 @@ var version = package_default.version || "0.0.0";
|
|
|
180090
181098
|
sortDeviceGridDevices,
|
|
180091
181099
|
strings,
|
|
180092
181100
|
subtractDecimals,
|
|
181101
|
+
sumItemMoney,
|
|
180093
181102
|
sumMoneyDecimals,
|
|
180094
181103
|
summaryDeviceToTotalsRow,
|
|
180095
181104
|
summaryLastReadingTs,
|
|
@@ -180104,6 +181113,7 @@ var version = package_default.version || "0.0.0";
|
|
|
180104
181113
|
toCSV,
|
|
180105
181114
|
toFixedSafe,
|
|
180106
181115
|
toFreshdeskTicketSummary,
|
|
181116
|
+
toItemMoney,
|
|
180107
181117
|
truncateAnnotationText,
|
|
180108
181118
|
updateDeviceGridStats,
|
|
180109
181119
|
updateFreshdeskTicket,
|
|
@@ -180113,11 +181123,14 @@ var version = package_default.version || "0.0.0";
|
|
|
180113
181123
|
validateDeviceProductName,
|
|
180114
181124
|
validateProfile,
|
|
180115
181125
|
validateTree,
|
|
181126
|
+
valuateDomainMoney,
|
|
181127
|
+
valueDisplayModeStorageKey,
|
|
180116
181128
|
valveHistoryFromTelemetry,
|
|
180117
181129
|
version,
|
|
180118
181130
|
waterDeviceStatusIcons,
|
|
180119
181131
|
wireCategoryToPanel,
|
|
180120
181132
|
wireDomainToPanel,
|
|
180121
181133
|
writeFreshdeskSyncedAtToTB,
|
|
180122
|
-
writeFreshdeskTicketsToTB
|
|
181134
|
+
writeFreshdeskTicketsToTB,
|
|
181135
|
+
writeValueDisplayMode
|
|
180123
181136
|
});
|