Skip to content

Commit

Permalink
fix: if flat or percentage commission is set, remove the required field
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 committed Nov 11, 2019
1 parent 5abdeb2 commit a3170cc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/admin/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@
if ( field in value && value[field].length < 1 ) {
if ( ! this.errors.includes( field ) ) {
this.errors.push( field );
// If flat or percentage commission is set. Remove the required field.
if ( 'flat' === value['commission_type'] || 'percentage' === value['commission_type'] ) {
this.errors = this.arrayRemove( this.errors, 'admin_percentage' );
}
}
}
} );
Expand All @@ -259,6 +264,12 @@
}
return false;
},
arrayRemove( array, value ) {
return array.filter( ( element ) => {
return element !== value;
});
}
},
Expand Down

0 comments on commit a3170cc

Please sign in to comment.