Files
Unify/application/user/group/user.group.js

138 lines
1.8 KiB
JavaScript
Raw Normal View History

2025-12-25 11:16:59 +01:00
import collection from "/unify/collection.js";
import datatype from '/unify/datatype.js';
import option from '/elements/option.js';
class visitor extends option{
value = 2.0;
label = "Visitor";
type = "userGroup";
constructor() {
super();
}
}
class member extends option{
value = 0.0;
ander = 0.0;
label = "Member";
type = "userGroup";
constructor() {
super();
}
}
class admin extends option {
value = 1.0;
label = "Admin";
type = "userGroup";
constructor() {
super();
}
}
export default class groups {
datatype = 'TEXT';
value = 2.0;
enabled = false;
type = "column"
change() {
var children = this.getChildren();
for(var c = 0; c<children.length; c++) {
var child = children[ c ];
if( child.customElement.selected ) {
this.value = child.customElement.value;
}
}
}
create() {
this.customElement.value = parseFloat( this.value );
// the code here under is redundant, There is still an error, bug that needs to be resolved.
/*
var children = this.getChildren();
for (var i = 0; i < children.length; i++) {
var child = children[i];
if( child.type == "userGroup" ) {
var childValue = child.value
// todo bug this should be 0.0 but is false
if(! childValue ) {
childValue = 0.0
}
console.log(childValue,parseFloat( this.value ), childValue==parseFloat( this.value ) );
if( childValue == parseFloat( this.value ) ) {
console.log(child.customElement);
child.customElement.setAttribute("selected", "true")
}
}
}
*/
}
member = new member();
admin = new admin();
visitor = new visitor();
}