added unlock_device()
This commit is contained in:
parent
f0f786324d
commit
b3111c8d12
|
@ -73,7 +73,7 @@ function save_field(field) {
|
|||
let params = {
|
||||
device_id: device_id,
|
||||
sub_dev_id: sub_dev_id,
|
||||
field: field.className,
|
||||
field: field.classList[0],
|
||||
value: value
|
||||
};
|
||||
let query = Object.keys(params)
|
||||
|
@ -135,5 +135,18 @@ function lock_device(device) {
|
|||
}
|
||||
|
||||
function unlock_device(device) {
|
||||
console.log(device);
|
||||
let fields = device.querySelectorAll('.editable');
|
||||
fields.forEach(function(field) {
|
||||
let edit = document.createElement('span');
|
||||
edit.innerHTML = '';
|
||||
edit.className = 'edit font-awesome';
|
||||
edit.setAttribute('onclick', 'edit_field(this.parentElement)');
|
||||
field.appendChild(edit);
|
||||
});
|
||||
device.querySelector('.id').querySelector('.unlock').remove();
|
||||
let lock = document.createElement('span');
|
||||
lock.innerHTML = '';
|
||||
lock.className = 'lock font-awesome';
|
||||
lock.setAttribute('onclick', 'lock_device(this.parentElement.parentElement)');
|
||||
device.querySelector('.id').appendChild(lock);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user