Files
firefly-iii/frontend/src/components/transactions/TransactionExternalUrl.vue

76 lines
2.2 KiB
Vue
Raw Normal View History

2021-01-17 08:52:40 +01:00
<!--
- TransactionInternalReference.vue
- Copyright (c) 2021 james@firefly-iii.org
-
- This file is part of Firefly III (https://github.com/firefly-iii).
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<template>
2021-02-15 20:32:29 +01:00
<div class="form-group" v-if="showField">
2021-01-17 08:52:40 +01:00
<div class="text-xs d-none d-lg-block d-xl-block">
{{ $t('firefly.external_url') }}
</div>
<div class="input-group">
<input
type="url"
name="external_url[]"
:placeholder="$t('firefly.external_url')"
2021-02-14 19:13:42 +01:00
v-model="url"
2021-01-31 07:26:52 +01:00
:class="errors.length > 0 ? 'form-control is-invalid' : 'form-control'"
/>
2021-01-17 08:52:40 +01:00
<div class="input-group-append">
2021-02-10 06:55:56 +01:00
<button tabindex="-1" type="button" class="btn btn-outline-secondary"><i class="far fa-trash-alt"></i></button>
2021-01-17 08:52:40 +01:00
</div>
</div>
</div>
</template>
<script>
export default {
2021-02-15 20:32:29 +01:00
props: ['index', 'value', 'errors', 'customFields'],
2021-01-17 08:52:40 +01:00
name: "TransactionExternalUrl",
2021-02-14 19:13:42 +01:00
data() {
return {
2021-02-15 20:32:29 +01:00
url: this.value,
2021-02-25 06:27:43 +01:00
availableFields: this.customFields,
2021-02-15 20:32:29 +01:00
}
},
computed: {
showField: function () {
if ('external_uri' in this.availableFields) {
return this.availableFields.external_uri;
}
return false;
2021-02-14 19:13:42 +01:00
}
},
2021-02-23 06:39:25 +01:00
methods: {},
2021-01-17 08:52:40 +01:00
watch: {
2021-02-15 20:32:29 +01:00
customFields: function (value) {
this.availableFields = value;
},
2021-02-25 06:27:43 +01:00
value: function (value) {
this.url = value;
},
2021-02-14 19:13:42 +01:00
url: function (value) {
2021-02-25 06:27:43 +01:00
this.$emit('set-field', {field: 'external_url', index: this.index, value: value});
2021-01-17 08:52:40 +01:00
}
}
}
</script>
<style scoped>
</style>