Commit | Line | Data |
---|---|---|
32de5a57 | 1 | <template> |
9dc8b66f JB |
2 | <tr class="connectors-table__row"> |
3 | <td class="connectors-table__column">{{ connectorId }}</td> | |
4 | <td class="connectors-table__column">{{ connector.status ?? 'Ø' }}</td> | |
5 | <td class="connectors-table__column"> | |
6 | {{ connector.transactionStarted === true ? 'Yes' : 'No' }} | |
7 | </td> | |
8 | <td class="connectors-table__column"> | |
9 | {{ atgStatus?.start === true ? 'Yes' : 'No' }} | |
10 | </td> | |
11 | <td class="connectors-table__column"> | |
12 | <Button @click="startTransaction()">Start Transaction</Button> | |
13 | <!-- <IdTagInputModal | |
14 | :visibility="state.isIdTagModalVisible" | |
15 | :id-tag="state.idTag" | |
16 | @close="hideIdTagModal()" | |
17 | @done="compose(state.transaction, hideIdTagModal)()" | |
18 | > | |
19 | Start Transaction | |
20 | </IdTagInputModal> --> | |
21 | <Button @click="stopTransaction()">Stop Transaction</Button> | |
22 | <Button @click="startAutomaticTransactionGenerator()">Start ATG</Button> | |
23 | <Button @click="stopAutomaticTransactionGenerator()">Stop ATG</Button> | |
24 | </td> | |
25 | </tr> | |
32de5a57 LM |
26 | </template> |
27 | ||
28 | <script setup lang="ts"> | |
9d76f5ec | 29 | import { getCurrentInstance } from 'vue' |
9dc8b66f | 30 | // import { reactive } from 'vue' |
9d76f5ec JB |
31 | // import IdTagInputModal from '@/components/charging-stations/IdTagInputModal.vue' |
32 | import Button from '@/components/buttons/Button.vue' | |
9dc8b66f | 33 | import type { ConnectorStatus, Status } from '@/types' |
9d76f5ec | 34 | // import { compose } from '@/composables' |
32de5a57 LM |
35 | |
36 | const props = defineProps<{ | |
66a7748d | 37 | hashId: string |
66a7748d | 38 | connectorId: number |
9dc8b66f JB |
39 | connector: ConnectorStatus |
40 | atgStatus?: Status | |
66a7748d JB |
41 | transactionId?: number |
42 | idTag?: string | |
43 | }>() | |
32de5a57 | 44 | |
5a010bf0 | 45 | // type State = { |
66a7748d JB |
46 | // isIdTagModalVisible: boolean |
47 | // idTag: string | |
48 | // transaction: () => void | |
49 | // } | |
32de5a57 | 50 | |
5a010bf0 JB |
51 | // const state: State = reactive({ |
52 | // isIdTagModalVisible: false, | |
53 | // idTag: '', | |
66a7748d JB |
54 | // transaction: startTransaction |
55 | // }) | |
32de5a57 | 56 | |
5a010bf0 | 57 | // function getIdTag(transaction: () => void): void { |
66a7748d JB |
58 | // state.transaction = transaction |
59 | // showTagModal() | |
5a010bf0 JB |
60 | // } |
61 | ||
62 | // function showTagModal(): void { | |
66a7748d | 63 | // state.isIdTagModalVisible = true |
5a010bf0 JB |
64 | // } |
65 | // function hideIdTagModal(): void { | |
66a7748d | 66 | // state.isIdTagModalVisible = false |
5a010bf0 | 67 | // } |
32de5a57 | 68 | |
9d76f5ec JB |
69 | const UIClient = getCurrentInstance()?.appContext.config.globalProperties.$UIClient |
70 | ||
8fc2e5cc | 71 | function startTransaction(): void { |
9d76f5ec | 72 | UIClient.startTransaction(props.hashId, props.connectorId, props.idTag) |
8fc2e5cc JB |
73 | } |
74 | function stopTransaction(): void { | |
9d76f5ec | 75 | UIClient.stopTransaction(props.hashId, props.transactionId) |
8fc2e5cc | 76 | } |
757b2ecf | 77 | function startAutomaticTransactionGenerator(): void { |
9d76f5ec | 78 | UIClient.startAutomaticTransactionGenerator(props.hashId, props.connectorId) |
757b2ecf JB |
79 | } |
80 | function stopAutomaticTransactionGenerator(): void { | |
9d76f5ec | 81 | UIClient.stopAutomaticTransactionGenerator(props.hashId, props.connectorId) |
757b2ecf | 82 | } |
32de5a57 | 83 | </script> |