From e7e7179cd98a42f36f128a5ff0260ac97af8fc5e Mon Sep 17 00:00:00 2001 From: Bluemedia Date: Sun, 27 Apr 2025 13:56:20 +0000 Subject: [PATCH] WIP: Add chargepoint list --- frontend/src/lib/types/chargepoint.ts | 19 ++++ .../routes/(navbar)/chargepoint/+page.svelte | 98 +++++++++++++++++++ frontend/static/locales/de/chargepoint.json | 13 +++ frontend/static/locales/en/chargepoint.json | 13 +++ 4 files changed, 143 insertions(+) create mode 100644 frontend/src/lib/types/chargepoint.ts create mode 100644 frontend/static/locales/de/chargepoint.json create mode 100644 frontend/static/locales/en/chargepoint.json diff --git a/frontend/src/lib/types/chargepoint.ts b/frontend/src/lib/types/chargepoint.ts new file mode 100644 index 0000000..ade067b --- /dev/null +++ b/frontend/src/lib/types/chargepoint.ts @@ -0,0 +1,19 @@ +export type ChargePoint = { + identity: string; + is_active: boolean; + price: number; + id: string; + last_seen: string; + vendor_name: string; + model: string; + serial_number: string, + firmware_version: string; + connectors: [ + { + id: string; + evse: number; + index: number; + status: 'Available' | 'Occupied' | 'Reserved' | 'Unavailable' | 'Faulted' + } + ] +} \ No newline at end of file diff --git a/frontend/src/routes/(navbar)/chargepoint/+page.svelte b/frontend/src/routes/(navbar)/chargepoint/+page.svelte index e69de29..f12908f 100644 --- a/frontend/src/routes/(navbar)/chargepoint/+page.svelte +++ b/frontend/src/routes/(navbar)/chargepoint/+page.svelte @@ -0,0 +1,98 @@ + + +
+

+ {$i18n.t('chargepoint:header')} +

+
+ + + + + + + + + + + + {#if chargepoints.length > 0} + {#each chargepoints as chargepoint} + + + + + + + + {/each} + {/if} + +
{$i18n.t('chargepoint:tableHeader.name')}{$i18n.t('chargepoint:tableHeader.active')}{$i18n.t('chargepoint:tableHeader.lastSeen')}{$i18n.t('chargepoint:tableHeader.price')}
+
+
+

+ {$i18n.t('common:transactionTable.startTime', { + time: transaction.begin, + formatParams: { + time: { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }, + }, + })} +

+

+ {$i18n.t('common:transactionTable.endTime', { + time: transaction.end, + formatParams: { + time: { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }, + }, + })} +

+
+
+
+ + + {transaction.chargepoint.name} + + {transaction.energyAmmount} kWh{transaction.cost} € + + {$i18n.t('common:transactionTable.detailButton')} + + +
+ {#if chargepoints.length === 0} +

+ {$i18n.t('chargepoint:noChargepoints')} +

+ {/if} +
+
+ + + +
+
diff --git a/frontend/static/locales/de/chargepoint.json b/frontend/static/locales/de/chargepoint.json new file mode 100644 index 0000000..4f76841 --- /dev/null +++ b/frontend/static/locales/de/chargepoint.json @@ -0,0 +1,13 @@ +{ + "header": "Ladepunkte", + "tableHeader": { + "name": "Name", + "active": "Aktiv", + "price": "Preis", + "lastSeen": "Zuletzt gesehen" + }, + "tableFormatting": { + "lastSeen": "{{val, relativetime}}" + }, + "noChargepoints": "Noch keine Ladepunkte vorhanden." +} \ No newline at end of file diff --git a/frontend/static/locales/en/chargepoint.json b/frontend/static/locales/en/chargepoint.json new file mode 100644 index 0000000..0bcbf00 --- /dev/null +++ b/frontend/static/locales/en/chargepoint.json @@ -0,0 +1,13 @@ +{ + "header": "Chargepoints", + "tableHeader": { + "name": "Name", + "active": "Active", + "price": "Price", + "lastSeen": "Last seen" + }, + "tableFormatting": { + "lastSeen": "{{val, relativetime}}" + }, + "noChargepoints": "There are no chargepoints yet." +} \ No newline at end of file