Commit | Line | Data |
---|---|---|
32de5a57 LM |
1 | <template> |
2 | <td class="cs-table__action-col"> | |
8fc2e5cc JB |
3 | <Button @click="startChargingStation()">Start Charging Station</Button> |
4 | <Button @click="stopChargingStation()">Stop Charging Station</Button> | |
5 | <Button @click="openConnection()">Open Connection</Button> | |
6 | <Button @click="closeConnection()">Close Connection</Button> | |
32de5a57 | 7 | <Button @click="startTransaction()">Start Transaction</Button> |
5a010bf0 JB |
8 | <!-- <IdTagInputModal |
9 | :visibility="state.isIdTagModalVisible" | |
01ff4231 | 10 | :id-tag="state.idTag" |
5a010bf0 | 11 | @close="hideIdTagModal()" |
f568f368 | 12 | @done="compose(state.transaction, hideIdTagModal)()" |
32de5a57 | 13 | > |
5a010bf0 JB |
14 | Start Transaction |
15 | </IdTagInputModal> --> | |
16 | <Button @click="stopTransaction()">Stop Transaction</Button> | |
757b2ecf JB |
17 | <Button @click="startAutomaticTransactionGenerator()">Start ATG</Button> |
18 | <Button @click="stopAutomaticTransactionGenerator()">Stop ATG</Button> | |
32de5a57 LM |
19 | </td> |
20 | <td class="cs-table__connector-col">{{ connectorId }}</td> | |
5a010bf0 | 21 | <td class="cs-table__status-col">{{ connector.status }}</td> |
8fc2e5cc | 22 | <td class="cs-table__transaction-col">{{ connector.transactionStarted ? 'Yes' : 'No' }}</td> |
32de5a57 LM |
23 | </template> |
24 | ||
25 | <script setup lang="ts"> | |
5a010bf0 | 26 | // import { reactive } from 'vue'; |
cbac2373 JB |
27 | import Button from '../buttons/Button.vue'; |
28 | // import IdTagInputModal from './IdTagInputModal.vue'; | |
4147bb7e | 29 | import type { ConnectorStatus } from '@/types'; |
8137295e | 30 | import { UIClient } from '@/composables/UIClient'; |
f568f368 | 31 | // import { compose } from '@/composables/Utils'; |
32de5a57 LM |
32 | |
33 | const props = defineProps<{ | |
34 | hashId: string; | |
35 | connector: ConnectorStatus; | |
5a010bf0 | 36 | connectorId: number; |
51c83d6f | 37 | transactionId?: number; |
5a010bf0 | 38 | idTag?: string; |
32de5a57 LM |
39 | }>(); |
40 | ||
5a010bf0 JB |
41 | // type State = { |
42 | // isIdTagModalVisible: boolean; | |
43 | // idTag: string; | |
44 | // transaction: () => void; | |
45 | // }; | |
32de5a57 | 46 | |
5a010bf0 JB |
47 | // const state: State = reactive({ |
48 | // isIdTagModalVisible: false, | |
49 | // idTag: '', | |
50 | // transaction: startTransaction, | |
51 | // }); | |
32de5a57 | 52 | |
5a010bf0 JB |
53 | // function getIdTag(transaction: () => void): void { |
54 | // state.transaction = transaction; | |
55 | // showTagModal(); | |
56 | // } | |
57 | ||
58 | // function showTagModal(): void { | |
59 | // state.isIdTagModalVisible = true; | |
60 | // } | |
61 | // function hideIdTagModal(): void { | |
62 | // state.isIdTagModalVisible = false; | |
63 | // } | |
32de5a57 | 64 | |
8fc2e5cc | 65 | function startChargingStation(): void { |
f27eb751 | 66 | UIClient.getInstance().startChargingStation(props.hashId); |
32de5a57 | 67 | } |
8fc2e5cc | 68 | function stopChargingStation(): void { |
f27eb751 | 69 | UIClient.getInstance().stopChargingStation(props.hashId); |
32de5a57 | 70 | } |
5a010bf0 | 71 | function openConnection(): void { |
f27eb751 | 72 | UIClient.getInstance().openConnection(props.hashId); |
5a010bf0 JB |
73 | } |
74 | function closeConnection(): void { | |
f27eb751 | 75 | UIClient.getInstance().closeConnection(props.hashId); |
5a010bf0 | 76 | } |
8fc2e5cc | 77 | function startTransaction(): void { |
f27eb751 | 78 | UIClient.getInstance().startTransaction(props.hashId, props.connectorId, props.idTag); |
8fc2e5cc JB |
79 | } |
80 | function stopTransaction(): void { | |
f27eb751 | 81 | UIClient.getInstance().stopTransaction(props.hashId, props.transactionId); |
8fc2e5cc | 82 | } |
757b2ecf JB |
83 | function startAutomaticTransactionGenerator(): void { |
84 | UIClient.getInstance().startAutomaticTransactionGenerator(props.hashId, props.connectorId); | |
85 | } | |
86 | function stopAutomaticTransactionGenerator(): void { | |
87 | UIClient.getInstance().stopAutomaticTransactionGenerator(props.hashId, props.connectorId); | |
88 | } | |
32de5a57 | 89 | </script> |