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 CancelIcon from '~icons/mdi/cancel';
|
|
|
|
import ActionIcon from '~icons/mdi/gesture-tap';
|
|
|
|
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 },
|
|
|
|
});
|
|
|
|
const emit = defineEmits(['forceExit', 'forceExitPartial', 'cancelOpenOrder', 'deleteTrade']);
|
|
|
|
const popoverOpen = ref(false);
|
|
|
|
|
|
|
|
const forceExitHandler = (item: Trade, ordertype: string | undefined = undefined) => {
|
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('forceExit', item, ordertype);
|
|
|
|
};
|
|
|
|
const forceExitPartialHandler = (item: Trade) => {
|
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('forceExitPartial', item);
|
|
|
|
};
|
|
|
|
const cancelOpenOrderHandler = (item: Trade) => {
|
|
|
|
popoverOpen.value = false;
|
|
|
|
emit('cancelOpenOrder', item);
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<b-button
|
|
|
|
:id="`btn-actions-${id}`"
|
|
|
|
class="btn-xs"
|
|
|
|
size="sm"
|
|
|
|
title="Actions"
|
|
|
|
@click="popoverOpen = !popoverOpen"
|
|
|
|
>
|
2023-05-09 05:02:18 +00:00
|
|
|
<ActionIcon />
|
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"
|
|
|
|
/>
|
|
|
|
<b-button class="mt-1 w-100 text-start" size="sm" @click="popoverOpen = false">
|
2023-05-09 05:02:18 +00:00
|
|
|
<CancelIcon class="me-1" />Close Actions menu
|
2023-02-19 16:28:44 +00:00
|
|
|
</b-button>
|
|
|
|
</b-popover>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped></style>
|