2 <h1 id="action">Action</h1>
3 <h2>Add Charging Stations</h2>
5 <select v-model="state.template">
6 <option disabled value="">Please select a template</option>
8 v-for="template in app?.appContext.config.globalProperties.$templates"
10 Array.isArray(app?.appContext.config.globalProperties.$templates) &&
11 app.appContext.config.globalProperties.$templates.length > 0
17 <p>Number of stations:</p>
19 id="number-of-stations"
20 v-model="state.numberOfStations"
23 name="number-of-stations"
24 placeholder="number of stations"
26 <p>Template options overrides:</p>
32 v-model.trim="state.supervisionUrl"
34 name="supervision-url"
40 <input v-model="state.autoStart" type="checkbox" true-value="true" false-value="false" />
43 Persistent configuration:
45 v-model="state.persistentConfiguration"
52 OCPP strict compliance:
54 v-model="state.ocppStrictCompliance"
61 Performance statistics:
63 v-model="state.enableStatistics"
76 .addChargingStations(state.template, state.numberOfStations, {
77 supervisionUrls: state.supervisionUrl.length > 0 ? state.supervisionUrl : undefined,
78 autoStart: convertToBoolean(state.autoStart),
79 persistentConfiguration: convertToBoolean(state.persistentConfiguration),
80 ocppStrictCompliance: convertToBoolean(state.ocppStrictCompliance),
81 enableStatistics: convertToBoolean(state.enableStatistics)
84 $toast.success('Charging stations successfully added')
86 .catch((error: Error) => {
87 $toast.error('Error at adding charging stations')
88 console.error('Error at adding charging stations:', error)
91 $router.push({ name: 'charging-stations' })
100 <script setup lang="ts">
101 import { getCurrentInstance, ref } from 'vue'
102 import { useToast } from 'vue-toast-notification'
103 import Button from '@/components/buttons/Button.vue'
104 import { convertToBoolean } from '@/composables'
108 numberOfStations: number
109 supervisionUrl: string
111 persistentConfiguration: boolean
112 ocppStrictCompliance: boolean
113 enableStatistics: boolean
119 persistentConfiguration: true,
120 ocppStrictCompliance: true,
121 enableStatistics: false
124 const app = getCurrentInstance()
125 const uiClient = app?.appContext.config.globalProperties.$uiClient
127 const $toast = useToast()
131 #number-of-stations {