mirror of
https://github.com/frappe/books.git
synced 2025-01-22 22:58:28 +00:00
validate each step of setup wizard before next
This commit is contained in:
parent
e4dd0a9954
commit
56aa6c70af
@ -23,14 +23,6 @@ module.exports = {
|
|||||||
fieldtype: "Account"
|
fieldtype: "Account"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"fieldname": "file",
|
|
||||||
"label": "File",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"required": 1,
|
|
||||||
"directory": 1
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"fieldname": "country",
|
"fieldname": "country",
|
||||||
"label": "Country",
|
"label": "Country",
|
||||||
@ -53,13 +45,6 @@ module.exports = {
|
|||||||
"required": 1
|
"required": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"fieldname": "abbreviation",
|
|
||||||
"label": "Abbreviation",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"required": 1
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"fieldname": "bankName",
|
"fieldname": "bankName",
|
||||||
"label": "Bank Name",
|
"label": "Bank Name",
|
||||||
|
@ -30,7 +30,8 @@ module.exports = {
|
|||||||
"fieldname": "email",
|
"fieldname": "email",
|
||||||
"label": "Email",
|
"label": "Email",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"required": 1
|
"required": 1,
|
||||||
|
"inputType": "email"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -40,13 +41,6 @@ module.exports = {
|
|||||||
"required": 1
|
"required": 1
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"fieldname": "abbreviation",
|
|
||||||
"label": "Abbreviation",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"required": 1
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"fieldname": "bankName",
|
"fieldname": "bankName",
|
||||||
"label": "Bank Name",
|
"label": "Bank Name",
|
||||||
@ -73,14 +67,7 @@ module.exports = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
title: 'Add your Company',
|
title: 'Add your Company',
|
||||||
columns: [
|
fields: ['companyName', 'bankName']
|
||||||
{
|
|
||||||
fields: ['companyName', 'bankName']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fields: ['abbreviation']
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,29 @@ module.exports = class SetupWizard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nextSlide() {
|
nextSlide() {
|
||||||
this.showSlide(this.currentIndex + 1);
|
const isValid = this.validateCurrentSlide();
|
||||||
|
frappe.ui.toggleClass(this.formLayout.sections[this.currentIndex], 'was-validated', !isValid);
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
this.showSlide(this.currentIndex + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
validateCurrentSlide() {
|
||||||
|
const fields = this.getFieldsInSlide(this.currentIndex);
|
||||||
|
const inputValidityMap = fields.map(field => this.formLayout.controls[field].input.checkValidity());
|
||||||
|
const isValid = !inputValidityMap.includes(false);
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldsInSlide(index) {
|
||||||
|
const visibleSection = slideConfigs.layout[index];
|
||||||
|
const fieldsInSlide = visibleSection.fields ||
|
||||||
|
visibleSection.columns.reduce(
|
||||||
|
(col, fields) => fields.concat(col.fields), []
|
||||||
|
);
|
||||||
|
|
||||||
|
return fieldsInSlide;
|
||||||
}
|
}
|
||||||
|
|
||||||
activateIndicator(index) {
|
activateIndicator(index) {
|
||||||
|
2
www/dist/css/style.css
vendored
2
www/dist/css/style.css
vendored
@ -7587,3 +7587,5 @@ input[type=file] {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: -1; }
|
z-index: -1; }
|
||||||
|
.was-validated input[type=file]:invalid + button {
|
||||||
|
border-color: #dc3545; }
|
||||||
|
3095
www/dist/js/bundle.js
vendored
3095
www/dist/js/bundle.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user