瀏覽代碼

appointment filtering

feature-profilechilds
Daniel 3 年之前
父節點
當前提交
f9b2c2a989
共有 4 個檔案被更改,包括 83 行新增58 行删除
  1. +41
    -26
      src/client/manager/js/app/components/appointments/appointment-select-table.html
  2. +27
    -25
      src/client/manager/js/app/components/contract/contract-uncharged-member-data-table.html
  3. +1
    -1
      src/server/server/control/TB_Server_Control_Appointment.php
  4. +14
    -6
      src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php

+ 41
- 26
src/client/manager/js/app/components/appointments/appointment-select-table.html 查看文件

@@ -1,5 +1,5 @@
<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 style="margin-left: 15px">Zeitraum 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" >
<thead>
@@ -52,33 +52,48 @@
<td class="text-center"><%= _nf ( apps[ ai ].getPriceFactor(), 2 ) %></td>
<td class="text-center"><%= apps[ ai ].getNumAcceptedAttendees() %></td>
<td class="text-center">
<button type="button"
data-type="btn-edit-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-pencil-square-o"></i>
</button>
<button type="button"
data-type="btn-detail-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-search"></i>
</button>
<button type="button"
data-type="btn-attendees-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-users"></i>
</button>
<button type="button"
data-type="btn-chat-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-comments-o"></i>
</button>
<div class="button-group">
<button type="button"
data-type="btn-edit-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-pencil-square-o"></i>
</button>
<button type="button"
data-type="btn-detail-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-search"></i>
</button>
<button type="button"
data-type="btn-attendees-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-users"></i>
</button>
<button type="button"
data-type="btn-chat-appointment"
data-appointment-id="<%= apps[ ai ].id %>"
class="btn btn-sm btn-primary">
<i class="fa fa-comments-o"></i>
</button>
</div>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
/* todo: refactoring into css file */
<style>
/* spawntree */
.button-group {
display: flex;
flex-wrap: nowrap;
}
.button-group .btn {
margin: 0 1px;
}
</style>

+ 27
- 25
src/client/manager/js/app/components/contract/contract-uncharged-member-data-table.html 查看文件

@@ -15,31 +15,33 @@
</thead>
<tbody>
<% for ( let i = 0; i < ui.length; i++ ) { %>
<tr data-type="memberChargeItem"
class="clickable"
data-member-id="<%= ui[ i ].member ? ui[ i ].member.id : '' %>">
<td>
<%= ui[ i ].member ? ui[ i ].member.id : '-' %>
</td>
<td>
<%= 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 : '---' %>
</td>
<td>
<%= ui[ i ].member && ui[ i ].member.zip ? ui[ i ].member.zip : '---' %>
</td>
<td>
<%= ui[ i ].member && ui[ i ].member.city ? ui[ i ].member.city : '---' %>
</td>
<td>
<%= ui[ i ].count %>
</td>
<td>
<%= ui[ i ].hasActiveContract ? 'ja' : 'nein' %>
</td>
</tr>
<% if ( ui[ i ].member ) { %>
<tr data-type="memberChargeItem"
class="clickable"
data-member-id="<%= ui[ i ].member ? ui[ i ].member.id : '' %>">
<td>
<%= ui[ i ].member.id %>
</td>
<td>
<%= ui[ i ].member.getName() %>
</td>
<td>
<%= ui[ i ].member.street ? ui[ i ].member.street : '---' %>
</td>
<td>
<%= ui[ i ].member.zip ? ui[ i ].member.zip : '---' %>
</td>
<td>
<%= ui[ i ].member.city ? ui[ i ].member.city : '---' %>
</td>
<td>
<%= ui[ i ].count %>
</td>
<td>
<%= ui[ i ].hasActiveContract ? 'ja' : 'nein' %>
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>

+ 1
- 1
src/server/server/control/TB_Server_Control_Appointment.php 查看文件

@@ -908,7 +908,7 @@ class TB_Server_Control_Appointment {
if ( $filter === 'all' )
{
$filter = array();
$filter[ 'previous' ] = true;
$filter[ 'all' ] = true;
$filter[ 'appointmentCategoryIds' ] = array();
foreach( $teamIds as $teamId )
{


+ 14
- 6
src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php 查看文件

@@ -220,7 +220,9 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row
public static function getAllForTeamIds( array $teamIds, $filter = NULL )
{
$appointments = array();
$filterGetOld = ( is_array( $filter ) && array_key_exists( 'previous', $filter ) ) ? $filter[ 'previous' ] : false;
$filterGetAll = ( is_array( $filter ) && array_key_exists( 'all', $filter ) ) ? $filter[ 'all' ] : false;
$filterGetPrevious = ( is_array( $filter ) && array_key_exists( 'previous', $filter ) ) ? $filter[ 'previous' ] : false;
$filterCategories = isset( $filter ) && isset( $filter[ 'appointmentCategoryIds' ] ) ? $filter[ 'appointmentCategoryIds' ] : [];
if ( 0 === count( $teamIds ) || 0 === count( $filterCategories ) ) return $appointments;
@@ -247,12 +249,18 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row
$inCategories = str_repeat( '?,', count( $filterCategories ) - 1 ) . '?';
$sql .= "AND COALESCE( category_id, -1 ) IN ( $inCategories ) ";
*/
if ( false === $filterGetOld )
{
$sql .= "AND end_dt > UTC_TIMESTAMP() ";
} else {
$sql .= "AND end_dt > UTC_TIMESTAMP() - INTERVAL 1 MONTH ";
if ( false === $filterGetAll ) {
// if not get all appointments
if ( true === $filterGetPrevious ) {
// get future appointments and some previous within limited date span
$sql .= "AND end_dt > UTC_TIMESTAMP() - INTERVAL 1 MONTH ";
} else {
// future appointments only
$sql .= "AND end_dt > UTC_TIMESTAMP() ";
}
}
$sql .= "ORDER BY start_dt ASC";
$stmt = $dbh->prepare( $sql );
$stmt->execute( array_merge( $teamIds ) );


Loading…
取消
儲存