Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
>
<i class="fa-solid fa-coins" />
</a>
<a
class="nav-link"
data-bs-toggle="tab"
:data-bs-target="'#timedSettings' + cpid"
>
<i class="fa-solid fa-clock" />
</a>
<!-- <a
class="nav-link"
data-bs-toggle="tab"
Expand Down Expand Up @@ -114,7 +121,7 @@
>
<CPConfigScheduled
v-if="chargeTemplate != undefined"
:charge-template-id="cp.chargeTemplate?.id ?? 0"
:charge-point="cp"
/>
</div>
<div
Expand All @@ -125,6 +132,14 @@
>
<CPConfigEco v-if="chargeTemplate != undefined" :chargepoint="cp" />
</div>
<div
:id="'timedSettings' + cpid"
class="tab-pane"
role="tabpanel"
aria-labelledby="scheduled-tab"
>
<CPConfigTimed v-if="chargeTemplate != undefined" :charge-point="cp" />
</div>

<!-- <div
:id="'carSettings' + cpid"
Expand Down Expand Up @@ -159,11 +174,9 @@ import ConfigItem from '../../shared/ConfigItem.vue'
import CPConfigInstant from './CPConfigInstant.vue'
import CPConfigPv from './CPConfigPv.vue'
import CPConfigScheduled from './CPConfigScheduled.vue'
import CPConfigTimed from './CPConfigTimed.vue'
import CPConfigEco from './CPConfigEco.vue'
//import CPConfigVehicle from './CPConfigVehicle.vue'
import CPChargeConfig from './CPChargeConfig.vue'
//import PriceChart from '@/components/priceChart/PriceChart.vue'
// import { etData } from '@/components/priceChart/model'
const props = defineProps<{
chargepoint: ChargePoint
}>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<template>
<p class="heading ms-1 pt-2">Zielladen:</p>
<table class="table table-borderless">
<p class="heading ms-1 pt-2">Pläne für Zielladen:</p>
<table v-if="plans.length > 0" class="table table-borderless">
<thead>
<tr>
<th class="tableheader">Ziel</th>
<th class="tableheader">Limit</th>
<th class="tableheader left" />
<th class="tableheader left">Plan</th>
<th class="tableheader">Zeit</th>
<th class="tableheader">Wiederholung</th>
<th class="tableheader" />
<th class="tableheader">Ziel</th>
<th class="tableheader">Wiederh.</th>

<th class="tableheader right" />
</tr>
</thead>
<tbody>
<tr v-for="(plan, i) in plans" :key="i" :style="cellStyle(i)">
<td class="tablecell">{{ plan.limit.soc_scheduled }}%</td>
<td class="tablecell">{{ plan.limit.soc_limit }}%</td>
<td class="tablecell">
{{ timeString(i) }}
</td>
<td class="tablecell">
{{ freqNames[plan.frequency.selected] }}
</td>
<tr
v-for="(plan, i) in plans"
:key="i"
:class="plan.active ? 'text-bold' : 'text-normal'"
>
<td class="tablecell left">
<a
:href="
'../../settings/#/VehicleConfiguration/charge_template/' +
props.chargeTemplateId
"
v-if="props.chargePoint.chargeTemplate?.id != undefined"
@click="toggleSwitch(i)"
>
<span
:class="plan.active ? 'fa-toggle-on' : 'fa-toggle-off'"
Expand All @@ -36,32 +32,68 @@
</span
></a>
</td>
<td class="tablecell left">{{ plan.name }}</td>
<td class="tablecell">
{{ timeString(i) }}
</td>
<td class="tablecell">
{{
plan.limit.selected == 'soc'
? plan.limit.soc_scheduled + '%'
: formatWattH(plan.limit.amount, 0)
}}
</td>
<td class="tablecell">
{{ freqNames[plan.frequency.selected] }}
</td>

<td class="tablecell right">
<i
class="me-1 fa-solid fa-sm fa-circle-info"
@click="showPlanDetails = !showPlanDetails"
/>
</td>
</tr>
</tbody>
</table>
<p v-else class="ms-1">
Pläne für das Zielladen können in den Einstellungen des Ladeprofils angelegt
werden .
</p>

<div v-if="showPlanDetails">
<ScheduleDetails
v-for="plan in plans"
:key="plan.id"
:plan="plan"
@close="showPlanDetails = false"
/>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { scheduledChargingPlans, type ChargeSchedule } from '../model'
import { computed, ref } from 'vue'
import { ChargePoint, type ChargeSchedule } from '../model'
import { updateChargeTemplate } from '@/assets/js/sendMessages'
import ScheduleDetails from './ScheduleDetails.vue'
import { formatWattH } from '@/assets/js/helpers'

const showPlanDetails = ref(false)
const freqNames: { [key: string]: string } = {
daily: 'Täglich',
once: 'Einmal',
weekly: 'Wöchentlich',
weekly: 'Woche',
}
const props = defineProps<{
chargeTemplateId: number
chargePoint: ChargePoint
}>()

