✨ (transaction) save location in transaction
This commit is contained in:
1
.env
1
.env
@@ -1 +1,2 @@
|
|||||||
VUE_APP_COUCHDB=https://couch.li212.fr
|
VUE_APP_COUCHDB=https://couch.li212.fr
|
||||||
|
VUE_APP_MAP_KEY=AnLDo_m_IGvMsQPLuBak9igWj3gNYvqBodj0esZZ7VfI1OkqVWvg04eTZ4U9R0Y2
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="(category, k) in filteredCategories"
|
v-for="(category, k) in filteredCategories"
|
||||||
:key="k"
|
:key="k"
|
||||||
class="category-list-container column is-half"
|
class="category-list-container column is-one-third"
|
||||||
>
|
>
|
||||||
<div class="columns category-list">
|
<div class="columns category-list">
|
||||||
<div class="column is-2 tag-element account-color">
|
<div class="column is-2 tag-element account-color">
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<transaction-tag-update v-model="tag" />
|
<transaction-tag-update v-model="tag" />
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column" v-if="account.users.length > 1">
|
||||||
<div class="field is-horizontal">
|
<div class="field is-horizontal">
|
||||||
<div class="field-label is-normal">
|
<div class="field-label is-normal">
|
||||||
<label class="label">Payé par</label>
|
<label class="label">Payé par</label>
|
||||||
@@ -290,6 +290,7 @@ export default class TransactionCreate extends Vue {
|
|||||||
mainCurrency: this.currency,
|
mainCurrency: this.currency,
|
||||||
currencies: this.account.currencies,
|
currencies: this.account.currencies,
|
||||||
transactionType: TransactionType.normal,
|
transactionType: TransactionType.normal,
|
||||||
|
location: this.transaction.location,
|
||||||
exchange: await exchangeService.get(this.currency.code, date, currencies)
|
exchange: await exchangeService.get(this.currency.code, date, currencies)
|
||||||
}
|
}
|
||||||
const response: PouchDB.Core.Response = hasId
|
const response: PouchDB.Core.Response = hasId
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ class MapService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private url(latitude: number, longitude: number) {
|
private url(latitude: number, longitude: number) {
|
||||||
return `https://dev.virtualearth.net/REST/v1/Locations/${latitude},${longitude}?key=${
|
return `https://dev.virtualearth.net/REST/v1/Locations/${latitude},${longitude}?key=${this.key}`
|
||||||
this.key
|
|
||||||
}`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,23 +25,30 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="columns is-centered">
|
||||||
|
<div class="column is-half">
|
||||||
<h3 class="subtitle is-3">{{ transaction.date | fulldate }}</h3>
|
<h3 class="subtitle is-3">{{ transaction.date | fulldate }}</h3>
|
||||||
<div class="resume">
|
<div class="resume">
|
||||||
Dépense payée par
|
Dépense payée par
|
||||||
<span class="pay-by">{{ transaction.payBy }}</span>
|
<span class="pay-by">{{ transaction.payBy }}</span>
|
||||||
|
<span v-if="!uniqueUser">
|
||||||
pour
|
pour
|
||||||
<span>{{ payForLabel.join(', ') }}</span>
|
<span class="pay-for">{{ payForLabel.join(', ') }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-if="transaction.location">
|
||||||
|
à {{ transaction.location.place }}
|
||||||
|
</span>
|
||||||
d'une somme de
|
d'une somme de
|
||||||
<span class="numeric">{{
|
<span class="numeric">{{
|
||||||
transaction.amount | money(transaction.mainCurrency)
|
transaction.amount | money(transaction.mainCurrency)
|
||||||
}}</span
|
}}</span>
|
||||||
>.
|
.
|
||||||
</div>
|
</div>
|
||||||
<div v-if="transaction.exchange" class="exchange">
|
</div>
|
||||||
<div v-if="currencies.length">
|
<div v-if="transaction.exchange">
|
||||||
<hr />
|
<div v-if="currencies.length" class="exchange column is-half">
|
||||||
<h3 class="subtitle is-3">
|
<h3 class="subtitle is-3">
|
||||||
Taux d'échange le {{ transaction.date | fulldate }}
|
Taux d'échange
|
||||||
</h3>
|
</h3>
|
||||||
<div class="columns is-centered">
|
<div class="columns is-centered">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
@@ -55,9 +62,8 @@
|
|||||||
<tr v-for="(currency, k) in currencies" :key="k">
|
<tr v-for="(currency, k) in currencies" :key="k">
|
||||||
<td class="numeric">
|
<td class="numeric">
|
||||||
{{
|
{{
|
||||||
(transaction.amount *
|
(transaction && transaction.amount) ||
|
||||||
transaction.exchange.rates[currency.code])
|
(1 * getRate(currency.code)) | moneypad(currency)
|
||||||
| moneypad(currency)
|
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -74,10 +80,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(currency, k) in currencies" :key="k">
|
<tr v-for="(currency, k) in currencies" :key="k">
|
||||||
<td class="numeric">
|
<td class="numeric">
|
||||||
{{
|
{{ getRate(currency.code) | moneypad(currency) }}
|
||||||
transaction.exchange.rates[currency.code]
|
|
||||||
| moneypad(currency)
|
|
||||||
}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -97,8 +100,8 @@
|
|||||||
<td>{{ 1 | money(currency) }}</td>
|
<td>{{ 1 | money(currency) }}</td>
|
||||||
<td class="numeric">
|
<td class="numeric">
|
||||||
{{
|
{{
|
||||||
(1 / transaction.exchange.rates[currency.code])
|
(1 / getRate(currency.code))
|
||||||
| moneypad(transaction.mainCurrency)
|
| moneypad(transaction && transaction.mainCurrency)
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -108,9 +111,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else class="column is-half">
|
||||||
<online-view @online="retrieveExchange" />Le taux d'échange n'a pas pu
|
<online-view @online="retrieveExchange" />
|
||||||
être récupéré.
|
Le taux d'échange n'a pas pu être récupéré.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons is-centered" v-if="account && !account.archive">
|
<div class="buttons is-centered" v-if="account && !account.archive">
|
||||||
<router-link
|
<router-link
|
||||||
@@ -118,11 +122,12 @@
|
|||||||
tag="button"
|
tag="button"
|
||||||
class="button"
|
class="button"
|
||||||
:to="{ name: 'transaction-update', params: { id } }"
|
: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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</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 {
|
public get accountId(): string {
|
||||||
return (this.transaction && this.transaction.accountId) || ''
|
return (this.transaction && this.transaction.accountId) || ''
|
||||||
}
|
}
|
||||||
@@ -303,7 +324,8 @@ table.table {
|
|||||||
.buttons {
|
.buttons {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
.pay-by {
|
.pay-by,
|
||||||
|
.pay-for {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.numeric {
|
.numeric {
|
||||||
|
|||||||
Reference in New Issue
Block a user