|
@@ -227,11 +227,74 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="card-body-inner-action" th:if="${item.tipus == 3}">
|
|
|
|
|
+ <div id="pamSplitContainer" class="split-view-conttainer">
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="table-responsive">
|
|
|
|
|
+ <table class="table table-bordered uv-table-pam-modern" id="pamTable">
|
|
|
|
|
+ <thead>
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <th colspan="3">ORIGEN DE LA ACCIÓN</th>
|
|
|
|
|
+ <th colspan="5">ACCIÓN PLANIFICADA</th>
|
|
|
|
|
+ <th colspan="3">SEGUIMIENTO</th>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ <tr class="subheader">
|
|
|
|
|
+ <th class="col-id">ID</th>
|
|
|
|
|
+ <th>Objetivo de mejora</th>
|
|
|
|
|
+ <th>Origen</th>
|
|
|
|
|
+ <th>Actividades a desarrollar</th>
|
|
|
|
|
+ <th>Responsable</th>
|
|
|
|
|
+ <th class="col-prioridad">Prioridad</th>
|
|
|
|
|
+ <th class="col-curso">Curso Inicio</th>
|
|
|
|
|
+ <th class="col-curso">Curso Fin</th>
|
|
|
|
|
+ <th>Indicadores de seguimiento</th>
|
|
|
|
|
+ <th class="col-seguimiento">Grado de ejecución de las acciones</th>
|
|
|
|
|
+ <th>Justificación</th>
|
|
|
|
|
+ </tr>
|
|
|
|
|
+ </thead>
|
|
|
|
|
+ <tbody>
|
|
|
|
|
+ </tbody>
|
|
|
|
|
+ </table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="text-left mt-3 mb-4">
|
|
|
|
|
+ <button type="button" class="btn btn-outline-primary btn-sm" onclick="addNewRowPAM()">
|
|
|
|
|
+ <i class="fas fa-plus"></i> Añadir otra fila al Plan de Acción
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div id="pdfWidget" class="pdf-widget">
|
|
|
|
|
+ <div id="pdfWidgetHeader" class="pdf-widget-header">
|
|
|
|
|
+ <i class="fas fa-file-pdf"></i>
|
|
|
|
|
+ <span>Informe</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div id="pdfPreviewContainer" class="pdf-preview-side">
|
|
|
|
|
+ <div class="pdf-preview-header">
|
|
|
|
|
+ <span><i class="fas fa-info-circle mr-2"></i> Documentación de apoyo</span>
|
|
|
|
|
+ <button type="button" class="btn-close-pdf" onclick="closePdfPreview(event)">
|
|
|
|
|
+ ×
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="flex-grow: 1; background: #525659;">
|
|
|
|
|
+ <iframe th:src="@{/E_PG1_1.pdf}" frameborder="0" style="width:100%; height:100%;"></iframe>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
<div class="row card-body-up-btn">
|
|
<div class="row card-body-up-btn">
|
|
|
<span class="btn btn-primary pointer" th:if="${#lists.contains({11, 15}, item.tipus)}" style="margin-right:10px;" onclick="saveEditorWithConfirmation();"><i class="fas fa-save"></i> <span th:text="#{procedures.btn.draft}">Guardar borrador</span></span>
|
|
<span class="btn btn-primary pointer" th:if="${#lists.contains({11, 15}, item.tipus)}" style="margin-right:10px;" onclick="saveEditorWithConfirmation();"><i class="fas fa-save"></i> <span th:text="#{procedures.btn.draft}">Guardar borrador</span></span>
|
|
|
- <button class="btn btn-success" th:if="${not #lists.contains({1, 11, 12, 13, 14, 15}, item.tipus)}">Confirmar</button>
|
|
|
|
|
|
|
+ <span class="btn btn-primary pointer" th:if="${item.tipus == 3}"
|
|
|
|
|
+ style="margin-right:10px;" onclick="processPAMTable('draft');">
|
|
|
|
|
+ <i class="fas fa-save"></i> <span th:text="#{procedures.btn.draft}">Guardar borrador</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <button class="btn btn-success" th:if="${not #lists.contains({1, 3, 11, 12, 13, 14, 15}, item.tipus)}">Confirmar</button>
|
|
|
<button class="btn btn-success" th:if="${#lists.contains({11, 15}, item.tipus)}" data-toggle="confirmation" th:attr="data-title=#{procedures.editor.confirm}"><i class="fas fa-file-import"></i> Enviar</button>
|
|
<button class="btn btn-success" th:if="${#lists.contains({11, 15}, item.tipus)}" data-toggle="confirmation" th:attr="data-title=#{procedures.editor.confirm}"><i class="fas fa-file-import"></i> Enviar</button>
|
|
|
<span class="btn btn-success pointer" th:if="${#lists.contains({1, 12, 13, 14}, item.tipus)}" onclick="$('#filepicker').fileinput('upload');">Confirmar</span>
|
|
<span class="btn btn-success pointer" th:if="${#lists.contains({1, 12, 13, 14}, item.tipus)}" onclick="$('#filepicker').fileinput('upload');">Confirmar</span>
|
|
|
|
|
+ <button type="button" class="btn btn-success" th:if="${item.tipus == 3}"
|
|
|
|
|
+ onclick="processPAMTable('submit');">
|
|
|
|
|
+ <i class="fas fa-check-circle"></i> Confirmar
|
|
|
|
|
+ </button>
|
|
|
</div>
|
|
</div>
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
@@ -376,6 +439,10 @@
|
|
|
<script th:src="@{/js/fileinput/js/locales/ca.js}" th:if="${#locale.language != 'es'}"></script>
|
|
<script th:src="@{/js/fileinput/js/locales/ca.js}" th:if="${#locale.language != 'es'}"></script>
|
|
|
<script th:src="@{/js/confirmation/bootstrap-confirmation.js}"></script>
|
|
<script th:src="@{/js/confirmation/bootstrap-confirmation.js}"></script>
|
|
|
<script src="https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js"></script>
|
|
|
|
|
+ <script src="https://unpkg.com/@popperjs/core@2"></script>
|
|
|
|
|
+ <script src="https://unpkg.com/tippy.js@6"></script>
|
|
|
|
|
+ <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
|
|
|
|
|
+ <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/themes/light.css" />
|
|
|
|
|
|
|
|
|
|
|
|
|
<script th:inline="javascript" th:if="${#authentication.principal.isAdmin()}">
|
|
<script th:inline="javascript" th:if="${#authentication.principal.isAdmin()}">
|
|
@@ -414,6 +481,8 @@
|
|
|
var tinyobjectresizing = false;
|
|
var tinyobjectresizing = false;
|
|
|
var tinypasteplain = false;
|
|
var tinypasteplain = false;
|
|
|
var tinypasteremovestyles = true;
|
|
var tinypasteremovestyles = true;
|
|
|
|
|
+ const widget = document.getElementById("pdfWidget");
|
|
|
|
|
+ const preview = document.getElementById("pdfPreviewContainer");
|
|
|
|
|
|
|
|
function tinyconfigure(editor){
|
|
function tinyconfigure(editor){
|
|
|
|
|
|
|
@@ -693,8 +762,93 @@
|
|
|
btnOkLabel: 'Sí',
|
|
btnOkLabel: 'Sí',
|
|
|
btnCancelClass: 'btn btn-sm btn-danger',
|
|
btnCancelClass: 'btn btn-sm btn-danger',
|
|
|
btnCancelLabel: 'No',
|
|
btnCancelLabel: 'No',
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if ($.fn.DataTable.isDataTable('#pamTable')) {
|
|
|
|
|
+ $('#pamTable').DataTable().destroy();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $('#pamTable').DataTable({
|
|
|
|
|
+ "searching": false,
|
|
|
|
|
+ "ordering": false,
|
|
|
|
|
+ "paging": false,
|
|
|
|
|
+ "info": false,
|
|
|
|
|
+ "responsive": true,
|
|
|
|
|
+ "autoWidth": false
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ var jsonPrueba = [
|
|
|
|
|
+ {"id":"RH2-1", "objetivo":"Implantar el Manual para la Evaluación de la actividad docente del profesorado(Programa DOCENTIA)", "origen":"SAIC / Informe Externo", "actividades":"Fases 1 a 6 de certificación", "responsable":"Unidad de Calidad / RRHH", "prioridad":"Alta", "cursoInicio":"Curso Inicio:2022", "cursoFin":"Curso fin: 2024", "indicadores":"Profesorado evaluado"," gradoEjecucion":"En desarrollo", "justificacion":"Faltan los trámites de la Fase 6."},
|
|
|
|
|
+ {"id":"RH2-2","objetivo":null, "origen":null,"actividades":null,"responsable":null,"prioridad":"Alta","cursoInicio":null,"cursoFin":"27/28","indicadores":null,"gradoEjecucion":"En desarrollo","justificacion":null}];
|
|
|
|
|
+
|
|
|
|
|
+ rebuildPAMTable(jsonPrueba);
|
|
|
|
|
+
|
|
|
|
|
+ $('#pamTable').on('input', 'textarea', function() {
|
|
|
|
|
+ autoResize(this);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if(widget) {
|
|
|
|
|
+ dragElement(widget);
|
|
|
|
|
+
|
|
|
|
|
+ widget.ondblclick = function() {
|
|
|
|
|
+ togglePdfPreview();
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $('#pamTable tbody tr').each(function() {
|
|
|
|
|
+ $('.curso-select-dinamico').html(generarOpcionesCursos());
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $('#pamTable').on('dblclick', 'td textarea', function() {
|
|
|
|
|
+ const target = this;
|
|
|
|
|
+ const currentVal = $(target).val();
|
|
|
|
|
+
|
|
|
|
|
+ const editorHtml = `
|
|
|
|
|
+ <div class="p-2" style="width: 400px;">
|
|
|
|
|
+ <label class="small font-weight-bold">Editor rápido</label>
|
|
|
|
|
+ <textarea id="popoverEditor" class="form-control mb-2" rows="6">${currentVal}</textarea>
|
|
|
|
|
+ <div class="text-right">
|
|
|
|
|
+ <button type="button" id="cancelPop" class="btn btn-xs btn-light">Cancelar</button>
|
|
|
|
|
+ <button type="button" id="savePop" class="btn btn-xs btn-primary">Guardar</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+
|
|
|
|
|
+ const instance = tippy(target, {
|
|
|
|
|
+ content: editorHtml,
|
|
|
|
|
+ allowHTML: true,
|
|
|
|
|
+ interactive: true,
|
|
|
|
|
+ trigger: 'manual',
|
|
|
|
|
+ placement: 'top',
|
|
|
|
|
+ theme: 'light',
|
|
|
|
|
+ maxWidth: 'none',
|
|
|
|
|
+ onShown(instance) {
|
|
|
|
|
+ $('#popoverEditor').focus();
|
|
|
|
|
+
|
|
|
|
|
+ $('#savePop').on('click', (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ const newVal = $('#popoverEditor').val();
|
|
|
|
|
+ $(target).val(newVal);
|
|
|
|
|
+ autoResize(target);
|
|
|
|
|
+ instance.hide();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $('#cancelPop').on('click', (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ instance.hide();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ onHidden(instance) {
|
|
|
|
|
+ instance.destroy();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ instance.show();
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
$('#customFile').on("change", function() {
|
|
$('#customFile').on("change", function() {
|
|
@@ -897,7 +1051,282 @@
|
|
|
};
|
|
};
|
|
|
img.src = svgBase64;
|
|
img.src = svgBase64;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ function addNewRowPAM() {
|
|
|
|
|
+ const tableBody = document.querySelector('#pamTable tbody');
|
|
|
|
|
+ const filas = tableBody.querySelectorAll('tr');
|
|
|
|
|
+ let nuevoId ="RH-1";
|
|
|
|
|
+
|
|
|
|
|
+ if (filas.length > 0) {}{
|
|
|
|
|
+ const ultimaFila = filas[filas.length - 1];
|
|
|
|
|
+ const ultimoIdTexto = ultimaFila.querySelector('td').innerText.trim();
|
|
|
|
|
+ const partes = ultimoIdTexto.match(/^(.*-)(\d+)$/);
|
|
|
|
|
+
|
|
|
|
|
+ if (partes) {
|
|
|
|
|
+ const prefijo = partes[1];
|
|
|
|
|
+ const numero = parseInt(partes[2]) + 1;
|
|
|
|
|
+ nuevoId = prefijo + numero.toString().padStart(2, '0');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ const newRow = document.createElement('tr');
|
|
|
|
|
+ const opcionesDinamicas = generarOpcionesCursos();
|
|
|
|
|
+
|
|
|
|
|
+ newRow.innerHTML = `
|
|
|
|
|
+ <td><small>${nuevoId}</small></td>
|
|
|
|
|
+ <td><textarea class="form-control form-control-sm" rows="3" placeholder="Objetivo..."></textarea></td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option>SAIC</option>
|
|
|
|
|
+ <option>Autoinforme</option>
|
|
|
|
|
+ <option>Informe Externo</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td><textarea class="form-control form-control-sm" rows="3" placeholder="Actividades..."></textarea></td>
|
|
|
|
|
+ <td><textarea class="form-control form-control-sm" rows="2" placeholder="Responsable..."></textarea></td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option>Alta</option>
|
|
|
|
|
+ <option>Media</option>
|
|
|
|
|
+ <option>Baja</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td><select class="form-control form-control-sm">${opcionesDinamicas}</select></td>
|
|
|
|
|
+ <td><select class="form-control form-control-sm">${opcionesDinamicas}</select></td>
|
|
|
|
|
+ <td><textarea class="form-control form-control-sm" rows="2" placeholder="Indicadores"></textarea></td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option>Planificación</option>
|
|
|
|
|
+ <option>En desarrollo</option>
|
|
|
|
|
+ <option>Finalizado</option>
|
|
|
|
|
+ <option>Cancelada</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td><textarea class="form-control form-control-sm" rows="2" placeholder="Justificación"></textarea></td>
|
|
|
|
|
+ `;
|
|
|
|
|
+
|
|
|
|
|
+ tableBody.appendChild(newRow);
|
|
|
|
|
+
|
|
|
|
|
+ newRow.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function autoResize(textarea) {
|
|
|
|
|
+ textarea.style.height = 'auto';
|
|
|
|
|
+ textarea.style.height = textarea.scrollHeight + 'px';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function dragElement(elmnt) {
|
|
|
|
|
+ let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
|
|
|
|
+ elmnt.onmousedown = dragMouseDown;
|
|
|
|
|
+
|
|
|
|
|
+ function dragMouseDown(e) {
|
|
|
|
|
+ e = e || window.event;
|
|
|
|
|
+ pos3 = e.clientX;
|
|
|
|
|
+ pos4 = e.clientY;
|
|
|
|
|
+ document.onmouseup = closeDragElement;
|
|
|
|
|
+ document.onmousemove = elementDrag;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function elementDrag(e) {
|
|
|
|
|
+ e = e || window.event;
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ pos1 = pos3 - e.clientX;
|
|
|
|
|
+ pos2 = pos4 - e.clientY;
|
|
|
|
|
+ pos3 = e.clientX;
|
|
|
|
|
+ pos4 = e.clientY;
|
|
|
|
|
+ elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
|
|
|
|
|
+ elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
|
|
|
|
+ elmnt.style.right = 'auto';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function closeDragElement() {
|
|
|
|
|
+ document.onmouseup = null;
|
|
|
|
|
+ document.onmousemove = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function togglePdfPreview() {
|
|
|
|
|
+ const $preview = $("#pdfPreviewContainer");
|
|
|
|
|
+ const $widget = $("#pdfWidget");
|
|
|
|
|
+ const $tableContainer = $('.table-responsive');
|
|
|
|
|
+ const $table = $('#pamTable');
|
|
|
|
|
+
|
|
|
|
|
+ if ($preview.is(":hidden")) {
|
|
|
|
|
+ const isRight = $widget.offset().left > (window.innerWidth / 2);
|
|
|
|
|
+
|
|
|
|
|
+ $widget.fadeOut(200);
|
|
|
|
|
+
|
|
|
|
|
+ $preview.addClass('active-split');
|
|
|
|
|
+
|
|
|
|
|
+ if (isRight) {
|
|
|
|
|
+ $preview.css({ left: 'auto', right: '0' });
|
|
|
|
|
+ $tableContainer.addClass('table-split-right').removeClass('table-split-left');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $preview.css({ left: '0', right: 'auto' });
|
|
|
|
|
+ $tableContainer.addClass('table-split-left').removeClass('table-split-right');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $table.addClass('compact-mode');
|
|
|
|
|
+
|
|
|
|
|
+ $preview.fadeIn(300).css("display", "flex");
|
|
|
|
|
+
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ if ($.fn.DataTable.isDataTable('#pamTable')) {
|
|
|
|
|
+ $('#pamTable').DataTable().columns.adjust();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 310);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ closePdfPreview();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function closePdfPreview(event) {
|
|
|
|
|
+ if(event) {
|
|
|
|
|
+ event.preventDefault();
|
|
|
|
|
+ event.stopPropagation();
|
|
|
|
|
+ }
|
|
|
|
|
+ const $preview = $("#pdfPreviewContainer");
|
|
|
|
|
+ const $widget = $("#pdfWidget");
|
|
|
|
|
+ const $tableContainer = $('.table-responsive');
|
|
|
|
|
+ const $table = $('#pamTable');
|
|
|
|
|
+
|
|
|
|
|
+ $tableContainer.removeClass('table-split-right table-split-left');
|
|
|
|
|
+ $table.removeClass('compact-mode');
|
|
|
|
|
+ $preview.removeClass('active-split');
|
|
|
|
|
+
|
|
|
|
|
+ $preview.fadeOut(200, function() {
|
|
|
|
|
+ $widget.fadeIn(300);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function generarOpcionesCursos() {
|
|
|
|
|
+ const fechaActual = new Date();
|
|
|
|
|
+ const añoActual = fechaActual.getFullYear();
|
|
|
|
|
+ const mesActual = fechaActual.getMonth();
|
|
|
|
|
+
|
|
|
|
|
+ let cursoActual = (mesActual >= 7) ? añoActual : añoActual - 1;
|
|
|
|
|
+
|
|
|
|
|
+ let html = '<option value="">Seleccionar...</option>';
|
|
|
|
|
+
|
|
|
|
|
+ for (let i = -3; i <= 3; i++) {
|
|
|
|
|
+ let inicio = cursoActual + i;
|
|
|
|
|
+ let fin = inicio + 1;
|
|
|
|
|
+ let texto = `${inicio.toString().slice(-2)}/${fin.toString().slice(-2)}`;
|
|
|
|
|
+ html += `<option value="${texto}">${texto}</option>`;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return html;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function rebuildPAMTable(data) {
|
|
|
|
|
+ const tableBody = $('#pamTable tbody');
|
|
|
|
|
+ tableBody.empty();
|
|
|
|
|
+
|
|
|
|
|
+ if (!data || data.length === 0) return;
|
|
|
|
|
+
|
|
|
|
|
+ const renderInputOrStatic = function(value, placeholder, rows = 2) {
|
|
|
|
|
+ if (value === null || value === undefined || value === "" || value === "null") {
|
|
|
|
|
+ return `<textarea class="form-control form-control-sm" rows="${rows}" placeholder="${placeholder}"></textarea>`;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return `<small class="text-dark">${value}</small>`;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ data.forEach(item => {
|
|
|
|
|
+ const row = $('<tr></tr>');
|
|
|
|
|
+
|
|
|
|
|
+ row.html(`
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <small>${item.id || ''}</small>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td>${renderInputOrStatic(item.objetivo, "Objetivo...", 3)}</td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option value="SAIC" ${item.origen === 'SAIC' ? 'selected' : ''}>SAIC</option>
|
|
|
|
|
+ <option value="Autoinforme" ${item.origen === 'Autoinforme' ? 'selected' : ''}>Autoinforme</option>
|
|
|
|
|
+ <option value="Informe Externo" ${item.origen === 'Informe Externo' ? 'selected' : ''}>Informe Externo</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td>${renderInputOrStatic(item.actividades, "Actividades...", 3)}</td>
|
|
|
|
|
+ <td>${renderInputOrStatic(item.responsable, "Responsable...")}</td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option value="Alta" ${item.prioridad === 'Alta' ? 'selected' : ''}>Alta</option>
|
|
|
|
|
+ <option value="Media" ${item.prioridad === 'Media' ? 'selected' : ''}>Media</option>
|
|
|
|
|
+ <option value="Baja" ${item.prioridad === 'Baja' ? 'selected' : ''}>Baja</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td><select class="form-control form-control-sm curso-inicio-val">${generarOpcionesCursos()}</select></td>
|
|
|
|
|
+ <td><select class="form-control form-control-sm curso-fin-val">${generarOpcionesCursos()}</select></td>
|
|
|
|
|
+ <td>${renderInputOrStatic(item.indicadores, "Indicadores...")}</td>
|
|
|
|
|
+ <td>
|
|
|
|
|
+ <select class="form-control form-control-sm">
|
|
|
|
|
+ <option value="Planificación" ${item.gradoEjecucion === 'Planificación' ? 'selected' : ''}>Planificación</option>
|
|
|
|
|
+ <option value="En desarrollo" ${item.gradoEjecucion === 'En desarrollo' ? 'selected' : ''}>En desarrollo</option>
|
|
|
|
|
+ <option value="Finalizado" ${item.gradoEjecucion === 'Finalizado' ? 'selected' : ''}>Finalizado</option>
|
|
|
|
|
+ <option value="Cancelada" ${item.gradoEjecucion === 'Cancelada' ? 'selected' : ''}>Cancelada</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td>${renderInputOrStatic(item.justificacion, "Justificación...")}</td>
|
|
|
|
|
+ `);
|
|
|
|
|
+ tableBody.append(row);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ tableBody.find('textarea').each(function() {
|
|
|
|
|
+ if (typeof autoResize === 'function') autoResize(this);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function processPAMTable(actionType) {
|
|
|
|
|
+ var data = [];
|
|
|
|
|
+ var rows = $('#pamTable tbody tr');
|
|
|
|
|
+
|
|
|
|
|
+ rows.each(function() {
|
|
|
|
|
+ var row = $(this);
|
|
|
|
|
+
|
|
|
|
|
+ var getVal = function(cellIndex) {
|
|
|
|
|
+ var cell = row.find('td').eq(cellIndex);
|
|
|
|
|
+ var input = cell.find('textarea, select, input');
|
|
|
|
|
+
|
|
|
|
|
+ if (input.length > 0) {
|
|
|
|
|
+ return input.val();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return cell.text().trim();
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ var rowData = {
|
|
|
|
|
+ "id": getVal(0),
|
|
|
|
|
+ "objetivo": getVal(1),
|
|
|
|
|
+ "origen": getVal(2),
|
|
|
|
|
+ "actividades": getVal(3),
|
|
|
|
|
+ "responsable": getVal(4),
|
|
|
|
|
+ "prioridad": getVal(5),
|
|
|
|
|
+ "cursoInicio": getVal(6),
|
|
|
|
|
+ "cursoFin": getVal(7),
|
|
|
|
|
+ "indicadores": getVal(8),
|
|
|
|
|
+ "gradoEjecucion": getVal(9),
|
|
|
|
|
+ "justificacion": getVal(10)
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ if (rowData.id !== "") {
|
|
|
|
|
+ data.push(rowData);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ var jsonResult = JSON.stringify(data);
|
|
|
|
|
+ $('#pam_json_data').val(jsonResult);
|
|
|
|
|
+
|
|
|
|
|
+ if (actionType === 'draft') {
|
|
|
|
|
+ console.log("Generando Borrador JSON:", jsonResult);
|
|
|
|
|
+ alert("Borrador de la tabla generado correctamente en el sistema.");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (data.length === 0) {
|
|
|
|
|
+ alert("La tabla está vacía. Por favor, añade al menos una acción.");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log("Enviando JSON definitivo:", jsonResult);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
</body>
|