2 <h1 id="action">Add Charging Stations</h1>
4 <select :key="state.renderTemplates" v-model="state.template">
5 <option disabled value="">Please select a template</option>
7 v-for="template in $templates.value"
8 v-show="Array.isArray($templates.value) && $templates.value.length > 0"
13 <p>Number of stations:</p>
15 id="number-of-stations"
16 v-model="state.numberOfStations"
19 name="number-of-stations"
20 placeholder="number of stations"
22 <p>Template options overrides:</p>
23 <ul id="template-options">
28 v-model.trim="state.supervisionUrl"
30 name="supervision-url"
36 <input v-model="state.autoStart" type="checkbox" true-value="true" false-value="false" />
39 Persistent configuration:
41 v-model="state.persistentConfiguration"
48 OCPP strict compliance:
50 v-model="state.ocppStrictCompliance"
57 Performance statistics:
59 v-model="state.enableStatistics"
72 .addChargingStations(state.template, state.numberOfStations, {
73 supervisionUrls: state.supervisionUrl.length > 0 ? state.supervisionUrl : undefined,
74 autoStart: convertToBoolean(state.autoStart),
75 persistentConfiguration: convertToBoolean(state.persistentConfiguration),
76 ocppStrictCompliance: convertToBoolean(state.ocppStrictCompliance),
77 enableStatistics: convertToBoolean(state.enableStatistics)
80 $toast.success('Charging stations successfully added')
82 .catch((error: Error) => {
83 $toast.error('Error at adding charging stations')
84 console.error('Error at adding charging stations:', error)
87 $router.push({ name: 'charging-stations' })
96 <script setup lang="ts">
97 import { getCurrentInstance, ref, watch } from 'vue'
98 import Button from '@/components/buttons/Button.vue'
99 import { convertToBoolean, randomUUID } from '@/composables'
102 renderTemplates: `${string}-${string}-${string}-${string}-${string}`
104 numberOfStations: number
105 supervisionUrl: string
107 persistentConfiguration: boolean
108 ocppStrictCompliance: boolean
109 enableStatistics: boolean
111 renderTemplates: randomUUID(),
116 persistentConfiguration: true,
117 ocppStrictCompliance: true,
118 enableStatistics: false
121 watch(getCurrentInstance()!.appContext.config.globalProperties.$templates, () => {
122 state.value.renderTemplates = randomUUID()
127 #number-of-stations {
138 list-style: circle inside;