Update translations + JS

This commit is contained in:
James Cole
2020-10-17 21:41:13 +02:00
parent a79f7e3b59
commit 937c11e83c
76 changed files with 1656 additions and 1603 deletions

View File

@@ -19,107 +19,117 @@
-->
<template>
<div>
<p class="help-block" v-html="$t('firefly.hidden_fields_preferences')"></p>
<component
:error="error.interest_date"
v-model="value.interest_date" v-if="this.fields.interest_date" name="interest_date[]" v-bind:title="$t('form.interest_date')" v-bind:is="dateComponent"></component>
<component
:error="error.book_date"
v-model="value.book_date" v-if="this.fields.book_date" name="book_date[]" v-bind:title="$t('form.book_date')" v-bind:is="dateComponent"></component>
<component
:error="error.process_date"
v-model="value.process_date" v-if="this.fields.process_date" name="process_date[]" v-bind:title="$t('form.process_date')" v-bind:is="dateComponent"></component>
<component
:error="error.due_date"
v-model="value.due_date" v-if="this.fields.due_date" name="due_date[]" v-bind:title="$t('form.due_date')" v-bind:is="dateComponent"></component>
<component
:error="error.payment_date"
v-model="value.payment_date" v-if="this.fields.payment_date" name="payment_date[]" v-bind:title="$t('form.payment_date')" v-bind:is="dateComponent"></component>
<div>
<p class="help-block" v-html="$t('firefly.hidden_fields_preferences')"></p>
<component
v-bind:is="dateComponent"
v-if="this.fields.interest_date" v-model="value.interest_date" :error="error.interest_date"
name="interest_date[]" v-bind:title="$t('form.interest_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.book_date" v-model="value.book_date" :error="error.book_date" name="book_date[]"
v-bind:title="$t('form.book_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.process_date" v-model="value.process_date" :error="error.process_date"
name="process_date[]" v-bind:title="$t('form.process_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.due_date" v-model="value.due_date" :error="error.due_date" name="due_date[]"
v-bind:title="$t('form.due_date')"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.payment_date" v-model="value.payment_date" :error="error.payment_date"
name="payment_date[]" v-bind:title="$t('form.payment_date')"></component>
<component
:error="error.invoice_date"
v-model="value.invoice_date" v-if="this.fields.invoice_date" name="invoice_date[]" v-bind:title="$t('form.invoice_date')" v-bind:is="dateComponent"></component>
<component
v-bind:is="dateComponent"
v-if="this.fields.invoice_date" v-model="value.invoice_date" :error="error.invoice_date"
name="invoice_date[]" v-bind:title="$t('form.invoice_date')"></component>
<component
:error="error.internal_reference"
v-model="value.internal_reference" v-if="this.fields.internal_reference" name="internal_reference[]" v-bind:title="$t('form.internal_reference')" v-bind:is="stringComponent"></component>
<component
v-bind:is="stringComponent"
v-if="this.fields.internal_reference" v-model="value.internal_reference" :error="error.internal_reference"
name="internal_reference[]" v-bind:title="$t('form.internal_reference')"></component>
<component
:error="error.attachments"
v-model="value.attachments" v-if="this.fields.attachments" name="attachments[]" v-bind:title="$t('firefly.attachments')" v-bind:is="attachmentComponent"></component>
<component
v-bind:is="attachmentComponent"
v-if="this.fields.attachments" v-model="value.attachments" :error="error.attachments"
name="attachments[]" v-bind:title="$t('firefly.attachments')"></component>
<component
:error="error.external_uri"
v-model="value.external_uri" v-if="this.fields.external_uri" name="external_uri[]" v-bind:title="$t('firefly.external_uri')" v-bind:is="uriComponent"></component>
<component
v-bind:is="uriComponent"
v-if="this.fields.external_uri" v-model="value.external_uri" :error="error.external_uri"
name="external_uri[]" v-bind:title="$t('firefly.external_uri')"></component>
<component
:error="error.notes"
v-model="value.notes" v-if="this.fields.notes" name="notes[]" v-bind:title="$t('firefly.notes')" v-bind:is="textareaComponent"></component>
</div>
<component
v-bind:is="textareaComponent"
v-if="this.fields.notes" v-model="value.notes" :error="error.notes" name="notes[]"
v-bind:title="$t('firefly.notes')"></component>
</div>
</template>
<script>
export default {
name: "CustomTransactionFields",
props: ['value','error'],
mounted() {
this.getPreference();
},
data() {
return {
customInterestDate: null,
fields: [
{
"interest_date": false,
"book_date": false,
"process_date": false,
"due_date": false,
"payment_date": false,
"invoice_date": false,
"internal_reference": false,
"notes": false,
"attachments": false,
"external_uri": false
}
]
};
},
computed: {
// TODO this seems a pretty weird way of doing it.
dateComponent () {
return 'custom-date';
},
stringComponent () {
return 'custom-string';
},
attachmentComponent () {
return 'custom-attachments';
},
textareaComponent () {
return 'custom-textarea';
},
uriComponent () {
return 'custom-uri';
}
},
methods: {
handleInput(e) {
this.$emit('input', this.value);
},
getPreference() {
// Vue.component('custom-date', (resolve) => {
// console.log('loaded');
// });
const url = document.getElementsByTagName('base')[0].href + 'api/v1/preferences/transaction_journal_optional_fields';
axios.get(url).then(response => {
this.fields = response.data.data.attributes.data;
}).catch(() => console.warn('Oh. Something went wrong loading custom transaction fields.'));
},
export default {
name: "CustomTransactionFields",
props: ['value', 'error'],
mounted() {
this.getPreference();
},
data() {
return {
customInterestDate: null,
fields: [
{
"interest_date": false,
"book_date": false,
"process_date": false,
"due_date": false,
"payment_date": false,
"invoice_date": false,
"internal_reference": false,
"notes": false,
"attachments": false,
"external_uri": false
}
]
};
},
computed: {
// TODO this seems a pretty weird way of doing it.
dateComponent() {
return 'custom-date';
},
stringComponent() {
return 'custom-string';
},
attachmentComponent() {
return 'custom-attachments';
},
textareaComponent() {
return 'custom-textarea';
},
uriComponent() {
return 'custom-uri';
}
},
methods: {
handleInput(e) {
this.$emit('input', this.value);
},
getPreference() {
// Vue.component('custom-date', (resolve) => {
// console.log('loaded');
// });
const url = document.getElementsByTagName('base')[0].href + 'api/v1/preferences/transaction_journal_optional_fields';
axios.get(url).then(response => {
this.fields = response.data.data.attributes.data;
}).catch(() => console.warn('Oh. Something went wrong loading custom transaction fields.'));
},
}
}
</script>
<style scoped>