refactor(ui): refine action bar style
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / StartTransaction.vue
index 62fe31f1ceac25c92d341cd8bc86385ac84712d1..5e83983f34512ab1057d65f98a069bafc3c1200d 100644 (file)
@@ -1,16 +1,21 @@
 <template>
-  <h2>Action Start Transaction</h2>
+  <h1 id="action">Action</h1>
+  <h2>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
+    id="action-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(() => {
           })
       }
     "
-    >Start Transaction</Button
   >
-  <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
+    Start Transaction
+  </Button>
+  <Button id="action-button" @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
 </template>
 
 <script setup lang="ts">