//computed
const plans = computed(() => {
let result: ChargeSchedule[] = []
if (scheduledChargingPlans[props.chargeTemplateId]) {
result = Object.values(scheduledChargingPlans[props.chargeTemplateId])
}
return result
})
const plans = computed(
() =>
props.chargePoint?.chargeTemplate?.chargemode.scheduled_charging.plans ??
([] as ChargeSchedule[]),
)
//methods
function timeString(key: number) {
return plans.value[key].time
Expand All @@ -72,9 +104,11 @@ function switchStyle(key: number) {
: 'var(--color-switchRed)'
return { color: style }
}
function cellStyle(key: number) {
const style = plans.value[key].active ? 'bold' : 'regular'
return { 'font-weight': style }
function toggleSwitch(i: number) {
props.chargePoint.chargeTemplate!.chargemode.scheduled_charging.plans[
i
]!.active = !plans.value[i].active
updateChargeTemplate(props.chargePoint.id)
}
</script>

Expand All @@ -83,7 +117,7 @@ function cellStyle(key: number) {
color: var(--color-fg);
background-color: var(--color-bg);
text-align: center;
font-size: var(--font-medium);
font-size: var(--font-settings);
}

.tableheader {
Expand All @@ -101,4 +135,14 @@ function cellStyle(key: number) {
.left {
text-align: left;
}
.text-bold {
font-weight: bold;
}
.text-normal {
font-weight: normal;
}
.fa-circle-info {
color: var(--color-charging);
cursor: pointer;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
<template>
<ConfigItem title="Zeitplan aktiv" icon="fa-clock" :fullwidth="true">
<template #inline-item>
<SwitchInput v-model="cp.timedCharging" />
</template>
</ConfigItem>
<p class="heading ms-1 pt-2">Zeitpläne:</p>
<table class="table table-borderless">
<thead>
<tr>
<th class="tableheader left" />
<th class="tableheader">Von</th>
<th class="tableheader">Bis</th>
<th class="tableheader">Ladestrom</th>
<th class="tableheader">Wiederholung</th>
<th class="tableheader">Strom</th>
<th class="tableheader">Wiederh.</th>
<th class="tableheader right" />
</tr>
</thead>
<tbody>
<tr v-for="(plan, i) in plans" :key="i" :style="cellStyle(i)">
<tr
v-for="(plan, i) in plans"
:key="i"
:class="plan.active ? 'text-bold' : 'text-normal'"
>
<td class="tablecell left">
<span
v-if="props.chargePoint.chargeTemplate?.id != undefined"
@click="toggleSwitch(i)"
>
<span
:class="plan.active ? 'fa-toggle-on' : 'fa-toggle-off'"
:style="switchStyle(i)"
class="fa"
type="button"
>
</span
></span>
</td>
<td class="tablecell">
{{ plan.time[0] }}
</td>
Expand All @@ -22,56 +46,61 @@
<td class="tablecell">
{{ freqNames[plan.frequency.selected] }}
</td>
<td class="tablecell left">
<a
:href="
'../../settings/#/VehicleConfiguration/charge_template/' +
props.chargeTemplateId
"
>
<span
:class="plan.active ? 'fa-toggle-on' : 'fa-toggle-off'"
:style="switchStyle(i)"
class="fa"
type="button"
>
</span
></a>
<td class="tablecell right">
<i
class="me-1 fa-solid fa-sm fa-circle-info"
@click="showPlanDetails = !showPlanDetails"
/>
</td>
</tr>
</tbody>
</table>

<div v-if="showPlanDetails">
<TimePlanDetails
v-for="plan in plans"
:key="plan.id"
:plan="plan"
@close="showPlanDetails = false"
/>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { timeChargingPlans } from '../model'
import { computed, ref } from 'vue'
import { ChargePoint, type ChargeTimePlan } from '../model'
import { updateChargeTemplate } from '@/assets/js/sendMessages'
import TimePlanDetails from './TimePlanDetails.vue'
import SwitchInput from '@/components/shared/SwitchInput.vue'
import ConfigItem from '../../shared/ConfigItem.vue'
const props = defineProps<{
chargePoint: ChargePoint
}>()

const showPlanDetails = ref(false)
const cp = props.chargePoint
const freqNames: { [key: string]: string } = {
daily: 'Täglich',
once: 'Einmal',
weekly: 'Wöchentlich',
weekly: 'Woche',
}
const props = defineProps<{
chargeTemplateId: number
}>()
const plans = computed(() => {
if (timeChargingPlans[props.chargeTemplateId]) {
let result = Object.values(timeChargingPlans[props.chargeTemplateId])
return result ?? []
} else {
return []
}
})

const plans = computed(
() =>
props.chargePoint?.chargeTemplate?.time_charging.plans ??
([] as ChargeTimePlan[]),
)

function switchStyle(key: number) {
const style = plans.value[key].active
? 'var(--color-switchGreen)'
: 'var(--color-switchRed)'
return { color: style }
}
function cellStyle(key: number) {
const style = plans.value[key].active ? 'bold' : 'regular'
return { 'font-weight': style }
function toggleSwitch(i: number) {
props.chargePoint.chargeTemplate!.time_charging.plans[i]!.active =
!plans.value[i].active
updateChargeTemplate(props.chargePoint.id)
}
</script>

Expand All @@ -80,7 +109,7 @@ function cellStyle(key: number) {
color: var(--color-fg);
background-color: var(--color-bg);
text-align: center;
font-size: var(--font-medium);
font-size: var(--font-settings);
}
.tableheader {
color: var(--color-menu);
Expand All @@ -101,4 +130,14 @@ function cellStyle(key: number) {
.right {
text-align: right;
}
.text-bold {
font-weight: bold;
}
.text-normal {
font-weight: normal;
}
.fa-circle-info {
color: var(--color-charging);
cursor: pointer;
}
</style>
Loading
Loading