2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
- Dont render hidden fields
- Render Fields with Custom Template
- Disabled fields
This commit is contained in:
Faris Ansari 2018-07-09 18:30:57 +05:30
parent 180845aa0c
commit c8422eca39
3 changed files with 19 additions and 2 deletions

View File

@ -7,6 +7,7 @@
<div class="col" v-for="(column, j) in section.columns" :key="j">
<frappe-control
v-for="fieldname in column.fields"
v-if="fieldIsNotHidden(fieldname)"
:key="fieldname"
:docfield="getDocField(fieldname)"
:value="$data[fieldname]"
@ -58,6 +59,9 @@ export default {
getDocField(fieldname) {
return this.fields.find(df => df.fieldname === fieldname);
},
fieldIsNotHidden(fieldname) {
return !Boolean(this.getDocField(fieldname).hidden);
},
updateDoc(fieldname, value) {
this.doc.set(fieldname, value);
},

View File

@ -70,7 +70,8 @@ export default {
type: 'text',
placeholder: '',
value: this.value,
required: this.docfield.required
required: this.docfield.required,
disabled: this.docfield.disabled
}
},
getInputListeners() {

View File

@ -1,5 +1,6 @@
<template>
<component :is="component"
<component
:is="component"
:docfield="docfield"
:value="value"
:onlyInput="onlyInput"
@ -7,6 +8,7 @@
/>
</template>
<script>
import Base from './Base';
import Autocomplete from './Autocomplete';
import Check from './Check';
import Code from './Code';
@ -27,6 +29,16 @@ export default {
props: ['docfield', 'value', 'onlyInput'],
computed: {
component() {
if (this.docfield.template) {
// for controls with their own template
// create a vue object for it
return {
extends: Base,
render: null,
template: this.docfield.template()
}
}
return {
Autocomplete,
Check,