Commit | Line | Data |
---|---|---|
32de5a57 | 1 | <template> |
1d41bc6b | 2 | <td class="cs-table__column"> |
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 | 19 | </td> |
1d41bc6b JB |
20 | <td class="cs-table__column">{{ connectorId }}</td> |
21 | <td class="cs-table__column">{{ connector.status ?? 'Ø' }}</td> | |
22 | <td class="cs-table__column">{{ connector.transactionStarted === true ? 'Yes' : 'No' }}</td> | |
32de5a57 LM |
23 | </template> |
24 | ||
25 | <script setup lang="ts"> | |
9d76f5ec JB |
26 | import { getCurrentInstance } from 'vue' |
27 | // import { reactive } from 'vue'; | |
28 | // import IdTagInputModal from '@/components/charging-stations/IdTagInputModal.vue' | |
29 | import Button from '@/components/buttons/Button.vue' | |
66a7748d | 30 | import type { ConnectorStatus } from '@/types' |
9d76f5ec | 31 | // import { compose } from '@/composables' |
32de5a57 LM |
32 | |
33 | const props = defineProps<{ | |
66a7748d JB |
34 | hashId: string |
35 | connector: ConnectorStatus | |
36 | connectorId: number | |
37 | transactionId?: number | |
38 | idTag?: string | |
39 | }>() | |
32de5a57 | 40 | |
5a010bf0 | 41 | // type State = { |
66a7748d JB |
42 | // isIdTagModalVisible: boolean |
43 | // idTag: string | |
44 | // transaction: () => void | |
45 | // } | |
32de5a57 | 46 | |
5a010bf0 JB |
47 | // const state: State = reactive({ |
48 | // isIdTagModalVisible: false, | |
49 | // idTag: '', | |
66a7748d JB |
50 | // transaction: startTransaction |
51 | // }) | |
32de5a57 | 52 | |
5a010bf0 | 53 | // function getIdTag(transaction: () => void): void { |
66a7748d JB |
54 | // state.transaction = transaction |
55 | // showTagModal() | |
5a010bf0 JB |
56 | // } |
57 | ||
58 | // function showTagModal(): void { | |
66a7748d | 59 | // state.isIdTagModalVisible = true |
5a010bf0 JB |
60 | // } |
61 | // function hideIdTagModal(): void { | |
66a7748d | 62 | // state.isIdTagModalVisible = false |
5a010bf0 | 63 | // } |
32de5a57 | 64 | |
9d76f5ec JB |
65 | const UIClient = getCurrentInstance()?.appContext.config.globalProperties.$UIClient |
66 | ||
8fc2e5cc | 67 | function startChargingStation(): void { |
9d76f5ec | 68 | UIClient.startChargingStation(props.hashId) |
32de5a57 | 69 | } |
8fc2e5cc | 70 | function stopChargingStation(): void { |
9d76f5ec | 71 | UIClient.stopChargingStation(props.hashId) |
32de5a57 | 72 | } |
5a010bf0 | 73 | function openConnection(): void { |
9d76f5ec | 74 | UIClient.openConnection(props.hashId) |
5a010bf0 JB |
75 | } |
76 | function closeConnection(): void { | |
9d76f5ec | 77 | UIClient.closeConnection(props.hashId) |
5a010bf0 | 78 | } |
8fc2e5cc | 79 | function startTransaction(): void { |
9d76f5ec | 80 | UIClient.startTransaction(props.hashId, props.connectorId, props.idTag) |
8fc2e5cc JB |
81 | } |
82 | function stopTransaction(): void { | |
9d76f5ec | 83 | UIClient.stopTransaction(props.hashId, props.transactionId) |
8fc2e5cc | 84 | } |
757b2ecf | 85 | function startAutomaticTransactionGenerator(): void { |
9d76f5ec | 86 | UIClient.startAutomaticTransactionGenerator(props.hashId, props.connectorId) |
757b2ecf JB |
87 | } |
88 | function stopAutomaticTransactionGenerator(): void { | |
9d76f5ec | 89 | UIClient.stopAutomaticTransactionGenerator(props.hashId, props.connectorId) |
757b2ecf | 90 | } |
32de5a57 | 91 | </script> |