diff --git a/.gitignore b/.gitignore index 66317d6..7cb0589 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ dist/icons/petrvs/petrvs.png dist/manifest_antaq_v2.json dist/manifest_seipro_v2.json dist/manifest_v2.json +dist/manifest_antt.json +dist/manifest_antt_v2.json diff --git a/dist/css/sei-pro.css b/dist/css/sei-pro.css index cfa0c8b..7badef7 100644 --- a/dist/css/sei-pro.css +++ b/dist/css/sei-pro.css @@ -877,6 +877,21 @@ div.selectProgressoBar { background: #4285F4 !important; border: 1px solid #365ea0 !important; } +div.progressPrescricao { + height: 8px !important; + border: none !important; + margin: 10px 0; + width: 95%; + background: #ccc; +} +.progressPrescricao .ui-progressbar-value { + background: #9ece4e !important; + border: 1px solid #78a135 !important; +} +.progressPrescricao.urgente .ui-progressbar-value { + background: #e46e65 !important; + border: 1px solid #b44c44 !important; +} div.atividadesProgressoBar { height: 4px !important; border: none !important; @@ -1817,6 +1832,9 @@ table.moreInfoBox td:first-child, padding-right: 10px; color: #747474; } +#processosKanban .kanban-description span.sub[data-type="especificacao"] { + font-size: 11pt; +} .kanban-container .kanban-board .proc_tags .kanban-title-board::before { content: "\f02b"; } @@ -2484,6 +2502,9 @@ a.newLink.filterTableProcessos.newLink_active i { #atividadesPro.minView .modulesActions:has(.iconLabel) { margin-top: 20px; } +#atividadesPro.minView .panelInfoHome:not(.panelInfoHomeAtividade) { + margin-top: 50px; +} #divInfraAreaTelaD { position: relative; } @@ -3741,4 +3762,43 @@ input[type="currency"]{ } .cke_dialog_ui_labeled_content:has(select.cke_dialog_ui_input_select) { min-height: 30px; +} +i.fas.fa-spinner.fa-spin.fa-pulse { + height: 13px; + padding: 0 !important; +} +.tabelaControle a[href*="acao=procedimento_trabalhar"] { + white-space: nowrap; +} +.dialogBoxDiv .ui-accordion .ui-accordion-header { + text-indent: 20px; +} +h3.ui-accordion-header span.counter { + width: 18px; + border-radius: 50%; + text-indent: initial; + height: 18px; + background-color: #e4e9e9; + float: right; + color: #666; + font-size: 80%; + text-align: center; +} +div[id*="boxConfiguracoes"] .tag-input { + height: 22px !important; +} +#configEntidade_acoes_dados_externos td, +#configEntidade_acoes_dados_externos tr { + height: auto; + margin: 0 !important; + padding: 0 !important; +} +.tableOptionConfig .editCellSelect.inEdit .chosen-container { + width: calc(100% - 30px) !important; +} +#cache_demandas_time_chosen { + width: 40% !important; +} +.fa-spinner:before { + content: "\f110" !important; } \ No newline at end of file diff --git a/dist/css/sei-slim.css b/dist/css/sei-slim.css index 9ece5a5..4090897 100644 --- a/dist/css/sei-slim.css +++ b/dist/css/sei-slim.css @@ -1694,6 +1694,7 @@ a[href*="andamento_marcador_gerenciar"][data-color], .seiSlim a.botaoSEI[onclick*="saveAtividade("], .seiSlim a.botaoSEI[onclick*="selectAtividadeBox("], .seiSlim a.botaoSEI[onclick*="addControlePrazo("], +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("], .seiSlim a.botaoSEI[onclick*="dialogChangeTypeProc("], .seiSlim a.botaoSEI[onclick*="initUploadFilesInProcess("], .seiSlim a.botaoSEI[onclick*="checkDadosAcompEspecial("], @@ -1702,6 +1703,7 @@ a[href*="andamento_marcador_gerenciar"][data-color], .seiSlim a.botaoSEI[onclick*="getDosimetria("], .seiSlim a.botaoSEI[onclick*="dialogRelatoriosSFIS("], .seiSlim a.botaoSEI[onclick*="getDocumentosActions("], +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("], .seiSlim a[id*="anchorImg"][data-img], .seiSlim span.infraImgPro[data-img], .seiSlim a[href*="javascript:alert('Assinado por:"], @@ -1754,6 +1756,8 @@ a[href*="andamento_marcador_gerenciar"][data-color], .seiSlim a.botaoSEI[onclick*="selectAtividadeBox("] img:hover, .seiSlim a.botaoSEI[onclick*="addControlePrazo("] img, .seiSlim a.botaoSEI[onclick*="addControlePrazo("] img:hover, +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("] img, +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("] img:hover, .seiSlim a.botaoSEI[onclick*="dialogChangeTypeProc("] img, .seiSlim a.botaoSEI[onclick*="dialogChangeTypeProc("] img:hover, .seiSlim a.botaoSEI[onclick*="initUploadFilesInProcess("] img, @@ -1770,6 +1774,8 @@ a[href*="andamento_marcador_gerenciar"][data-color], .seiSlim a.botaoSEI[onclick*="dialogRelatoriosSFIS("] img:hover, .seiSlim a.botaoSEI[onclick*="getDocumentosActions("] img, .seiSlim a.botaoSEI[onclick*="getDocumentosActions("] img:hover, +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("] img, +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("] img:hover, .seiSlim a.botaoSEI[href*="?acao=procedimento_atribuicao_cadastrar"] img, .seiSlim a.botaoSEI[href*="?acao=procedimento_atribuicao_cadastrar"] img:hover, .seiSlim a.botaoSEI[onclick*="?acao=procedimento_atribuicao_cadastrar"] img, @@ -1987,6 +1993,7 @@ span.tagUserColorPro[data-color] img:hover, .seiSlim a.botaoSEI[onclick*="saveAtividade("]:before, .seiSlim a.botaoSEI[onclick*="selectAtividadeBox("]:before, .seiSlim a.botaoSEI[onclick*="addControlePrazo("]:before, +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("]:before, .seiSlim a.botaoSEI[onclick*="dialogChangeTypeProc("]:before, .seiSlim a.botaoSEI[onclick*="initUploadFilesInProcess("]:before, .seiSlim a.botaoSEI[onclick*="checkDadosAcompEspecial("]:before, @@ -1995,6 +2002,7 @@ span.tagUserColorPro[data-color] img:hover, .seiSlim a.botaoSEI[onclick*="getDosimetria("]:before, .seiSlim a.botaoSEI[onclick*="dialogRelatoriosSFIS("]:before, .seiSlim a.botaoSEI[onclick*="getDocumentosActions("]:before, +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("]:before, .seiSlim a.botaoSEI[href*="?acao=procedimento_credencial_gerenciar"]:before, .seiSlim a.botaoSEI[href*="?acao=credencial_assinatura_gerenciar"]:before, .seiSlim a.botaoSEI[href*="?acao=procedimento_atualizar_andamento"]:before, @@ -2437,6 +2445,11 @@ a[href*="andamento_marcador_gerenciar"][data-color]:before { content: "\f085"; color: #7562d8; } +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("]:after, +.seiSlim a.botaoSEI[onclick*="getCtrPrescricao("]:before { + content: "\f252"; + color: #7562d8; +} .seiSlim a.botaoSEI[onclick*="getDocCertidao("]:after, .seiSlim a.botaoSEI[onclick*="getDocCertidao("]:before { content: "\f5bf"; @@ -2497,6 +2510,11 @@ a[href*="andamento_marcador_gerenciar"][data-color]:before { content: "\f017"; color: #4285f4; } +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("]:after, +.seiSlim a.botaoSEI[onclick*="getProcessoNaoLido("]:before { + content: "\f070"; + color: #4285f4; +} .seiSlim a.botaoSEI[onclick*="initUploadFilesInProcess("]:after, .seiSlim a.botaoSEI[onclick*="initUploadFilesInProcess("]:before { content: "\f574"; @@ -3138,6 +3156,9 @@ td .linhaNumerada:after { .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__boxsigilo_icon, .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__ctr_review_icon, .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__review_icon, +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__ditado_icon, +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__ctr_ditado_icon, +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__newstyle_icon, .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__natjus_icon, .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__tablestyles_icon, .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__quicktable_icon, @@ -3418,6 +3439,21 @@ td .linhaNumerada:after { content: "\f4ff"; color: #4285f4; } +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__ditado_icon:before { + content: "\f3c9"; + color: #ea48cc; +} +.seiSlim.seiSlim_parent.seiSlim_view .cke_button_on span.cke_button_icon.cke_button__ditado_icon:before { + animation: pulser 2s infinite; +} +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__ctr_ditado_icon:before { + content: "\f085"; + color: #ea48cc; +} +.seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__newstyle_icon:before { + content: "\f53f"; + color: #ea48cc; +} .seiSlim.seiSlim_parent.seiSlim_view span.cke_button_icon.cke_button__natjus_icon:before { content: "\f46b"; color: #34caef; @@ -3860,4 +3896,10 @@ strong.title-reviewtip { } #uploadListPro .dz-preview.dz-file-preview { margin: 10px; +} +.editorTextDisclaimer p { + font-size: 120%; + line-height: 30px; + width: 800px; + white-space: break-spaces; } \ No newline at end of file diff --git a/dist/css/tableselection.css b/dist/css/tableselection.css new file mode 100644 index 0000000..83b24bb --- /dev/null +++ b/dist/css/tableselection.css @@ -0,0 +1,36 @@ +.cke_table-faked-selection-editor *::selection, table[data-cke-table-faked-selection-table] *::selection { + background: transparent; +} + +.cke_table-faked-selection { + background: darkgray !important; + color: black; +} +.cke_table-faked-selection a { + color: black; +} +.cke_editable:focus .cke_table-faked-selection { + /* We have to use !important here, as td might specify it's own background, thus table selection + would not be visible. */ + background: #0076cb !important; + color: white; +} +.cke_editable:focus .cke_table-faked-selection a { + color: white; +} +.cke_table-faked-selection::-moz-selection, .cke_table-faked-selection ::-moz-selection { + background: transparent; +} +.cke_table-faked-selection::selection, .cke_table-faked-selection ::selection { + background: transparent; +} + +/* Change the cursor when selecting cells (#706). + * + * This solution does not work in IE, Edge and Safari due to upstream isues: + * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3419602/ + * https://bugs.webkit.org/show_bug.cgi?id=53341 + */ +table[data-cke-table-faked-selection-table] { + cursor: cell; +} \ No newline at end of file diff --git a/dist/html/options.html b/dist/html/options.html index 745e445..6fdb060 100644 --- a/dist/html/options.html +++ b/dist/html/options.html @@ -21,7 +21,7 @@ -

| Configurações

+

| Configurações

- +

Ferramentas de Inteligência Artificial @@ -308,6 +308,34 @@

Base de Dados

+ + +

+ Permitir marcar processos como "Não Visualizado" + +

+ + +
+ + +
+ + + + +

+ Ditado no editor de documentos + +

+ + +
+ + +
+ +

diff --git a/dist/html/options.js b/dist/html/options.js index 039437b..6676b60 100755 --- a/dist/html/options.js +++ b/dist/html/options.js @@ -389,9 +389,11 @@ function getManifestExtension() { function setNamePage() { var manifest = getManifestExtension(); var NAMESPACE_SPRO = manifest.short_name; + var ICONSPACE_SPRO = manifest.icons['32']; var URLPages_SPRO = manifest.homepage_url; // var title = 'Configura\u00E7\u00F5es Gerais | '+NAMESPACE_SPRO; $('.title .name-space').text(NAMESPACE_SPRO); + $('.icon-space').attr('src','../'+ICONSPACE_SPRO); $('a.manual').each(function(){ $(this).attr('href', URLPages_SPRO+$(this).attr('href')); }); @@ -402,6 +404,7 @@ function setNamePage() { } else if (NAMESPACE_SPRO == 'ANTT Pro') { $('body').addClass('ANTAQ_Pro'); } + console.log(manifest); } $('#options-functions').find('input[type="text"]').on("keyup", function () { if ($(this).val() != '') { diff --git a/dist/icons/antt/icon-128.png b/dist/icons/antt/icon-128.png new file mode 100644 index 0000000..8453dd7 Binary files /dev/null and b/dist/icons/antt/icon-128.png differ diff --git a/dist/icons/antt/icon-16.png b/dist/icons/antt/icon-16.png new file mode 100644 index 0000000..8225335 Binary files /dev/null and b/dist/icons/antt/icon-16.png differ diff --git a/dist/icons/antt/icon-256.png b/dist/icons/antt/icon-256.png new file mode 100644 index 0000000..ede6c2b Binary files /dev/null and b/dist/icons/antt/icon-256.png differ diff --git a/dist/icons/antt/icon-32.png b/dist/icons/antt/icon-32.png new file mode 100644 index 0000000..d2f6d40 Binary files /dev/null and b/dist/icons/antt/icon-32.png differ diff --git a/dist/icons/antt/icon-48.png b/dist/icons/antt/icon-48.png new file mode 100644 index 0000000..f466df9 Binary files /dev/null and b/dist/icons/antt/icon-48.png differ diff --git a/dist/icons/addestilotabela.png b/dist/icons/editor/addestilotabela.png similarity index 100% rename from dist/icons/addestilotabela.png rename to dist/icons/editor/addestilotabela.png diff --git a/dist/icons/blockedition.png b/dist/icons/editor/blockedition.png similarity index 100% rename from dist/icons/blockedition.png rename to dist/icons/editor/blockedition.png diff --git a/dist/icons/copiarformatacao.png b/dist/icons/editor/copiarformatacao.png similarity index 100% rename from dist/icons/copiarformatacao.png rename to dist/icons/editor/copiarformatacao.png diff --git a/dist/icons/duplicartabela.png b/dist/icons/editor/duplicartabela.png similarity index 100% rename from dist/icons/duplicartabela.png rename to dist/icons/editor/duplicartabela.png diff --git a/dist/icons/editarimagem.png b/dist/icons/editor/editarimagem.png similarity index 100% rename from dist/icons/editarimagem.png rename to dist/icons/editor/editarimagem.png diff --git a/dist/icons/ferramentasia.png b/dist/icons/editor/ferramentasia.png similarity index 100% rename from dist/icons/ferramentasia.png rename to dist/icons/editor/ferramentasia.png diff --git a/dist/icons/formatarimagem.png b/dist/icons/editor/formatarimagem.png similarity index 100% rename from dist/icons/formatarimagem.png rename to dist/icons/editor/formatarimagem.png diff --git a/dist/icons/editor/speech.gif b/dist/icons/editor/speech.gif new file mode 100644 index 0000000..c645b97 Binary files /dev/null and b/dist/icons/editor/speech.gif differ diff --git a/dist/icons/editor/webspeech-enable.gif b/dist/icons/editor/webspeech-enable.gif new file mode 100644 index 0000000..99ccada Binary files /dev/null and b/dist/icons/editor/webspeech-enable.gif differ diff --git a/dist/icons/editor/webspeech-settings.png b/dist/icons/editor/webspeech-settings.png new file mode 100644 index 0000000..47b75a4 Binary files /dev/null and b/dist/icons/editor/webspeech-settings.png differ diff --git a/dist/icons/editor/webspeech.png b/dist/icons/editor/webspeech.png new file mode 100644 index 0000000..3323f2e Binary files /dev/null and b/dist/icons/editor/webspeech.png differ diff --git a/dist/icons/lab/icon-32.png b/dist/icons/lab/icon-32.png new file mode 100644 index 0000000..18374bb Binary files /dev/null and b/dist/icons/lab/icon-32.png differ diff --git a/dist/js/init.js b/dist/js/init.js index 844c22a..748fa83 100644 --- a/dist/js/init.js +++ b/dist/js/init.js @@ -217,7 +217,7 @@ function loadDataBaseProStorage(items) { } } function loadFontIcons(elementTo, target = $('html')) { - var iconBoxSlim = (localStorage.getItem('seiSlim')) ? true : false; + var iconBoxSlim = (localStorage.getItem('seiSlim') || localStorage.getItem('seiSlim_editor')) ? true : false; var pathExtension = pathExtensionSEIPro(); if (target.find('link[data-style="seipro-fonticon"]').length == 0 && target.find('style[data-style="seipro-fonticon"]').length == 0) { $("", { diff --git a/dist/js/init_all.js b/dist/js/init_all.js index 44e927a..0134bc6 100644 --- a/dist/js/init_all.js +++ b/dist/js/init_all.js @@ -1,3 +1,5 @@ +var isNewSEI = $('#divInfraSidebarMenu ul#infraMenu').length ? true : false; + if ($('#frmEditor').length == 0) { $.getScript(getUrlExtension("js/sei-functions-pro.js")); } @@ -103,7 +105,7 @@ function _P() { // get Session Name Space } function loadStyleDesign() { var body = document.body; - if (localStorage.getItem('seiSlim')) { + if (localStorage.getItem('seiSlim') && !isNewSEI) { body.classList.add("seiSlim"); body.classList.add("seiSlim_parent"); if (document.getElementById("divInfraAreaTelaE") === null) body.classList.add("seiSlim_view"); diff --git a/dist/js/lib/_chosen.jquery.min.js b/dist/js/lib/_chosen.jquery.min.js new file mode 100755 index 0000000..b05b5c9 --- /dev/null +++ b/dist/js/lib/_chosen.jquery.min.js @@ -0,0 +1,44 @@ +/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ + +(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s"+this.escape_html(t.group_label)+""+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t"+this.escape_html(s)+""+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'\n '+this.default_text+'\n

\n\n
\n \n \n
'},t.prototype.get_multi_html=function(){return'\n
\n \n
'},t.prototype.get_no_results_html=function(t){return'
  • \n '+this.results_none_found+" "+this.escape_html(t)+"\n
  • "},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("
    ",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("
  • ",{"class":"search-choice"}).html(""+this.choice_label(e)+""),e.disabled?s.addClass("search-choice-disabled"):((i=t("",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("
    ").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this); + +(function($) { + $.fn.chosenImage = function(options) { + return this.each(function() { + var $select = $(this); + var imgMap = {}; + + // 1. Retrieve img-src from data attribute and build object of image sources for each list item. + $select.find('option').filter(function(){ + return $(this).text(); + }).each(function(i) { + imgMap[i] = $(this).attr('data-img-src'); + }); + + // 2. Execute chosen plugin and get the newly created chosen container. + $select.chosen(options); + var $chosen = $select.next('.chosen-container').addClass('chosenImage-container'); + + // 3. Style lis with image sources. + $chosen.on('click.chosen, mousedown.chosen, keyup.chosen', function(event){ + $chosen.find('.chosen-results li').each(function() { + var imgIndex = $(this).attr('data-option-array-index'); + $(this).css(cssObj(imgMap[imgIndex])); + }); + }); + + // 4. Change image on chosen selected element when form changes. + $select.change(function() { + var imgSrc = $select.find('option:selected').attr('data-img-src') || ''; + $chosen.find('.chosen-single span').css(cssObj(imgSrc)); + }); + $select.trigger('change'); + + // Utilties + function cssObj(imgSrc) { + var bgImg = (imgSrc) ? 'url(' + imgSrc + ')' : 'none'; + return { 'background-image' : bgImg }; + } + }); + }; +})(jQuery); \ No newline at end of file diff --git a/dist/js/lib/chosen.jquery.min.js b/dist/js/lib/chosen.jquery.min.js old mode 100755 new mode 100644 index b05b5c9..df56cea --- a/dist/js/lib/chosen.jquery.min.js +++ b/dist/js/lib/chosen.jquery.min.js @@ -1,6 +1,6 @@ -/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ +/* Chosen v1.8.2-hanoii | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ -(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s"+this.escape_html(t.group_label)+""+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t"+this.escape_html(s)+""+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'\n '+this.default_text+'\n
    \n
    \n
    \n \n
      \n
      '},t.prototype.get_multi_html=function(){return'
        \n
      • \n \n
      • \n
      \n
      \n
        \n
        '},t.prototype.get_no_results_html=function(t){return'
      • \n '+this.results_none_found+" "+this.escape_html(t)+"\n
      • "},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("
        ",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("
      • ",{"class":"search-choice"}).html(""+this.choice_label(e)+""),e.disabled?s.addClass("search-choice-disabled"):((i=t("",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("
        ").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this); +(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s"+t.group_label+""+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t"+this.escape_html(s)+""+this.escape_html(k)}null!=b&&(b.group_match=!0)}else null!=a.group_array_index&&this.results_data[a.group_array_index].search_match&&(a.search_match=!0);return this.result_clear_highlight(),v<1&&d.length?(this.update_results_content(""),this.no_results(d)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'\n '+this.default_text+'\n
        \n
        \n
        \n \n
          \n
          '},t.prototype.get_multi_html=function(){return'
            \n
          • \n \n
          • \n
          \n
          \n
            \n
            '},t.prototype.get_no_results_html=function(t){return'
          • \n '+this.results_none_found+" "+this.escape_html(t)+"\n
          • "},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("
            ",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("
          • ",{"class":"search-choice"}).html(""+this.choice_label(e)+""),e.disabled?s.addClass("search-choice-disabled"):((i=t("",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("
            ").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this); (function($) { $.fn.chosenImage = function(options) { diff --git a/dist/js/lib/jquery-visible.min.js b/dist/js/lib/jquery-visible.min.js new file mode 100644 index 0000000..51f75b5 --- /dev/null +++ b/dist/js/lib/jquery-visible.min.js @@ -0,0 +1,13 @@ + +/** + * Copyright 2012, Digital Fusion + * Licensed under the MIT license. + * http://teamdf.com/jquery-plugins/license/ + * + * @author Sam Sehnert + * @desc A small plugin that checks whether elements are within + * the user visible viewport of a web browser. + * can accounts for vertical position, horizontal, or both + * https://github.com/customd/jquery-visible + */ +!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top0&&g.bottom<=h,c=g.left>=0&&g.left0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery); diff --git a/dist/js/sei-functions-pro.js b/dist/js/sei-functions-pro.js index 829b4c6..02977dc 100644 --- a/dist/js/sei-functions-pro.js +++ b/dist/js/sei-functions-pro.js @@ -28,7 +28,7 @@ var fileSystemContentPro = false; var delayCrash = false; var unidade = isNewSEI ? $('#lnkInfraUnidade').text() : $('#selInfraUnidades').find('option:selected').text().trim(); var isProcUrgente = false; -var isNewSEI = $('#divInfraSidebarMenu ul#infraMenu').length ? true : false; +var isNewSEI = getIsNewSEI(); var divInformacao = isNewSEI ? '#divArvoreInformacao' : '#divInformacao'; var mainMenu = isNewSEI ? '#infraMenu' : '#main-menu'; var ancoraArvoreDownload = isNewSEI ? 'a.ancoraVisualizacaoArvore' : 'a.ancoraArvoreDownload'; @@ -145,23 +145,6 @@ var listIconsFontAwesome = ["ad","address-book","address-card","adjust","air-fre var html_initContentPro = ''; if ( $('#sheetsCompleteEtapaForm').length == 0 ) { $('#divInfraBarraSistema').append(html_initContentPro) } - -/** - * Copyright 2012, Digital Fusion - * Licensed under the MIT license. - * http://teamdf.com/jquery-plugins/license/ - * - * @author Sam Sehnert - * @desc A small plugin that checks whether elements are within - * the user visible viewport of a web browser. - * can accounts for vertical position, horizontal, or both - */ -!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top0&&g.bottom<=h,c=g.left>=0&&g.left0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery); - -function _P() { // get Session Name Space - return JSON.parse(sessionStorage.getItem('new_extension')); -} - function _G() { // get Session Google Name Space var _return = localStorage.getItem('SEIPro_google_projetos'); _return = (_return === null) ? localStorage.getItem('SEIPro_google_processos') : _return; @@ -170,6 +153,9 @@ function _G() { // get Session Google Name Space return _return ? JSON.parse(_return) : false; } +function _P() { // get Session Name Space + return JSON.parse(sessionStorage.getItem('new_extension')); +} function loadAPIGooglePro() { if (!!URL_SPRO) $.getScript(URL_SPRO+"js/lib/google_api.js"); /* @@ -180,6 +166,11 @@ function loadAPIGooglePro() { } */ } +function getIsNewSEI() { + var isNewSEI = $('#divInfraSidebarMenu ul#infraMenu').length ? true : false; + if (isNewSEI) setOptionsPro('isNewSEI', true); + return getOptionsPro('isNewSEI') ? true : isNewSEI; +} function setCaretPosition(elem, caretPos) { if (elem != null) { if (elem.createTextRange) { @@ -301,9 +292,9 @@ function filterTextExtractDate(elem, table, cellIndex) { return text; } function insertFontIcon(elementTo, target = $('html')) { - var iconBoxSlim = (localStorage.getItem('seiSlim')) ? true : false; + var iconBoxSlim = (localStorage.getItem('seiSlim') || localStorage.getItem('seiSlim_editor')) ? true : false; var pathExtension = URL_SPRO; - if ( target, target.find('link[datastyle="seipro-fonticon"]').length == 0 && target.find('style[data-style="seipro-fonticon"]').length == 0) { + if ( target, target.find('link[data-style="seipro-fonticon"]').length == 0 && target.find('style[data-style="seipro-fonticon"]').length == 0) { $("", { rel: "stylesheet", type: "text/css", @@ -349,6 +340,9 @@ function insertFontIcon(elementTo, target = $('html')) { ''; target.find('head').append(htmlStyleFont); } + if (localStorage.getItem('seiSlim_editor')) { + $('body').addClass('seiSlim seiSlim_parent seiSlim_view'); + } } function numberToLetter(number) { return (parseInt(number) + 9).toString(36).toUpperCase(); @@ -403,6 +397,14 @@ function isJson(str) { } return true; } +function tryParseJSONObject(jsonString){ + try { + var o = JSON.parse(jsonString); + if (o && typeof o === "object") { return o; } + } + catch (e) { } + return false; +} function avgArray(array) { var sum = 0; for( var i = 0; i < array.length; i++ ){ @@ -1010,7 +1012,7 @@ function getBrightnessColor(value) { } function setIconLoadinBtnSEI(elem, display = true) { if (display) { - elem.find('img').css('opacity','0').end().append(''); + elem.find('img').css('opacity','0').end().append(''); } else { elem.find('img').css('opacity','1').end().find('.botaoSEI_loading').remove(); } @@ -2202,6 +2204,176 @@ function updateDadosArvoreIframe(nameLink, idElement, value, ifrArvore, callback } } + +function getProcessoNaoLido() { + var listId = getListIdProtocoloSelected(); + var tableProc = $('#tblProcessosRecebidos, #tblProcessosGerados, #tblProcessosDetalhado'); + if (listId) { + if ($('body').hasClass('seiSlim')) { + $('#divComandos .iconNaoLido').addClass('iconLoading'); + } else { + setIconLoadinBtnSEI($('.iconNaoLido'),true); + } + var id_procedimento = listId[0]; + var tr = tableProc.find('tr#P'+id_procedimento); + if (isNewSEI) { + var idUnidade = getParamsUrlPro($('#lnkInfraUnidade').attr('onclick').split("'")[1]).infra_unidade_atual; + var nomeUnidade = $('#lnkInfraUnidade').text(); + } else { + var nomeUnidade = $('#selInfraUnidades').find('option:selected').text(); + var idUnidade = $('#selInfraUnidades').val(); + } + var href = url_host.replace('controlador.php','')+'controlador.php?acao=procedimento_trabalhar&id_procedimento='+String(id_procedimento); + if (href !== null) { + $.ajax({ url: href }).done(function (html) { + var $html = $(html); + var urlArvore = $html.find("#ifrArvore").attr('src'); + $.ajax({ url: urlArvore }).done(function (htmlArvore) { + var arrayLinksArvore = getLinksArvoreAjax(htmlArvore); + var urlEnviar = jmespath.search(arrayLinksArvore, "[?name=='Enviar Processo'] | [0].url"); + var urlAndamento = jmespath.search(arrayLinksArvore, "[?name=='Atualizar Andamento'] | [0].url"); + console.log(arrayLinksArvore, urlEnviar, urlAndamento); + if (urlAndamento !== null && urlEnviar !== null) { + + $.ajax({ url: urlAndamento }).done(function (htmlDoc) { + var $htmlDoc = $(htmlDoc); + var form = $htmlDoc.find('#frmAtividadeListar'); + var hrefForm = form.attr('action'); + var param = {}; + form.find("input[type=hidden]").each(function () { + if ( $(this).attr('name') && $(this).attr('id').indexOf('hdn') !== -1) { + param[$(this).attr('name')] = $(this).val(); + } + }); + form.find('input[type=text]').each(function () { + if ( $(this).attr('id') && $(this).attr('id').indexOf('txt') !== -1) { + param[$(this).attr('id')] = $(this).val(); + } + }); + form.find('select').each(function () { + if ( $(this).attr('id') && $(this).attr('id').indexOf('sel') !== -1) { + param[$(this).attr('id')] = $(this).val(); + } + }); + form.find('input[type=radio]').each(function () { + if ( $(this).attr('name') && $(this).attr('name').indexOf('rdo') !== -1) { + param[$(this).attr('name')] = $(this).val(); + } + }); + param.txaDescricao = 'Processo marcado como n\u00E3o visualizado'; + param.sbmSalvar = 'Salvar'; + + // console.log({nr_sei: nr_sei, name: nameOption, value: value, url: urlDoc, param: param}); + + var postData = ''; + for (var k in param) { + if (postData !== '') postData = postData + '&'; + var valor = (k=='hdnAssuntos') ? param[k] : escapeComponent(param[k]); + valor = (k=='hdnInteressados') ? param[k] : valor; + // valor = (k=='txtDescricao') ? parent.encodeURI_toHex(param[k].normalize('NFC')) : valor; + valor = (k=='txtNumero') ? escapeComponent(param[k]) : valor; + postData = postData + k + '=' + valor; + } + // console.log(postData); + + var xhr = new XMLHttpRequest(); + $.ajax({ + method: 'POST', + // data: param, + data: postData, + url: hrefForm, + contentType: 'application/x-www-form-urlencoded; charset=ISO-8859-1', + xhr: function() { + return xhr; + }, + }).done(function (htmlResult) { + var status = (xhr.responseURL.indexOf('controlador.php?acao=procedimento_consultar_historico&acao_origem=procedimento_atualizar_andamento') !== -1) ? true : false; + if (status) { + + $.ajax({ url: urlEnviar }).done(function (htmlDoc) { + var $htmlDoc = $(htmlDoc); + var form = $htmlDoc.find('#frmAtividadeListar'); + var hrefForm = form.attr('action'); + var param = {}; + form.find("input[type=hidden]").each(function () { + if ( $(this).attr('name') && $(this).attr('id').indexOf('hdn') !== -1) { + param[$(this).attr('name')] = $(this).val(); + } + }); + form.find('input[type=text]').each(function () { + if ( $(this).attr('id') && $(this).attr('id').indexOf('txt') !== -1) { + param[$(this).attr('id')] = $(this).val(); + } + }); + form.find('select').each(function () { + if ( $(this).attr('id') && $(this).attr('id').indexOf('sel') !== -1) { + param[$(this).attr('id')] = $(this).val(); + } + }); + form.find('input[type=radio]').each(function () { + if ( $(this).attr('name') && $(this).attr('name').indexOf('rdo') !== -1) { + param[$(this).attr('name')] = $(this).val(); + } + }); + param.selUnidades = idUnidade; + param.hdnUnidades = idUnidade+'\u00B1'+nomeUnidade; + param.sbmEnviar = 'Enviar'; + + // console.log({nr_sei: nr_sei, name: nameOption, value: value, url: urlDoc, param: param}); + + var postData = ''; + for (var k in param) { + if (postData !== '') postData = postData + '&'; + var valor = (k=='hdnAssuntos') ? param[k] : escapeComponent(param[k]); + valor = (k=='hdnInteressados') ? param[k] : valor; + valor = (k=='txtDescricao') ? parent.encodeURI_toHex(param[k].normalize('NFC')) : valor; + valor = (k=='txtNumero') ? escapeComponent(param[k]) : valor; + postData = postData + k + '=' + valor; + } + // console.log(postData); + + var xhr = new XMLHttpRequest(); + $.ajax({ + method: 'POST', + // data: param, + data: postData, + url: hrefForm, + contentType: 'application/x-www-form-urlencoded; charset=ISO-8859-1', + xhr: function() { + return xhr; + }, + }).done(function (htmlResult) { + var status = (xhr.responseURL.indexOf('controlador.php?acao=arvore_visualizar&acao_origem=procedimento_enviar') !== -1) ? true : false; + if (status) { + tr.find('a[href*="controlador.php?acao=procedimento_trabalhar"]').attr('class', 'processoNaoVisualizado'); + tr.find(elemCheckbox+':checked').trigger('click'); + initNaoVisualizadoPro(); + setTimeout(() => { + getProcessoNaoLido(); + }, 500); + } + }); + + }); + + } + }); + + }); + } + if (urlEnviar !== null) { + } + }); + }); + } + } else { + if ($('body').hasClass('seiSlim')) { + $('#divComandos .iconNaoLido').removeClass('iconLoading'); + } else { + setIconLoadinBtnSEI($('.iconNaoLido'),false); + } + } +} function updateDadosArvoreMult(nameLink, values, idProcedimento, callback = false) { if (typeof idProcedimento !== 'undefined' && idProcedimento != '' && idProcedimento !== null && idProcedimento != 0 && !checkProcessoSigiloso()) { if ($('#ifrArvore').length == 0) { @@ -2419,7 +2591,11 @@ function goReaberturaProcesso(index = 0) { setTimeout(function(){ td.find('.sucessEdit').remove(); }, 2000); if (next == listReabertura.length) { - alertaBoxPro('Sucess', 'check-circle', (listReabertura.length > 1 ? 'Processos reabertos': 'Processo reaberto')+' com sucesso!', function(){ window.location.reload() }); + alertaBoxPro('Sucess', 'check-circle', (listReabertura.length > 1 ? 'Processos reabertos': 'Processo reaberto')+' com sucesso!', function(){ + window.location.href += "#ID-"+selectReabertura.join(','); + location.reload(); + // window.location.reload(); + }); loadingButtonConfirm(false); } console.log(listReabertura[index], next, listReabertura.length); @@ -3301,7 +3477,7 @@ function getLinksArvoreAjax(htmlArvore) { $.each(htmlArvore.split('\n'), function(ind, val){ if (val.indexOf('Nos[0].acoes = ') !== -1) { var barraControle = val.trim().replace("Nos[0].acoes = '",'').slice(0,-2); - $('
            '+barraControle+'
            ').find('a.botaoSEI').each(function(){ + $('
            '+barraControle+'
            ').find(parent.isNewSEI ? 'a[href*="controlador.php?acao="]' : 'a.botaoSEI').each(function(){ if (typeof $(this).attr('href') !== 'undefined' && $(this).attr('href') != '#') { links.push({name: $(this).find('img').attr('title'), url: $(this).attr('href')}); } @@ -4638,7 +4814,7 @@ function verifyConfigValue(name) { } } function restrictConfigValue(name) { - if (NAMESPACE_SPRO == 'ANTAQ Pro' || NAMESPACE_SPRO == 'ANTT Pro' || NAMESPACE_SPRO == 'SEI Pro') { + if (NAMESPACE_SPRO == 'ANTAQ Pro' || NAMESPACE_SPRO == 'ANTT Pro') { return false; } else { return checkConfigValue(name); @@ -4918,7 +5094,7 @@ function confirmaFraseBoxPro(text, phrase, func, cancel) { }] }); } -function confirmaBoxPro(text, func, titBtn = 'OK', cancel) { +function confirmaBoxPro(text, func, titBtn = 'OK', cancel = false, titBtnCancel = 'Cancelar') { if (alertBoxPro) { alertBoxPro.dialog('destroy'); alertBoxPro = false; @@ -4935,7 +5111,7 @@ function confirmaBoxPro(text, func, titBtn = 'OK', cancel) { $('.alertaAttencionPro').html(''); }, buttons: [{ - text: "Cancelar", + text: titBtnCancel, click: function() { if (typeof cancel === 'function') { cancel() } $(this).dialog('close'); @@ -5424,7 +5600,7 @@ function eraseCookiePro(name) { createCookiePro(name, "", -1); } function removeAcentos(str) { - return (typeof str !== 'undefined' && str !== null) ? str.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : ''; + return (typeof str !== 'undefined' && str !== null && typeof str.normalize === 'function') ? str.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : ''; } function encodeURI_toHex(str){ var hex, i; @@ -5899,6 +6075,7 @@ function ajaxDadosProcessoPro(href, mode, arrayAcompEsp) { // console.log(processo); setTimeout(function(){ updateTitlePage(mode); + if (typeof setTipoPrescricaoProcesso === 'function') setTipoPrescricaoProcesso(); }, 500); if (mode == 'editor' || mode == 'gantt' || mode == 'dados' || mode == 'processo') { checkDadosIframeDocumentosPro(mode); @@ -6130,6 +6307,7 @@ function getHistoryProcessosPro() { }, 500); } }, 500); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } function getAllLinksFolder() { var _ifrArvore = $('#ifrArvore'); @@ -6878,6 +7056,7 @@ function getDocumentosActions() { }, 1000); } }, 500); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } function initAppendIconsDocumentosActions(TimeOut = 3000) { if (TimeOut <= 0) { @@ -9379,6 +9558,39 @@ function appendIconBatchActions(loop = true) { },1500); } } +function appendIconCtrPrescricao(loop = true) { + var ifrVisualizacao = $('#ifrVisualizacao').contents(); + var base64IconCtrPrescricao = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAABFJJREFUeJztmG9MG2UYwFeyaTZwcSwx2WzLBjNxGx/mvuAHiYl+WGCML/uDMZWVAHPqNJsxS8acY1sy/DMzQRNzxj8fNNEYPxmTJc4P6jelQLtCS0t71/ZKodcrEOjd296fPr7vXTsKQgbxrsbIk/zy3uV67/3yXNvned9NmzZiI/4D0dba99Khvec+r7e/QhnBQdtZqssx0GiYYHPjFcpe1QH2KqchWCtPwwvH3jtjmGBT41WKTGrTwA+pxLLauH7IHNbKdmg79q5xgq3P91K1O7uhrrpIJ9Tt6FoXtYRqMpJ7O6H9xAfGCc7xcoUkJzfTKamfTskQSKgwEsmvC3eB0ajyBp9UKgiGCRYjzClUmJPBP7l+wSL3oso5w8WMFVT/x4KJKf+nbMILEdYFweDPmLsQmFgb5LPkHob985IpcjmVrxATH1/N0j2Agp0guqyAXLvxuFZ2gTCIR/adblMEScjpO/sRcwVQ+CIII4dAcNnwQ9dGZtAKmeH6lMx/v800QZTntiD2w7sofBlE3wksuEd78IPkRCLoqoGM78ht0+SKIfLf7kbx/l9E+nIeYUlxsOaBmcwM1Sli4PgXIv/VTtMFSSD+xxox9v5PiHk7I461gDD0ZEHGvixzOLsjB+YFf/OXmYU79rLIFUPKTmzPcV8/i2I3f0fhN0EcbcKiTywKDu0T0L2G78TIxcNZObRdgbSlrIJ54C0oz2zJpr55DE0OdKPo9UkxeAZEz9MgeBsjC4GTbRL9+iN5NWUhlFWuNOK8spXm5CN0Ev3GTo3JsekIMHxuMMLnGhJz0kP/mhi/IFtiXG4Pw0mf4AozTypMkRAGS3Ohabk3GFceL7sck5KraE7qwzJsqVgpPtzxeGIquKMq62Wla/RktjzZjKZQJZa7iSXkleUUGE8oWmul119St9WsN5a7wKSkh00XZLhcP40lVsvcOM6ce8VGQYVRVnrLVLnErLqVTkppehU5AnmtK3cyCngiii+eVjebJsgklaMri0mYHCTYX2F84g9wMwoMR+S/ZZDgjalPmSfIKTdCqwjGp8ZgIfAazLibYCzkwTLLBXW8MdlhmmCIk6hSMfKqQykJ2KlxEOnrIPhPauVubrgBfGG/9lr1zJU2rLKZHbVMLc9cdDoG85EByIZ7cIfThusvqcdW4DwvgjccLkiWSRD/eil6SQZnIMPcBkSaWIzgP6W1VsV6nHa3gIeZXZJFjxmLptm0rNVShpNv4f9AIDBJAWbYHwAxlzA9+ohfMelgRJfeA5Ix7ruBJTOapFv/Dp6fS4OFYJhg63PXKG3BvqNbX4iTBXh1Bz4+jXHCvkd19PN2vDh3LKGu2gl78WK9trCAJ3M4jt8ybuHe/EwvZStsfVgL6OftYLt/jNnWUbjuvM/iNYJT2/YwfG/mKBbU9lYM2jyyGS14qqXPUW9/9bOD9rPUP8ZGeJnqcnxk3PZbRkhbCIZNuBEbsRh/AXsKOj5cMZb5AAAAAElFTkSuQmCC'; + var htmlIconCtrPrescricao = '
            '+ + 'Gerenciar Prescri\u00E7\u00F5es'+ + ''; + if (ifrVisualizacao.find('#iconCtrPrescicao').length == 0) { + ifrVisualizacao.find('#divArvoreAcoes').append(htmlIconCtrPrescricao); + } + if (loop) { + setTimeout(function () { + appendIconCtrPrescricao(); + },1500); + } +} +function checkTipoPrescricaoProcesso() { + if (typeof arrayConfigAtividades.tipos_prescricoes !== 'undefined') { + var arrayTipoPrescicaoProcesso = []; + var id_tipo_procedimento = typeof dadosProcessoPro.propProcesso !== 'undefined' ? dadosProcessoPro.propProcesso.hdnIdTipoProcedimento : false; + if (id_tipo_procedimento) { + $.each(arrayConfigAtividades.tipos_prescricoes,function(i, v){ + if (typeof v.config !== 'undefined' && typeof v.config.tipo_processo !== 'undefined') { + if (jmespath.search(v.config.tipo_processo,"[?value=='"+id_tipo_procedimento+"']") !== null) arrayTipoPrescicaoProcesso.push(v); + } + }); + return arrayTipoPrescicaoProcesso; + } else { + return false; + } + } else { + return false; + } +} function insertIconDocCertidao() { waitLoadPro($('#ifrVisualizacao').contents(), '#divArvoreAcoes', 'a[href*="controlador.php?acao="]', appendIconDocCertidao); } @@ -9428,7 +9640,7 @@ function appendTooltipOnButtons() { }); } function insertIconNewDoc() { - waitLoadPro($('#ifrVisualizacao').contents(), '#divArvoreAcoes', "a.botaoSEI", appendIconNewDoc); + if (!isNewSEI) waitLoadPro($('#ifrVisualizacao').contents(), '#divArvoreAcoes', "a.botaoSEI", appendIconNewDoc); } function appendIconNewDoc(loop = true) { var ifrVisualizacao = $('#ifrVisualizacao').contents(); diff --git a/dist/js/sei-pro-all.js b/dist/js/sei-pro-all.js index 4ca75e0..31bccd9 100644 --- a/dist/js/sei-pro-all.js +++ b/dist/js/sei-pro-all.js @@ -1,6 +1,9 @@ var pagesInfiniteSearch = []; var frmPesquisaProtocolo = ($('#seiSearch').length) ? '#seiSearch' : '#frmPesquisaProtocolo'; +var divPaginas = isNewSEI ? 'div.pesquisaPaginas' : 'div.paginas'; + function getTableInfiniteSearch(ifrView, formID, tableID, index) { + console.log(pagesInfiniteSearch, index, pagesInfiniteSearch); if (pagesInfiniteSearch.length == 0 || $.inArray(index, pagesInfiniteSearch) === -1) { var form = ifrView.find(formID); var href = form.attr('action'); @@ -18,7 +21,8 @@ function getTableInfiniteSearch(ifrView, formID, tableID, index) { }); param['hdnInicio'] = index; pagesInfiniteSearch.push(index); - ifrView.find('div.paginas').append(''); + ifrView.find(divPaginas).append(''); + console.log(param, href); $.ajax({ method: 'POST', @@ -35,23 +39,23 @@ function getTableInfiniteSearch(ifrView, formID, tableID, index) { param['hdnInicio'] = 0; $.ajax({ method: 'POST', data: param, url: href }); } - ifrView.find('div.paginas').after($html.find('div.paginas')).remove(); + ifrView.find(divPaginas).after($html.find(divPaginas)).remove(); startQuickViewSearch(); console.log('startQuickViewSearch'); }); } } function getInfiniteSearch() { - var nrPage = parseInt($('div.paginas b').text()+'0'); - if ($('div.paginas span.pequeno').last().text() == 'Pr\u00F3xima') { - getTableInfiniteSearch($('#divInfraAreaTela'), frmPesquisaProtocolo, 'table.resultado', nrPage); + var nrPage = parseInt($(isNewSEI ? 'div.pesquisaPaginas .pesquisaPaginaSelecionada' : 'div.paginas b').text()+'0'); + if ($(isNewSEI ? 'div.pesquisaPaginas a' : 'div.paginas span.pequeno').last().text() == 'Pr\u00F3xima') { + getTableInfiniteSearch($('#divInfraAreaTela'), frmPesquisaProtocolo, isNewSEI ? 'table.pesquisaResultado' : 'table.resultado', nrPage); } } function startPagesInfiniteSearch(index = false) { - $(window).scroll(function () { + $(isNewSEI ? '#divInfraAreaTelaD' : window).scroll(function () { if ($(window).scrollTop() >= $(document).height() - $(window).height() - 120) { getInfiniteSearch(); - } + } }); } function repairLnkControleProcesso() { diff --git a/dist/js/sei-pro-arvore.js b/dist/js/sei-pro-arvore.js index 72c1ab9..3eda290 100644 --- a/dist/js/sei-pro-arvore.js +++ b/dist/js/sei-pro-arvore.js @@ -1219,7 +1219,7 @@ function getInfoArvoreLastDoc(dataResult, urlParent, arrayDropzone = arvoreDropz if (queuedFiles.length == 0) { dropzoneAlertBoxInfo(); setTimeout(function(){ window.location.reload(); }, 500); - if (typeof parent.parent.nextUploadFilesInProcess === 'function') parent.parent.nextUploadFilesInProcess(); + if (typeof parent.parent.nextUploadFilesInProcess === 'function' && parent.parent.arvoreDropzone) parent.parent.nextUploadFilesInProcess(); } }); return false; @@ -2349,6 +2349,46 @@ function checkProcessoSigiloso() { sessionStorageStorePro('processo_sigiloso_'+id_protocolo,true); } } +function initPanelPrescricaoProcesso() { + var prescData = parent.arrayPrescricoesProcPro; + var tipos_prescricao = typeof jmespath !== 'undefined' ? jmespath.search(prescData,"[*].id_tipo_prescricao") : null; + if (typeof prescData !== 'undefined' && prescData.length > 0 && tipos_prescricao !== null && tipos_prescricao.length > 0) { + $.each(tipos_prescricao, function(i, v){ + var value_prescricao = typeof parent.arrayConfigAtividades.tipos_prescricoes !== 'undefined' ? jmespath.search(parent.arrayConfigAtividades.tipos_prescricoes, "[?id_tipo_prescricao==`"+v+"`] | [0]") : null; + value_prescricao = value_prescricao !== null ? value_prescricao : false; + var prescricao = jmespath.search(prescData,"[?id_tipo_prescricao==`"+v+"`]"); + prescricao = prescricao !== null ? prescricao : false; + var vigente = jmespath.search(prescricao, "[?data_fim=='0000-00-00 00:00:00'] | [0]"); + vigente = vigente !== null ? vigente : false; + var prazo = value_prescricao ? value_prescricao.prazo : false; + var config = value_prescricao ? value_prescricao.config : false; + + if (prazo) { + var decorrido = moment().diff(moment(vigente.data_inicio, 'YYYY-MM-DD HH:mm:ss'),'days'); + var porcentagem = parseFloat(((decorrido/prazo)*100).toFixed(2)); + var nivel_critico = config && typeof config.nivel_critico !== 'undefined' ? config.nivel_critico : 75; + var urgencia_nivel_critico = config && typeof config.urgencia_nivel_critico !== 'undefined' ? config.urgencia_nivel_critico : false; + var classUrgente = porcentagem >= nivel_critico ? 'urgente' : ''; + var txtTip = 'Decorrido: '+decorrido+' dias ('+porcentagem+'%)
            In\u00EDcio: '+vigente.descricao+' ('+moment(vigente.data_inicio).format('DD/MM/YYYY HH:mm')+')
            Prazo: '+prazo+' dias\',\''+value_prescricao.nome_prescricao; + + $('#progressPrescricao').remove(); + $('#topmenu').append('
            '); + $('#progressPrescricao').progressbar({ + value: decorrido, + max: prazo + }); + $('#container').css('margin-top','35px'); + + setTimeout(function(){ + if (typeof parent.dadosProcessoPro.propProcesso !== 'undefined' && parent.dadosProcessoPro.propProcesso.txtDescricao.toLowerCase().indexOf('(urgente)') === -1 && porcentagem >= nivel_critico && urgencia_nivel_critico) { + parent.addUrgenteProcessoPro(); + } + }, 4000); + console.log(value_prescricao, vigente, prazo, decorrido, porcentagem, nivel_critico, urgencia_nivel_critico, parent.dadosProcessoPro); + } + }) + } +} function initAnchorImg() { $('a[id*="anchorImg"], a[id*="anchorA"], a[id*="ancjoinPASTA"]').each(function(){ var img = $(this).find('img').attr('src'); @@ -2380,6 +2420,7 @@ function initOnClickPasta() { function initSeiProArvore(loop = true) { loadStyleDesign(); checkProcessoSigiloso(); + initPanelPrescricaoProcesso(); arrayLinksArvore = getLinksArvore(); arrayLinksPage = getLinksPage(); parent.linksArvore = getLinksPage(); diff --git a/dist/js/sei-pro-atividades.js b/dist/js/sei-pro-atividades.js index d40c81b..4524a4b 100644 --- a/dist/js/sei-pro-atividades.js +++ b/dist/js/sei-pro-atividades.js @@ -15,6 +15,7 @@ var tableConfigEditor = {}; var tableConfigList = {}; var arrayAtividadesPro = (!getOptionsPro('panelLocalStorePro') && hybridStorageRestorePro('configDataAtividadesPro') !== null) ? hybridStorageRestorePro('configDataAtividadesPro') : []; var arrayAtividadesProcPro = !getOptionsPro('panelLocalStorePro') && (hybridStorageRestorePro('configDataAtividadesProcPro') !== null) ? hybridStorageRestorePro('configDataAtividadesProcPro') : []; +var arrayPrescricoesProcPro = !getOptionsPro('panelLocalStorePro') && (hybridStorageRestorePro('configDataPrescricoesProcPro') !== null) ? hybridStorageRestorePro('configDataPrescricoesProcPro') : []; var checkLoadAtividadesProcPro = false; var checkLoadFavoritesProcPro = false; var arrayAtividades = ($('#ifrArvore').length > 0) ? arrayAtividadesProcPro : arrayAtividadesPro; @@ -23,7 +24,10 @@ var perfilAtividadesSelected = getOptionsPro('panelAtividadesViewSyncUnidade') : (getOptionsPro('perfilAtividadesSelected')) ? getOptionsPro('perfilAtividadesSelected') : ''; var arrayProcessosUnidade = getProcessoUnidadePro(); var arrayNomenclaturas = []; -var lastUpdateAtividades = (!getOptionsPro('panelLocalStorePro') && hybridStorageRestorePro('lastUpdateAtividades') !== null) ? hybridStorageRestorePro('lastUpdateAtividades') : false; +var timeRestoreAtividades = (getOptionEntidade('cache_demandas_value') && getOptionEntidade('cache_demandas_time')) ? {time: getOptionEntidade('cache_demandas_time'), value: getOptionEntidade('cache_demandas_value')} : {time: 'day', value: 1}; +var lastUpdateAtividades = (!getOptionsPro('panelLocalStorePro') && localStorageRestorePro('lastUpdateAtividades') !== null) + ? localStorageRestorePro('lastRestoreAtividades') !== null && moment(localStorageRestorePro('lastRestoreAtividades'),'YYYY-MM-DD HH:mm:ss').add(timeRestoreAtividades.value,timeRestoreAtividades.time) < moment() ? false : localStorageRestorePro('lastUpdateAtividades') + : false; var dly; var loadRowsPanelAtiv = false; var indexReportUpdate = 0; @@ -75,6 +79,7 @@ function setNameConst() { a_demanda: getName('demanda', 'a demanda', true, true, false), a_demanda_selecionada: getName('demanda', 'a demanda', true, true, false)+' '+getNameGenre('demanda', 'selecionado', 'selecionada'), A_demanda: getNameGenre('demanda', 'O', 'A')+' '+__demanda, + As_demandas: getNameGenre('demanda', 'O', 'A')+'s '+__demandas, da_demanda: getNameGenre('demanda', 'do', 'da')+' '+__demanda, esta_demanda: getNameGenre('demanda', 'este', 'esta')+' '+__demanda, a_outra_demanda_vinculada: getNameGenre('demanda', 'o outro', 'a outra')+' '+__demanda+' '+getNameGenre('demanda', 'vinculado', 'vinculada'), @@ -110,6 +115,9 @@ function setNameConst() { Paralisada: getName('paralisada', 'Paralisada', true, false, true), paralisacao: getName('paralisacao', 'paralisa\u00E7\u00E3o', true, false, false), Paralisacao: getName('paralisacao', 'Paralisa\u00E7\u00E3o', true, false, true), + prescricao: getName('prescricao', 'prescri\u00E7\u00E3o', true, false, false), + Prescricao: getName('prescricao', 'Prescri\u00E7\u00E3o', true, false, true), + Prescricoes: getName('prescricao', 'Prescri\u00E7\u00F5es', false, false, true), retomada: getName('retomada', 'retomada', true, false, false), Retomada: getName('retomada', 'Retomada', true, false, true), retomar: getName('retomar', 'retomar', true, false, false), @@ -255,6 +263,7 @@ function getServerAtividades(param, mode) { } } else if (mode == 'edit_tempos') { updateServerTemposDemanda('reset', param.mode, false, ativData, param); + $('.update_tempos_demanda').removeClass('fa-spin'); } else if (mode == 'edit_documento') { loadingButtonConfirm(false); if (param.reference == 'modelo') { @@ -277,6 +286,11 @@ function getServerAtividades(param, mode) { resetDialogBoxPro('dialogBoxPro'); updateAtividade(); alertaBoxPro('Sucess', 'check-circle', 'Justificativa cadastrada com sucesso!'); + } else if (mode == 'config_new_planos' && param.mode == 'new') { + resetDialogBoxPro('dialogBoxPro'); + alertaBoxPro('Sucess', 'check-circle', 'Plano de trabalho cadastrado com sucesso!'); + } else if (mode == 'config_update_tipos_capacidades' && param.mode == 'update') { + updateConfigPerfilCapacidade(param, ativData); } } else if (mode == 'view_contato') { setTableContatoPanel(ativData['result']); @@ -288,9 +302,10 @@ function getServerAtividades(param, mode) { } else if (mode.indexOf('config_') !== -1) { loadingButtonConfirm(false); - if (typeof ativData['padrao'] !== 'undefined' && ativData['padrao'] !== null && (mode == 'config_users' || mode == 'config_unidades' || mode == 'config_tipos_modalidades')) { - arrayConfigAtividades['unidades_all'] = ativData['padrao']['unidades_all']; - arrayConfigAtividades['perfis'] = ativData['padrao']['perfis']; + if (typeof ativData['padrao'] !== 'undefined' && ativData['padrao'] !== null && (mode == 'config_users' || mode == 'config_unidades' || mode == 'config_tipos_modalidades' || mode == 'config_tipos_capacidades' || mode == 'config_perfis')) { + if (typeof ativData['padrao']['unidades_all'] !== 'undefined') arrayConfigAtividades['unidades_all'] = ativData['padrao']['unidades_all']; + if (typeof ativData['padrao']['perfis'] !== 'undefined') arrayConfigAtividades['perfis'] = ativData['padrao']['perfis']; + if (typeof ativData['padrao']['tipos_capacidades'] !== 'undefined') arrayConfigAtividades['tipos_capacidades'] = ativData['padrao']['tipos_capacidades']; } if (typeof ativData['padrao'] !== 'undefined' && ativData['padrao'] !== null && (mode == 'config_planos')) { arrayConfigAtividades['tipos_modalidades'] = ativData['padrao']['tipos_modalidades']; @@ -304,6 +319,9 @@ function getServerAtividades(param, mode) { } } + if (typeof ativData['config'] !== 'undefined' && ativData['config'] !== null && (mode == 'config_tipos_prescricoes')) { + arrayConfigAtividades['tipos_prescricoes'] = ativData['config']; + } if (typeof ativData['config'] !== 'undefined' && ativData['config'] !== null && (mode == 'config_cadeia_valor')) { arrayConfigAtividades['cadeia_valor'] = ativData['config']; } @@ -390,11 +408,16 @@ function getServerAtividades(param, mode) { appendDataDemandaOnLocalArray(ativData['demandas'], 'demandas'); } else { arrayAtividadesPro = ativData['demandas']; + localStorageStorePro('lastRestoreAtividades', moment().format('YYYY-MM-DD HH:mm:ss')); } } if (typeof ativData['demandas_processo'] !== 'undefined' && ativData['demandas_processo'] !== null && isInitOffset) { arrayAtividadesProcPro = ativData['demandas_processo']; } + if (typeof ativData['prescricoes_processo'] !== 'undefined' && ativData['prescricoes_processo'] !== null && isInitOffset) { + arrayPrescricoesProcPro = ativData['prescricoes_processo']; + initPanelPrescricaoProc(); + } if (typeof ativData['demandas_excluidas'] !== 'undefined' && ativData['demandas_excluidas'] !== null && ativData['demandas_excluidas'].length > 0 && isInitOffset) { $.each(ativData['demandas_excluidas'], function(i, v){ removeRowsPanelAtividades(v.id_demanda); @@ -410,7 +433,7 @@ function getServerAtividades(param, mode) { storeLocalDataConfigArray(arrayConfigAtividades); lastUpdateAtividades = (!getOptionsPro('panelLocalStorePro') && typeof ativData['last_update'] !== 'undefined' && ativData['last_update']) ? ativData['last_update'] : lastUpdateAtividades; - hybridStorageStorePro('lastUpdateAtividades', lastUpdateAtividades); + localStorageStorePro('lastUpdateAtividades', lastUpdateAtividades); var ativDataPanel = false; var _caption = $('#tabelaAtivPanel table caption.infraCaption'); @@ -501,14 +524,17 @@ function getServerAtividades(param, mode) { mode == 'pause_atividade' || mode == 'pause_atividade_remove' || mode == 'start_cancel_atividade' || + mode == 'start_cancel_atividades' || mode == 'complete_atividade' || mode == 'complete_atividade_parcial' || mode == 'complete_edit_atividade' || mode == 'complete_cancel_atividade' || + mode == 'complete_cancel_atividades' || mode == 'rate_atividade' || mode == 'rate_atividades' || mode == 'rate_edit_atividade' || mode == 'rate_cancel_atividade' || + mode == 'rate_cancel_atividades' || mode == 'send_atividade' || mode == 'send_cancel_atividade' || mode == 'notify_send' || @@ -541,11 +567,14 @@ function getServerAtividades(param, mode) { txtAlert = (mode == 'complete_atividade_parcial') ? __.Demanda+' residual '+getNameGenre('demanda', 'cadastrado', 'cadastrada') : txtAlert; txtAlert = (mode == 'complete_edit_atividade') ? __.Demanda+' '+getNameGenre('demanda', 'editado', 'editada') : txtAlert; txtAlert = (mode == 'start_cancel_atividade') ? 'In\u00EDcio de '+__.demanda+' cancelado' : txtAlert; + txtAlert = (mode == 'start_cancel_atividades') ? 'In\u00EDcio de '+__.demandas+' cancelado' : txtAlert; txtAlert = (mode == 'complete_cancel_atividade') ? 'Conclus\u00E3o de '+__.demanda+' cancelada' : txtAlert; + txtAlert = (mode == 'complete_cancel_atividades') ? 'Conclus\u00E3o de '+__.demandas+' cancelada' : txtAlert; txtAlert = (mode == 'rate_atividade') ? 'Avalia\u00E7\u00E3o cadastrada' : txtAlert; txtAlert = (mode == 'rate_atividades') ? 'Avalia\u00E7\u00F5es cadastradas' : txtAlert; txtAlert = (mode == 'rate_edit_atividade') ? 'Avalia\u00E7\u00E3o editada' : txtAlert; txtAlert = (mode == 'rate_cancel_atividade') ? 'Avalia\u00E7\u00E3o cancelada' : txtAlert; + txtAlert = (mode == 'rate_cancel_atividades') ? 'Avalia\u00E7\u00F5es canceladas' : txtAlert; txtAlert = (mode == 'send_atividade') ? (ativData['update_demandas'].length == 1 ? __.Demanda+' '+__.arquivada : __.Demandas+' '+__.arquivadas) : txtAlert; txtAlert = (mode == 'send_cancel_atividade') ? __.Arquivamento+' de '+__.demanda+' '+getNameGenre('arquivamento', 'cancelado', 'cancelado') : txtAlert; txtAlert = (mode == 'save_afastamento') ? 'Afastamento salvo' : txtAlert; @@ -670,11 +699,11 @@ function getServerAtividades(param, mode) { removeRowsPanelAtividades(param.id_demanda); } if ( - mode == 'complete_atividade' || mode == 'complete_edit_atividade' || mode == 'complete_atividade_parcial' || mode == 'complete_cancel_atividade' || + mode == 'complete_atividade' || mode == 'complete_edit_atividade' || mode == 'complete_atividade_parcial' || mode == 'complete_cancel_atividade' || mode == 'complete_cancel_atividades' || mode == 'save_atividade' || mode == 'edit_atividade' || mode == 'pause_atividade' || - mode == 'rate_atividade' || mode == 'rate_atividades' || mode == 'rate_cancel_atividade' || mode == 'rate_default_atividade' || mode == 'rate_edit_atividade' || + mode == 'rate_atividade' || mode == 'rate_atividades' || mode == 'rate_cancel_atividade' || mode == 'rate_cancel_atividades' || mode == 'rate_default_atividade' || mode == 'rate_edit_atividade' || mode == 'send_atividade' || mode == 'send_cancel_atividade' || - mode == 'start_atividade' || mode == 'start_cancel_atividade' || + mode == 'start_atividade' || mode == 'start_cancel_atividade' || mode == 'start_cancel_atividades' || mode == 'type_atividade' || mode == 'extend_atividade' || mode == 'variation_atividade' || mode == 'delete_atividade' ) { @@ -687,12 +716,16 @@ function getServerAtividades(param, mode) { indexReportUpdate = 0; checkUpdateReports(); } + if (typeof arrayConfigAtividades !== 'undefined' && typeof arrayConfigAtividades.perfil !== 'undefined' &&typeof arrayConfigAtividades.perfil.nivel !== 'undefined' && arrayConfigAtividades.perfil.nivel == 1 && checkOptionEntidade('sincronizar_dados_externos')) { + indexReportUpdate = 0; + checkSyncDadoExterno(); + } } } } }).fail(function(data, textStatus){ - loadingButtonConfirm(false); if (typeof param.type !== 'undefined') { resetButtonTabConfig('.actionsConfig_'+param.type) } + if (typeof data.refresh_page !== 'undefined' && data.refresh_page) cleanAtivParams(); failureScreen(data, textStatus); }); } else { @@ -840,6 +873,11 @@ function repairPerfilSelectUnidade() { } } function failureScreen(data, textStatus) { + loadingButtonConfirm(false); + $('.panelHome').find('.iconAtividade_update i').removeClass('fa-spin'); + $('#tabsPanelConfig').find('.ui-tabs-anchor i').removeClass('fa-spin').removeClass('fa-spinner'); + $('.dataFallback').removeClass('dataLoading'); + var dataResponse = $("
            ").html(data.responseText).text(); dataResponse = (dataResponse) ? dataResponse.trim() : ''; var htmlReportError = '

            '+ @@ -862,6 +900,7 @@ function failureScreen(data, textStatus) { '

            '; var textError = (textStatus === 'timeout' || dataResponse == '') ? 'Erro ao receber sua informa\u00E7\u00F5es do servidor de dados. Tente novamente mais tarde. ('+textStatus+')' : 'Erro ao enviar sua informa\u00E7\u00F5es. Tente novamente mais tarde ou notifique o administrador.'+htmlReportError; alertaBoxPro('Error', 'exclamation-triangle', textError); + getInsertIconAtividade(); } function sendErrorReport(this_) { var _this = $(this_); @@ -2284,6 +2323,7 @@ function setPanelAtividades(storeAtividades = arrayAtividadesPro) { (checkCapacidade('config_users') ? getHtmlActionsConfig('users') : '')+ (checkCapacidade('config_unidades') ? getHtmlActionsConfig('unidades') : '')+ (checkCapacidade('config_cadeia_valor') ? getHtmlActionsConfig('cadeia_valor') : '')+ + (checkCapacidade('config_tipos_prescricoes') ? getHtmlActionsConfig('tipos_prescricoes') : '')+ (checkCapacidade('config_tipos_documentos') ? getHtmlActionsConfig('tipos_documentos') : '')+ (checkCapacidade('config_tipos_requisicoes') ? getHtmlActionsConfig('tipos_requisicoes') : '')+ (checkCapacidade('config_tipos_justificativas') ? getHtmlActionsConfig('tipos_justificativas') : '')+ @@ -2453,8 +2493,8 @@ function getBtnActionsAtividade(value, more_options = false) { return btnActionAtiv; } function awaitRowsPanelAtividades(id_demanda) { - $('#tabelaAtivPanel tr[data-index="'+id_demanda+'"] td[data-type="action"] a[onclick*="actionsAtividade"] i').attr('class','fas fa-spinner fa-spin'); - $('#kanbanAtivPanel .kanban-item[data-eid="_id_'+id_demanda+'"] .drag_handler_icon').attr('class','fas fa-spinner fa-spin').css({'font-size': '160%', 'color': '#4385f4', 'margin-top': '5px'}); + $('#tabelaAtivPanel tr[data-index="'+id_demanda+'"] td[data-type="action"] a[onclick*="actionsAtividade"] i').attr('class','fas fa-spinner fa-spin fa-pulse'); + $('#kanbanAtivPanel .kanban-item[data-eid="_id_'+id_demanda+'"] .drag_handler_icon').attr('class','fas fa-spinner fa-spin fa-pulse').css({'font-size': '160%', 'color': '#4385f4', 'margin-top': '5px'}); } function getRowsPanelAtividades(storeAtividades, target) { function setRowsPanelAtividades(value, index) { @@ -2665,15 +2705,16 @@ function getHtmlActionsConfig(type) { param = (type == 'users') ? {name_new: 'Novo Usu\u00E1rio', name: 'Usu\u00E1rios', icon: 'fas fa-users', index: 4} : param; param = (type == 'unidades') ? {name_new: 'Nova Unidade', name: 'Unidades', icon: 'fas fa-briefcase', index: 5} : param; param = (type == 'cadeia_valor') ? {name_new: 'Novo Processo', name: 'Cadeia de Valor', icon: 'fas fa-share-alt', index: 6} : param; - param = (type == 'tipos_documentos') ? {name_new: 'Novo Tipo de Documento', name: 'Tipo de Documento', icon: 'fas fa-file-alt', index: 7} : param; - param = (type == 'tipos_requisicoes') ? {name_new: 'Novo Tipo de Requisi\u00E7\u00E3o', name: 'Tipo de Requisi\u00E7\u00E3o', icon: 'fas fa-inbox', index: 8} : param; - param = (type == 'tipos_justificativas') ? {name_new: 'Novo Tipo de Justificativa de Avalia\u00E7\u00E3o', name: 'Tipo de Justificativa', icon: 'fas fa-star', index: 9} : param; - param = (type == 'tipos_modalidades') ? {name_new: 'Novo Tipo de Modalidade de Trabalho', name: 'Tipo de Modalidade', icon: 'fas fa-wrench', index: 10} : param; - param = (type == 'tipos_motivos') ? {name_new: 'Novo Tipo de Motivo de Afastamento', name: 'Tipo de Motivo', icon: 'fas fa-luggage-cart', index: 11} : param; - param = (type == 'tipos_capacidades') ? {name_new: 'Novo Tipo de Capacidade', name: 'Tipo de Capacidade', icon: 'fas fa-users-cog', index: 12} : param; - param = (type == 'perfis') ? {name_new: 'Novo Tipo de Perfil', name: 'Tipo de Perfil', icon: 'fas fa-shield-alt', index: 13} : param; - param = (type == 'nomenclaturas') ? {name_new: 'Nova Nomenclatura', name: 'Nomenclatura', icon: 'fas fa-ad', index: 14} : param; - param = (type == 'entidades') ? {name_new: 'Nova Entidade', name: 'Entidades', icon: 'fas fa-university', index: 15} : param; + param = (type == 'tipos_prescricoes') ? {name_new: 'Novo Tipo de '+__.Prescricao+'', name: __.Prescricao, icon: 'fas fa-history', index: 7} : param; + param = (type == 'tipos_documentos') ? {name_new: 'Novo Tipo de Documento', name: 'Tipo de Documento', icon: 'fas fa-file-alt', index: 8} : param; + param = (type == 'tipos_requisicoes') ? {name_new: 'Novo Tipo de Requisi\u00E7\u00E3o', name: 'Tipo de Requisi\u00E7\u00E3o', icon: 'fas fa-inbox', index: 9} : param; + param = (type == 'tipos_justificativas') ? {name_new: 'Novo Tipo de Justificativa de Avalia\u00E7\u00E3o', name: 'Tipo de Justificativa', icon: 'fas fa-star', index: 10} : param; + param = (type == 'tipos_modalidades') ? {name_new: 'Novo Tipo de Modalidade de Trabalho', name: 'Tipo de Modalidade', icon: 'fas fa-wrench', index: 11} : param; + param = (type == 'tipos_motivos') ? {name_new: 'Novo Tipo de Motivo de Afastamento', name: 'Tipo de Motivo', icon: 'fas fa-luggage-cart', index: 12} : param; + param = (type == 'tipos_capacidades') ? {name_new: 'Novo Tipo de Capacidade', name: 'Tipo de Capacidade', icon: 'fas fa-users-cog', index: 13} : param; + param = (type == 'perfis') ? {name_new: 'Novo Tipo de Perfil', name: 'Tipo de Perfil', icon: 'fas fa-shield-alt', index: 14} : param; + param = (type == 'nomenclaturas') ? {name_new: 'Nova Nomenclatura', name: 'Nomenclatura', icon: 'fas fa-ad', index: 15} : param; + param = (type == 'entidades') ? {name_new: 'Nova Entidade', name: 'Entidades', icon: 'fas fa-university', index: 16} : param; var html = ' '+ (checkCapacidade('config_new_'+type) ? @@ -2840,7 +2881,7 @@ function initPanelAtividadesView() { } function removeLocalDataAtiv(force = false) { removeLocalDataConfigArray(); - hybridStorageRemovePro('lastUpdateAtividades'); + localStorageRemovePro('lastUpdateAtividades'); hybridStorageRemovePro('configDataAtividadesPro'); hybridStorageRemovePro('configDataAtividadesProcPro'); hybridStorageRemovePro('configDataAtividadesPadraoPro'); @@ -3095,6 +3136,7 @@ function openModalConfigPanel(){ (checkCapacidade('config_users') ? getHtmlActionsConfig('users') : '')+ (checkCapacidade('config_unidades') ? getHtmlActionsConfig('unidades') : '')+ (checkCapacidade('config_cadeia_valor') ? getHtmlActionsConfig('cadeia_valor') : '')+ + (checkCapacidade('config_tipos_prescricoes') ? getHtmlActionsConfig('tipos_prescricoes') : '')+ (checkCapacidade('config_tipos_documentos') ? getHtmlActionsConfig('tipos_documentos') : '')+ (checkCapacidade('config_tipos_requisicoes') ? getHtmlActionsConfig('tipos_requisicoes') : '')+ (checkCapacidade('config_tipos_justificativas') ? getHtmlActionsConfig('tipos_justificativas') : '')+ @@ -3139,6 +3181,9 @@ function getTabsConfigPanel(panel = 'panelInfoHomeConfiguracao') { (checkCapacidade('config_cadeia_valor') ? '
          • Cadeia de Valor
          • '+ '' : '')+ + (checkCapacidade('config_tipos_prescricoes') ? + '
          • Tipos de '+__.Prescricoes+'
          • '+ + '' : '')+ (checkCapacidade('config_tipos_documentos') ? '
          • Tipos de Documentos
          • '+ '' : '')+ @@ -3188,6 +3233,9 @@ function getTabsConfigPanel(panel = 'panelInfoHomeConfiguracao') { (checkCapacidade('config_cadeia_valor') ? '
            '+ '' : '')+ + (checkCapacidade('config_tipos_prescricoes') ? + '
            '+ + '' : '')+ (checkCapacidade('config_tipos_documentos') ? '
            '+ '' : '')+ @@ -3283,7 +3331,7 @@ function getTabConfig(type, mode, data = false, loop = true) { getServerAtividades(param, action); $('#tabs-'+type).find('.dataFallback').addClass('dataLoading'); var iconTab = $('a[href="#tabs-'+type+'"]').find('i'); - iconTab.toggleClass('fa-'+iconTab.attr('data-icon')+' fa-spinner').addClass('fa-spin'); + iconTab.addClass('fa-spinner').addClass('fa-spin'); } else if ((checkCapacidade('config_'+type) || checkCapacidade('config_self_'+type)) && mode == 'set') { if (typeof SimpleTableCellEditor === 'undefined' && loop) { @@ -3295,7 +3343,7 @@ function getTabConfig(type, mode, data = false, loop = true) { getTableTabConfig(type, data); infraTooltipOcultar(); var iconTab = $('a[href="#tabs-'+type+'"]').find('i'); - iconTab.toggleClass('fa-'+iconTab.attr('data-icon')+' fa-spinner').removeClass('fa-spin'); + iconTab.removeClass('fa-spinner').removeClass('fa-spin'); } } } @@ -3381,6 +3429,10 @@ function changeSelectConfigItem(this_) { console.log(data_tr, value_txt, value, td.data()); tr.find('td').eq(1).text(value); } + if (td.data('key') == 'tipos_prescricoes') { + console.log(data_tr, value_txt, value, td.data()); + tr.find('td').eq(1).text(value); + } if (table.data('format') == 'obj_mult') { value = (value == '') ? 'remove' : value; @@ -3392,7 +3444,7 @@ function changeSelectConfigItem(this_) { } else { table.find('tbody tr:last-child').find('td:first-child').trigger('click'); } - if (tr.find('td').length == 2 && tr.data('index') == table.find('tbody tr').length-1 && value_txt != '' && (data_tr.key != 'perfil' || data_tr.key != 'cadeia_valor')) { + if (tr.find('td').length == 2 && tr.data('index') == table.find('tbody tr').length-1 && value_txt != '' && (data_tr.key != 'perfil' || data_tr.key != 'cadeia_valor' || data_tr.key != 'tipos_prescricoes')) { addConfigItem(this_); } @@ -3832,7 +3884,7 @@ function getRowsTableTabConfig(type, mode, list = false, value = false) { ' '; } } else { - var colspan = 6; + var colspan = 7; colspan = (checkCapacidade('config_update_'+type)) ? colspan+1 : colspan; colspan = (checkOutrasUnidades) ? colspan+1 : colspan; _return = ' '+ @@ -4204,6 +4256,57 @@ function getRowsTableTabConfig(type, mode, list = false, value = false) { ' '; } } + } else if (type == 'tipos_prescricoes') { + if (mode == 'header') { + _return = ' '+ + ' '+ + ' Nome da '+__.Prescricao+''+ + ' Prazo'+ + (checkCapacidade('config_update_'+type) ? + ' Op\u00E7\u00F5es'+ + ' A\u00E7\u00F5es'+ + '' : '')+ + ' '; + } else if (mode == 'body') { + if (value) { + var classDisabled = (moment(value.data_fim,'YYYY-MM-DD HH:mm:ss') < moment() && value.data_fim != '0000-00-00 00:00:00') ? ' disabled' : ''; + var classClone = (value.nome_prescricao.indexOf('(C\u00F3pia)') !== -1) ? {name: ' clone', text: 'C\u00D3PIA' } : false; + var classNew = (value.nome_prescricao.indexOf('(Novo)') !== -1) ? {name: ' new', text: 'NOVO' } : false; + var config = (value.config && value.config !== null && (Object.keys(value.config).length > 0 || value.config.length > 0 )) ? value.config : false; + _return = ' '+ + ' '+ + ' '+ + ' '+value.nome_prescricao+''+ + ' '+value.prazo+''+ + (checkCapacidade('config_update_'+type) ? + ' '+ + ' Op\u00E7\u00F5es'+ + ' '+ + ' '+ + (checkCapacidade('config_update_'+type) ? + ' '+ + ' '+ + '' : '')+ + (checkCapacidade('config_new_'+type) ? + ' '+ + '' : '')+ + ' '+ + '' : '')+ + ' '; + } else { + var colspan = 3; + colspan = (checkCapacidade('config_update_'+type)) ? colspan+1 : colspan; + _return = ' '+ + ' '+ + '
            '+ + '
            '+ + ' '+($('.actionsConfig_'+type).find('.iconConfig_add')[0].outerHTML)+ + '
            '+ + '
            '+ + ' '+ + ' '; + } + } } else if (type == 'entidades') { if (mode == 'header') { _return = ' '+ @@ -4252,6 +4355,56 @@ function getRowsTableTabConfig(type, mode, list = false, value = false) { ' '; } } + } else if (type == 'nomenclaturas') { + if (mode == 'header') { + _return = ' '+ + ' '+ + ' Nome da Nomenclatura'+ + ' Refer\u00EAncia'+ + ' Descri\u00E7\u00E3o'+ + (checkCapacidade('config_update_'+type) ? + ' Op\u00E7\u00F5es'+ + ' A\u00E7\u00F5es'+ + '' : '')+ + ' '; + } else if (mode == 'body') { + if (value) { + var classDisabled = (moment(value.data_fim,'YYYY-MM-DD HH:mm:ss') < moment() && value.data_fim != '0000-00-00 00:00:00') ? ' disabled' : ''; + var classClone = (value.nome_nomenclatura.indexOf('(C\u00F3pia)') !== -1) ? {name: ' clone', text: 'C\u00D3PIA' } : false; + var classNew = (value.nome_nomenclatura.indexOf('(Novo)') !== -1) ? {name: ' new', text: 'NOVO' } : false; + _return = ' '+ + ' '+ + ' '+ + ' '+value.nome_nomenclatura+''+ + ' '+value.ref_nomenclatura+''+ + ' '+value.descricao+''+ + (checkCapacidade('config_update_'+type) ? + ' '+ + ' Op\u00E7\u00F5es'+ + ' '+ + ' '+ + ' '+ + ' '+ + (checkCapacidade('config_new_'+type) ? + ' '+ + '' : '')+ + ' '+ + '' : '')+ + ' '; + } else { + var colspan = 4; + colspan = (checkCapacidade('config_update_'+type)) ? colspan+1 : colspan; + _return = ' '+ + ' '+ + '
            '+ + '
            '+ + ' '+($('.actionsConfig_'+type).find('.iconConfig_add')[0].outerHTML)+ + '
            '+ + '
            '+ + ' '+ + ' '; + } + } } else if ( type == 'tipos_documentos' || type == 'tipos_justificativas' || @@ -4259,8 +4412,7 @@ function getRowsTableTabConfig(type, mode, list = false, value = false) { type == 'tipos_motivos' || type == 'tipos_capacidades' || type == 'perfis' || - type == 'tipos_requisicoes' || - type == 'nomenclaturas' + type == 'tipos_requisicoes' ) { param = (type == 'tipos_documentos') ? {name_head: 'Tipo de Documento', label_id: 'id_tipo_documento', label_name: 'nome_documento', icon: 'fas fa-file-alt', index: 6, edit_table: true, col_descricao: false} : null; param = (type == 'tipos_requisicoes') ? {name_head: 'Tipo de Requisi\u00E7\u00E3o', label_id: 'id_tipo_requisicao', label_name: 'nome_requisicao', icon: 'fas fa-inbox', index: 7, edit_table: true, col_descricao: false} : param; @@ -4269,7 +4421,6 @@ function getRowsTableTabConfig(type, mode, list = false, value = false) { param = (type == 'tipos_motivos') ? {name_head: 'Tipo de Motivos de Afastamento', label_id: 'id_tipo_motivo', label_name: 'nome_motivo', icon: 'fas fa-luggage-cart', index: 10, edit_table: true, col_descricao: false} : param; param = (type == 'tipos_capacidades') ? {name_head: 'Tipo de Capacidade', label_id: 'id_tipo_capacidade', label_name: 'nome_capacidade', icon: 'fas fa-users-cog', index: 11, edit_table: true, col_descricao: true} : param; param = (type == 'perfis') ? {name_head: 'Tipo de Perfil', label_id: 'id_perfil', label_name: 'nome_perfil', icon: 'fas fa-shield-alt', index: 12, edit_table: true, col_descricao: true} : param; - param = (type == 'nomenclaturas') ? {name_head: 'Nomenclaturas', label_id: 'id_nomenclatura', label_name: 'nome_nomenclatura', icon: 'fas fa-ad', index: 13, edit_table: false, col_descricao: false} : param; if (mode == 'header') { _return = ' '+ @@ -4829,6 +4980,7 @@ function getTableTabConfig(type, listConfig) { }); configTabela.find('.tablesorter-filter-row input.tablesorter-filter[aria-label*="Data"]').attr('type','date'); }, 500); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } var observerTableConfig = new MutationObserver(function(mutations) { @@ -5050,7 +5202,7 @@ function updateConfigTempoPactuado(_this, id, objIndex, data_tr) { if (value !== null) { var dates = getWorkDaysBetweenDates(value.data_inicio_vigencia, value.data_fim_vigencia, value.sigla_unidade); if (dates.dias) { - var tempo_total = parseInt(dates.dias)*parseInt(value.carga_horaria); + var tempo_total = parseInt(dates.dias)*parseFloat(value.carga_horaria); var tr = _this.closest('tr'); tr.find('td[data-key="tempo_total"]').text(tempo_total); tableConfigList.planos[objIndex].tempo_total = tempo_total; @@ -5074,6 +5226,8 @@ function updateConfigTempoPactuado(_this, id, objIndex, data_tr) { updateConfigServer({mode: 'update', id: id, type: 'planos', key: 'tempo_proporcional', value: tempo_proporcional, rowindex: data_tr.rowindex}); } + tempo_total = parseInt(tempo_total.toFixed(2)); + updateConfigServer({mode: 'update', id: id, type: 'planos', key: 'tempo_total', value: tempo_total, rowindex: data_tr.rowindex}); } } @@ -5128,7 +5282,7 @@ function cloneConfig(this_, e) { } function newConfig_(this_) { var _this = $(this_); - if (_this.data('type') == 'users') { + if (_this.data('type') == 'users' || (_this.data('type') == 'planos' && !checkCapacidade('config_self_planos')) ) { newConfig(this_); } else { var textBox = (typeof _this.attr('onmouseover') !== 'undefined') ? extractTooltip(_this.attr('onmouseover')) : 'adicionar novo item'; @@ -5286,9 +5440,24 @@ function newConfig(this_) { ? { nome_processo: '(Novo)', dependencia: 0, + config: [], selecionavel: 0 } : key; + key = (type == 'tipos_prescricoes') + ? { + nome_prescricao: '(Novo)', + config: [], + prazo: 60 + } : key; + + key = (type == 'nomenclaturas') + ? { + ref_nomenclatura: 'novo', + nome_nomenclatura: '(Novo)', + config: [] + } : key; + key = (type == 'entidades') ? { nome_entidade: '(Novo)', @@ -5297,7 +5466,7 @@ function newConfig(this_) { } : key; - if (type != 'users') { + if (type != 'users' && (type != 'planos' || checkCapacidade('config_self_planos') )) { var param = { action: action, id: -1, @@ -5308,12 +5477,146 @@ function newConfig(this_) { }; _this.find('i.icon-parent').attr('class','fas fa-spinner fa-spin icon-parent'); getConfigServer(action, param); + } else if (type == 'planos' && !checkCapacidade('config_self_planos')) { + newConfigPlano(this_); } else if (type == 'users') { newConfigUser(this_); } } +function changeConfigCargaHPadrao(this_) { + var _this = $(this_); + var carga_horaria_padrao = _this.find('option:selected').data('carga_horaria_padrao'); + _this.closest('table').find('#carga_horaria').val(carga_horaria_padrao); +} +function newConfigPlano(this_) { + var _this = $(this_); + var carga_horaria_entidade = jmespath.search(arrayConfigAtividades.entidades,"[?id_entidade==`"+arrayConfigAtividades.perfil.id_entidade+"`] |[0].config.carga_horaria_padrao"); + carga_horaria_entidade = (carga_horaria_entidade == null) ? 8 : carga_horaria_entidade; + var selectModalidadesOptions = $.map(arrayConfigAtividades.tipos_modalidades,function(v){ + if (v.data_fim == '0000-00-00 00:00:00' || (typeof arrayConfigAtividades.perfil.nivel !== 'undefined' && arrayConfigAtividades.perfil.nivel !== null && arrayConfigAtividades.perfil.nivel == 1)) { + var carga_horaria_padrao = (v.config && typeof v.config.carga_horaria_padrao !== 'undefined' && v.config.carga_horaria_padrao !== null) ? v.config.carga_horaria_padrao : 8; + return ''; + } + }).join(''); + + var config_unidade = (typeof arrayConfigAtivUnidade !== 'undefined' && arrayConfigAtivUnidade !== null && typeof arrayConfigAtivUnidade.config !== 'undefined' && arrayConfigAtivUnidade.config !== null) ? arrayConfigAtivUnidade.config : false; + var duracao_padrao = (config_unidade && typeof config_unidade.planos !== 'undefined' && config_unidade.planos !== null && typeof config_unidade.planos.duracao_padrao !== 'undefined' && config_unidade.planos.duracao_padrao !== null) ? config_unidade.planos.duracao_padrao : 1; + duracao_padrao = parseInt(duracao_padrao)-1; + + var selectUsuariosOptions = $.map(arrayConfigAtividades.usuarios,function(v){ + return ''; + }).join(''); + var htmlBox = '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + '
            '; + + resetDialogBoxPro('dialogBoxPro'); + dialogBoxPro = $('#dialogBoxPro') + .html('
            '+htmlBox+'
            ') + .dialog({ + title: 'Adicionar Plano de Trabalho', + width: 780, + open: function() { + updateButtonConfirm(this, true); + initChosenReplace('box_init', this, true); + $('.dialogBoxDiv #id_tipo_modalidade').trigger('change'); + }, + close: function() { + $('#boxUser').remove(); + resetDialogBoxPro('dialogBoxPro'); + }, + buttons: [{ + text: 'Adicionar', + class: 'confirm', + click: function(event) { + var _parent = $(this).closest('.ui-dialog'); + var id_user = _parent.find('select#id_user').val(); + var id_tipo_modalidade = _parent.find('select#id_tipo_modalidade').val(); + var carga_horaria = _parent.find('input#carga_horaria').val(); + var data_inicio_vigencia = moment(_parent.find('input#data_inicio_vigencia').val(), 'YYYY-MM-DD').startOf('day').format('YYYY-MM-DD HH:mm:ss'); + var data_fim_vigencia = moment(_parent.find('input#data_fim_vigencia').val(), 'YYYY-MM-DD').endOf('day').format('YYYY-MM-DD HH:mm:ss'); + var datesKey = getWorkDaysBetweenDates(data_inicio_vigencia, data_fim_vigencia, arrayConfigAtivUnidade.sigla_unidade); + + if (checkAtivRequiredFields(_parent.find('select#id_user'), 'mark')) { + var key = { + id_user: parseInt(id_user), + id_unidade: parseInt(arrayConfigAtivUnidade.id_unidade), + id_tipo_modalidade: parseInt(id_tipo_modalidade), + carga_horaria: parseInt(carga_horaria), + tempo_total: datesKey.dias*carga_horaria, + tempo_proporcional: datesKey.dias*carga_horaria, + data_inicio_vigencia: data_inicio_vigencia, + data_fim_vigencia: data_fim_vigencia, + config: { + atividades_lista_integral:true + } + }; + var action = 'config_new_planos'; + var param = { + action: action, + id: -1, + ids: [], + type: 'planos', + key: JSON.stringify(key), + mode: 'new' + }; + _this.find('i.icon-parent').attr('class','fas fa-spinner fa-spin icon-parent'); + getConfigServer(action, param); + } + } + }] + }); +} function newConfigUser(this_) { var _this = $(this_); + + var perfilOptions = $.map(arrayConfigAtividades.perfis, function(v){ + if (arrayConfigAtividades.perfil.nivel <= v.nivel) { + return ''; + } + }).join(''); + var htmlBox = '
            '+ ' '+ ' '+ @@ -5323,11 +5626,11 @@ function newConfigUser(this_) { ' '+ - ' '+ ' '+ ' '+ ' '+ @@ -5337,11 +5640,26 @@ function newConfigUser(this_) { ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ ' '+ ' '+ ' '+ ' '+ @@ -5364,6 +5682,7 @@ function newConfigUser(this_) { width: 780, open: function() { updateButtonConfirm(this, true); + initChosenReplace('box_init', this, true); }, close: function() { $('#boxUser').remove(); @@ -5377,6 +5696,8 @@ function newConfigUser(this_) { var nome_completo = _parent.find('input#user_nome_completo'); var user_login = _parent.find('input#user_login'); var apelido = _parent.find('input#user_apelido'); + var matricula = _parent.find('input#matricula'); + var id_perfil = _parent.find('select#id_perfil'); var email = _parent.find('input#user_email'); var novo_plano = (_parent.find('input#novo_plano').is(':checked')) ? true : false; var carga_horaria_padrao = jmespath.search(arrayConfigAtividades.entidades,"[?id_entidade==`"+arrayConfigAtividades.perfil.id_entidade+"`] |[0].config.carga_horaria_padrao"); @@ -5393,6 +5714,8 @@ function newConfigUser(this_) { nome_completo: nome_completo.val(), login: user_login.val(), apelido: apelido.val(), + matricula: matricula.val(), + id_perfil: id_perfil.val(), novo_plano: novo_plano, host: url_host.replace('controlador.php',''), email: email.val(), @@ -5452,7 +5775,6 @@ function getConfigServerDoc(action, param) { } }).fail(function(data, textStatus){ - loadingButtonConfirm(false); failureScreen(data, textStatus); }); } @@ -6164,6 +6486,12 @@ function editConfigOptions(this_, id) { var exige_autorizacao = (modalidade !== null && modalidade.hasOwnProperty('config') && typeof modalidade.config !== 'undefined' && modalidade.config !== null && modalidade.config.hasOwnProperty('exige_autorizacao')) ? modalidade.config.exige_autorizacao : false; var assinatura = (typeof value.config !== 'undefined' && value.config !== null && typeof value.config.assinatura !== 'undefined' && value.config.hasOwnProperty('assinatura')) ? value.config.assinatura : false; var inputAssinatura = (assinatura) ? "" : ''; + var carga_horaria_padrao = (modalidade !== null && modalidade.hasOwnProperty('config') && typeof modalidade.config !== 'undefined' && modalidade.config !== null && modalidade.config.hasOwnProperty('carga_horaria_padrao')) ? modalidade.config.carga_horaria_padrao : false; + + var documento_autorizacao = (typeof value.config !== 'undefined' && value.config !== null && typeof value.config.documentos !== 'undefined' && value.config.hasOwnProperty('documentos') && value.config.documentos.length) ? value.config.documentos : false; + documento_autorizacao = (documento_autorizacao) ? jmespath.search(documento_autorizacao,"[?nr_sei!=''] | [?id_procedimento!=`0`]"): false; + documento_autorizacao = (documento_autorizacao && documento_autorizacao !== null && documento_autorizacao.length > 0) ? true : false; + var reducao_carga_horaria = (carga_horaria_padrao && value.carga_horaria < carga_horaria_padrao && !documento_autorizacao && !assinatura) ? true : false; htmlBox = '
            '+ '
            '+ ' '+ ' '+ - ' '+ + ' '+ + ' '+ ' '+ - ' '+ + ' '+ '
            '+ ' '+ ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ - ' '+ + ' '+ ' '+ - ' '+ + ' '+ '
            '+ @@ -6196,7 +6524,7 @@ function editConfigOptions(this_, id) { ' '+ ' '+ '' : '')+ - (exige_autorizacao || !view_modelos ? + (exige_autorizacao || !view_modelos || reducao_carga_horaria ? ' '+ ' ' : ''); var documentos = (typeof value.config !== 'undefined' && value.config !== null && typeof value.config.documentos !== 'undefined' && value.config !== null) ? value.config.documentos : false; var documentos_len = (documentos) ? documentos.length : 0; - if (documentos && (exige_autorizacao || !view_modelos)){ + if (documentos && (exige_autorizacao || !view_modelos || reducao_carga_horaria)){ $.each(value.config.documentos, function(i, v){ var previewDoc = ''+ ' '+ @@ -6234,7 +6562,7 @@ function editConfigOptions(this_, id) { ' '; }); } - htmlBox += (exige_autorizacao || !view_modelos ? + htmlBox += (exige_autorizacao || !view_modelos || reducao_carga_horaria ? ' '+ ' '+ ' '+ @@ -6513,77 +6841,158 @@ function editConfigOptions(this_, id) { } htmlBox += '
            '+ ' '+ @@ -6216,7 +6544,7 @@ function editConfigOptions(this_, id) { '
            '+ '
            '; - } else if (data.type == 'programas') { - var value = jmespath.search(tableConfigList[data.type], "[?id_programa==`"+id+"`] | [0]"); + } else if (data.type == 'tipos_prescricoes') { + var value = jmespath.search(tableConfigList[data.type], "[?id_tipo_prescricao==`"+id+"`] | [0]"); var idConfigBox = 'boxConfiguracoes_'+data.type; - var nameBox = 'Programas de Gest\u00E3o'; - var titleBox = 'Op\u00E7\u00F5es de '+nameBox+': '+value.nome_sigla; + var nameBox = __.Prescricao; + var titleBox = 'Op\u00E7\u00F5es de '+nameBox+': '+value.nome_prescricao; - htmlBox = '
            '+ + htmlBox = '
            '+ ' '+ ' '+ - ' '+ - ' '+ + ' '+ + ' '+ + ' '+ + '' : '')+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ - ' '+ + ' '+ + ' '+ ' '+ - ' '+ + ' '+ - ' '+ - '
            '+ + '
            '+ + ' '+ ' '+ ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ + ' '+ ' '+ ' '+ ' '+ ' '; - var documentos = (typeof value.config !== 'undefined' && value.config !== null && typeof value.config.documentos !== 'undefined' && value.config.documentos !== null) ? value.config.documentos : false; - var documentos_len = (documentos) ? documentos.length : 0; - if (documentos){ - $.each(value.config.documentos, function(i, v){ - var previewDoc = ''+ - ' '+ - ''; - htmlBox += ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '; + var tipo_processo = (value.config !== null && typeof value.config.tipo_processo !== 'undefined' && value.config.tipo_processo !== null) ? value.config.tipo_processo : false; + var tipo_processo_len = (tipo_processo) ? tipo_processo.length : 0; + if (tipo_processo){ + $.each(value.config.tipo_processo, function(i, v){ + var nomeTipoProc = jmespath.search(arrayListTypesSEI.selectTipoProc, "[?value=='"+v.value+"'].name | [0]"); + nomeTipoProc = (nomeTipoProc !== null) ? nomeTipoProc : false; + if (nomeTipoProc) { + htmlBox += ' '+ + ' '+ + ' '+ + ' '; + } }); } - htmlBox += ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - '
            Tipo de DocumentoN\u00FAmero SEIPr\u00E9viaTipoOrdem
            '+unicodeToChar(v.documento)+''+v.nr_sei+''+v.id_procedimento+''+v.id_documento+''+previewDoc+''+ - ' '+ - ' '+ - '
            '+nomeTipoProc+''+ + ' '+ + ' '+ + '
            '+ - ' '+ - ' '+ - '
            '+ - ' '+ - ' '+ - ' Adicionar novo item'+ - ' '+ - '
            '+ - '
            '+ + htmlBox += (tipo_processo_len == 0 ? + '
            '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' Adicionar novo item'+ + ' '+ + '
            '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '; + var tipo_documento = (value.config !== null && typeof value.config.tipo_documento !== 'undefined' && value.config.tipo_documento !== null) ? value.config.tipo_documento : false; + var tipo_documento_len = (tipo_documento) ? tipo_documento.length : 0; + if (tipo_documento){ + $.each(value.config.tipo_documento, function(i, v){ + var nomeTipoDoc = jmespath.search(arrayListTypesSEI.selSeriePesquisa, "[?value=='"+v.value+"'].name | [0]"); + nomeTipoDoc = (nomeTipoDoc !== null) ? nomeTipoDoc : false; + if (nomeTipoDoc) { + htmlBox += ' '+ + ' '+ + ' '+ + ' '; + } + }); + } + htmlBox += (tipo_documento_len == 0 ? + ' '+ + ' '+ + ' '+ + ' '+ + '' : '')+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            TipoOrdem
            '+nomeTipoDoc+''+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' Adicionar novo item'+ + ' '+ + '
            '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            Movimenta\u00E7\u00E3o processual interrompem a presci\u00E7\u00E3o'+ + '
            '+ + ' '+ + ' '+ + '
            '+ + '
            Adicionar Urg\u00EAncia no processo ao atingir o n\u00EDvel cr\u00EDtico'+ + '
            '+ + ' '+ + ' '+ + '
            '+ + '
            N\u00EDvel cr\u00EDtico para a prescri\u00E7\u00E3o processual (1 a 100)'+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ '
            '; } else if (data.type == 'unidades') { var value = jmespath.search(tableConfigList[data.type], "[?id_unidade==`"+id+"`] | [0]"); @@ -7059,6 +7468,7 @@ function editConfigOptions(this_, id) { ' '+ ' '+ ' '+ + '
            '+ ' '+ ' '+ ' '+ @@ -7103,6 +7513,7 @@ function editConfigOptions(this_, id) { ' '+ ' '+ '
            '+ + '
            '+ '
            '; } else if (data.type == 'tipos_motivos') { var value = jmespath.search(tableConfigList[data.type], "[?id_tipo_motivo==`"+id+"`] | [0]"); @@ -7247,6 +7658,102 @@ function editConfigOptions(this_, id) { ' '+ ' '+ '
            '; + } else if (data.type == 'tipos_capacidades') { + var value = jmespath.search(tableConfigList[data.type], "[?id_tipo_capacidade==`"+id+"`] | [0]"); + var idConfigBox = 'boxConfiguracoes_'+data.type; + var nameBox = 'Tipos de Capacidades'; + var titleBox = 'Op\u00E7\u00F5es de '+nameBox+': '+value.nome_capacidade; + + htmlBox = '
            '+ + ' '; + + if (typeof arrayConfigAtividades.perfis !== 'undefined'){ + $.each(arrayConfigAtividades.perfis, function(i, v){ + var capacidade = jmespath.search(value.lista_capacidades,"[?id_perfil==`"+v.id_perfil+"`] | [0]"); + var checked = (capacidade !== null) ? true : false; + var id_capacidade = (capacidade !== null && typeof capacidade.id_capacidade !== 'undefined') ? capacidade.id_capacidade : 0; + var idInput = 'changeItemConfig_'+data.type+'_'+i+'_'+randomString(4); + htmlBox += ' '+ + ' '+ + ' '+ + ' '; + }); + } + htmlBox += ''; + + } else if (data.type == 'perfis') { + var value = jmespath.search(tableConfigList[data.type], "[?id_perfil==`"+id+"`] | [0]"); + var idConfigBox = 'boxConfiguracoes_'+data.type; + var nameBox = 'Perfis'; + var titleBox = 'Op\u00E7\u00F5es de '+nameBox+': '+value.nome_perfil; + + htmlBox = '
            '+ + '
            '; + + if (typeof arrayConfigAtividades.tipos_capacidades !== 'undefined'){ + function listConfigCapacidadesPerfil(arrayList) { + var count = 0; + var _htmlB = '
            '+v.nome_perfil+''+ + '
            '+ + ' '+ + ' '+ + '
            '+ + '
            '; + $.each(arrayList, function(i, v){ + var capacidade = jmespath.search(v.lista_capacidades,"[?id_perfil==`"+value.id_perfil+"`] | [0]"); + var checked = (capacidade !== null) ? true : false; + var id_capacidade = (capacidade !== null && typeof capacidade.id_capacidade !== 'undefined') ? capacidade.id_capacidade : 0; + var idInput = 'changeItemConfig_'+data.type+'_'+i+'_'+randomString(4); + _htmlB += ' '+ + ' '+ + ' '+ + ' '; + if (checked) count++; + }); + _htmlB += '
            '+v.descricao+' ('+v.nome_capacidade+')'+ + '
            '+ + ' '+ + ' '+ + '
            '+ + '
            '; + + return {count: count, html: _htmlB}; + } + function accordionConfigCapacidadesPerfil(name, filter_name, filter_desc) { + var arraList = jmespath.search(arrayConfigAtividades.tipos_capacidades,"[?contains(nome_capacidade, '"+filter_name+"') || contains(descricao, '"+filter_desc+"')]"); + var listCapacidades = listConfigCapacidadesPerfil(arraList); + var _htmlB = '

            '+name+' '+listCapacidades.count+'

            '+ + '
            '; + _htmlB += listCapacidades.html; + _htmlB += '
            '; + return _htmlB; + } + + htmlBox += accordionConfigCapacidadesPerfil('Demandas', '_atividade', 'demanda'); + htmlBox += accordionConfigCapacidadesPerfil('Afastamentos', '_afastamento', 'afastamento'); + htmlBox += accordionConfigCapacidadesPerfil('Planos', '_plano', 'plano'); + htmlBox += accordionConfigCapacidadesPerfil('Atividades', '_atividades', 'atividades'); + htmlBox += accordionConfigCapacidadesPerfil('Unidades', '_unidade', 'unidade'); + htmlBox += accordionConfigCapacidadesPerfil('Relat\u00F3rios', 'report_', 'Relat\u00F3rio'); + htmlBox += accordionConfigCapacidadesPerfil('Configura\u00E7\u00F5es', 'config_', 'Configurar'); + htmlBox += accordionConfigCapacidadesPerfil('Gr\u00E1ficos', 'chart_', 'gr\u00E1fico'); + htmlBox += accordionConfigCapacidadesPerfil('Documentos', '_documento', 'documento'); + htmlBox += accordionConfigCapacidadesPerfil('Visualizar', 'view_', 'Visualizar'); + htmlBox += accordionConfigCapacidadesPerfil('Salvar', 'save_', 'Salvar'); + htmlBox += accordionConfigCapacidadesPerfil('Editar', 'edit_', 'Editar'); + htmlBox += accordionConfigCapacidadesPerfil('Deletar', 'delete_', 'Deletar'); + htmlBox += accordionConfigCapacidadesPerfil('Cancelar', '_cancel', 'Cancelar'); + htmlBox += accordionConfigCapacidadesPerfil('Atualizar', 'update_', 'Atualizar'); + htmlBox += accordionConfigCapacidadesPerfil('Avaliar', 'rate_', 'Avaliar'); + htmlBox += accordionConfigCapacidadesPerfil('Concluir', 'complete_', 'Concluir'); + htmlBox += accordionConfigCapacidadesPerfil('Iniciar', 'start_', 'Iniciar'); + htmlBox += accordionConfigCapacidadesPerfil('Arquivar', 'send_', 'Arquivar'); + htmlBox += accordionConfigCapacidadesPerfil('Apenas as suas', 'self_', 'sua '); + htmlBox += accordionConfigCapacidadesPerfil('Cadastrar novo', 'new_', 'Cadastrar'); + } + htmlBox += '
            '+ + '
            '; + } else if (data.type == 'entidades') { var value = jmespath.search(tableConfigList[data.type], "[?id_entidade==`"+id+"`] | [0]"); var config = (typeof value.config !== 'undefined' && value.config !== null) ? value.config : false; @@ -7547,6 +8054,20 @@ function editConfigOptions(this_, id) { ' '+ ' '+ ' '+ + ' Sincronizar dados com sistemas externos'+ + ' '+ + '
            '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ ' Visualizar telefones na lista de contatos'+ ' '+ '
            '+ @@ -7555,6 +8076,25 @@ function editConfigOptions(this_, id) { '
            '+ ' '+ ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' Dura\u00E7\u00E3o do mecanisco de armazenamento em cache das demandas'+ + ' '+ + ' '+ + ' '+ + '
            '+ + ' '+ + ' '+ ' '+ ' '+ ' '+ @@ -7601,6 +8141,12 @@ function editConfigOptions(this_, id) { ' '+ ' '+ ' '+ + ' '+ + ' URL do calend\u00E1rio (gmail) para afastamentos autom\u00E1ticos de reuni\u00F5es'+ + ' '+ + ' '+ + ' '+ + ' '+ ' '+ ' '+ ' '+ @@ -7623,6 +8169,17 @@ function editConfigOptions(this_, id) { setTimeout(function(){ centralizeDialogBox(dialogBoxPro); }, 100); + if (data.type == 'entidades') { + $('#acoes_dados_externos').tagsInput({ + interactive: true, + placeholder: 'Adicionar', + hide: true, + delimiter: [','], + unique: true, + removeWithBackspace: true, + }); + initChosenReplace('box_init', this, true); + } if (data.type == 'planos') { loadConfigAtivIntegral('#configBox_lista_atividades',id); } @@ -7639,6 +8196,11 @@ function editConfigOptions(this_, id) { }) } initClassicEditor(); + if ($('#accordion-'+data.type).length) $('#accordion-'+data.type).accordion({ + active: false, + collapsible: true, + heightStyle: "content" + }); }, close: function() { if (_this.closest('tr').hasClass('infraTrMarcada')) { @@ -7647,13 +8209,14 @@ function editConfigOptions(this_, id) { $('#'+idConfigBox).remove(); resetDialogBoxPro('dialogBoxPro'); }, - buttons: [{ - text: 'Salvar', - class: 'confirm', - click: function(event) { - saveOptionConfigItem(this, data.type, id); - } - }] + buttons: (data.type == 'tipos_capacidades' || data.type == 'perfis') ? [] + : [{ + text: 'Salvar', + class: 'confirm', + click: function(event) { + saveOptionConfigItem(this, data.type, id); + } + }] }); setTimeout(function(){ configBox = new SimpleTableCellEditor(idConfigBox); @@ -7718,7 +8281,7 @@ function editConfigOptions(this_, id) { var _this = $(elem); var data_elem = _this.data(); var data_tr = _this.closest('tr').data(); - var arrayList = (data_tr.key == 'documentos') ? arrayListTypesSEI.selSeriePesquisa : []; + var arrayList = (data_tr.key == 'documentos' || data_tr.key == 'tipo_documento') ? arrayListTypesSEI.selSeriePesquisa : []; arrayList = (data_tr.key == 'tipo_processo') ? arrayListTypesSEI.selectTipoProc : arrayList; // arrayList = (data_tr.key == 'lotacao') ? jmespath.search(arrayConfigAtividades.unidades_all,"[*].{name: join('',[nome_unidade,' (',sigla_unidade,')']), value: id_unidade}") : arrayList; arrayList = (data_tr.key == 'perfil') ? jmespath.search(arrayConfigAtividades.perfis,"[*].{name: nome_perfil, nivel: nivel, value: id_perfil}") : arrayList; @@ -7785,6 +8348,62 @@ function editConfigOptions(this_, id) { alertaBoxPro('Error', 'exclamation-triangle', 'Em desenvolvimento!'); } } +function updateConfigPerfilCapacidade(param, ativData) { + var key_id = tryParseJSONObject(param.key) ? JSON.parse(param.key) : false; + var query_return = (typeof ativData['query_return'] !== 'undefined') ? ativData['query_return'][0] : false; + var capacidade = (query_return) ? jmespath.search(query_return.lista_capacidades, "[?id_perfil==`"+key_id.id_perfil+"`] | [0]") : false; + var id_capacidade = (capacidade) ? capacidade.id_capacidade : 0; + loadingButtonConfirm(false); + + if (query_return && key_id) { + $('#tableConfiguracoesPanel_tipos_capacidades tr[data-id="'+param.id+'"] td[data-key="lista_perfis"]').text(query_return.lista_perfis); + + var tr = $('.tableConfigCapacidades tr[data-id_perfil="'+key_id.id_perfil+'"][data-id="'+param.id+'"]'); + tr.find('td:first-child').removeClass('editCellLoading'); + tr.find('input').attr('data-id_capacidade', id_capacidade).prop('checked',(param.value == 'add' ? true : false)); + + if (typeof tableConfigList['tipos_capacidades'] !== 'undefined') { + objIndex = tableConfigList['tipos_capacidades'].findIndex((obj => obj['id_tipo_capacidade'] == param.id)); + if (objIndex !== -1) { + tableConfigList['tipos_capacidades'][objIndex] = query_return; + } + } + if (typeof arrayConfigAtividades['tipos_capacidades'] !== 'undefined') { + objIndex_ = arrayConfigAtividades['tipos_capacidades'].findIndex((obj => obj['id_tipo_capacidade'] == param.id)); + if (objIndex_ !== -1) { + arrayConfigAtividades['tipos_capacidades'][objIndex_] = query_return; + } + } + $('#accordion-perfis .ui-accordion-content').each(function(){ + var count = $(this).find('.onoffswitch-checkbox:checked').length; + var ref = $(this).attr('aria-labelledby'); + $('h3#'+ref+' span').text(count); + }) + } +} +function changeConfigPerfilCapacidade(this_) { + var _this = $(this_); + var _data = _this.data(); + var mode = 'update'; + var type = 'tipos_capacidades'; + var value = (_this.is(':checked')) ? 'add' : 'remove'; + var key = { + id_perfil: _data.id_perfil, + id_capacidade: _data.id_capacidade + } + + var action = 'config_update_tipos_capacidades'; + var param = { + action: action, + mode: mode, + type: type, + key: JSON.stringify(convertJsonBools(key)), + value: value, + id: _data.id + }; + getConfigServer(action, param); + _this.closest('tr').find('td').eq(0).addClass('editCellLoading'); +} function configModalidadesLimitePlanos(this_) { var _this = $(this_); if (_this.is(':checked')) { @@ -7988,6 +8607,16 @@ function extractDataDocument(this_) { }); return arrayAtiv; } +function changeConfigOptions(this_) { + var _this = $(this_); + var _data = _this.data(); + var _parent = _this.closest('.ui-dialog'); + if (_this.is(':checked')) { + _parent.find('#'+_data.ref).show(); + } else { + _parent.find('#'+_data.ref).hide(); + } +} function changeConfigAtivIntegral(this_) { var _this = $(this_); var _parent = _this.closest('.ui-dialog'); @@ -8207,7 +8836,6 @@ function getResendKey(this_) { } } }).fail(function(data, textStatus){ - loadingButtonConfirm(false); failureScreen(data, textStatus); }); } @@ -8243,7 +8871,6 @@ function configResendKey(userSEI) { } } }).fail(function(data, textStatus){ - loadingButtonConfirm(false); failureScreen(data, textStatus); }); console.log(action, param); @@ -8646,18 +9273,22 @@ function configPessoal() { ' '+ htmlSelectConfigBase+ ' '+ - ' '+(checkOptionEntidade('gerar_relatorios_gerenciais') && typeof arrayConfigAtividades.perfil.nivel !== 'undefined' && arrayConfigAtividades.perfil.nivel !== null && arrayConfigAtividades.perfil.nivel == 1 ? + ' '+( (checkOptionEntidade('gerar_relatorios_gerenciais') || checkOptionEntidade('sincronizar_dados_externos') ) && typeof arrayConfigAtividades.perfil.nivel !== 'undefined' && arrayConfigAtividades.perfil.nivel !== null && arrayConfigAtividades.perfil.nivel == 1 ? ' '+ ' '+ + (checkOptionEntidade('gerar_relatorios_gerenciais') ? '
            '+ ' '+ ' Atualizar relat\u00F3rios gerenciais'+ - ' '+ - ' '+ + ' '+ + '' : '')+ + (checkOptionEntidade('sincronizar_dados_externos') ? + ' '+ ' '+ ' Atualizar rotinas internas'+ ' '+ ' '+ + '' : '')+ ' '+ ' ' : '')+ ' '+ @@ -8796,6 +9427,7 @@ function getTableRelatorioPanel(data, param) { '' )+ ' '+__.Assunto+''+ ' '+__.Atividade+'
            '+ + ' Macro'+__.atividade+'
            '+ ' Etiquetas'+ ' Plano de Trabalho
            '+ ' Respons\u00E1vel
            '+ @@ -8874,6 +9506,7 @@ function getTableRelatorioPanel(data, param) { '' )+ ' '+value.assunto+''+ ' '+value.nome_atividade+''+ + ' '+value.macroatividade+''+ ' '+(value.etiquetas ? value.etiquetas.join('; ') : '')+''+ ' '+planoUser+''+ ' '+nameUser+''+ @@ -9292,6 +9925,7 @@ function getTableRelatorioPanel(data, param) { } }); }, 500); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } } relatorioTabela.find('.tablesorter-filter-row input.tablesorter-filter[aria-label*="Data"]').attr('type','date'); @@ -9404,13 +10038,13 @@ function getTableAfastamentoPanel(this_) { ' '+tagDate+''+ ' '+ ' '+ - ' '+ - ' '+ + ' '+ + ' '+ ' '+moment(value.inicio_afastamento, 'YYYY-MM-DD HH:mm:ss').format(format_display)+ ' '+ ' '+ - ' '+ - ' '+ + ' '+ + ' '+ ' '+moment(value.fim_afastamento, 'YYYY-MM-DD HH:mm:ss').format(format_display)+ ' '+ ' '+ @@ -9440,11 +10074,13 @@ function getTableAfastamentoPanel(this_) { sortLocaleCompare : true, textExtraction: { 3: function (elem, table, cellIndex) { - var text_date = $(elem).find('.info_dates_fav').data('time-sorter'); + var text_date = $(elem).data('time-sorter'); + console.log(text_date); return text_date; }, 4: function (elem, table, cellIndex) { - var text_date = $(elem).find('.info_dates_fav').data('time-sorter'); + var text_date = $(elem).data('time-sorter'); + console.log(text_date); return text_date; } }, @@ -9510,6 +10146,7 @@ function getTableAfastamentoPanel(this_) { attributes: true }); }, 500); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } var observerTableAfast = new MutationObserver(function(mutations) { @@ -12152,6 +12789,7 @@ function initFunctionsPanelAtiv(TimeOut = 9000) { setResizeAreaTelaD(); } }, 300); + $.getScript(URL_SPRO+"js/lib/jquery-visible.min.js"); } var tagName = getOptionsPro('filterTag_atividades'); @@ -12401,7 +13039,7 @@ function saveAtividadeSimple(id_demanda = 0) { ' '+ ' '+ ' '+ - ' '+ + ' '+ ''+($('#ifrArvore').length > 0 ? ' '+ ' '+ @@ -12777,10 +13415,54 @@ function saveAtividade(id_demanda = 0) { saveAtividadeFull(id_demanda); } } else { - alertaBoxPro('Error', 'exclamation-triangle', 'Existem demandas n\u00E3o avaliadas h\u00E1 mais de 40 dias. Solicite ao gestor que as avalie antes de prosseguir!'); - updateAtividade_(false); + // alertaBoxPro('Error', 'exclamation-triangle', 'Existem demandas n\u00E3o avaliadas h\u00E1 mais de 40 dias. Solicite ao gestor que as avalie antes de prosseguir!'); + + var daysMaxAvaliacao = (checkOptionEntidade('checar_avaliacao') && checkOptionEntidade('prazo_avaliacao')) ? getOptionEntidade('prazo_avaliacao') : 40; + var htmlBox = ''+ + ' '+ + ' Existem demandas n\u00E3o avaliadas h\u00E1 mais de '+daysMaxAvaliacao+' dias.
            '+(checkCapacidade('rate_atividade') ? 'Avalie-as antes de prosseguir.' : 'Solicite ao gestor que as avalie antes de prosseguir!')+ + '
            '; + + resetDialogBoxPro('dialogBoxPro'); + dialogBoxPro = $('#dialogBoxPro') + .html('
            '+htmlBox+'
            ') + .dialog({ + title: NAMESPACE_SPRO, + width:450, + open: function() { + updateButtonConfirm(this, true); + }, + close: function() { + resetDialogBoxPro('dialogBoxPro'); + updateAtividade_(false); + }, + buttons: [{ + text: (checkCapacidade('rate_atividade') ? 'Visualizar demandas' : 'Ok'), + class: (checkCapacidade('rate_atividade') ? 'confirm' : ''), + click: function(event) { + if (checkCapacidade('rate_atividade')) { + selectDemanadasPendentesAvaliacao(daysMaxAvaliacao); + } else { + updateAtividade_(false); + } + resetDialogBoxPro('dialogBoxPro'); + } + }] + }); } } +function selectDemanadasPendentesAvaliacao(daysMaxAvaliacao) { + $('.filterTablePro.filterTableAtivStatus .tagTableText_date_entregue').trigger('click'); + $('#tabelaAtivPanel').find('.tableAtividades').trigger("sorton",[[[0,0],[2,0]]]); + + $('#tabelaAtivPanel').find('thead th a[onclick*="setSelectAllTr"]').data('index',1).trigger('click'); + + $('.dateboxDisplay.tagTableText_date_entregue').each(function(){ + if (moment($(this).data('time-sorter'), 'YYYY-MM-DD HH:mm:ss').add(daysMaxAvaliacao,'d') < moment()) { + $(this).closest('tr').find('input[type="checkbox"][onclick*="followSelecionarItens("]').trigger('click'); + } + }); +} // BOX DE DEMANDA COMPLETA function saveAtividadeFull(id_demanda = 0) { var checkPlanos = (typeof arrayConfigAtividades.planos !== 'undefined' && arrayConfigAtividades.planos != 0 && arrayConfigAtividades.planos.length > 0) ? true : false; @@ -13956,7 +14638,7 @@ function completeAtividade(id_demanda, confirmeBox = false) { ' '+ ' '+ ' '+ ''; - CKEDITOR.dialog.add( 'DadosSEI', function ( editor ) + CKEDITOR.dialog.add( 'DadosSEI', function(editor) { return { title : 'Dados do Processo', @@ -2923,7 +2954,7 @@ function updateSelectDialog(element, array) { } function getDialogSumarioDocumento() { var arrayStyles = getListStylesDocumento(); - CKEDITOR.dialog.add( 'SumarioSEI', function ( editor ) + CKEDITOR.dialog.add( 'SumarioSEI', function(editor) { return { title : 'Inserir sum\u00E1rio', @@ -3012,7 +3043,7 @@ function getTinyUrl(this_) { oEditor.openDialog('TinyUrlSEI'); } function getDialogTinyUrl() { - CKEDITOR.dialog.add( 'TinyUrlSEI', function ( editor ) + CKEDITOR.dialog.add( 'TinyUrlSEI', function(editor) { return { title : 'Gerar link curto do TinyURL', @@ -3192,7 +3223,7 @@ function getDialogQrCode() { ' '+ ''; - CKEDITOR.dialog.add( 'QrCodeSEI', function ( editor ) + CKEDITOR.dialog.add( 'QrCodeSEI', function(editor) { return { title : 'Gerar C\u00F3digo QR', @@ -3380,7 +3411,7 @@ function loadResizeImg() { } }); } -//// Insere o texto selecionado no documento no campo 'Texto visível' do janela de propriedades do link +//// Insere o texto selecionado no documento no campo 'Texto vis\u00EDvel' do janela de propriedades do link function insertTextTotLink(idEditor) { var selectTxt = oEditor.getSelection().getSelectedText(); if ( isValidHttpUrl(selectTxt) ) { @@ -3435,7 +3466,7 @@ function editLinkPro(idEditor) { oEditor.openDialog('editLinkPro'); } function getDialogLinkPro() { - CKEDITOR.dialog.add( 'editLinkPro', function ( editor ) + CKEDITOR.dialog.add( 'editLinkPro', function(editor) { return { title : 'Editar link', @@ -3500,7 +3531,7 @@ function openDialogBatchImgQuality(this_) { oEditor.openDialog('batchImgQuality'); } function getDialogBatchImgQuality() { - CKEDITOR.dialog.add( 'batchImgQuality', function ( editor ) + CKEDITOR.dialog.add( 'batchImgQuality', function(editor) { return { title : 'Reduzir qualidade das imagens', @@ -4245,7 +4276,7 @@ function getDialogImageEditorPro() { var hScreen = $('body').height()-10; hScreen = hScreen > 900 ? 900 : hScreen - CKEDITOR.dialog.add( 'ImageEditorPro', function ( editor ) { + CKEDITOR.dialog.add( 'ImageEditorPro', function(editor) { return { title : 'Editar Imagem', minWidth : wScreen, @@ -4348,7 +4379,7 @@ function getDialogImportDocPro() { var tipsDocs = '' var tipsSheets = '' - CKEDITOR.dialog.add( 'importDocPro', function ( editor ) + CKEDITOR.dialog.add( 'importDocPro', function(editor) { return { title : 'Inserir conte\u00FAdo externo', @@ -4634,7 +4665,7 @@ function openDialogLatex(this_) { function getDialogLatex() { var htmlLatexPreview = '
            '+ ''; - CKEDITOR.dialog.add( 'latexDialog', function ( editor ) + CKEDITOR.dialog.add( 'latexDialog', function(editor) { return { title : 'Inserir Equa\u00E7\u00E3o', @@ -4695,13 +4726,13 @@ function tableSorterPro( editor ) { editor.addMenuGroup( 'tablesorterGroup' ); editor.addMenuItem( 'addestilo', { label: 'Adicionar Estilo', - icon: URL_SPRO+'icons/addestilotabela.png', + icon: URL_SPRO+'icons/editor/addestilotabela.png', command: 'addestilo', group: 'tableproGroup' }); editor.addMenuItem( 'clonetable', { label: 'Duplicar Tabela', - icon: URL_SPRO+'icons/duplicartabela.png', + icon: URL_SPRO+'icons/editor/duplicartabela.png', command: 'clonetable', group: 'tableproGroup' }); @@ -4807,7 +4838,13 @@ function tableSorterPro( editor ) { } } } -function initContextMenuPro() { +function initContextMenuPro() { + $(txaEditor).each(function(){ + var idEditor_ = $(this).attr('id').replace('cke_', ''); + if ($('iframe[title*="'+idEditor_+'"]').length == 0) { + $(this).find('iframe').attr('title', 'Editor de Rich Text, '+idEditor_); + } + }); setTimeout(function () { $(txaEditor).each(function(index){ var idEditor_ = $(this).attr('id').replace('cke_', ''); @@ -4901,7 +4938,7 @@ function openDialogProcessoPublicoPro(this_) { oEditor.openDialog('processoPublico'); } function getDialogProcessoPublicoPro() { - CKEDITOR.dialog.add( 'processoPublico', function ( editor ) + CKEDITOR.dialog.add( 'processoPublico', function(editor) { return { title : 'Adicionar Link de Documento P\u00FAblico', @@ -5185,7 +5222,11 @@ function repairSaveButtonBug(loop = true) { // INSERE ChatGPT function getOpenAI(this_) { setParamEditor(this_); - oEditor.openDialog('openAI'); + if (!getOptionsPro('consentimentoIA')) { + oEditor.openDialog('openAI_disclaimer'); + } else { + oEditor.openDialog('openAI'); + } } function getDialogNaoDisponivel(title) { return { @@ -5211,177 +5252,231 @@ function getDialogNaoDisponivel(title) { } function getDialogOpenAI() { if (checkProcessoSigiloso()) { - CKEDITOR.dialog.add( 'openAI', function ( editor ) { return getDialogNaoDisponivel('Inserir texto de intelig\u00EAncia artificial (ChatGPT)') } ); + CKEDITOR.dialog.add( 'openAI', function(editor) { return getDialogNaoDisponivel('Inserir texto de intelig\u00EAncia artificial (ChatGPT)') } ); } else { - CKEDITOR.dialog.add( 'openAI', function ( editor ) - { - return { - title : 'Inserir texto de intelig\u00EAncia artificial (ChatGPT)', - minWidth : 800, - minHeight : 80, - buttons: [], - onShow : function() { - $('#openAI_load').hide(); - if ($('#openAI_result').is(':visible')) { - this.move(this.getPosition().x, (this.getPosition().y+125)); - $('#openAI_result').html('').hide(); - } - var selectedText = oEditor.getSelection().getSelectedText(); - if (selectedText !== '') { - this.setValueOf("tab_ia", "textPrompt", selectedText); - } - $('textarea.cke_dialog_ui_input_textarea').css('white-space','break-spaces') - if (verifyConfigValue('substituiselecao')) { - $('textarea.cke_dialog_ui_input_textarea').closest('div.cke_dialog_ui_textarea').css('margin-top','30px'); - setChosenInCke(false, '900px'); - } - - if (perfilOpenAI) { - var idKeyword = this.getContentElement( 'tab_ia_options', 'keyword' )._.inputId; - var idModeInline = this.getContentElement( 'tab_ia_options', 'mode_inline' ).domId; - var elemKeyword = $('#'+idKeyword); - var elemInline = $('#'+idModeInline+' input'); - - elemKeyword.on('change', function(){ - setOptionsPro('setKeywordInlineOpenAI', $(this).val()); - $('.wordGpt').text($(this).val()); - }); - elemInline.prop('checked', getOptionsPro('setInlineOpenAI')).on('change', function(){ - getInlineOpenAI(this); - console.log('change'); - }); - } - }, - contents : - [ - (!perfilOpenAI) - ? { - id : 'tab_ia', - label : 'Cadastro de Token', - elements : - [ - { - type: 'html', - html: '
            '+ - '
            '+ - ' Aproveite todo o potencial da intelig\u00EAncia artificial do ChatGPT diretamente no editor de documentos do SEI.

            Siga o passo-a-passo abaixo para cadastrar suas credenciais de acesso:

            '+ - '
            '+ - '
            '+ - ' 1. Acesse o site do OpenAI (https://beta.openai.com/) e clique em "Sign Up" no canto superior direito da tela.

            '+ - ' 2. Preencha o formul\u00E1rio de cadastro com seus dados pessoais e crie uma senha.
            \u00C9 poss\u00EDvel logar com sua conta Google ou Microsoft.

            '+ - ' 3. Verifique seu e-mail e clique no link de confirma\u00E7\u00E3o enviado pela OpenAI.

            '+ - ' 4. Verifique seu celular e adicione o c\u00F3digo de verifica\u00E7\u00E3o enviado por SMS.

            '+ - ' 5. Fa\u00E7a login na sua conta OpenAI.

            '+ - ' 6. Clique em " Upgrade" no menu do lado direito da tela ou acesse o endere\u00E7o https://beta.openai.com/account/billing/overview.

            '+ - ' 7. Selecione a op\u00E7\u00E3o "USER > Create API Key".

            '+ - ' 8. Clique em "Create new secret key" para gerar sua chave de API.

            '+ - ' 9. Ser\u00E1 adicionado um cr\u00E9dito promocional de $18, para utiliza\u00E7\u00E3o em at\u00E9 4 (quatro) meses.
            Caso deseje prosseguir ap\u00F3s isso, adicione suas informa\u00E7\u00F5es de pagamento no menu "Billing".
            Consulte condi\u00E7\u00F5es de precifica\u00E7\u00E3o da plataforma em: https://openai.com/api/pricing/

            '+ - ' 10. Copie sua chave secreta de API, pois ela ser\u00E1 necess\u00E1ria para fazer chamadas \u00E0 API. Cole-a no campo abaixo:

            '+ - '
            '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - '
            '+NAMESPACE_SPRO+' n\u00E3o fomenta ou recebe financiamento para a utiliza\u00E7\u00E3o dos produtos da OpenAI. Recomenda-se o seu uso meramente did\u00E1tico.
            '+ - '
            ' - } - ] - } - : { - id : 'tab_ia', - label : 'ChatGPT', - elements : - [ + CKEDITOR.dialog.add( 'openAI_disclaimer', function(editor) { + var htmlConcentimento = ''+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '; + return { + title : 'Intelig\u00EAncia artificial (ChatGPT): Consentimento', + minWidth : 500, + minHeight : 200, + buttons: [ CKEDITOR.dialog.cancelButton, CKEDITOR.dialog.okButton ], + onOk: function(event, a, b) { + if($('#ciente_disclaimer').is(':checked')) { + event.data.hide = true; + setOptionsPro('consentimentoIA', true); + setTimeout(() => { + oEditor.openDialog('openAI'); + }, 1000); + } else { + alert('\u00C9 necess\u00E1rio consentimento antes de prosseguir!'); + event.data.hide = false; + } + }, + contents : [ { - type: 'select', - id: 'selectPrompt', - label: 'Tipo de Integra\u00E7\u00E3o', - width: '100%', - items: [ - ['Discorra sobre '], - ['Resuma em linguagem simples o seguinte trecho: '], - ['Reescreva o seguinte trecho: '], - ['Descubra a base legal para o seguinte tema: '], - ['Traga o texto legal, sem explica\u00E7\u00F5es, do seguintes dispositivo legal: '], - ['Traduza para portugu\u00EAs a frase: '], - ['Fa\u00E7a uma an\u00E1lise cr\u00EDtica sobre o seguinte t\u00F3pico: '], - ['Liste at\u00E9 10 sin\u00F4nimos em portugu\u00EAs para a palavra: '], - ['Conclua o seguinte texto: '], - ['Extraia as palavras-chave deste texto: '], - ['Converta minha nota curta em uma ata de reuni\u00E3o: '], - ['Fa\u00E7a um resumo em t\u00F3picos do seguinte texto: '], - ['Escreva um texto longo e detalhado, cite fontes e dispositivos legais que embase a argumenta\u00E7\u00E3o sobre o seguinte tema: '], - ['Amplie e reescreva o texto a seguir, em voz ativa, com corre\u00E7\u00F5es gramaticais, citando as fontes e adicinando coes\u00E3o \u00E0s ora\u00E7\u00F5es: '], - ['Crie um Parecer t\u00E9cnico detalhado, cite fontes e legisla\u00E7\u00E3o, traga argumentos a favor e contr\u00E1rios sobre o tema: '], - ['-'] - ], - 'default': 'Discorra sobre ' - },{ - type: 'textarea', - label: 'Texto de Entrada', - id: 'textPrompt', - 'default': '' - },{ - type: 'html', - html: ''+ - ' '+ - ' '+ - ' '+ - ' '+ - ' '+ - ''+ - ''+ - '
            Os dados s\u00E3o processados pelo servi\u00E7o OpenAI. N\u00E3o envie informa\u00E7\u00F5es restritas ou sigilosas.
            ' + id : 'tab1', + label : 'Consentimento', + elements : + [ + { + type: 'html', + html: htmlConcentimento + } + ] } ] - }, { - id : 'tab_ia_options', - label : 'Op\u00E7\u00F5es', - elements : + }; + }); + CKEDITOR.dialog.add( 'openAI', function(editor) { + return { + title : 'Inserir texto de intelig\u00EAncia artificial (ChatGPT)', + minWidth : 800, + minHeight : 80, + buttons: [], + onShow : function() { + $('#openAI_load').hide(); + if ($('#openAI_result').is(':visible')) { + this.move(this.getPosition().x, (this.getPosition().y+125)); + $('#openAI_result').html('').hide(); + } + var selectedText = oEditor.getSelection().getSelectedText(); + if (selectedText !== '') { + this.setValueOf("tab_ia", "textPrompt", selectedText); + } + $('textarea.cke_dialog_ui_input_textarea').css('white-space','break-spaces') + if (verifyConfigValue('substituiselecao')) { + $('textarea.cke_dialog_ui_input_textarea').closest('div.cke_dialog_ui_textarea').css('margin-top','30px'); + setChosenInCke(false, '900px'); + } + + if (perfilOpenAI) { + var idKeyword = this.getContentElement( 'tab_ia_options', 'keyword' )._.inputId; + var idModeInline = this.getContentElement( 'tab_ia_options', 'mode_inline' ).domId; + var elemKeyword = $('#'+idKeyword); + var elemInline = $('#'+idModeInline+' input'); + + elemKeyword.on('change', function(){ + setOptionsPro('setKeywordInlineOpenAI', $(this).val()); + $('.wordGpt').text($(this).val()); + }); + elemInline.prop('checked', getOptionsPro('setInlineOpenAI')).on('change', function(){ + getInlineOpenAI(this); + console.log('change'); + }); + } + }, + contents :[ + (!perfilOpenAI) + ? { + id : 'tab_ia', + label : 'Cadastro de Token', + elements : [ - { - type: "checkbox", - id: "mode_inline", - style: "margin-top:5px", - label: "Ativar o modo de escrita interativa" - },{ - type: 'select', - id: 'keyword', - label: 'Palavra de gatilho', - items: [ - ['+gpt'], - [':gpt'], - ['/gpt'], - ['.gpt'], - ['-gpt'] - ], - 'default': '+gpt' - },{ - type: 'html', - html: 'Digite '+(getOptionsPro('setKeywordInlineOpenAI') ? getOptionsPro('setKeywordInlineOpenAI') : '+gpt')+' em qualquer parte do documento, seguido do seu prompt. Pressione ENTER e veja a magia acontecer \uD83E\uDDD9\u200D\u2642\uFE0F' - } + { + type: 'html', + html: '
            '+ + '
            '+ + ' Aproveite todo o potencial da intelig\u00EAncia artificial do ChatGPT diretamente no editor de documentos do SEI.

            Siga o passo-a-passo abaixo para cadastrar suas credenciais de acesso:

            '+ + '
            '+ + '
            '+ + ' 1. Acesse o site do OpenAI (https://beta.openai.com/) e clique em "Sign Up" no canto superior direito da tela.

            '+ + ' 2. Preencha o formul\u00E1rio de cadastro com seus dados pessoais e crie uma senha.
            \u00C9 poss\u00EDvel logar com sua conta Google ou Microsoft.

            '+ + ' 3. Verifique seu e-mail e clique no link de confirma\u00E7\u00E3o enviado pela OpenAI.

            '+ + ' 4. Verifique seu celular e adicione o c\u00F3digo de verifica\u00E7\u00E3o enviado por SMS.

            '+ + ' 5. Fa\u00E7a login na sua conta OpenAI.

            '+ + ' 6. Clique em " Upgrade" no menu do lado direito da tela ou acesse o endere\u00E7o https://beta.openai.com/account/billing/overview.

            '+ + ' 7. Selecione a op\u00E7\u00E3o "USER > Create API Key".

            '+ + ' 8. Clique em "Create new secret key" para gerar sua chave de API.

            '+ + ' 9. Ser\u00E1 adicionado um cr\u00E9dito promocional de $18, para utiliza\u00E7\u00E3o em at\u00E9 4 (quatro) meses.
            Caso deseje prosseguir ap\u00F3s isso, adicione suas informa\u00E7\u00F5es de pagamento no menu "Billing".
            Consulte condi\u00E7\u00F5es de precifica\u00E7\u00E3o da plataforma em: https://openai.com/api/pricing/

            '+ + ' 10. Copie sua chave secreta de API, pois ela ser\u00E1 necess\u00E1ria para fazer chamadas \u00E0 API. Cole-a no campo abaixo:

            '+ + '
            '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + '
            '+NAMESPACE_SPRO+' n\u00E3o fomenta ou recebe financiamento para a utiliza\u00E7\u00E3o dos produtos da OpenAI. Recomenda-se o seu uso meramente did\u00E1tico.
            '+ + '
            ' + } ] - } - ] - }; - } ); + } + : { + id : 'tab_ia', + label : 'ChatGPT', + elements : + [ + { + type: 'select', + id: 'selectPrompt', + label: 'Tipo de Integra\u00E7\u00E3o', + width: '100%', + items: [ + ['Discorra sobre '], + ['Resuma em linguagem simples o seguinte trecho: '], + ['Reescreva o seguinte trecho: '], + ['Descubra a base legal para o seguinte tema: '], + ['Traga o texto legal, sem explica\u00E7\u00F5es, do seguintes dispositivo legal: '], + ['Traduza para portugu\u00EAs a frase: '], + ['Fa\u00E7a uma an\u00E1lise cr\u00EDtica sobre o seguinte t\u00F3pico: '], + ['Liste at\u00E9 10 sin\u00F4nimos em portugu\u00EAs para a palavra: '], + ['Conclua o seguinte texto: '], + ['Extraia as palavras-chave deste texto: '], + ['Converta minha nota curta em uma ata de reuni\u00E3o: '], + ['Fa\u00E7a um resumo em t\u00F3picos do seguinte texto: '], + ['Escreva um texto longo e detalhado, cite fontes e dispositivos legais que embase a argumenta\u00E7\u00E3o sobre o seguinte tema: '], + ['Amplie e reescreva o texto a seguir, em voz ativa, com corre\u00E7\u00F5es gramaticais, citando as fontes e adicinando coes\u00E3o \u00E0s ora\u00E7\u00F5es: '], + ['Crie um Parecer t\u00E9cnico detalhado, cite fontes e legisla\u00E7\u00E3o, traga argumentos a favor e contr\u00E1rios sobre o tema: '], + ['-'] + ], + 'default': 'Discorra sobre ' + },{ + type: 'textarea', + label: 'Texto de Entrada', + id: 'textPrompt', + 'default': '' + },{ + type: 'html', + html: ''+ + ' '+ + ' '+ + ' '+ + ' '+ + ' '+ + ''+ + ''+ + '
            Os dados s\u00E3o processados pelo servi\u00E7o OpenAI. N\u00E3o envie informa\u00E7\u00F5es restritas ou sigilosas.
            ' + } + ] + },{ + id : 'tab_ia_options', + label : 'Op\u00E7\u00F5es', + elements : + [ + { + type: "checkbox", + id: "mode_inline", + style: "margin-top:5px", + label: "Ativar o modo de escrita interativa" + },{ + type: 'select', + id: 'keyword', + label: 'Palavra de gatilho', + items: [ + ['+gpt'], + [':gpt'], + ['/gpt'], + ['.gpt'], + ['-gpt'] + ], + 'default': '+gpt' + },{ + type: 'html', + html: 'Digite '+(getOptionsPro('setKeywordInlineOpenAI') ? getOptionsPro('setKeywordInlineOpenAI') : '+gpt')+' em qualquer parte do documento, seguido do seu prompt. Pressione ENTER e veja a magia acontecer \uD83E\uDDD9\u200D\u2642\uFE0F' + } + ] + }] + }; + }); } } function getParamOpenAI(this_) { @@ -5440,15 +5535,13 @@ function sendRequestOpenAI(prompt_select, prompt_text, inline = false) { xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { - // console.log(xhr.status); - // console.log(xhr.responseText); + console.log(xhr.status); + console.log(xhr.responseText); open_ai_response = xhr.responseText; open_ai_response = JSON.parse(open_ai_response); - var container = (inline) ? $(oEditor.getSelection().getStartElement().$).closest('p') : $('#openAI_result .result .text'); - - // console.log(open_ai_response); + console.log(open_ai_response); var responseText = open_ai_response.choices[0].message.content; var btnInsertText = ''+ @@ -5463,26 +5556,31 @@ function sendRequestOpenAI(prompt_select, prompt_text, inline = false) { if (!inline) { $('#openAI_load').hide(); - $('#openAI_result').html(htmlResult).show(); + $('#openAI_result').html(htmlResult).show() + $('#openAI_result .result .text').data('text',responseText); dialog.move(dialog.getPosition().x, (dialog.getPosition().y-125)); } // type code var i = 0, isTag, text; (function type() { - text = responseText.slice(0, ++i); + + var container = (inline) ? $(oEditor.getSelection().getStartElement().$).closest('p') : $('#openAI_result .result .text'); + text = responseText.slice(0, ++i); if (text === responseText) return; - container.html(text + (!inline ? ' ' : '')); - if (!inline) container[0].scrollTop = container[0].scrollHeight; + container.html(text + (!inline ? ' ' : '')); + if (!inline) container[0].scrollTop = container[0].scrollHeight; var char = text.slice(-1); if (char === "<") isTag = true; if (char === ">") isTag = false; if (isTag) return type(); setTimeout(type, (!inline ? 40 : 10)); + })(); + } else if (xhr.status >= 400) { - // console.log(xhr.status); - // console.log(xhr.responseText); + console.log(xhr.status); + console.log(xhr.responseText); open_ai_response = xhr.responseText; open_ai_response = JSON.parse(open_ai_response); @@ -5552,7 +5650,8 @@ function sendRequestOpenAI(prompt_select, prompt_text, inline = false) { } } function insertTextEditorSEI(this_) { - var text = $('
            ').append($(this_).closest('.result').find('.text').clone()).text(); + var _this = $(this_); + var text = (_this.closest('.result').find('.text').data('text') !== 'undefined') ? _this.closest('.result').find('.text').data('text') : $('
            ').append(_this.closest('.result').find('.text').clone()).text(); var select = oEditor.getSelection().getStartElement(); var pElement = $(select.$).closest('p'); @@ -5621,7 +5720,7 @@ function menuOpenAI( editor ) { editor.addMenuGroup( 'openaiGroup', -10 * 3 ); editor.addMenuItem( 'openai', { label: 'Intelig\u00EAncia artificial', - icon: URL_SPRO+'icons/ferramentasia.png', + icon: URL_SPRO+'icons/editor/ferramentasia.png', command: 'openai', group: 'openaiGroup' }); @@ -5668,7 +5767,7 @@ function getRefInterna(this_) { oEditor.openDialog('openRefInterna'); } function getDialogRefInterna() { - CKEDITOR.dialog.add( 'openRefInterna', function ( editor ) + CKEDITOR.dialog.add( 'openRefInterna', function(editor) { return { title : 'Inserir refer\u00EAncia interna', @@ -6232,7 +6331,7 @@ function getBoxCtrReview(this_) { setParamEditor(this_); oEditor.openDialog('ReviewSEI'); } -function contentDialogReview(alertText = 'Nenhuma revis\u00E7\u00E3o identificada') { +function contentDialogReview(alertText = 'Nenhuma revis\u00E3o identificada') { var listReviews = $('iframe[title*="txaEditor_"]').map(function(v, i){ var _this = $(this); var body = _this.contents().find('body'); @@ -6266,7 +6365,7 @@ function contentDialogReview(alertText = ' n); + if (l.length > 0) { + var _this = this; + $.each(l, function(i, v){ + if (v.trim() != '') { + var ponto = (i < l.length-1) ? '.' : ''; + v = _this.replaceTranscript(v); + _this._editor.insertText(v+ponto); + if (ponto != '') oEditor.execCommand('enter'); + } + }); + } else { + oEditor.execCommand('enter'); + } + } else if (t.trim().toLocaleLowerCase() == 'desfazer') { + oEditor.execCommand('undo'); + } else if (t.trim().toLocaleLowerCase() == 'refazer') { + oEditor.execCommand('redo'); + } else { + t = this.replaceTranscript(t); + this._editor.insertText(t); + } + console.log(event.results[i][0].transcript, t); + } + } + } + + CKWebSpeechHandler.prototype.replaceTranscript = function(t) { + t = (t.match(/.* abre par\u00EAnteses .*/)) ? t.replace(/ abre par\u00EAnteses /, '(') : t; + t = (t.match(/.* fecha par\u00EAnteses .*/)) ? t.replace(/ fecha par\u00EAnteses /, ')') : t; + t = (t.match(/.* abre colchete .*/)) ? t.replace(/ abre colchetes /, '[') : t; + t = (t.match(/.* fecha colchete .*/)) ? t.replace(/ fecha colchete /, ']') : t; + t = (t.match(/.* abre aspas .*/)) ? t.replace(/ abre aspas /, '"') : t; + t = (t.match(/.* fecha aspas .*/)) ? t.replace(/ fecha aspas /, '"') : t; + t = (t.match(/.* espa\u00E7o .*/)) ? t.replace(/ espa\u00E7o /, ' ') : t; + t = (t.match(/.* aspas .*/)) ? t.replace(/ aspas /, '"') : t; + t = (t.match(/.* travess\u00E3o .*/)) ? t.replace(/ travess\u00E3o /, ' \u2013 ') : t; + t = (t.match(/.* tra\u00E7o .*/)) ? t.replace(/ tra\u00E7o /, '- ') : t; + t = (t.match(/.* ponto e v\u00EDrgula .*/)) ? t.replace(/ ponto e v\u00EDrgula /, '; ') : t; + t = (t.match(/.* dois pontos .*/)) ? t.replace(/ dois pontos /, ': ') : t; + t = (t.match(/.* 2 pontos .*/)) ? t.replace(/ 2 pontos /, ': ') : t; + t = (t.match(/.* ponto .*/)) ? t.replace(/ ponto /, '. ') : t; + t = (t.match(/.* v\u00EDrgula .*/)) ? t.replace(/ v\u00EDrgula /, ', ') : t; + + var iStr = Array.from(t.trim())[0]; + var space = (iStr == ',' || iStr == ';' || iStr == ':' || iStr == '-' || iStr == '.') ? '' : ' '; + return space+t.trim(); + } + CKWebSpeechHandler.prototype.toogleSpeech = function() { + if(!this._recognizing){ + this._recognition.lang = this._currentCulture.val; + this._recognition.start(); + this._ignore_onend = false; + this._start_timestamp = new Date().getTime(); + } + else + {this._recognition.stop();} + } + + CKWebSpeech = function(langs, culture, oEditor){ + CKWebSpeechHandler.call(this, oEditor); + this._langs = langs; + this.CKWebSpeech(culture); + } + + CKWebSpeech.prototype = Object.create( CKWebSpeechHandler.prototype ); + + CKWebSpeech.prototype.CKWebSpeech = function(_culture){ + if(typeof _culture !== "undefined") + this.setDialectByCulture(_culture); + } + + CKWebSpeech.prototype.setDialectByCulture = function(_culture) { + for (var i = 0; i < this._langs.length; i++) { + for (var j = 1; j < this._langs[i].length; j++) { + if(this._langs[i][j][0].toLowerCase() == _culture.toLowerCase()) + { + this._currentCulture ={val: this._langs[i][j][0], langVal: i}; + return this._currentCulture; + }//FALTA COLOCAR EN COOKIE + }; + }; + return this._currentCulture; + } + + CKWebSpeech.prototype.setDialectByLanguage = function(_langVal) { + this.setDialectByCulture(this._langs[_langVal][1][0]); + } + + CKWebSpeech.prototype.getLanguages = function() { + var _languages = new Array(); + for (var i = 0; i < this._langs.length; i++) { + _languages.push(new Array(this._langs[i][0], i)); + }; + return _languages; + } + + CKWebSpeech.prototype.getCultures = function(_langVal) { + + if(typeof _langVal === "undefined") + _langVal = this._currentCulture.langVal; + + var _cultures = new Array(); + for (var i = 1; i < this._langs[_langVal].length; i++) { + _cultures.push( new Array(this._langs[_langVal][i][0])); + }; + return _cultures; + } + var extern; + + wsDialogHtml = function() { + this.updateCulturesSelect = function(elmtCulture, options) + { + var select_dialect = document.getElementById(elmtCulture._.inputId); + + for (var i = select_dialect.options.length - 1; i >= 0; i--) { + select_dialect.remove(i); + } + + for (var i = 0; i < options.length; i++) { + select_dialect.options.add(new Option(options[i], options[i])); + } + + } + } +} +function getDialogDitado() { + if (checkConfigValue('revisaotexto')) { + initDitadoPro(); + CKEDITOR.dialog.add( 'webspeechDialog', function ( oEditor ) { + var wsDialogDom = new wsDialogHtml(); + var selectCulture = oEditor.ckWebSpeech._currentCulture.val; + + return { + title: 'Configura\u00E7\u00F5es do Ditado', + minWidth: 400, + minHeight: 200, + contents: [ + { + id: 'tab-basic', + label: 'Configura\u00E7\u00F5es b\u00E1sicas', + elements: [ + { + type: 'select', + id: 'wslanguages', + label: 'Idioma', + items: oEditor.ckWebSpeech.getLanguages(), + 'default': oEditor.ckWebSpeech._currentCulture.langVal, + onChange: function( api ) { + var dialog = CKEDITOR.dialog.getCurrent(); + var selCultures = dialog.getContentElement('tab-basic', 'wscultures'); + var options = oEditor.ckWebSpeech.getCultures(api.data.value); + selCultures.setup({selCultures : selCultures, options : options}); + selCultures.fire('change', {value : options[0][0]}, oEditor); + }, + onShow: function(data) { + var dialog = CKEDITOR.dialog.getCurrent(); + var selLanguages = dialog.getContentElement('tab-basic', 'wslanguages'); + document.getElementById(selLanguages._.inputId).value = + oEditor.ckWebSpeech._currentCulture.langVal; + } + }, + { + type: 'select', + id: 'wscultures', + label: 'Cultura', + items: oEditor.ckWebSpeech.getCultures(), + 'default': oEditor.ckWebSpeech._currentCulture.val, + onChange: function( api ) { + selectCulture = api.data.value; + }, + setup: function(data) { + wsDialogDom.updateCulturesSelect(data.selCultures, data.options); + }, + onShow: function(data) { + var dialog = CKEDITOR.dialog.getCurrent(); + var selCultures = dialog.getContentElement('tab-basic', 'wscultures'); + //console.log(selCultures); + document.getElementById(selCultures._.inputId).value = + oEditor.ckWebSpeech._currentCulture.val; + } + } + ] + }, + { + id: 'tab-adv', + label: 'Advanced Settings', + elements: [ + + ] + } + ], + onOk: function() { + oEditor.ckWebSpeech.setDialectByCulture(selectCulture); + } + }; + }); + } +} +function getBoxStyleEditor(this_) { + var btn = $('.getNewStyleButton'); + if ( btn.hasClass('cke_button_off') ) { + btn.addClass('cke_button_on').removeClass('cke_button_off'); + updateStyleEditor('set'); + } else { + btn.addClass('cke_button_off').removeClass('cke_button_on'); + updateStyleEditor('remove'); + } +} +function updateStyleEditor(mode) { + if (mode == 'set') { + localStorage.setItem('seiSlim_editor', true); + $('head').find('link[data-style="seipro-fonticon"]').remove(); + $('head').find('style[data-style="seipro-fonticon"]').remove(); + insertFontIcon('head'); + $('body').addClass('seiSlim seiSlim_parent seiSlim_view'); + } else { + localStorage.removeItem('seiSlim_editor'); + $('body').attr('class',''); + } +} function initFunctions() { + initContextMenuPro(); getDialogLegisSEI(); getDialogNotaRodape(); initOpenAI(); @@ -6334,12 +6920,12 @@ function initFunctions() { getDialogProcessoPublicoPro(); getDialogSigilo(); getDialogReview(); + getDialogDitado(); getDialogBatchImgQuality(); initDialogImageEditorPro(); loadResizeImg(); updateDialogDefinitionPro(); loadPasteImgToBase64(); - initContextMenuPro(); insertFontIcon('head'); reloadModalLink(); setDocCertidao(); diff --git a/dist/js/sei-pro-visualizacao.js b/dist/js/sei-pro-visualizacao.js index fb50b83..bd95df4 100644 --- a/dist/js/sei-pro-visualizacao.js +++ b/dist/js/sei-pro-visualizacao.js @@ -22,6 +22,9 @@ function initSeiProVisualizacao() { if (typeof parent.insertIconDocCertidao === 'function' && typeof parent.linksArvore !== 'undefined') { parent.insertIconDocCertidao(); } + if (typeof parent.setTipoPrescricaoProcesso === 'function' && parent.checkTipoPrescricaoProcesso()) { + parent.appendIconCtrPrescricao(); + } if (typeof parent.insertIconBatchActions === 'function' && parent.checkConfigValue('acoesemlote')) { parent.insertIconBatchActions(); } diff --git a/dist/js/sei-pro.js b/dist/js/sei-pro.js index ec4f739..08e5f96 100644 --- a/dist/js/sei-pro.js +++ b/dist/js/sei-pro.js @@ -459,9 +459,9 @@ function orderbyTableGroup(this_) { updateGroupTable($('#selectGroupTablePro')); } function getArrayProcessoRecebido(href) { - var storeRecebimento = ( typeof localStorageRestorePro('configDataRecebimentoPro') !== 'undefined' && !$.isEmptyObject(localStorageRestorePro('configDataRecebimentoPro')) ) ? localStorageRestorePro('configDataRecebimentoPro') : []; - var id_procedimento = String(getParamsUrlPro(href).id_procedimento); - var dadosRecebido = (jmespath.search(storeRecebimento, "[?id_procedimento=='"+id_procedimento+"'] | length(@)") > 0) ? jmespath.search(storeRecebimento, "[?id_procedimento=='"+id_procedimento+"'] | [0]") : ''; + var storeRecebimento = (typeof localStorageRestorePro !== 'undefined' && typeof localStorageRestorePro('configDataRecebimentoPro') !== 'undefined' && !$.isEmptyObject(localStorageRestorePro('configDataRecebimentoPro')) ) ? localStorageRestorePro('configDataRecebimentoPro') : []; + var id_procedimento = (typeof getParamsUrlPro !== 'undefined') ? String(getParamsUrlPro(href).id_procedimento) : false; + var dadosRecebido = (typeof jmespath !== 'undefined' && jmespath.search(storeRecebimento, "[?id_procedimento=='"+id_procedimento+"'] | length(@)") > 0) ? jmespath.search(storeRecebimento, "[?id_procedimento=='"+id_procedimento+"'] | [0]") : ''; return dadosRecebido; } function updateGroupTablePro(valueSelect, mode) { @@ -913,7 +913,18 @@ function initNewBtnHome() { $('#divComandos').find('.iconReaberturaPro').remove(); $('#divComandos').append(htmlBtn); } -function initNewTabProcesso() { +function initNewTabProcesso(TimeOut = 9000) { + if (TimeOut <= 0) { return; } + if (typeof verifyConfigValue !== 'undefined') { + getNewTabProcesso(); + } else { + setTimeout(function(){ + initNewTabProcesso(TimeOut - 100); + console.log('Reload initNewTabProcesso'); + }, 500); + } +} +function getNewTabProcesso() { if (verifyConfigValue('reaberturaprogramada')) initNewBtnHome(); var iconLabel = localStorage.getItem('iconLabel'); @@ -983,6 +994,18 @@ function initNewTabProcesso() { '' : ''; + var htmlBtnNaoLido = (checkConfigValue('marcar_naolido')) ? + ''+ + ' '+ + ' '+ + ' '+ + ' '+ + (iconLabel ? + ' Marcar como n\u00E3o visualizado'+ + '' : '')+ + '' + : ''; + htmlBtn = ''+ ' '+ ' '+ @@ -991,7 +1014,9 @@ function initNewTabProcesso() { (iconLabel ? ' Abrir Processos em Nova Aba'+ '' : '')+ - ''+htmlBtnAtiv+htmlBtnPrazo+htmlBtnTypes+htmlBtnUpload; + + ''+htmlBtnAtiv+htmlBtnPrazo+htmlBtnTypes+htmlBtnUpload+htmlBtnNaoLido; + $('#divComandos').find('.iconPro_Observe').remove(); $('#divComandos').append(htmlBtn); }, 500); @@ -1773,8 +1798,8 @@ function addKanbanProc(type = storeGroupTablePro(), loop = 3) { ' '+ '
            '+ '
            '+ - ' '+value.tipo+''+ ' '+value.especificacao+''+ + ' '+value.tipo+''+ ' '+value.html_atribuicao+''+ ' '+value.html_icons+''+ ' '+value.html_prazo+''+ @@ -2671,7 +2696,7 @@ function sortUploadArvore() { }).after(htmlUpload); } function storeLinkUsuarioSistema() { - setOptionsPro('usuarioSistema',$('#lnkUsuarioSistema').attr('title')); + if (typeof setOptionsPro !== 'undefined') setOptionsPro('usuarioSistema',$('#lnkUsuarioSistema').attr('title')); } function initSeiPro() { if ( $('#tblProcessosRecebidos, #tblProcessosGerados, #tblProcessosDetalhado').length > 0 ) { @@ -2694,7 +2719,7 @@ function initSeiPro() { initUrgentePro(); initNaoVisualizadoPro(); storeLinkUsuarioSistema(); - checkDadosAcompEspecial(); + if (typeof checkDadosAcompEspecial !== 'undefined') checkDadosAcompEspecial(); } else if ( $("#ifrArvore").length > 0 ) { initDadosProcesso(); initObserveUrlChange(); diff --git a/dist/manifest.json b/dist/manifest.json index b096d97..e599e43 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -3,11 +3,12 @@ "name": "SEI Pro Lab", "short_name": "SEI Pro Lab", "description": "Adiciona ao Sistema Eletrônico de Informações (SEI) funções avançadas", - "version": "1.3.9", + "version": "1.4.11", "author": "Pedro Henrique Soares", "homepage_url": "https://sei-pro.github.io/sei-pro", "icons": { "16": "icons/lab/icon-16.png", + "32": "icons/lab/icon-32.png", "48": "icons/lab/icon-48.png", "128": "icons/lab/icon-128.png" }, @@ -232,6 +233,7 @@ "js/lib/jszip.min.js", "js/lib/jszip-utils.min.js", "js/lib/google_api.js", + "js/lib/jquery-visible.min.js", "js/sei-functions-pro.js", "js/sei-gantt.js", "js/sei-forms.js", @@ -247,6 +249,7 @@ "js/sei-legis.js", "js/sei-pro-visualizacao-chosen.js", "https://accounts.google.com/gsi/client", + "icons/lab/icon-32.png", "css/sei-pro.css", "css/frappe-gantt.css", "css/jkanban.min.css", @@ -264,6 +267,7 @@ "css/chart.min.css", "css/chosen.min.css", "css/leaflet.css", + "css/tableselection.css", "webfonts/pro/fa-light-300.svg", "webfonts/pro/fa-light-300.eot", "webfonts/pro/fa-light-300.woff2", @@ -304,13 +308,17 @@ "webfonts/fa-brands-400.woff2", "webfonts/fa-brands-400.woff", "webfonts/fa-brands-400.ttf", - "icons/addestilotabela.png", - "icons/copiarformatacao.png", - "icons/blockedition.png", - "icons/ferramentasia.png", - "icons/duplicartabela.png", - "icons/editarimagem.png", - "icons/formatarimagem.png", + "icons/editor/addestilotabela.png", + "icons/editor/copiarformatacao.png", + "icons/editor/blockedition.png", + "icons/editor/ferramentasia.png", + "icons/editor/duplicartabela.png", + "icons/editor/editarimagem.png", + "icons/editor/formatarimagem.png", + "icons/editor/webspeech.png", + "icons/editor/webspeech-settings.png", + "icons/editor/webspeech-enable.gif", + "icons/editor/speech.gif", "css/images/layers-2x.png", "css/images/layers.png", "css/images/marker-icon-2x.png",