2 <h1 id="action">Action</h1>
3 <h2>Add Charging Stations</h2>
7 Array.isArray(app?.appContext.config.globalProperties.$templates) &&
8 app?.appContext.config.globalProperties.$templates.length > 0
10 v-model="state.template"
12 <option disabled value="">Please select a template</option>
13 <option v-for="template in app?.appContext.config.globalProperties.$templates">
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' })
98 <Button id="action-button" @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
101 <script setup lang="ts">
102 import { getCurrentInstance, ref } from 'vue'
103 import { useToast } from 'vue-toast-notification'
104 import Button from '@/components/buttons/Button.vue'
105 import { convertToBoolean } from '@/composables'
112 persistentConfiguration: true,
113 ocppStrictCompliance: true,
114 enableStatistics: false
117 const app = getCurrentInstance()
118 const uiClient = app?.appContext.config.globalProperties.$uiClient
120 const $toast = useToast()
124 #number-of-stations {