feat(ui): add charging station options to add action
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / AddChargingStations.vue
index 8412fdd0a7374251cd0b89d842fc23691bcd8c25..0ddf612e56a7f441690128d310ed1cadef75fec7 100644 (file)
     name="number-of-stations"
     placeholder="number of stations"
   />
+  <p>Options:</p>
+  <ul>
+    <li>
+      Auto start:
+      <input v-model="state.autoStart" type="checkbox" true-value="true" false-value="false" />
+    </li>
+  </ul>
   <br />
   <Button
     id="action-button"
     @click="
       () => {
         uiClient
-          .addChargingStations(state.template, state.numberOfStations)
+          .addChargingStations(state.template, state.numberOfStations, {
+            autoStart: convertToBoolean(state.autoStart)
+          })
           .then(() => {
             $toast.success('Charging stations successfully added')
           })
@@ -47,11 +56,13 @@ import { getCurrentInstance, onMounted, reactive } from 'vue'
 import { useToast } from 'vue-toast-notification'
 import Button from '@/components/buttons/Button.vue'
 import type { ResponsePayload } from '@/types'
+import { convertToBoolean } from '@/composables'
 
 const state = reactive({
   ready: false,
   template: '',
-  numberOfStations: 1
+  numberOfStations: 1,
+  autoStart: false
 })
 
 const app = getCurrentInstance()