mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
Make sure all custom fields are included in form.
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
v-model="transaction.tags"
|
||||
></tags>
|
||||
<!-- custom string fields -->
|
||||
<custom-transaction-fields></custom-transaction-fields>
|
||||
<custom-transaction-fields v-model="transaction.custom_fields"></custom-transaction-fields>
|
||||
|
||||
<!-- custom date fields -->
|
||||
|
||||
@@ -189,6 +189,17 @@
|
||||
piggy_bank: 0,
|
||||
budget: 0,
|
||||
tags: [],
|
||||
custom_fields: {
|
||||
"interest_date": "2010-01-01",
|
||||
"book_date": "",
|
||||
"process_date": "",
|
||||
"due_date": "",
|
||||
"payment_date": "",
|
||||
"invoice_date": "",
|
||||
"internal_reference": "",
|
||||
"notes": "",
|
||||
"attachments": []
|
||||
},
|
||||
foreign_amount: {
|
||||
amount: "",
|
||||
currency_id: 0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 text-sm">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<input multiple="multiple"
|
||||
autocomplete="off"
|
||||
:placeholder="title"
|
||||
:title="title"
|
||||
:name="name" type="file" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CustomAttachments",
|
||||
props: {
|
||||
title: String,
|
||||
name: String
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,21 +1,31 @@
|
||||
<template>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 text-sm">
|
||||
Custom Date
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<!-- v-model="transaction.date" -->
|
||||
<!-- :disabled="index > 0" -->
|
||||
<input type="date" class="form-control" name="date[]"
|
||||
title="Custom Date" value="" autocomplete="off"
|
||||
placeholder="Custom Date">
|
||||
<input type="date" class="form-control" :name="name"
|
||||
:title="title" autocomplete="off"
|
||||
ref="date"
|
||||
:value="value" @input="handleInput"
|
||||
:placeholder="title">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CustomDate"
|
||||
name: "CustomDate",
|
||||
props: {
|
||||
value: String,
|
||||
title: String,
|
||||
name: String
|
||||
},
|
||||
methods: {
|
||||
handleInput(e) {
|
||||
this.$emit('input', this.$refs.date.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
34
resources/assets/js/components/transactions/CustomString.vue
Normal file
34
resources/assets/js/components/transactions/CustomString.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 text-sm">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" :name="name"
|
||||
:title="title" autocomplete="off"
|
||||
ref="str"
|
||||
:value="value" @input="handleInput"
|
||||
:placeholder="title">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CustomString",
|
||||
props: {
|
||||
title: String,
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
methods: {
|
||||
handleInput(e) {
|
||||
this.$emit('input', this.$refs.str.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 text-sm">
|
||||
{{ title }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<textarea class="form-control" :name="name"
|
||||
:title="title" autocomplete="off"
|
||||
ref="str"
|
||||
:value="value" @input="handleInput"
|
||||
:placeholder="title" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CustomTextarea",
|
||||
props: {
|
||||
title: String,
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
methods: {
|
||||
handleInput(e) {
|
||||
this.$emit('input', this.$refs.str.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -20,18 +20,27 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<component v-if="this.fields.interest_date" v-bind:is="componentInstance"></component>
|
||||
<component v-if="this.fields.book_date" v-bind:is="componentInstance"></component>
|
||||
<component v-if="this.fields.process_date" v-bind:is="componentInstance"></component>
|
||||
<component v-if="this.fields.due_date" v-bind:is="componentInstance"></component>
|
||||
<component v-if="this.fields.payment_date" v-bind:is="componentInstance"></component>
|
||||
<component v-if="this.fields.invoice_date" v-bind:is="componentInstance"></component>
|
||||
<component v-model="value.interest_date" v-if="this.fields.interest_date" name="interest_date[]" title="Interest date" v-bind:is="dateComponent"></component>
|
||||
<component v-model="value.book_date" v-if="this.fields.book_date" name="book_date[]" title="Book date" v-bind:is="dateComponent"></component>
|
||||
<component v-model="value.process_date" v-if="this.fields.process_date" name="process_date[]" title="Process date" v-bind:is="dateComponent"></component>
|
||||
<component v-model="value.due_date" v-if="this.fields.due_date" name="due_date[]" title="Due date" v-bind:is="dateComponent"></component>
|
||||
<component v-model="value.payment_date" v-if="this.fields.payment_date" name="payment_date[]" title="Payment date" v-bind:is="dateComponent"></component>
|
||||
<component v-model="value.invoice_date" v-if="this.fields.invoice_date" name="invoice_date[]" title="Invoice date" v-bind:is="dateComponent"></component>
|
||||
|
||||
<component v-model="value.internal_reference" v-if="this.fields.internal_reference" name="internal_reference[]" title="Internal reference" v-bind:is="stringComponent"></component>
|
||||
|
||||
<component v-model="value.attachments" v-if="this.fields.attachments" name="attachments[]" title="Attachments" v-bind:is="attachmentComponent"></component>
|
||||
|
||||
<component v-model="value.notes" v-if="this.fields.notes" name="notes[]" title="Notes" v-bind:is="textareaComponent"></component>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CustomTransactionFields",
|
||||
props: ['value'],
|
||||
mounted() {
|
||||
this.getPreference();
|
||||
},
|
||||
@@ -54,11 +63,24 @@
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
componentInstance () {
|
||||
// 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';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleInput(e) {
|
||||
this.$emit('input', this.value);
|
||||
},
|
||||
getPreference() {
|
||||
|
||||
// Vue.component('custom-date', (resolve) => {
|
||||
|
||||
Reference in New Issue
Block a user