Aggiunte note nelle checklist

This commit is contained in:
MatteoPistorello 2023-05-19 17:15:30 +02:00
parent 1ecbca8303
commit 89f08d1c51
5 changed files with 34 additions and 24 deletions

View File

@ -18,6 +18,7 @@
*/ */
include_once __DIR__.'/../../core.php'; include_once __DIR__.'/../../core.php';
use Modules\Checklists\Check; use Modules\Checklists\Check;
use Modules\Checklists\ChecklistItem; use Modules\Checklists\ChecklistItem;
@ -65,6 +66,18 @@ switch(post('op')){
break; break;
case "save_note":
$note = post('note');
$id = post('id');
$record = Check::find($id);
$record->note = $note;
$record->save();
flash()->info(tr('Nota salvata correttamente!'));
break;
case "remove_checkbox": case "remove_checkbox":
$id = post('id'); $id = post('id');

View File

@ -39,7 +39,16 @@ function renderChecklist($check, $level = 1, $parent = 0) {
$result .= ' $result .= '
<td style="border-top:0px;"> <td style="border-top:0px;">
<span class="text" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>'; <span class="text" style="'.(!empty($check->checked_at)?'text-decoration:line-through;':'').'">'.$check->content.' </span>
</td>';
$result .= '
<td style="width:500px;border-top:0px;">
{[ "type": "textarea", "name": "note_checklist", "id": "'.$check->id.'", "value": "'.$check->note.'" ]}
</td>';
$result .= '
<td style="width:250px;border-top:0px;">';
if (intval($check->assignedUsers->pluck('id')->toArray())>0){ 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>'; $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>';
@ -59,10 +68,11 @@ function renderChecklist($check, $level = 1, $parent = 0) {
</td>'; </td>';
$result .= ' $result .= '
<td style="width:40px;text-align:center;border-top:0px;"> <td style="width:10px;text-align:center;border-top:0px;">
<div class="input-group-btn"> <div class="input-group-btn">
<button class="btn btn-warning btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="edit_check(\''.$check->id.'\')"><i class="fa fa-edit"></i></button> <button class="btn btn-warning btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="edit_check(\''.$check->id.'\')"><i class="fa fa-edit"></i></button>
<button class="btn btn-danger btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="delete_check(\''.$check->id.'\')"><i class="fa fa-trash"></i></button> <button class="btn btn-danger btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="delete_check(\''.$check->id.'\')"><i class="fa fa-trash"></i></button>
<button class="btn btn-xs btn-default handle" title="Modifica ordine delle righe" draggable="true"><i class="fa fa-sort"></i></button>
</div> </div>
</td>'; </td>';
@ -74,7 +84,7 @@ function renderChecklist($check, $level = 1, $parent = 0) {
if(sizeof($check->children)>0){ if(sizeof($check->children)>0){
$result .= ' $result .= '
<tr> <tr>
<td colspan="4" style="padding-left:'.$margin.'px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-top:0px;"> <td colspan="5" style="padding-left:'.$margin.'px;padding-right:10px;padding-top:0px;padding-bottom:0px;border-top:0px;">
<table class="table" style="margin-bottom:0px;"> <table class="table" style="margin-bottom:0px;">
<tbody class="sort" data-sonof="'.$check->id.'">'; <tbody class="sort" data-sonof="'.$check->id.'">';
$children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get(); $children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get();
@ -91,13 +101,6 @@ function renderChecklist($check, $level = 1, $parent = 0) {
$result .= ' $result .= '
</table> </table>
</td> </td>
<td style="width:40px;text-align:center;border-top:0px;">
<button class="btn btn-xs btn-default handle" title="Modifica ordine delle righe" draggable="true">
<i class="fa fa-sort"></i>
</button>
</td>
</tr>'; </tr>';
return $result; return $result;

View File

@ -103,19 +103,13 @@ for(i=0; i<sortable_table; i++){
}); });
} }
$("input[name^=\'value\']").keyup(function(){
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "save_value",
value: $(this).val(),
id: $(this).attr("data-id"),
});
});
$("textarea[name=\'note_checklist\']").keyup(function(){ $("textarea[name=\'note_checklist\']").keyup(function(){
$.post("'.$checklist_module->fileurl('ajax.php').'", { $.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "save_note", op: "save_note",
value: $(this).val(), note: $(this).val(),
id: $(this).attr("data-id"), id: $(this).attr("id"),
}, function() {
alertPush();
}); });
}); });

View File

@ -116,9 +116,6 @@ INSERT INTO `zz_prints` (`id_module`, `is_record`, `name`, `title`, `filename`,
INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES ( "Visualizza solo promemoria assegnati", '0', 'boolean', '1', 'Applicazione', '7', 'Se abilitata permetti ai tecnici la visualizzazione dei soli promemoria in cui risultano come assegnati'); INSERT INTO `zz_settings` (`nome`, `valore`, `tipo`, `editable`, `sezione`, `order`, `help`) VALUES ( "Visualizza solo promemoria assegnati", '0', 'boolean', '1', 'Applicazione', '7', 'Se abilitata permetti ai tecnici la visualizzazione dei soli promemoria in cui risultano come assegnati');
-- Aggiunta stampa ddt in entrata
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), '1', 'Ddt di acquisto', 'Ddt in entrata', 'DDT num. {numero} del {data}', 'ddt', 'idddt', '{\"pricing\":true}', 'fa fa-print', '', '', '0', '1', '1', '1');
-- Fix query Fatture di acquisto -- Fix query Fatture di acquisto
UPDATE `zz_modules` SET `options` = " UPDATE `zz_modules` SET `options` = "
SELECT SELECT

View File

@ -25,4 +25,7 @@ ORDER BY
DELETE FROM `zz_prints` WHERE `name` = 'Spesometro'; DELETE FROM `zz_prints` WHERE `name` = 'Spesometro';
-- Aggiunta stampa ddt in entrata -- Aggiunta stampa ddt in entrata
INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), '1', 'Ddt di acquisto', 'Ddt in entrata', 'DDT num. {numero} del {data}', 'ddt', 'idddt', '{\"pricing\":true}', 'fa fa-print', '', '', '0', '1', '1', '1'); INSERT INTO `zz_prints` (`id`, `id_module`, `is_record`, `name`, `title`, `filename`, `directory`, `previous`, `options`, `icon`, `version`, `compatibility`, `order`, `predefined`, `default`, `enabled`) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Ddt di acquisto'), '1', 'Ddt di acquisto', 'Ddt in entrata', 'DDT num. {numero} del {data}', 'ddt', 'idddt', '{\"pricing\":true}', 'fa fa-print', '', '', '0', '1', '1', '1');
-- Aggiunte note checklist
ALTER TABLE `zz_checks` ADD `note` TEXT NOT NULL AFTER `content`;