Skip to content

Commit

Permalink
Eigene Strompreise + Status Energiewerte: Mobile Ansicht
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenoF54 committed Jan 28, 2025
1 parent 3945460 commit 7aa1056
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 38 deletions.
22 changes: 21 additions & 1 deletion css/optionsPages.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#customEnergyValues {
#customEnergyValues,
#customEnergyPrices,
#hourlyEnergy {
width: 100% !important;
table-layout: auto !important;
font-family: Arial, sans-serif;
Expand All @@ -13,3 +15,21 @@
font-family: Arial, sans-serif !important;
font-size: 0.75rem !important;
}

#customEnergyPrices_info,
#customEnergyPrices_paginate .dt-paging-button,
.dt-length,
.dt-search,
.dt-paging {
font-family: Arial, sans-serif !important;
font-size: 0.75rem !important;
}

#hourlyEnergy_info,
#hourlyEnergy_paginate .dt-paging-button,
.dt-length,
.dt-search,
.dt-paging {
font-family: Arial, sans-serif !important;
font-size: 0.75rem !important;
}
2 changes: 1 addition & 1 deletion customEnergyPrices.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
$pageTitle = "Eigene Preisdaten";
$jsHeaderFiles = ["/js/utils.js"];
$jsFooterFiles = ["/js/custom-price-values/documentReady.js"];
$cssFiles = [];
$cssFiles = ["/css/optionsPages.css"];
$jsVars = [];

$partialTop = "views/pages/custom-price-values/inputform.phtml";
Expand Down
4 changes: 2 additions & 2 deletions js/custom-price-values/documentReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $(document).ready(function() {
});

