2023-02-19 16:28:44 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { Trade } from '@/types';
|
|
|
|
import { ref } from 'vue';
|
2023-05-09 04:49:13 +00:00
|
|
|
import TradeActions from './TradeActions.vue';
|
2023-02-19 16:28:44 +00:00
|
|
|
|
|
|
|
defineProps({
|
|
|
|
trade: { type: Object as () => Trade, required: true },
|
|
|
|
id: { type: Number, required: true },
|
|
|
|
botApiVersion: { type: Number, required: true },
|
|
|
|
});
|
2023-05-16 18:23:46 +00:00
|
|
|
const emit = defineEmits([
|
|
|
|
'forceExit',
|
|
|
|
'forceExitPartial',
|
|
|
|
'cancelOpenOrder',
|
|
|
|
'reloadTrade',
|
|
|
|
'deleteTrade',
|
|
|
|
]);
|
2023-02-19 16:28:44 +00:00
|
|
|
const popoverOpen = ref(false);
|
|
|
|
|
2023-05-16 18:23:46 +00:00
|
|
|
function forceExitHandler(item: Trade, ordertype: string | undefined = undefined) {
|
2023-02-19 16:28:44 +00:00
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('forceExit', item, ordertype);
|
2023-05-16 18:23:46 +00:00
|
|
|
}
|
|
|
|
function forceExitPartialHandler(item: Trade) {
|
2023-02-19 16:28:44 +00:00
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('forceExitPartial', item);
|
2023-05-16 18:23:46 +00:00
|
|
|
}
|
|
|
|
function cancelOpenOrderHandler(item: Trade) {
|
2023-02-19 16:28:44 +00:00
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('cancelOpenOrder', item);
|
2023-05-16 18:23:46 +00:00
|
|
|
}
|
|
|
|
function handleReloadTrade(item: Trade) {
|
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('reloadTrade', item);
|
|
|
|
}
|
2023-02-19 16:28:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<b-button
|
|
|
|
:id="`btn-actions-${id}`"
|
|
|
|
class="btn-xs"
|
|
|
|
size="sm"
|
|
|
|
title="Actions"
|
|
|
|
@click="popoverOpen = !popoverOpen"
|
|
|
|
>
|
2023-05-09 16:25:28 +00:00
|
|
|
<i-mdi-gesture-tap />
|
2023-02-19 16:28:44 +00:00
|
|
|
</b-button>
|
|
|
|
<b-popover
|
|
|
|
:target="`btn-actions-${id}`"
|
|
|
|
:title="`Actions for ${trade.pair}`"
|
|
|
|
triggers="manual"
|
|
|
|
:show="popoverOpen"
|
|
|
|
placement="left"
|
|
|
|
>
|
|
|
|
<trade-actions
|
|
|
|
:trade="trade"
|
|
|
|
:bot-api-version="botApiVersion"
|
|
|
|
@force-exit="forceExitHandler"
|
|
|
|
@force-exit-partial="forceExitPartialHandler"
|
2023-04-13 04:39:21 +00:00
|
|
|
@delete-trade="
|
2023-02-19 16:28:44 +00:00
|
|
|
popoverOpen = false;
|
|
|
|
$emit('deleteTrade', trade);
|
|
|
|
"
|
|
|
|
@cancel-open-order="cancelOpenOrderHandler"
|
2023-05-16 18:23:46 +00:00
|
|
|
@reload-trade="handleReloadTrade"
|
2023-02-19 16:28:44 +00:00
|
|
|
/>
|
|
|
|
<b-button class="mt-1 w-100 text-start" size="sm" @click="popoverOpen = false">
|
2023-05-09 16:25:28 +00:00
|
|
|
<i-mdi-cancel class="me-1" />Close Actions menu
|
2023-02-19 16:28:44 +00:00
|
|
|
</b-button>
|
|
|
|
</b-popover>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped></style>
|