diff --git a/actions.php b/actions.php index 5dadf67e6..734066ef3 100644 --- a/actions.php +++ b/actions.php @@ -3,6 +3,8 @@ include_once __DIR__.'/core.php'; use Models\Note; +use Models\Checklist; +use Models\User; if (empty($structure) || empty($structure['enabled'])) { die(tr('Accesso negato')); @@ -105,8 +107,8 @@ elseif (filter('op') == 'add_nota') { flash()->info(tr('Nota interna aggiunta correttamente!')); } -// Aggiunta nota interna -elseif (filter('op') == 'remove_nota') { +// Rimozione nota interna +elseif (filter('op') == 'delete_nota') { $id_nota = post('id_nota'); $nota = Note::find($id_nota); @@ -115,6 +117,39 @@ elseif (filter('op') == 'remove_nota') { flash()->info(tr('Nota interna aggiunta correttamente!')); } +// Rimozione checklist +elseif (filter('op') == 'add_check') { + $content = post('content'); + $parent_id = post('parent') ?: null; + + $assigned_user = User::find(post('assigned_user')); + + $check = Checklist::build($user, $assigned_user, $structure, $id_record, $content, $parent_id); +} + +// Rimozione checklist +elseif (filter('op') == 'delete_check') { + $check_id = post('check_id'); + $check = Checklist::find($check_id); + + $check->delete(); +} + +// Gestione check per le checklist +elseif (filter('op') == 'toggle_check') { + $check_id = post('check_id'); + $check = Checklist::find($check_id); + + if (!empty($check)) { + $check->checked_at = $check->checked_at ? null : date('Y-m-d H:i:s'); + $check->save(); + + echo json_encode([ + 'checked_at' => timestampFormat($check->checked_at) ?: null, + ]); + } +} + // Invio email elseif (post('op') == 'send-email') { $id_template = post('template'); diff --git a/ajax.php b/ajax.php index 29e4a42ba..00402a238 100644 --- a/ajax.php +++ b/ajax.php @@ -54,6 +54,11 @@ switch (get('op')) { break; + case 'checklists': + echo '{( "name": "checklists", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "id_plugin": "'.$id_plugin.'" )}'; + + break; + case 'active_users': $posizione = get('id_module'); if (isset($id_record)) { diff --git a/assets/src/css/style.css b/assets/src/css/style.css index 19ba34325..6024921be 100644 --- a/assets/src/css/style.css +++ b/assets/src/css/style.css @@ -826,7 +826,7 @@ input.small-width { margin-bottom: 5px; } -.skin-default .nav.navbar-nav li a{ +.skin-default .nav.navbar-nav li a{ color: #FFFFFF; } .skin-default .nav.navbar-nav li a:hover{ @@ -845,8 +845,48 @@ input.small-width { hyphens: auto; } - .request .morelink{ color: #fff; font-weight: bold; } + +/* Checklist */ +ul.checklist { + list-style-type: none; + margin: 0; + padding: 0; +} + +ul.checklist li { + cursor: pointer; + position: relative; + padding: 12px 8px 12px 10px; + font-size: 18px; + transition: 0.2s; + + /* make the list items unselectable */ + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +ul.checklist li:hover { + background: #ddd; +} + +ul.checklist li.checked { + background: #eee; +} + +ul.checklist li.checked > .check-text { + text-decoration: line-through; +} + +ul.checklist li > .check-icon { + display: none; +} + +ul.checklist li.checked > .check-icon { + display: inline-block; +} diff --git a/assets/src/js/supersearch.js b/assets/src/js/supersearch.js new file mode 100644 index 000000000..6622b9232 --- /dev/null +++ b/assets/src/js/supersearch.js @@ -0,0 +1,86 @@ +$(document).ready(function () { + $('#supersearch').keyup(function () { + $(document).ajaxStop(); + + if ($(this).val() == '') { + $(this).removeClass('wait'); + } else { + $(this).addClass('wait'); + } + }); + + $.widget("custom.supersearch", $.ui.autocomplete, { + _create: function () { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function (ul, items) { + if (items[0].value == undefined) { + $('#supersearch').removeClass('wait'); + ul.html(''); + } else { + var that = this, + currentCategory = ""; + + ul.addClass('ui-autocomplete-scrollable'); + ul.css('z-index', '999'); + + $.each(items, function (index, item) { + + if (item.category != currentCategory) { + ul.append("