diff --git a/oform/OForm.js b/oform/OForm.js index e796f6f..f458ff4 100644 --- a/oform/OForm.js +++ b/oform/OForm.js @@ -100,6 +100,10 @@ { this.CurrentUser = null; }; + OForm.prototype.getCurrentRole = function() + { + return this.CurrentUser ? this.CurrentUser.getRole() : null; + }; OForm.prototype.getCurrentUserMaster = function() { return this.CurrentUser; @@ -444,6 +448,21 @@ { this.NeedUpdateRoles = true; }; + OForm.prototype.onChangeFieldGroupFilled = function(fieldGroup) + { + if (!this.Document) + return; + + for (let i = 0; i < this.Roles.length; ++i) + { + let role = this.Roles[i]; + if (fieldGroup === role.getFieldGroup()) + { + this.Document.sendEvent("asc_onOFormRoleFilled", role.getRole(), fieldGroup.isFilled()); + return; + } + } + }; OForm.prototype.onChangeRoleColor = function() { this.NeedRedraw = true; @@ -579,13 +598,13 @@ return true; }; - OForm.prototype.setRoleFilled = function(roleName) + OForm.prototype.setRoleFilled = function(roleName, isFilled) { let role = this.getRole(roleName); if (!role) return; - role.setFilled(true); + role.setFilled(isFilled); }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Private area diff --git a/oform/format/Document.js b/oform/format/Document.js index c3c99da..e07236c 100644 --- a/oform/format/Document.js +++ b/oform/format/Document.js @@ -568,6 +568,13 @@ this.OForm.onChangeRoles(); }; + CDocument.prototype.onChangeFieldGroup = function(fieldGroup) + { + if (!this.OForm) + return; + + this.OForm.onChangeFieldGroupFilled(fieldGroup); + }; CDocument.prototype.onChangeUserMaster = function(userMaster) { if (!this.OForm) diff --git a/oform/format/FieldGroup.js b/oform/format/FieldGroup.js index 92a62a0..3426eb0 100644 --- a/oform/format/FieldGroup.js +++ b/oform/format/FieldGroup.js @@ -163,6 +163,13 @@ this.Parent.onChangeFieldGroup(this); }; + CFieldGroup.prototype.onChangeFilled = function() + { + if (!this.Parent) + return; + + this.Parent.onChangeFieldGroupFilled(this); + }; CFieldGroup.prototype.getAllFields = function() { let fields = [];