|
|
|
@@ -5,9 +5,33 @@ const AppointmentSelectTable = { |
|
|
|
var app = this.app,
|
|
|
|
$container = $( this.container );
|
|
|
|
|
|
|
|
this.render( { apps: appointments.getAll(), activeGroup : this.app.user.getActiveGroup() } );
|
|
|
|
let date = new Date();
|
|
|
|
let strFrom = '';
|
|
|
|
date.setMonth(date.getMonth() - 3);
|
|
|
|
let dd = String(date.getDate()).padStart(2, '0');
|
|
|
|
let mm = String(date.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
|
|
let yyyy = date.getFullYear();
|
|
|
|
strFrom = yyyy + '-' + mm + '-' + dd;
|
|
|
|
|
|
|
|
$container.find( '.datatable' ).DataTable( {
|
|
|
|
date = new Date();
|
|
|
|
let strTo = '';
|
|
|
|
date.setMonth(date.getMonth() + 3);
|
|
|
|
dd = String(date.getDate()).padStart(2, '0');
|
|
|
|
mm = String(date.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
|
|
yyyy = date.getFullYear();
|
|
|
|
strTo = yyyy + '-' + mm + '-' + dd;
|
|
|
|
|
|
|
|
let appointmentItems = appointments.getAll();
|
|
|
|
|
|
|
|
this.render(
|
|
|
|
{ apps: appointmentItems,
|
|
|
|
activeGroup : this.app.user.getActiveGroup(),
|
|
|
|
strFrom: strFrom,
|
|
|
|
strTo: strTo
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
let table = $container.find( '.datatable' ).DataTable( {
|
|
|
|
pageLength: 50,
|
|
|
|
responsive: true,
|
|
|
|
dom: '<"html5buttons"B>lTfgitp',
|
|
|
|
@@ -78,6 +102,31 @@ const AppointmentSelectTable = { |
|
|
|
app.openInApp( '/#/appointment/' + $( this ).attr( 'data-appointment-id' ) + '/chat' );
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('input.dateStart').on('change', function() {
|
|
|
|
table.draw();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('input.dateEnd').on('change', function() {
|
|
|
|
table.draw();
|
|
|
|
});
|
|
|
|
|
|
|
|
$.fn.dataTable.ext.search.push(
|
|
|
|
function(settings, searchData, index, rowData, counter) {
|
|
|
|
const dateFrom = $('input.dateStart').val();
|
|
|
|
const dateTo = $('input.dateEnd').val();
|
|
|
|
const item = appointmentItems[index];
|
|
|
|
const startDate = item['start_dt'];
|
|
|
|
const strStartDate = startDate.date.substring(0,10);
|
|
|
|
|
|
|
|
if (strStartDate >= dateFrom && strStartDate <= dateTo) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
// Initial drawing needed to filter by date interval
|
|
|
|
table.draw();
|
|
|
|
},
|
|
|
|
|
|
|
|
getSelectedIds : function()
|
|
|
|
|