added unlock_device()

This commit is contained in:
iou1name 2019-06-20 11:28:26 -04:00
parent f0f786324d
commit b3111c8d12

View File

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