refactor(ui): refine action inputs
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / StartTransaction.vue
index 4d3e818db66fc010b421d635851639f8bde3e11d..5d9cb8a626422911f384296d38c83f5e9c48d8c5 100644 (file)
@@ -2,15 +2,18 @@
   <h2>Action Start Transaction</h2>
   <h3>Connector {{ connectorId }} on {{ chargingStationId }}</h3>
   <p>Scan RFID tag:</p>
-  <input id="idtag" v-model="state.idTag" type="text" name="idtag" placeholder="RFID tag" />
+  <input id="idtag" v-model.trim="state.idTag" type="text" name="idtag" placeholder="RFID tag" />
   <br />
   <Button
     @click="
       () => {
         uiClient
           .startTransaction(props.hashId, parseInt(props.connectorId), state.idTag)
+          .then(() => {
+            $toast.success('Transaction successfully started')
+          })
           .catch((error: Error) => {
-            // TODO: add code for UI notifications or other error handling logic
+            $toast.error('Error at starting transaction')
             console.error('Error at starting transaction:', error)
           })
           .finally(() => {
@@ -20,6 +23,7 @@
     "
     >Start Transaction</Button
   >
+  <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
 </template>
 
 <script setup lang="ts">