order workflow
This commit is contained in:
@@ -1,31 +1,32 @@
|
||||
<template>
|
||||
<toolbar-pane>
|
||||
<toolbar-pane title="Create">
|
||||
<template v-slot:toolbar>
|
||||
<v-btn variant="flat" prepend-icon="mdi-plus" @click="co.newOrder" v-if="co.orders.length===0">New Order</v-btn>
|
||||
<!-- <v-btn variant="flat" prepend-icon="mdi-plus" @click="co.newOrder" v-if="co.orders.length===0">New Order</v-btn>-->
|
||||
<v-btn variant="text" prepend-icon="mdi-send" @click="placeOrder"
|
||||
:color="orderColor" v-if="co.orders.length>0" :disabled="co.drawing">
|
||||
Place Dexorder
|
||||
</v-btn>
|
||||
<v-btn variant="flat" prepend-icon="mdi-cancel" v-if="co.orders.length>0" @click="cancelOrder">Cancel</v-btn>
|
||||
<v-btn variant="flat" prepend-icon="mdi-delete" v-if="co.orders.length>0" @click="cancelOrder">Reset</v-btn>
|
||||
</template>
|
||||
<!-- <div v-for="b in co.builderList">{{JSON.stringify(b)}}</div>-->
|
||||
<template v-for="o in co.orders">
|
||||
<chart-order :order="o"/>
|
||||
</template>
|
||||
<v-dialog v-model="showCancel" max-width="300">
|
||||
<v-card title="Cancel Order?" text="Do you want to cancel this order and create a new one?">
|
||||
<v-card-actions>
|
||||
<v-spacer/>
|
||||
<v-btn @click="()=>showCancel=false">Keep Existing</v-btn>
|
||||
<v-btn @click="()=>{co.orders.shift(); showCancel=false}" color="red">Cancel Order</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<needs-chart>
|
||||
<template v-for="o in co.orders">
|
||||
<chart-order :order="o"/>
|
||||
</template>
|
||||
<v-dialog v-model="showResetDialog" max-width="300">
|
||||
<v-card title="Cancel Order?" text="Do you want to cancel this order and start again?">
|
||||
<v-card-actions>
|
||||
<v-spacer/>
|
||||
<v-btn @click="()=>showResetDialog=false">Keep Existing</v-btn>
|
||||
<v-btn @click="()=>{co.resetOrders(); showResetDialog=false}" color="red">Reset Order</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</needs-chart>
|
||||
</toolbar-pane>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {builderFuncs, orderFuncs, useChartOrderStore} from "@/orderbuild.js";
|
||||
import {orderFuncs, useChartOrderStore} from "@/orderbuild.js";
|
||||
import {addSymbolChangedCallback, removeSymbolChangedCallback} from "@/charts/chart.js";
|
||||
import {computed, onBeforeUnmount, ref} from "vue";
|
||||
import {useOrderStore, useStore} from "@/store/store.js";
|
||||
@@ -33,10 +34,10 @@ import {useOrderStore, useStore} from "@/store/store.js";
|
||||
import {routeFinder} from "@/blockchain/route.js";
|
||||
import ChartOrder from "@/components/chart/ChartOrder.vue";
|
||||
import {useTheme} from "vuetify";
|
||||
import Toolbar from "@/components/chart/Toolbar.vue";
|
||||
import {Exchange, newOrder} from "@/blockchain/orderlib.js";
|
||||
import {pendOrder} from "@/blockchain/wallet.js";
|
||||
import ToolbarPane from "@/components/chart/ToolbarPane.vue";
|
||||
import NeedsChart from "@/components/NeedsChart.vue";
|
||||
import router from "@/router/index.js";
|
||||
|
||||
const s = useStore()
|
||||
const co = useChartOrderStore()
|
||||
@@ -54,13 +55,13 @@ addSymbolChangedCallback(changeSymbol)
|
||||
onBeforeUnmount(() => removeSymbolChangedCallback(changeSymbol) )
|
||||
|
||||
|
||||
const showCancel = ref(false)
|
||||
const showResetDialog = ref(false)
|
||||
|
||||
const theme = useTheme().current
|
||||
const orderColor = computed(()=>co.orders.length===0?null : co.orders[0].buy ? theme.value.colors.success:theme.value.colors.error)
|
||||
|
||||
function cancelOrder() {
|
||||
showCancel.value = true
|
||||
showResetDialog.value = true
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +82,8 @@ async function placeOrder() {
|
||||
}
|
||||
else {
|
||||
await pendOrder(built[0])
|
||||
co.resetOrders()
|
||||
router.push('/orders')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user