Ripristinato aggiornamento ajax delle checklist dopo la spunta

This commit is contained in:
Matteo 2023-05-05 17:23:35 +02:00
parent 5180c58235
commit fed45af5ae
2 changed files with 18 additions and 1 deletions

View File

@ -39,7 +39,7 @@ function renderChecklist($check, $level = 1, $parent = 0) {
$result .= '
<td style="border-top:0px;">
<span class="text">'.$check->content.' </span>';
<span class="text" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>';
if (intval($check->assignedUsers->pluck('id')->toArray())>0){
$result .= ' <span class="label label-info pull-right" style="padding:6px 8px;" data-toggle="tooltip" title="Assegnato a '. implode(', ', $check->assignedUsers->pluck('username')->toArray()).'"><i class="fa fa-user"></i></span>';

View File

@ -124,8 +124,12 @@ $(".checkbox").click(function(){
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "save_checkbox",
id: $(this).attr("data-id"),
},function(result){
reload();
});
$(this).parent().parent().find(".text").css("text-decoration", "line-through");
parent = $(this).attr("data-id");
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
if(!$(this).is(":checked")){
@ -136,8 +140,12 @@ $(".checkbox").click(function(){
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "remove_checkbox",
id: $(this).attr("data-id"),
},function(result){
reload();
});
$(this).parent().parent().find(".text").css("text-decoration", "none");
parent = $(this).attr("data-id");
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
if($(this).is(":checked")){
@ -162,6 +170,15 @@ function edit_check(id){
launch_modal("Modifica checklist", "'.$checklist_module->fileurl('components/edit-check.php').'?id_record="+id, 1);
}
function reload(){
$("#loading_'.$checks_id.'").removeClass("hide");
$("#loading_'.$checks_id.'").addClass("show");
$("#'.$checks_id.'").load(globals.rootdir + "/ajax.php?op=checklists&id_module='.$id_module.'&id_record='.$id_record.'&id_plugin='.$id_plugin.'", function() {
$("#loading_'.$checks_id.'").removeClass("show");
$("#loading_'.$checks_id.'").addClass("hide");
});
}
</script>';
?>