Schedule update moved to program update

Schedule update updated a program attribute
This commit is contained in:
Ana 2016-08-04 19:20:11 +02:00
parent 310c521790
commit 81108290e5
4 changed files with 41 additions and 22 deletions

View file

@ -11,4 +11,27 @@ $(function () {
dataType: 'script'
});
});
$("[class='switch-checkbox-schedule']").bootstrapSwitch();
$('input[class="switch-checkbox-schedule"]').on('switchChange.bootstrapSwitch', function(event, state) {
var url = $(this).attr('url');
var method = $(this).attr('method');
if(state){
url += $(this).attr('value');
}
var callback = function(data) {
if(data.status != 'ok'){
alert("The schedule couldn't been updated");
}
}
$.ajax({
url: url,
type: method,
success: callback,
dataType: 'json'
});
});
});