This commit is contained in:
James Cole
2020-10-17 09:12:38 +02:00
parent 04d451be8d
commit c1b52524b1
4 changed files with 189 additions and 186 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -23,8 +23,7 @@
Show if: Show if:
- one or more currencies. - one or more currencies.
--> -->
<div class="form-group" v-bind:class="{ 'has-error': hasError()}" v-if=" <div class="form-group" v-bind:class="{ 'has-error': hasError()}" v-if="this.enabledCurrencies.length >= 1">
this.enabledCurrencies.length >= 1">
<div class="col-sm-8 col-sm-offset-4 text-sm"> <div class="col-sm-8 col-sm-offset-4 text-sm">
{{ $t('form.foreign_amount') }} {{ $t('form.foreign_amount') }}
</div> </div>
@@ -62,7 +61,7 @@
</template> </template>
<script> <script>
export default { export default {
name: "ForeignAmountSelect", name: "ForeignAmountSelect",
props: ['source', 'destination', 'transactionType', 'value', 'error', 'no_currency', 'title',], props: ['source', 'destination', 'transactionType', 'value', 'error', 'no_currency', 'title',],
@@ -120,8 +119,8 @@
this.enabledCurrencies = []; this.enabledCurrencies = [];
let destType = this.destination.type ? this.destination.type.toLowerCase() : 'invalid'; let destType = this.destination.type ? this.destination.type.toLowerCase() : 'invalid';
let srcType = this.source.type ? this.source.type.toLowerCase() : 'invalid'; let srcType = this.source.type ? this.source.type.toLowerCase() : 'invalid';
let tType =this.transactionType ? this.transactionType.toLowerCase() : 'invalid'; let tType = this.transactionType ? this.transactionType.toLowerCase() : 'invalid';
let liabilities = ['loan','debt','mortgage']; let liabilities = ['loan', 'debt', 'mortgage'];
let sourceIsLiability = liabilities.indexOf(srcType) !== -1; let sourceIsLiability = liabilities.indexOf(srcType) !== -1;
let destIsLiability = liabilities.indexOf(destType) !== -1; let destIsLiability = liabilities.indexOf(destType) !== -1;
@@ -129,17 +128,21 @@
// console.log(destType + ' (dest) is a liability: ' + destIsLiability); // console.log(destType + ' (dest) is a liability: ' + destIsLiability);
if (tType === 'transfer' || destIsLiability || sourceIsLiability) { if (tType === 'transfer' || destIsLiability || sourceIsLiability) {
//console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.'); console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.');
console.log('Length of currencies is ' + this.currencies.length);
console.log(this.currencies);
this.liability = true; this.liability = true;
// lock dropdown list on on currencyID of destination. // lock dropdown list on on currencyID of destination.
for (const key in this.currencies) { for (const key in this.currencies) {
if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) { if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
if (this.currencies[key].id === this.destination.currency_id) { console.log('this.currencies[key].id = ' + this.currencies[key].id);
console.log('this.destination.currency_id = ' + this.destination.currency_id);
if (parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id)) {
this.enabledCurrencies.push(this.currencies[key]); this.enabledCurrencies.push(this.currencies[key]);
} }
} }
} }
//console.log('Enabled currencies length is now ' + this.enabledCurrencies.length); console.log('Enabled currencies length is now ' + this.enabledCurrencies.length);
return; return;
} }
@@ -204,11 +207,11 @@
} }
} }
} }
// console.log(this.enabledCurrencies); console.log(this.enabledCurrencies);
}); });
} }
} }
} }
</script> </script>
<style scoped> <style scoped>