diff --git a/frontend/src/components/Dashboard/Views/Accounts/Accounts.vue b/frontend/src/components/Dashboard/Views/Accounts/Accounts.vue index 09121fe..aa57373 100644 --- a/frontend/src/components/Dashboard/Views/Accounts/Accounts.vue +++ b/frontend/src/components/Dashboard/Views/Accounts/Accounts.vue @@ -15,10 +15,10 @@ placeholder="Select account"> @@ -34,7 +34,10 @@ + v-for="item in ['EUR', 'USD']" + :key="item" + :label="item" + :value="item"> @@ -363,11 +366,11 @@ export default { deep: true }, "credential": { - handler(entity) { + handler(val, oldVal) { this.errors = {}; - } + }, + deep: true }, - deep: true }, methods: { async deleteAccount() { @@ -416,6 +419,7 @@ export default { this.readDialogVisible = false; }, async addAccount(done) { + console.log("Add or update account"); this.errors = {}; if (!this.credential.entity) { this.errors.entity = 'Choose an entity'; @@ -427,15 +431,15 @@ export default { if (!this.credential.currency) { this.errors.currency = 'The currency is required'; } - if (!this.credential.parameters.length) { + if (!this.credential.parameters.length && this.credential.id == undefined) { this.errors.parameters = 'Credentials are required'; } - - if (!this.credential.encrypt_password) { + if (!this.credential.encrypt_password && this.credential.id == undefined) { this.errors.encrypt_password = 'Encryption password is required'; } if (Object.keys(this.errors).length) { + console.log(this.errors) return; } @@ -444,11 +448,14 @@ export default { "entity_id": this.credential.entity, "currency": this.credential.currency } - - var vm = this; + let vm = this; if (this.credential['id'] != undefined) { - console.log("Update credentials!") - this.createCredential(this.credential); + console.log("Update account!"); + await axios.put(process.env.VUE_APP_BACKEND_URL + "/entities/accounts/" + this.credential['id'], data).then(function (res) {}); + if (this.credential.parameters.length) { + console.log("Update credential!"); + await this.createCredential(this.credential); + } } else { await axios.post(process.env.VUE_APP_BACKEND_URL + "/entities/accounts", data).then(function (res) { vm.createCredential(res.data); @@ -458,7 +465,7 @@ export default { }, async createCredential(account) { let parameters = [] - for (var key in this.credential.parameters) { + for (let key in this.credential.parameters) { parameters.push({ "value": this.credential.parameters[key], "credential_type_id": Number(key) @@ -480,7 +487,9 @@ export default { this.dialogVisible = true; this.credential = { "parameters": [], - "entity": undefined + "entity": undefined, + "currency": undefined, + "name": "" } if (account !== undefined) { this.credential["id"] = account.id; @@ -490,9 +499,8 @@ export default { } this.errors = []; this.entities = []; - var vm = this; + let vm = this; await axios.get(process.env.VUE_APP_BACKEND_URL + "/entities/").then(function (res) { - //let res_code = res.status === 200 ? true : false; res.data.forEach(function (e) { if (e.type == account_type) { vm.entities.push(e); diff --git a/frontend/src/components/Dashboard/Views/Broker/Balance.vue b/frontend/src/components/Dashboard/Views/Broker/Balance.vue index 5d17ff0..82b050f 100644 --- a/frontend/src/components/Dashboard/Views/Broker/Balance.vue +++ b/frontend/src/components/Dashboard/Views/Broker/Balance.vue @@ -24,7 +24,8 @@
-
Current wallet value
+
Current wallet value. Benefits vs cost and benefits from previous day +
- {{ this.current_benefits_percent }}% + {{ this.current_benefits_percent }}% | Previous day: + {{ this.total_value - this.base_previous_value | toCurrency(base_currency) }}
@@ -63,7 +65,7 @@
-
Executed benefits over bought items. Only open orders
+
Executed benefits over bought items. Only current open orders
+ + + + @@ -118,7 +153,7 @@ @@ -131,17 +166,21 @@ {{ scope.row.win_lose | toCurrency(base_currency) }} - + - + + + + -
@@ -173,7 +212,7 @@
+ :cell-class-name="colorClass"> @@ -178,9 +178,9 @@ export default { this.orders.forEach(function (s) { s.value_date = s.value_date.split(' ')[0]; s.total = s.shares * s.price; - if (s.type == 0) { + if (s.type === 0) { s.type = "Buy"; - s.cost = s.total - s.fee - s.exchange_fee; + s.cost = s.total * s.currency_rate - s.fee - s.exchange_fee; } else { s.type = "Sell"; s.cost = s.total * s.currency_rate + s.fee + s.exchange_fee; diff --git a/frontend/src/components/Dashboard/Views/Broker/Tax.vue b/frontend/src/components/Dashboard/Views/Broker/Tax.vue index 45b5894..960f70e 100644 --- a/frontend/src/components/Dashboard/Views/Broker/Tax.vue +++ b/frontend/src/components/Dashboard/Views/Broker/Tax.vue @@ -45,7 +45,7 @@
+ + + + + +
@@ -100,7 +120,7 @@
+ :cell-class-name="colorClass">