Files
Unify/application/user/edit/edit.user.checkbox.js

78 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2025-12-25 11:16:59 +01:00
import checkbox from "/elements/checkbox.js"
import user from "/user/user.js"
import tools from "/unify/tools.js"
export default class customCheckbox extends checkbox{
async create() {
var selected = await this.checkSelected();
this.customElement.checked = selected;
}
debug = "true"
node async checkSelected() {
var editUser = this.parents("editUser");
var collection = editUser.selectedUsers;
collection.sync();
var id = this.parent.id;
tools.log("check selected??", id);
var v = collection.rowExists( id );
console.log(v);
return v;
}
async change() {
this.value = this.customElement.checked;
await this.changeCollection( this.value );
var editUser = this.parent.parent.parent.parent;
editUser.showSelectedUser.sync();
}
node async changeCollection( checked ) {
var editUser = this.parents("editUser");
var collection = editUser.selectedUsers;
var userObject = this.parent;
tools.log(userObject );
if( checked ) {
collection.add( userObject );
} else {
collection.remove( userObject );
}
return 1234;
}
}