uprava adutiu - nacitani dalsich registru, uprava ekonomiky
Some checks failed
deploy / deploy (push) Failing after 1m15s
test / smoke-test (push) Successful in 2s

This commit is contained in:
Dusan Vojacek
2026-04-10 21:53:32 +02:00
parent 25090a9d95
commit 806274cf59
9 changed files with 440 additions and 130 deletions

View File

@@ -143,6 +143,7 @@ function DailyRow({
onToggle: () => void
onLockToggle: () => void
}) {
const colCount = hasGreenBonus ? 13 : 12
return (
<>
<tr
@@ -157,9 +158,17 @@ function DailyRow({
</td>
<td className="px-3 py-2 text-right text-sm">{kwh(row.import_kwh)}</td>
<td className="px-3 py-2 text-right text-sm">{kwh(row.export_kwh)}</td>
<td className="px-3 py-2 text-right text-sm text-slate-400">{kwh(row.self_consumption_kwh)}</td>
<td className="px-3 py-2 text-right text-sm text-red-400">{row.import_cost_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-green-400">{row.export_revenue_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-slate-400">{kwh(row.pv_self_consumption_kwh)}</td>
<td className="px-3 py-2 text-right text-sm text-red-400">{row.grid_import_cashflow_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-green-400">{row.grid_export_revenue_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-red-300">{row.import_cost_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-green-300">{row.export_revenue_czk.toFixed(2)}</td>
<td className="px-3 py-2 text-right text-sm text-slate-400">
{row.planned_balance_czk != null ? czk(row.planned_balance_czk) : ''}
</td>
<td className={`px-3 py-2 text-right text-sm ${row.deviation_cost_czk != null ? balanceColor(-row.deviation_cost_czk) : ''}`}>
{row.deviation_cost_czk != null ? czk(row.deviation_cost_czk) : ''}
</td>
{hasGreenBonus && (
<td className="px-3 py-2 text-right text-sm text-amber-400">
{row.green_bonus_czk > 0 ? row.green_bonus_czk.toFixed(2) : ''}
@@ -168,12 +177,6 @@ function DailyRow({
<td className={`px-3 py-2 text-right text-sm font-semibold ${balanceColor(row.total_balance_czk)}`}>
{czk(row.total_balance_czk)}
</td>
<td className="px-3 py-2 text-right text-sm text-slate-400">
{row.planned_balance_czk != null ? czk(row.planned_balance_czk) : ''}
</td>
<td className={`px-3 py-2 text-right text-sm ${row.deviation_cost_czk != null ? balanceColor(-row.deviation_cost_czk) : ''}`}>
{row.deviation_cost_czk != null ? czk(row.deviation_cost_czk) : ''}
</td>
<td className="px-2 py-2 text-center">
<button
onClick={(e) => {
@@ -193,7 +196,7 @@ function DailyRow({
</tr>
{expanded && (
<tr>
<td colSpan={hasGreenBonus ? 11 : 10} className="bg-slate-900/50 px-4 py-2">
<td colSpan={colCount} className="bg-slate-900/50 px-4 py-2">
<IntervalDetail siteId={siteId} day={row.day} hasGreenBonus={hasGreenBonus} />
</td>
</tr>
@@ -217,6 +220,8 @@ export default function Economics() {
return {
import_cost: days.reduce((s, d) => s + d.import_cost_czk, 0),
export_revenue: days.reduce((s, d) => s + d.export_revenue_czk, 0),
grid_import_cashflow: days.reduce((s, d) => s + d.grid_import_cashflow_czk, 0),
grid_export_revenue: days.reduce((s, d) => s + d.grid_export_revenue_czk, 0),
green_bonus: days.reduce((s, d) => s + d.green_bonus_czk, 0),
total_balance: days.reduce((s, d) => s + d.total_balance_czk, 0),
}
@@ -277,14 +282,22 @@ export default function Economics() {
{/* Summary cards */}
{summary && (
<div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6">
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
<p className="text-xs text-slate-400">Nákup celkem</p>
<p className="mt-1 text-lg font-semibold text-red-400">{summary.import_cost.toFixed(2)} </p>
<p className="text-xs text-slate-400">Nákup ze sítě</p>
<p className="mt-1 text-lg font-semibold text-red-400">{summary.grid_import_cashflow.toFixed(2)} </p>
</div>
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
<p className="text-xs text-slate-400">Prodej celkem</p>
<p className="mt-1 text-lg font-semibold text-green-400">{summary.export_revenue.toFixed(2)} </p>
<p className="text-xs text-slate-400">Prodej do sítě</p>
<p className="mt-1 text-lg font-semibold text-green-400">{summary.grid_export_revenue.toFixed(2)} </p>
</div>
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
<p className="text-xs text-slate-400">Náklad celkem</p>
<p className="mt-1 text-lg font-semibold text-red-300">{summary.import_cost.toFixed(2)} </p>
</div>
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
<p className="text-xs text-slate-400">Příjem celkem</p>
<p className="mt-1 text-lg font-semibold text-green-300">{summary.export_revenue.toFixed(2)} </p>
</div>
{hasGreenBonus && (
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
@@ -304,9 +317,9 @@ export default function Economics() {
{/* Chart */}
<div className="rounded-xl border border-slate-800 bg-slate-900 p-4">
<h2 className="mb-3 text-sm font-medium text-slate-300">
Denní bilance + kumulativ od 1. v měsíci
Denní bilance (síť + bonus) a kumulativ
</h2>
<EconomicsChart points={points} />
<EconomicsChart points={points} hasGreenBonus={hasGreenBonus} />
</div>
{/* Daily table */}
@@ -348,13 +361,15 @@ export default function Economics() {
<th className="px-3 py-2 text-left">Den</th>
<th className="px-3 py-2 text-right">Import kWh</th>
<th className="px-3 py-2 text-right">Export kWh</th>
<th className="px-3 py-2 text-right">Vl. spotřeba</th>
<th className="px-3 py-2 text-right">FVE vl. spot.</th>
<th className="px-3 py-2 text-right">Nákup ze sítě</th>
<th className="px-3 py-2 text-right">Prodej do sítě</th>
<th className="px-3 py-2 text-right">Náklad </th>
<th className="px-3 py-2 text-right">Příjem </th>
{hasGreenBonus && <th className="px-3 py-2 text-right">Bonus </th>}
<th className="px-3 py-2 text-right">Bilance </th>
<th className="px-3 py-2 text-right">Plán </th>
<th className="px-3 py-2 text-right">Odchylka </th>
{hasGreenBonus && <th className="px-3 py-2 text-right">Bonus </th>}
<th className="px-3 py-2 text-right">Bilance </th>
<th className="w-10 px-2 py-2 text-center" />
</tr>
</thead>