| @@ -5,9 +5,33 @@ const AppointmentSelectTable = { | |||||
| var app = this.app, | var app = this.app, | ||||
| $container = $( this.container ); | $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, | pageLength: 50, | ||||
| responsive: true, | responsive: true, | ||||
| dom: '<"html5buttons"B>lTfgitp', | dom: '<"html5buttons"B>lTfgitp', | ||||
| @@ -78,6 +102,31 @@ const AppointmentSelectTable = { | |||||
| app.openInApp( '/#/appointment/' + $( this ).attr( 'data-appointment-id' ) + '/chat' ); | app.openInApp( '/#/appointment/' + $( this ).attr( 'data-appointment-id' ) + '/chat' ); | ||||
| e.stopPropagation(); | 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() | getSelectedIds : function() | ||||
| @@ -1,4 +1,6 @@ | |||||
| <div class="table-responsive"> | <div class="table-responsive"> | ||||
| <label style="margin-left: 15px">von:<input type="date" style="margin-left: 12px;margin-right: 5px;" class="dateStart" name="search-start" value="<%= strFrom %>"></label> | |||||
| <label>bis:<input type="date" style="margin-left: 12px;margin-right: 5px;"class="dateEnd" name="search-end" value="<%= strTo %>"></label> | |||||
| <table class="table table-striped table-bordered table-hover datatable" > | <table class="table table-striped table-bordered table-hover datatable" > | ||||
| <thead> | <thead> | ||||
| <tr> | <tr> | ||||
| @@ -4,9 +4,11 @@ const ContractUnchargedMemberDataTable = { | |||||
| { | { | ||||
| var app = this.app, | var app = this.app, | ||||
| groupId = props.get( 'groupId' ), | groupId = props.get( 'groupId' ), | ||||
| items = props.get( 'unchargedItems' ), | |||||
| $container = $( this.container ); | $container = $( this.container ); | ||||
| this.render( { ui: props.get( 'unchargedItems' ), activeGroup : groupId } ); | |||||
| this.render( { ui: items, activeGroup : groupId } ); | |||||
| let table = $container.find( '.datatable' ).DataTable( { | let table = $container.find( '.datatable' ).DataTable( { | ||||
| pageLength: 50, | pageLength: 50, | ||||
| @@ -60,13 +62,17 @@ const ContractUnchargedMemberDataTable = { | |||||
| $.fn.dataTable.ext.search.push( | $.fn.dataTable.ext.search.push( | ||||
| function(settings, searchData, index, rowData, counter) { | function(settings, searchData, index, rowData, counter) { | ||||
| if ($('.filterContract:checked').length === 1) { | |||||
| // @Todo: this hardcoded index is sth to refactor (but haven't column as object yet) | |||||
| return rowData[6] === 'nein'; | |||||
| const contractChecked = $('.filterContract:checked').length === 1; | |||||
| const openClaimChecked = $('.filterOpenClaim:checked').length === 1; | |||||
| const item = items[index]; | |||||
| if (contractChecked && openClaimChecked) { | |||||
| return item['hasActiveContract'] === false && parseInt(item['count']) !== 0; | |||||
| } | |||||
| if (contractChecked) { | |||||
| return item['hasActiveContract'] === false; | |||||
| } | } | ||||
| if ($('.filterOpenClaim:checked').length === 1) { | |||||
| // @Todo: this hardcoded index is sth to refactor (but haven't column as object yet) | |||||
| return parseInt(rowData[5]) !== 0 ; | |||||
| if (openClaimChecked) { | |||||
| return parseInt(item['count']) !== 0; | |||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -1,6 +1,6 @@ | |||||
| <div class="table-responsive"> | <div class="table-responsive"> | ||||
| <label><input type="checkbox" style="margin-right: 5px;" class="filterContract" value="Active"/>Ohne aktiven Vertag</label> | |||||
| <label><input type="checkbox" style="margin-left: 12px;margin-right: 5px;" class="filterOpenClaim" value="Active"/>Nur offene Verrechnungen</label> | |||||
| <label><input type="checkbox" style="margin-right: 5px;" class="filterContract" value="Active"/>ohne aktiven Vertag</label> | |||||
| <label><input type="checkbox" style="margin-left: 12px;margin-right: 5px;" class="filterOpenClaim" value="Active"/>nur offene Verrechnungen</label> | |||||
| <table class="table table-striped table-bordered table-hover datatable" > | <table class="table table-striped table-bordered table-hover datatable" > | ||||
| <thead> | <thead> | ||||
| <tr> | <tr> | ||||
| @@ -10,7 +10,7 @@ | |||||
| <th>PLZ</th> | <th>PLZ</th> | ||||
| <th>Stadt</th> | <th>Stadt</th> | ||||
| <th>Offene Verrechnungen</th> | <th>Offene Verrechnungen</th> | ||||
| <th style="display: none">Aktiver Vertrag vorhanden</th> | |||||
| <th>Aktiver Vertrag vorhanden</th> | |||||
| </tr> | </tr> | ||||
| </thead> | </thead> | ||||
| <tbody> | <tbody> | ||||
| @@ -36,7 +36,7 @@ | |||||
| <td> | <td> | ||||
| <%= ui[ i ].count %> | <%= ui[ i ].count %> | ||||
| </td> | </td> | ||||
| <td style="display: none"> | |||||
| <td> | |||||
| <%= ui[ i ].hasActiveContract ? 'ja' : 'nein' %> | <%= ui[ i ].hasActiveContract ? 'ja' : 'nein' %> | ||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| @@ -59,6 +59,8 @@ const AppointmentList = { | |||||
| } | } | ||||
| } | } | ||||
| let compAst = this.createComponent( | let compAst = this.createComponent( | ||||
| 'appointment-select-table', | 'appointment-select-table', | ||||
| $container.find( '[f-id="container-appointment-data-table"]' ).first().get( 0 ), | $container.find( '[f-id="container-appointment-data-table"]' ).first().get( 0 ), | ||||
| @@ -250,6 +250,8 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row | |||||
| if ( false === $filterGetOld ) | if ( false === $filterGetOld ) | ||||
| { | { | ||||
| $sql .= "AND end_dt > UTC_TIMESTAMP() "; | $sql .= "AND end_dt > UTC_TIMESTAMP() "; | ||||
| } else { | |||||
| $sql .= "AND end_dt > UTC_TIMESTAMP() - INTERVAL 1 MONTH "; | |||||
| } | } | ||||
| $sql .= "ORDER BY start_dt ASC"; | $sql .= "ORDER BY start_dt ASC"; | ||||
| $stmt = $dbh->prepare( $sql ); | $stmt = $dbh->prepare( $sql ); | ||||