{% extends 'base.html.twig' %}
{% block javascripts_base %}
function initDateFormat( datePicker ) {
var selectedDate = ( typeof datePicker.date === 'undefined' || datePicker.date === null ) ? datePicker.options.defaultDate : datePicker.date;
var shortWeekdays = datePicker.options.i18n.weekdaysShort;
var shortMonths = datePicker.options.i18n.monthsShort;
var day = selectedDate.getDate();
var weekday = shortWeekdays[ selectedDate.getDay() ];
var month = shortMonths[ selectedDate.getMonth() ];
var formattedDate = weekday + ', ' + day + ' ' + month;
document.querySelector(".datepicker-date-display .date-text").innerHTML = formattedDate;
document.querySelector(".datepicker-date-display .year-text").innerHTML = selectedDate.getFullYear();
}
{% endblock %}
{% block js_document_ready %}
$('#datatable').dataTable({
filter : false,
language: {
"url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Spanish.json"
},
aLengthMenu: "",
bAutoWidth: false,
"columns": [
{
"data": "imagen",
render: function(data, type, row, meta) {
console.debug(data);
if (type === 'display') {
imagen = [
'',
].join('');
return imagen;
}
return data;
},
},
{ "data": "apellidos" },
{ "data": "nombres" },
{ "data": "dni" },
{ "data": "fecha_entrevista" },
{ "data": "cargo" },
{ "data": "psiquiatrico" },
],
order: [[ 1, 'asc' ]],
columnDefs: [
// These are the column name variables that will be sent to the server
{
"name": "imagen",
"searchable": false,
"orderable": false,
"targets": 0
},
{
"name": "dp.apellidos",
"targets": 1
},
{
"name": "dp.nombres",
"targets": 2
},
{
"name": "dp.dni",
"targets": 3
},
{
"name": "i.fechaEntrevista",
"targets": 4
},
{
"name": "carg.nombre",
"orderable": false,
"targets": 5
},
{
"name": "i.psiquiatrico",
"orderable": false,
"targets": 6
},
],
"displayStart": {{ app.session.get(constant('App\\Controller\\Personal\\PsiquiatraController::FORM_PSIQUIATRA_CONSULTA_INFORME_PSIQUIATRICO_START')) ?? 0 }},
serverSide: true,
processing: true,
ajax: {
url: '{{ path('psiquiatras_informes_psiquiatricos_datos', {idView:psiquiatra.idVIew}) }}',
type: 'POST'
}
});
// the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
{# $('.modal1').modal(); #}
$('select').formSelect();
$('.datepicker').datepicker({
autoClose: true,
showClearBtn: true,
format: 'dd/mm/yyyy',
container: 'body',
onDraw: function (datePicker) {
// materialize select dropdown not proper working on mobile and tablets so we make it browser default select
$('.datepicker-container').find('.datepicker-select').addClass('browser-default');
$(".datepicker-container .select-dropdown.dropdown-trigger").remove();
},
onOpen: function (p) {
var instance = M.Datepicker.getInstance(this.el);
var d = $('#informe_psiquiatrico_busqueda_fechaEntrevista').val().split(/[^0-9]/);
var newDate = new Date(d[2], d[1] - 1, d[0]);
instance.setDate(newDate);
initDateFormat(instance);
},
onSelect: function(date) {
var day = String(date.getDate()).padStart(2, '0');
var month = String(date.getMonth() + 1).padStart(2, '0');
var year = String(date.getFullYear());
var fecha = day + '/' + month + '/' + year;
$('#informe_psiquiatrico_busqueda_fechaEntrevista').val(fecha);
$('#informe_psiquiatrico_busqueda_fechaEntrevista').siblings('label').addClass('active');
},
i18n: {
cancel: 'Cancelar',
clear: 'Limpiar',
done: 'Aceptar',
weekdays: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
weekdaysShort: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
weekdaysAbbrev: ["D", "L", "M", "M", "J", "V", "S"],
today: 'Hoy',
months: [
'Enero',
'Febrero',
'Marzo',
'Abril',
'Mayo',
'Junio',
'Julio',
'Agosto',
'Septiembre',
'Octubre',
'Noviembre',
'Diciembre'
],
monthsShort: [
'Enero',
'Febrero',
'Marzo',
'Abril',
'Mayo',
'Junio',
'Julio',
'Agosto',
'Septiembre',
'Octubre',
'Noviembre',
'Diciembre'
],
}
});
// Agregar evento de clic al botón de limpiar del datepicker
$('.datepicker-clear').click(function(){
$('#informe_psiquiatrico_busqueda_fechaEntrevista').val(''); // Vaciar el valor del input
});
{% endblock %}
{% block breadcrumb %}
Apellidos y Nombre | Nombres | DNI | Fecha de la Entrevista | Cargo | Psiquiátrico |
---|