✨ (transaction) save location in transaction
This commit is contained in:
@@ -25,92 +25,96 @@
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<h3 class="subtitle is-3">{{ transaction.date | fulldate }}</h3>
|
||||
<div class="resume">
|
||||
Dépense payée par
|
||||
<span class="pay-by">{{ transaction.payBy }}</span>
|
||||
pour
|
||||
<span>{{ payForLabel.join(', ') }}</span>
|
||||
d'une somme de
|
||||
<span class="numeric">{{
|
||||
transaction.amount | money(transaction.mainCurrency)
|
||||
}}</span
|
||||
>.
|
||||
</div>
|
||||
<div v-if="transaction.exchange" class="exchange">
|
||||
<div v-if="currencies.length">
|
||||
<hr />
|
||||
<h3 class="subtitle is-3">
|
||||
Taux d'échange le {{ transaction.date | fulldate }}
|
||||
</h3>
|
||||
<div class="columns is-centered">
|
||||
<div class="column">
|
||||
<table class="table is-fullwidth is-striped is-bordered">
|
||||
<caption>
|
||||
<span class="numeric">{{
|
||||
transaction.amount | money(transaction.mainCurrency)
|
||||
}}</span>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td class="numeric">
|
||||
{{
|
||||
(transaction.amount *
|
||||
transaction.exchange.rates[currency.code])
|
||||
| moneypad(currency)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="column">
|
||||
<table class="table is-fullwidth is-striped is-bordered">
|
||||
<caption>
|
||||
<span class="numeric">{{
|
||||
1 | money(transaction.mainCurrency)
|
||||
}}</span>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td class="numeric">
|
||||
{{
|
||||
transaction.exchange.rates[currency.code]
|
||||
| moneypad(currency)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="column">
|
||||
<table
|
||||
class="table is-hoverable is-fullwidth is-striped is-bordered"
|
||||
>
|
||||
<caption>
|
||||
{{
|
||||
$tc('transaction.money', currencies.length)
|
||||
}}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td>{{ 1 | money(currency) }}</td>
|
||||
<td class="numeric">
|
||||
{{
|
||||
(1 / transaction.exchange.rates[currency.code])
|
||||
| moneypad(transaction.mainCurrency)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-half">
|
||||
<h3 class="subtitle is-3">{{ transaction.date | fulldate }}</h3>
|
||||
<div class="resume">
|
||||
Dépense payée par
|
||||
<span class="pay-by">{{ transaction.payBy }}</span>
|
||||
<span v-if="!uniqueUser">
|
||||
pour
|
||||
<span class="pay-for">{{ payForLabel.join(', ') }}</span>
|
||||
</span>
|
||||
<span v-if="transaction.location">
|
||||
à {{ transaction.location.place }}
|
||||
</span>
|
||||
d'une somme de
|
||||
<span class="numeric">{{
|
||||
transaction.amount | money(transaction.mainCurrency)
|
||||
}}</span>
|
||||
.
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="transaction.exchange">
|
||||
<div v-if="currencies.length" class="exchange column is-half">
|
||||
<h3 class="subtitle is-3">
|
||||
Taux d'échange
|
||||
</h3>
|
||||
<div class="columns is-centered">
|
||||
<div class="column">
|
||||
<table class="table is-fullwidth is-striped is-bordered">
|
||||
<caption>
|
||||
<span class="numeric">{{
|
||||
transaction.amount | money(transaction.mainCurrency)
|
||||
}}</span>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td class="numeric">
|
||||
{{
|
||||
(transaction && transaction.amount) ||
|
||||
(1 * getRate(currency.code)) | moneypad(currency)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="column">
|
||||
<table class="table is-fullwidth is-striped is-bordered">
|
||||
<caption>
|
||||
<span class="numeric">{{
|
||||
1 | money(transaction.mainCurrency)
|
||||
}}</span>
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td class="numeric">
|
||||
{{ getRate(currency.code) | moneypad(currency) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="column">
|
||||
<table
|
||||
class="table is-hoverable is-fullwidth is-striped is-bordered"
|
||||
>
|
||||
<caption>
|
||||
{{
|
||||
$tc('transaction.money', currencies.length)
|
||||
}}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr v-for="(currency, k) in currencies" :key="k">
|
||||
<td>{{ 1 | money(currency) }}</td>
|
||||
<td class="numeric">
|
||||
{{
|
||||
(1 / getRate(currency.code))
|
||||
| moneypad(transaction && transaction.mainCurrency)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<online-view @online="retrieveExchange" />Le taux d'échange n'a pas pu
|
||||
être récupéré.
|
||||
<div v-else class="column is-half">
|
||||
<online-view @online="retrieveExchange" />
|
||||
Le taux d'échange n'a pas pu être récupéré.
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons is-centered" v-if="account && !account.archive">
|
||||
<router-link
|
||||
@@ -118,11 +122,12 @@
|
||||
tag="button"
|
||||
class="button"
|
||||
:to="{ name: 'transaction-update', params: { id } }"
|
||||
>modifier</router-link
|
||||
>
|
||||
<confirm-button class="is-danger" @confirm="removeTransaction"
|
||||
>supprimer</confirm-button
|
||||
>
|
||||
modifier
|
||||
</router-link>
|
||||
<confirm-button class="is-danger" @confirm="removeTransaction">
|
||||
supprimer
|
||||
</confirm-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -227,6 +232,22 @@ export default class TransactionItem extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public getRate(code: string) {
|
||||
return (
|
||||
(this.transaction &&
|
||||
this.transaction.exchange &&
|
||||
this.transaction.exchange.rates[code]) ||
|
||||
1
|
||||
)
|
||||
}
|
||||
|
||||
public uniqueUser() {
|
||||
if (!this.transaction) {
|
||||
return false
|
||||
}
|
||||
return this.transaction.payBy === this.payForLabel.join(',')
|
||||
}
|
||||
|
||||
public get accountId(): string {
|
||||
return (this.transaction && this.transaction.accountId) || ''
|
||||
}
|
||||
@@ -303,7 +324,8 @@ table.table {
|
||||
.buttons {
|
||||
margin-top: 15px;
|
||||
}
|
||||
.pay-by {
|
||||
.pay-by,
|
||||
.pay-for {
|
||||
font-weight: bold;
|
||||
}
|
||||
.numeric {
|
||||
|
||||
Reference in New Issue
Block a user