Aggiunto pulsante salvataggio note checklist

This commit is contained in:
MatteoPistorello 2023-09-11 16:16:52 +02:00
parent 11ec8cf9fe
commit 5fcff1491b
2 changed files with 14 additions and 6 deletions

View File

@ -50,11 +50,12 @@ function renderChecklist($check, $level = 1, $parent = 0)
$result .= '
<td style="width:500px;border-top:0px;">
{[ "type": "textarea", "class": "unblockable", "name": "note_checklist", "placeholder": "'.tr('Note').'...", "id": "'.$check->id.'", "value": "'.$check->note.'" ]}
{[ "type": "textarea", "class": "unblockable", "name": "note_checklist", "placeholder": "'.tr('Note').'...", "id": "note_'.$check->id.'", "value": "'.$check->note.'" ]}
</td>';
$result .= '
<td style="width:250px;border-top:0px;">';
<td style="width:250px;border-top:0px;">
<button class="btn btn-default btn-xs '.(!$enabled ? 'disabled' : '').' save-nota" onclick="saveNota(\''.$check->id.'\')"><i class="fa fa-check"></i> '.tr('Salva nota').'</button>';
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

@ -103,15 +103,22 @@ for(i=0; i<sortable_table; i++){
});
}
$("textarea[name=\'note_checklist\']").keyup(function(){
$("textarea[name=\'note_checklist\']").keyup(function() {
$(this).parent().parent().parent().find(".save-nota").removeClass("btn-default");
$(this).parent().parent().parent().find(".save-nota").addClass("btn-success");
});
function saveNota(id) {
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "save_note",
note: $(this).val(),
id: $(this).attr("id"),
note: $("#note_" + id).val(),
id: id
}, function() {
alertPush();
$("#note_" + id).parent().parent().parent().find(".save-nota").removeClass("btn-success");
$("#note_" + id).parent().parent().parent().find(".save-nota").addClass("btn-default");
});
});
}
$(".checkbox").click(function(){
if($(this).is(":checked")){