2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00

fix: update setup wizard

This commit is contained in:
18alantom 2022-04-25 14:27:05 +05:30
parent 1b85fee5e6
commit b383e426a0
4 changed files with 39 additions and 17 deletions

View File

@ -102,7 +102,16 @@ export class Doc extends Observable<DocValue | Doc[]> {
}
get quickEditFields() {
const fieldnames = this.schema.quickEditFields ?? ['name'];
let fieldnames = this.schema.quickEditFields;
if (fieldnames === undefined) {
fieldnames = [];
}
if (fieldnames.length === 0 && this.fieldMap['name']) {
fieldnames = ['name'];
}
return fieldnames.map((f) => this.fieldMap[f]);
}

View File

@ -66,17 +66,18 @@
"placeholder": "Currency",
"required": true
},
{
"fieldname": "chartOfAccounts",
"label": "Chart of Accounts",
"fieldtype": "AutoComplete",
"placeholder": "Select CoA",
"required": true
},
{
"fieldname": "completed",
"label": "Completed",
"fieldtype": "Check",
"readOnly": true
},
{
"fieldname": "chartOfAccounts",
"label": "Chart of Accounts",
"fieldtype": "AutoComplete",
"placeholder": "Select CoA"
}
],
"quickEditFields": [

View File

@ -99,7 +99,7 @@ export default {
emits: ['error', 'change'],
props: {
doc: Doc,
fields: Array,
fields: { type: Array, default: () => [] },
autosave: Boolean,
columnRatio: {
type: Array,
@ -137,7 +137,10 @@ export default {
if (this.focusFirstInput) {
this.$refs['controls'][0].focus();
}
if (fyo.store.isDevelopment) {
window.tcf = this;
}
},
methods: {
getRegularValue(df) {
@ -248,8 +251,18 @@ export default {
},
computed: {
formFields() {
return (this.fields || this.doc.quickEditFields).filter(
(field) => !evaluateHidden(field, this.doc)
let fieldList = this.fields;
if (fieldList.length === 0) {
fieldList = this.doc.quickEditFields;
}
if (fieldList.length === 0) {
fieldList = this.doc.schema.fields.filter((f) => f.required);
}
return fieldList.filter(
(field) => field && !evaluateHidden(field, this.doc)
);
},
style() {

View File

@ -57,7 +57,7 @@
@change="(value) => setValue('companyName', value)"
:input-class="
() => [
'bg-transparent font-semibold text-xl text-white placeholder-blue-200 focus:outline-none focus:bg-blue-600 px-3 rounded py-1',
'bg-transparent font-semibold text-xl text-white placeholder-blue-400 focus:outline-none focus:bg-blue-600 px-3 rounded py-1',
]
"
:autofocus="true"
@ -68,7 +68,7 @@
@change="(value) => setValue('email', value)"
:input-class="
() => [
'text-base bg-transparent text-white placeholder-blue-200 focus:bg-blue-600 focus:outline-none rounded px-3 py-1',
'text-base bg-transparent text-white placeholder-blue-400 focus:bg-blue-600 focus:outline-none rounded px-3 py-1',
]
"
/>
@ -163,16 +163,15 @@ export default {
setValue(fieldname, value) {
this.emailError = null;
this.doc.set(fieldname, value).catch((e) => {
// set error
if (fieldname === 'email') {
this.emailError = getErrorMessage(e, this.doc);
}
});
},
allValuesFilled() {
const values = this.doc.schema.quickEditFields.map(
(fieldname) => this.doc[fieldname]
);
const values = this.doc.schema.fields
.filter((f) => f.required)
.map((f) => this.doc[f.fieldname]);
return values.every(Boolean);
},
async submit() {