| @@ -8,7 +8,7 @@ const ContractUnchargedMemberDataTable = { | |||
| this.render( { ui: props.get( 'unchargedItems' ), activeGroup : groupId } ); | |||
| $container.find( '.datatable' ).DataTable( { | |||
| let table = $container.find( '.datatable' ).DataTable( { | |||
| pageLength: 50, | |||
| responsive: true, | |||
| dom: '<"html5buttons"B>lTfgitp', | |||
| @@ -49,6 +49,28 @@ const ContractUnchargedMemberDataTable = { | |||
| { | |||
| app.redirect( '/contract/charge-appointment/' + groupId + '/' + $( e.currentTarget ).attr( 'data-member-id' ) ); | |||
| }); | |||
| $('input.filterContract').on('change', function() { | |||
| table.draw(); | |||
| }); | |||
| $('input.filterOpenClaim').on('change', function() { | |||
| table.draw(); | |||
| }); | |||
| $.fn.dataTable.ext.search.push( | |||
| 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'; | |||
| } | |||
| 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 ; | |||
| } | |||
| return true; | |||
| } | |||
| ); | |||
| }, | |||
| destroy : function() | |||
| @@ -1,4 +1,6 @@ | |||
| <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> | |||
| <table class="table table-striped table-bordered table-hover datatable" > | |||
| <thead> | |||
| <tr> | |||
| @@ -8,6 +10,7 @@ | |||
| <th>PLZ</th> | |||
| <th>Stadt</th> | |||
| <th>Offene Verrechnungen</th> | |||
| <th style="display: none">Aktiver Vertrag vorhanden</th> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| @@ -19,7 +22,7 @@ | |||
| <%= ui[ i ].member ? ui[ i ].member.id : '-' %> | |||
| </td> | |||
| <td> | |||
| <%= ui[ i ].member ? ui[ i ].member.getName() : '[gelöscht]' %> | |||
| <%= ui[ i ].member ? ui[ i ].member.getName() : '[gelöscht - nicht mehr Mitglied der Gruppe]' %> | |||
| </td> | |||
| <td> | |||
| <%= ui[ i ].member && ui[ i ].member.street ? ui[ i ].member.street : '---' %> | |||
| @@ -30,9 +33,12 @@ | |||
| <td> | |||
| <%= ui[ i ].member && ui[ i ].member.city ? ui[ i ].member.city : '---' %> | |||
| </td> | |||
| <td class="text-center"> | |||
| <td> | |||
| <%= ui[ i ].count %> | |||
| </td> | |||
| <td style="display: none"> | |||
| <%= ui[ i ].hasActiveContract ? 'ja' : 'nein' %> | |||
| </td> | |||
| </tr> | |||
| <% } %> | |||
| </tbody> | |||
| @@ -36,7 +36,7 @@ const AccessDataTable = { | |||
| }, | |||
| }, | |||
| buttons: [ | |||
| { extend: 'copy'}, | |||
| {extend: 'copy'}, | |||
| {extend: 'csv'}, | |||
| {extend: 'excel', title: 'Mitgliederliste'}, | |||
| {extend: 'pdf', title: 'Mitgliederliste'}, | |||
| @@ -16,6 +16,7 @@ const ContractCharging = { | |||
| app = this.app, | |||
| members = [], | |||
| groupId = p.get( 'groupId' ), | |||
| profileIdsWithActiveContract = [], | |||
| self = this; | |||
| function getMemberById( mId ) | |||
| @@ -55,49 +56,63 @@ const ContractCharging = { | |||
| app.rpc.call( | |||
| 'Contract', | |||
| 'getUnchargedProfileIds', | |||
| 'getList', | |||
| { | |||
| teamId : groupId | |||
| teamId : groupId, | |||
| state : 'active' | |||
| }, | |||
| function( res ) | |||
| { | |||
| let unchargedItems = [], | |||
| memberIdsInList = []; | |||
| if ( res && res.hasOwnProperty( 'data' ) && res.data.hasOwnProperty( 'unchargedProfileIds' ) ) | |||
| { | |||
| const up = res.data.unchargedProfileIds; | |||
| for( let upi = 0; upi < up.length; upi++ ) | |||
| { | |||
| memberIdsInList.push( +up[ upi ].profile_id ); | |||
| unchargedItems.push({ | |||
| member : getMemberById( up[ upi ].profile_id ), | |||
| count : up[ upi ].cnt | |||
| }); | |||
| function( res ) { | |||
| if (res && res.hasOwnProperty('data') && res.data.hasOwnProperty('contractData')) { | |||
| const cs = res.data.contractData; | |||
| for (let ci = 0; ci < cs.length; ci++) { | |||
| profileIdsWithActiveContract[cs[ci]['profile_id']] = 1; | |||
| } | |||
| } | |||
| for ( let mi = 0; mi < members.length; mi++ ) | |||
| { | |||
| if ( -1 === memberIdsInList.indexOf( +members[ mi ].id ) ) | |||
| app.rpc.call( | |||
| 'Contract', | |||
| 'getUnchargedProfileIds', | |||
| { | |||
| unchargedItems.push({ | |||
| member : members[ mi ], | |||
| count : 0 | |||
| }); | |||
| } | |||
| } | |||
| teamId: groupId | |||
| }, | |||
| function (res) { | |||
| let unchargedItems = [], | |||
| memberIdsInList = []; | |||
| if (res && res.hasOwnProperty('data') && res.data.hasOwnProperty('unchargedProfileIds')) { | |||
| const up = res.data.unchargedProfileIds; | |||
| for (let upi = 0; upi < up.length; upi++) { | |||
| memberIdsInList.push(+up[upi].profile_id); | |||
| unchargedItems.push({ | |||
| member: getMemberById(up[upi].profile_id), | |||
| count: up[upi].cnt, | |||
| hasActiveContract: profileIdsWithActiveContract.hasOwnProperty(up[upi].profile_id) | |||
| }); | |||
| } | |||
| } | |||
| let st = self.createComponent( | |||
| 'contract-uncharged-member-data-table', | |||
| $container.find( '[f-id="container-contract-uncharged-member-table"]' ).first().get( 0 ), | |||
| { | |||
| unchargedItems : unchargedItems, | |||
| groupId : groupId | |||
| } | |||
| ); | |||
| for (let mi = 0; mi < members.length; mi++) { | |||
| if (-1 === memberIdsInList.indexOf(+members[mi].id)) { | |||
| unchargedItems.push({ | |||
| member: members[mi], | |||
| count: 0, | |||
| hasActiveContract: -1 !== profileIdsWithActiveContract.indexOf(+members[mi].id) | |||
| }); | |||
| } | |||
| } | |||
| $container.find( '.sk-loading' ).toggleClass( 'sk-loading' ); | |||
| }.bind ( this ) | |||
| let st = self.createComponent( | |||
| 'contract-uncharged-member-data-table', | |||
| $container.find('[f-id="container-contract-uncharged-member-table"]').first().get(0), | |||
| { | |||
| unchargedItems: unchargedItems, | |||
| groupId: groupId | |||
| } | |||
| ); | |||
| $container.find('.sk-loading').toggleClass('sk-loading'); | |||
| }.bind(this) | |||
| ); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -168,7 +168,6 @@ class TB_Shared_Ent_TeamData_Contract extends Francis_Db_Row | |||
| $sql .= "AND app.state = 'open' "; | |||
| $sql .= 'AND app.start_dt < NOW() '; | |||
| $sql .= 'AND a.has_attended = "attended" AND a.contract_id IS NULL GROUP BY a.profile_id'; | |||
| $dbh = self::getDbh(); | |||
| $stmt = $dbh->prepare( $sql ); | |||