[oform] Add an event when current role is filled in

This commit is contained in:
Ilya Kirillov
2025-02-19 14:16:26 +03:00
parent bb4bd422b3
commit 46d2220494
3 changed files with 35 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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 = [];