// Sort + Filter table
$('#customEnergyValues').DataTable({
$('#customEnergyPrices').DataTable({
"paging": true,
"searching": true,
"ordering": true,
Expand All @@ -43,7 +43,7 @@ $(document).ready(function() {
[0, 'asc']
],
"pageLength": 25,
"responsive": true,
"responsive": false,
"columnDefs": [{
"targets": 0,
"orderDataType": "dom-text", // Sort for "data-sort"-Attribute
Expand Down
6 changes: 4 additions & 2 deletions lib/utils/htmlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ public static function renderPopoverFailureTemplate(MissingRowSet $missingRowSet
</div>
<?php } ?>
<div class="d-flex justify-content-between mb-2">
<div class="me-3 text-success"><strong>Zeilen<br/>gesamt</strong></div>
<div class="me-1 text-success"><?=($missingRowSet->getCountRows() == 0 ? '/' : StringHelper::formatIntNumber($missingRowSet->getCountRows()))?></div>
<div class="me-3 text-success">
<?=($missingRowSet->getCountRows() == 0 ? '/' : StringHelper::formatIntNumber($missingRowSet->getCountRows()))?>
Zeilen im Zeitraum vorhanden
</div>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/timeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public static function convertSecondsToLabel($val, $prefixSingle="", $prefixMult
return $val . ($val == 1 ? "Sekunde" : " Sekunden");
}

public static function formatDate($mysqlDate)
{
return date("d.m.Y", strtotime($mysqlDate));
public static function formatDate($mysqlDate, $smallYear = false)
{
return $smallYear ? date("d.m.y", strtotime($mysqlDate)) : date("d.m.Y", strtotime($mysqlDate));
}

public static function formatMonthNameAndYear($mysqlDate, $monthNameShort = true)
Expand Down
2 changes: 1 addition & 1 deletion statusEnergyValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$pageTitle = "Status Übersichtsseiten";
$jsHeaderFiles = ["/js/utils.js", "/js/status-energy-values/documentReady.js"];
$jsFooterFiles = [];
$cssFiles = [];
$cssFiles = ["/css/optionsPages.css"];
$jsVars = [
"API_KEY" => json_encode(API_KEY)
];
Expand Down
1 change: 0 additions & 1 deletion views/pages/custom-energy-values/inputform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<button type="submit" class="btn btn-sm btn-primary">Speichern</button>
</div>
</div>

</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/pages/custom-energy-values/values-list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</tr>
<tr>
<th class="table-active"></th>
<th class="table-active">(kWh)</th>
<th class="table-active"><span class="d-none d-md-inline">(kWh)</span></th>
<th class="table-active"><span class="d-none d-xl-inline">Phase 1</span><span class="d-inline d-xl-none">P1</span></th>
<th class="table-active"><span class="d-none d-xl-inline">Phase 2</span><span class="d-inline d-xl-none">P2</span></th>
<th class="table-active"><span class="d-none d-xl-inline">Phase 3</span><span class="d-inline d-xl-none">P3</span></th>
Expand Down
8 changes: 4 additions & 4 deletions views/pages/custom-price-values/inputform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="p-3" style="background-color: #f8f9fa; border-radius: 8px; max-width: 800px; width: 100%;">
<?php $textTooltip = "Hier können eigene Preisdaten für einen einzelnen Tag oder Monat bearbeitet werden."; ?>
<?php $textTooltip .= "<br>Die Preisdaten werden als Basis für die anderen Seite benutzt und bestehende Werte werden überschrieben."; ?>
<h6 class="text-start text-secondary mb-3"><?=$pageTitle?>: Daten bearbeiten
<h6 class="text-start text-secondary mb-3"><?=$pageTitle?>: <span class="d-none d-md-inline">Daten bearbeiten</span>
<i class="bi bi-info-circle text-primary ms-1" data-bs-toggle="tooltip" data-bs-html="true" title="<?=$textTooltip?>"></i></h6>

<form method="post" action="" id="editform">
Expand All @@ -27,13 +27,13 @@

<!-- purchase price -->
<div class="col-md-3 col-sm-12 align-top">
<label for="price" class="form-label small fw-bold">Einkaufspreis (Ct / kWh)</label>
<label for="price" class="form-label small fw-bold"><span class="d-sm-none d-md-none d-lg-none d-xl-inline">Einkaufspreis</span><span class="d-none d-sm-inline d-md-inline d-lg-inline d-xl-none">Eink.</span> (Ct / kWh)</label>
<input type="number" class="form-control form-control-sm" id="outCentPricePerKwh" name="outCentPricePerKwh" step="0.01" min="0" value="<?=isset($outCentPricePerKwh) ? $outCentPricePerKwh : ""?>" required>
</div>

<!-- sell price -->
<div class="col-md-3 col-sm-12 align-top">
<label for="price" class="form-label small fw-bold">Einspeisepreis (Ct / kWh)</label>
<label for="price" class="form-label small fw-bold"><span class="d-sm-none d-md-none d-lg-none d-xl-inline">Einspeisepreis</span><span class="d-none d-sm-inline d-md-inline d-lg-inline d-xl-none">Einsp.</span> (Ct / kWh)</label>
<input type="number" class="form-control form-control-sm" id="inCentPricePerKwh" name="inCentPricePerKwh" step="0.01" min="0" value="<?=isset($inCentPricePerKwh) ? $inCentPricePerKwh : ""?>" required>
</div>

Expand All @@ -47,7 +47,7 @@

<!-- Save Button -->
<button type="submit" class="btn btn-primary btn-lg" style="border-radius: 8px; font-size: 16px;">
<i class="bi bi-save me-1"></i> Speichern
<i class="bi bi-save me-1"></i> <span class="small m-0 d-none d-xl-inline">Speichern</span>
</button>
</div>
</div>
Expand Down
32 changes: 19 additions & 13 deletions views/pages/custom-price-values/values-list.phtml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<div class="container mt-4">
<h6 class="text-start text-secondary mb-3">Eingegebene Werte</h6>
<table class="table table-bordered table-hover" id="customEnergyValues">
<table class="table table-bordered table-hover" id="customEnergyPrices">
<thead class="thead-light">
<tr>
<th class="table-active">Datum von</th>
<th class="table-active">Datum bis</th>
<th class="table-active">Einkaufspreis</th>
<th class="table-active">Einspeisepreis</th>
<th class="table-active"><span class="d-none d-xl-inline">Datum von</span><span class="d-inline d-xl-none">Von</span></th>
<th class="table-active"><span class="d-none d-xl-inline">Datum bis</span><span class="d-inline d-xl-none">Bis</span></th>
<th class="table-active">
<span class="d-none d-md-inline">Einkaufspreis</span><span class="d-inline d-md-none">Eink.</span>
</th>
<th class="table-active">
<span class="d-none d-md-inline">Einspeisepreis</span><span class="d-inline d-md-none">Einsp.</span>
</th>
<th class="table-active">Aktionen</th>
</tr>
<tr>
<th class="table-active"></th>
<th class="table-active"></th>
<th class="table-active">(Ct / kWh)</th>
<th class="table-active">(Ct / kWh)</th>
<th class="table-active"></th>
<th class="table-active"><span class="d-none d-xl-inline">(Ct / kWh)</span></th>
<th class="table-active"><span class="d-none d-xl-inline">(Ct / kWh)</span></th>
<th class="table-active" data-priority="2"></th>
</tr>
</thead>
<tbody>
<?php foreach($customDataList as $customData) {
$timestampFromHtml = TimeHelper::formatDate($customData->getTimestampFrom());
$timestampFromHtmlSmall = TimeHelper::formatDate($customData->getTimestampFrom(), true);
$timestampToHtml = TimeHelper::formatDate($customData->getTimestampTo());
$timestampToHtmlSmall = TimeHelper::formatDate($customData->getTimestampTo(), true);
?>
<tr
data-price-row-id="<?=$customData->getId()?>"
Expand All @@ -31,17 +37,17 @@
data-out-cent-price-per-watt-hour="<?= $customData->getOutCentPricePerWh() ?>"
data-in-cent-price-per-watt-hour="<?= $customData->getInCentPricePerWh() ?>"
>
<td data-sort="<?=$timestampDataRow?>"><?=$timestampFromHtml?></td>
<td data-sort="<?=$timestampDataRow?>"><?=$timestampToHtml?></td>
<td data-sort="<?=$timestampDataRow?>"><span class="d-none d-sm-inline"><?=$timestampFromHtml?></span><span class="d-inline d-sm-none"><?=$timestampFromHtmlSmall?></span></td>
<td data-sort="<?=$timestampDataRow?>"><span class="d-none d-sm-inline"><?=$timestampToHtml?></span><span class="d-inline d-sm-none"><?=$timestampToHtmlSmall?></span></td>
<td class="text-end"><?=StringHelper::formatNumber($customData->getOutCentPricePerWh() * 1000, 8)?></td>
<td class="text-end"><?=StringHelper::formatNumber($customData->getInCentPricePerWh() * 1000, 8)?></td>
<td>
<td class="text-nowrap">
<?php if ($customData->isCustomValue()) { ?>
<button class="btn btn-sm btn-primary edit-btn" title="Bearbeiten">
<i class="bi bi-pencil-square"></i> Bearbeiten
<i class="bi bi-pencil-square"></i> <span class="small m-0 d-none d-md-inline">Bearbeiten</span>
</button>
<button class="btn btn-sm btn-danger delete-btn" title="Löschen">
<i class="bi bi-trash"></i> Löschen
<i class="bi bi-trash"></i> <span class="small m-0 d-none d-md-inline">Löschen</span>
</button>
<?php } ?>
</td>
Expand Down
19 changes: 10 additions & 9 deletions views/pages/status-energy-values/values-list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
<?php $textTooltip="Die Übersichtsseiten zeigen aufaddierte Werte der Echtzeitdaten, soweit vorhanden und manuell eingebenene Werte an. Vorhandende Lücken werden hier angezeigt." ?>
<i class="bi bi-info-circle text-primary ms-1" data-bs-toggle="tooltip" data-bs-html="true" title="<?=$textTooltip?>"></i>
</h6>
<div class="text-start text-muted small">
Zeitraum vorhandender Echtzeitdaten: <?=date("d.m.Y H:i:s", strtotime($realtimeEnergyStats->getFirstRowDate()))?> bis <?=date("d.m.Y H:i:s", strtotime($realtimeEnergyStats->getLastRowDate()))?>
<div class="text-start text-muted small mb-3">
Echtzeitdaten <span class="d-none d-md-inline">vorhanden</span> vom:
<?=date("d.m.Y H:i:s", strtotime($realtimeEnergyStats->getFirstRowDate()))?><br class="d-sm-inline d-md-none"> bis <?=date("d.m.Y H:i:s", strtotime($realtimeEnergyStats->getLastRowDate()))?>
&nbsp;
<button class="btn btn-sm btn-primary recalculate-btn" title="Letzten Tag neu berechnen">
<i class="bi bi-pencil-square"></i> Letzten Tag neu berechnen
<button class="btn btn-sm btn-primary recalculate-btn mt-1" title="Letzten Tag neu berechnen">
<i class="bi bi-circle"></i> Letzten Tag neu berechnen
</button>
</div>
<table class="table table-sm table-bordered table-hover" id="hourlyEnergy">
<thead class="thead-light">
<tr>
<th class="table-active">Datum von</th>
<th class="table-active">Datum bis</th>
<th class="table-active">Lücke in Minuten</th>
<th class="table-active"><span class="d-none d-md-inline">Datum von</span><span class="d-inline d-md-none">Von</span></th>
<th class="table-active"><span class="d-none d-md-inline">Datum bis</span><span class="d-inline d-md-none">Bis</span></th>
<th class="table-active"><span class="d-none d-md-inline">Lücke in Minuten</span><span class="d-inline d-md-none">Lücke</span></th>
<th class="table-active">Aktionen</th>
</tr>
</thead>
Expand All @@ -33,11 +34,11 @@
<?php $textTooltip="In einigen Fällen kann es helfen die Daten des Monats neu zu berechnen. Andernfalls scheint es keine Echtzeitdaten für diesen Zeitraum zu geben und es gibt keine Möglichkeit diese Lücke zu schließen." ?>
<i class="bi bi-info-circle text-primary ms-1" data-bs-toggle="tooltip" data-bs-html="true" title="<?=$textTooltip?>"></i>
<button class="btn btn-sm btn-primary recalculate-btn" title="Neu berechnen">
<i class="bi bi-pencil-square"></i> Neu berechnen
<i class="bi bi-circle"></i> Neu <span class="d-none d-md-inline">berechnen</span>
</button>
<?php else: ?>
<a href="customEnergyValues.php" class="btn btn-sm btn-primary" title="Manuell eingeben">
<i class="bi bi-pencil-square"></i> Manuell eingeben
<i class="bi bi-pencil-square"></i> Manuell <span class="d-none d-md-inline">eingeben</span>
</a>
<?php endif; ?>
</td>
Expand Down

0 comments on commit 7aa1056

Please sign in to comment.