a6a819aa45fd14fddcfa5bce3410fc27e9199140
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / components / charging-stations / CSData.vue
1 <template>
2 <tr v-for="(connector, index) in getConnectors()" class="cs-table__row">
3 <CSConnector
4 :hash-id="getHashId()"
5 :connector="connector"
6 :connector-id="index + 1"
7 :transaction-id="connector.transactionId"
8 :id-tag="props.idTag"
9 />
10 <td class="cs-table__name-col">{{ getId() }}</td>
11 <td class="cs-table__started-col">{{ getStarted() }}</td>
12 <td class="cs-table__registration-status-col">{{ getRegistrationStatus() }}</td>
13 <td class="cs-table__vendor-col">{{ getVendor() }}</td>
14 <td class="cs-table__model-col">{{ getModel() }}</td>
15 <td class="cs-table__firmware-col">{{ getFirmwareVersion() }}</td>
16 </tr>
17 </template>
18
19 <script setup lang="ts">
20 import CSConnector from './CSConnector.vue';
21
22 // import { reactive } from 'vue';
23 import Utils from '@/composables/Utils';
24 import type {
25 ChargingStationData,
26 ChargingStationInfo,
27 ConnectorStatus,
28 } from '@/types/ChargingStationType';
29
30 const props = defineProps<{
31 chargingStation: ChargingStationData;
32 idTag: string;
33 }>();
34
35 // type State = {
36 // isTagModalVisible: boolean;
37 // idTag: string;
38 // };
39
40 // const state: State = reactive({
41 // isTagModalVisible: false,
42 // idTag: '',
43 // });
44
45 function getConnectors(): ConnectorStatus[] {
46 return props.chargingStation.connectors?.slice(1);
47 }
48 function getInfo(): ChargingStationInfo {
49 return props.chargingStation.stationInfo;
50 }
51 function getHashId(): string {
52 return getInfo().hashId;
53 }
54 function getId(): string {
55 return Utils.ifUndefined<string>(getInfo().chargingStationId, 'Ø');
56 }
57 function getModel(): string {
58 return getInfo().chargePointModel;
59 }
60 function getVendor(): string {
61 return getInfo().chargePointVendor;
62 }
63 function getFirmwareVersion(): string {
64 return Utils.ifUndefined<string>(getInfo().firmwareVersion, 'Ø');
65 }
66 function getStarted(): string {
67 return props.chargingStation.started === true ? 'Yes' : 'No';
68 }
69 function getRegistrationStatus(): string {
70 return props.chargingStation?.bootNotificationResponse?.status ?? 'Ø';
71 }
72 // function showTagModal(): void {
73 // state.isTagModalVisible = true;
74 // }
75 // function hideTagModal(): void {
76 // state.isTagModalVisible = false;
77 // }
78 </script>