... | ... |
@@ -18,13 +18,25 @@ |
18 | 18 |
<button name="filter" id="filter" class="tl_img_submit filter_apply" title="">Anwenden</button> |
19 | 19 |
<button name="filter_reset" id="filter_reset" value="1" class="tl_img_submit filter_reset" title="">Zurücksetzen</button> |
20 | 20 |
</div> |
21 |
- <div class="tl_sorting tl_subpanel"> |
|
21 |
+ <div class="tl_filter tl_subpanel"> |
|
22 | 22 |
<strong>Filter:</strong> |
23 |
- <select name="tl_month" id="tl_month" class="tl_select tl_chosen"> |
|
23 |
+ <select name="tl_day" id="tl_day" class="tl_select tl_chosen"> |
|
24 |
+ <option value=""{{ filter.day.selected is not defined or not filter.day.selected ? ' selected' : '' }}>Tag</option> |
|
25 |
+ {% for value, label in filter.day.options %} |
|
26 |
+ <option value="{{ value }}"{{ filter.day.selected is defined and filter.day.selected == value ? ' selected' : '' }}>{{ label }}</option> |
|
27 |
+ {% endfor %} |
|
28 |
+ </select> |
|
29 |
+ {#<select name="tl_month" id="tl_month" class="tl_select tl_chosen"> |
|
24 | 30 |
<option value=""{{ filter.month.selected is not defined or not filter.month.selected ? ' selected' : '' }}>Monat</option> |
25 | 31 |
{% for value, label in filter.month.options %} |
26 | 32 |
<option value="{{ value }}"{{ filter.month.selected is defined and filter.month.selected == value ? ' selected' : '' }}>{{ label }}</option> |
27 | 33 |
{% endfor %} |
34 |
+ </select>#} |
|
35 |
+ <select name="tl_standort" id="tl_standort" class="tl_select tl_chosen"> |
|
36 |
+ <option value=""{{ filter.standort.selected is not defined or not filter.standort.selected ? ' selected' : '' }}>Standort</option> |
|
37 |
+ {% for value, label in filter.standort.options %} |
|
38 |
+ <option value="{{ value }}"{{ filter.standort.selected is defined and filter.standort.selected == value ? ' selected' : '' }}>{{ label }}</option> |
|
39 |
+ {% endfor %} |
|
28 | 40 |
</select> |
29 | 41 |
</div> |
30 | 42 |
</div> |
... | ... |
@@ -77,7 +77,20 @@ class WeinanlieferungBookingsController extends AbstractController |
77 | 77 |
->select('id') |
78 | 78 |
->from(WeinanlieferungSlotsModel::getTable()); |
79 | 79 |
|
80 |
- if (!empty(Input::post('tl_month')) && is_numeric(Input::post('tl_month'))) |
|
80 |
+ if (!empty(Input::post('tl_day')) && is_numeric(Input::post('tl_day'))) |
|
81 |
+ { |
|
82 |
+ $Day = new Date(Input::post('tl_day')); |
|
83 |
+ $arrData['filter']['day']['selected'] = Input::post('tl_day'); |
|
84 |
+ $queryBuilder->andWhere('date BETWEEN :day_start AND :day_end') |
|
85 |
+ ->setParameter('day_start', $Day->dayBegin) |
|
86 |
+ ->setParameter('day_end', $Day->dayEnd); |
|
87 |
+ } else { |
|
88 |
+ $Today = new Date(); |
|
89 |
+ $queryBuilder->andWhere("time >= :today") |
|
90 |
+ ->setParameter('today',$Today->dayBegin); |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ /*if (!empty(Input::post('tl_month')) && is_numeric(Input::post('tl_month'))) |
|
81 | 94 |
{ |
82 | 95 |
$Month = new Date(Input::post('tl_month')); |
83 | 96 |
$arrData['filter']['month']['selected'] = Input::post('tl_month'); |
... | ... |
@@ -88,20 +101,46 @@ class WeinanlieferungBookingsController extends AbstractController |
88 | 101 |
$Today = new Date(); |
89 | 102 |
$queryBuilder->andWhere("time >= :today") |
90 | 103 |
->setParameter('today',$Today->dayBegin); |
104 |
+ }*/ |
|
105 |
+ |
|
106 |
+ if (!empty(Input::post('tl_standort')) && is_numeric(Input::post('tl_standort'))) |
|
107 |
+ { |
|
108 |
+ $Month = new Date(Input::post('tl_standort')); |
|
109 |
+ $arrData['filter']['standort']['selected'] = Input::post('tl_standort'); |
|
110 |
+ $queryBuilder->andWhere('pid = :pid') |
|
111 |
+ ->setParameter('pid', (int) Input::post('tl_standort')); |
|
91 | 112 |
} |
92 | 113 |
|
93 | 114 |
$arrSlots = $queryBuilder->fetchFirstColumn(); |
94 | 115 |
|
95 | 116 |
} |
96 |
- $arrMonthOptions = []; |
|
117 |
+ |
|
118 |
+ $arrDayOptions = []; |
|
119 |
+ $DayRequest = $this->db->executeQuery("SELECT s.date, DATE_FORMAT(FROM_UNIXTIME(s.date),'%d.%m.%Y') as 'day_label' FROM tl_vr_wa_reservation r INNER JOIN tl_vr_wa_slot s ON s.id = r.pid GROUP BY day_label ORDER BY s.date ASC"); |
|
120 |
+ |
|
121 |
+ foreach ($DayRequest->iterateAssociative() as $day) |
|
122 |
+ { |
|
123 |
+ $arrDayOptions[$day['date']] = $day['day_label']; |
|
124 |
+ } |
|
125 |
+ |
|
126 |
+ /*$arrMonthOptions = []; |
|
97 | 127 |
$MonthRequest = $this->db->executeQuery("SELECT s.date, DATE_FORMAT(FROM_UNIXTIME(s.date),'%m/%Y') as 'month_label' FROM tl_vr_wa_reservation r INNER JOIN tl_vr_wa_slot s ON s.id = r.pid GROUP BY month_label ORDER BY s.date ASC"); |
98 | 128 |
|
99 | 129 |
foreach ($MonthRequest->iterateAssociative() as $month) |
100 | 130 |
{ |
101 | 131 |
$arrMonthOptions[$month['date']] = $month['month_label']; |
132 |
+ }*/ |
|
133 |
+ |
|
134 |
+ $arrStandortOptions = []; |
|
135 |
+ $StandortRequest = $this->db->executeQuery("SELECT l.id, l.title FROM tl_vr_wa_reservation r INNER JOIN tl_vr_wa_slot s ON s.id = r.pid INNER JOIN tl_vr_wa_standort l ON l.id = s.pid GROUP BY l.id ORDER BY l.title ASC"); |
|
136 |
+ foreach ($StandortRequest->iterateAssociative() as $standort) |
|
137 |
+ { |
|
138 |
+ $arrStandortOptions[$standort['id']] = $standort['title']; |
|
102 | 139 |
} |
103 | 140 |
|
104 |
- $arrData['filter']['month']['options'] = $arrMonthOptions; |
|
141 |
+ $arrData['filter']['day']['options'] = $arrDayOptions; |
|
142 |
+// $arrData['filter']['month']['options'] = $arrMonthOptions; |
|
143 |
+ $arrData['filter']['standort']['options'] = $arrStandortOptions; |
|
105 | 144 |
|
106 | 145 |
|
107 | 146 |
// Get bookings |