First commit
This commit is contained in:
78
application/user/edit/edit.user.checkbox.js
Normal file
78
application/user/edit/edit.user.checkbox.js
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user