| @@ -137,49 +137,8 @@ | ||
| 137 | 137 | $ret = array( $to, $msg ); |
| 138 | 138 | return $ret; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function postClearSelected() | |
| 142 | - { | |
| 143 | - $params = $this->request->getParams(); | |
| 144 | - $date = isset($params['date']) ? $params['date'] : $this->t->setNow()->formatDateDb(); | |
| 145 | - $type = isset($params['type']) ? $params['type'] : SH4_Reminders_Model::RANGE_DAILY; | |
| 146 | - $employeeIds = $this->post->get('employee'); | |
| 147 | - | |
| 148 | - $to = 'admin/reminders/review'; | |
| 149 | - $params = array( | |
| 150 | - 'date' => $date, | |
| 151 | - 'type' => $type | |
| 152 | - ); | |
| 153 | - $to = $this->uri->makeUrl(array($to, $params)); | |
| 154 | - | |
| 155 | - if (!$employeeIds) { | |
| 156 | - $ret = array($to, ''); | |
| 157 | - return $ret; | |
| 158 | - } | |
| 159 | - | |
| 160 | - // reminders | |
| 161 | - $reminders = $this->remindersQuery->find($type, $date); | |
| 162 | - | |
| 163 | - foreach ($reminders as $reminder) { | |
| 164 | - if (!$reminder->log) { | |
| 165 | - continue; | |
| 166 | - } | |
| 167 | - | |
| 168 | - $thisEmployeeId = $reminder->employee->getId(); | |
| 169 | - if (!in_array($thisEmployeeId, $employeeIds)) { | |
| 170 | - continue; | |
| 171 | - } | |
| 172 | - | |
| 173 | - $this->remindersCommandLog->delete($reminder->log); | |
| 174 | - } | |
| 175 | - | |
| 176 | - $msg = '__Logs Cleared__'; | |
| 177 | - $ret = array($to, $msg); | |
| 178 | - | |
| 179 | - return $ret; | |
| 180 | - } | |
| 181 | - | |
| 182 | 141 | public function render() |
| 183 | 142 | { |
| 184 | 143 | $params = $this->request->getParams(); |
| 185 | 144 | $date = isset($params['date']) ? $params['date'] : $this->t->setNow()->formatDateDb(); |
| @@ -194,9 +153,8 @@ | ||
| 194 | 153 | 'type' => $type |
| 195 | 154 | ); |
| 196 | 155 | $toSend = $this->uri->makeUrl( array($slug . '/send', $params) ); |
| 197 | 156 | $toClear = $this->uri->makeUrl( array($slug . '/clear', $params) ); |
| 198 | - $toClearSelected = $this->uri->makeUrl( array($slug . '/clearselected', $params) ); | |
| 199 | 157 | |
| 200 | 158 | // reminders |
| 201 | 159 | $reminders = $this->remindersQuery->find( $type, $date ); |
| 202 | 160 | |
| @@ -260,20 +218,24 @@ | ||
| 260 | 218 | </div> |
| 261 | 219 | |
| 262 | 220 | <?php if( $reminders ) : ?> |
| 263 | 221 | |
| 264 | -<?php if($logs) : ?> | |
| 265 | - <form action="<?php echo $toClearSelected; ?>" method="post" accept-charset="utf-8"> | |
| 266 | -<?php endif; ?> | |
| 267 | 222 | <table class="wp-list-table widefat fixed striped"> |
| 268 | 223 | |
| 269 | 224 | <thead> |
| 270 | 225 | <tr> |
| 271 | - <?php if($logs) : ?><td style="width: 2em;"></td><?php endif; ?> | |
| 272 | - <td class="hc-col-4">__Employee__</td> | |
| 273 | - <td class="hc-col-4">__User__</td> | |
| 274 | - <td class="hc-col-1">__Shifts__</td> | |
| 275 | - <td class="hc-col-3">__Sent__</td> | |
| 226 | + <td class="hc-col-4"> | |
| 227 | + __Employee__ | |
| 228 | + </td> | |
| 229 | + <td class="hc-col-4"> | |
| 230 | + __User__ | |
| 231 | + </td> | |
| 232 | + <td class="hc-col-1"> | |
| 233 | + __Shifts__ | |
| 234 | + </td> | |
| 235 | + <td class="hc-col-3"> | |
| 236 | + __Sent__ | |
| 237 | + </td> | |
| 276 | 238 | </tr> |
| 277 | 239 | </thead> |
| 278 | 240 | |
| 279 | 241 | <tbody> |
| @@ -309,25 +271,15 @@ | ||
| 309 | 271 | } |
| 310 | 272 | |
| 311 | 273 | $to = 'schedule'; |
| 312 | 274 | $detailsLink = $this->uri->makeUrl( array($to, $toParams) ); |
| 313 | - $employeeId = $r->employee->getId(); | |
| 314 | 275 | ?> |
| 315 | 276 | |
| 316 | 277 | <tr> |
| 317 | - <?php if($logs) : ?> | |
| 318 | - <td class="hc-align-center"> | |
| 319 | - <?php if($r->log): ?> | |
| 320 | - <label><input id="employee-<?php echo esc_attr($employeeId); ?>" type="checkbox" name="hc-employee[]" value="<?php echo esc_attr($employeeId); ?>"></label> | |
| 321 | - <?php endif; ?> | |
| 322 | - </td> | |
| 323 | - <?php endif; ?> | |
| 324 | 278 | <td> |
| 325 | - <?php if($logs) : ?><label for="employee-<?php echo esc_attr($employeeId); ?>"><?php endif; ?> | |
| 326 | 279 | <?php echo $this->employeesPresenter->presentTitle( $r->employee ); ?> |
| 327 | - <?php if($logs) : ?></label><?php endif; ?> | |
| 328 | 280 | <?php if( in_array($r->range, [SH4_Reminders_Model::RANGE_DAILY_SMS]) ) : ?> |
| 329 | - <?php $phone = $this->sms->getEmployeePhone($employeeId); ?> | |
| 281 | + <?php $phone = $this->sms->getEmployeePhone( $r->employee->getId() ); ?> | |
| 330 | 282 | <a href="<?php echo esc_attr($this->uri->makeUrl('admin/reminders/sms')); ?>" title="__Phone Number__" class="hc-block"> |
| 331 | 283 | <?php if( $phone ) : ?><?php echo esc_html( $phone ); ?><?php else : ?>__No Phone Number__<?php endif; ?> |
| 332 | 284 | </a> |
| 333 | 285 | <?php endif; ?> |
| @@ -358,31 +310,23 @@ | ||
| 358 | 310 | </tbody> |
| 359 | 311 | |
| 360 | 312 | </table> |
| 361 | 313 | |
| 362 | -<?php if( $logs ) : ?> | |
| 363 | - <p> | |
| 364 | - <button type="submit" class="button button-secondary hc-xs-block">× __Clear Logs For Selected Employees__</button> | |
| 365 | - </p> | |
| 366 | -</form> | |
| 367 | -<?php endif; ?> | |
| 368 | - | |
| 369 | -<?php if( $logs ) : ?> | |
| 370 | - <form action="<?php echo $toClear; ?>" method="post" accept-charset="utf-8"> | |
| 314 | +<?php if( $notSent ) : ?> | |
| 315 | + <form action="<?php echo $toSend; ?>" method="post" accept-charset="utf-8"> | |
| 371 | 316 | <p> |
| 372 | - <button type="submit" class="button button-secondary hc-xs-block">× __Clear All Logs__</button> | |
| 317 | + <button type="submit" class="button button-primary hc-xs-block">__Send Reminder Messages__</button> | |
| 373 | 318 | </p> |
| 374 | 319 | </form> |
| 375 | 320 | <?php endif; ?> |
| 376 | 321 | |
| 377 | -<?php if( $notSent ) : ?> | |
| 378 | - <form action="<?php echo $toSend; ?>" method="post" accept-charset="utf-8"> | |
| 322 | +<?php if( $logs ) : ?> | |
| 323 | + <form action="<?php echo $toClear; ?>" method="post" accept-charset="utf-8"> | |
| 379 | 324 | <p> |
| 380 | - <button type="submit" class="button button-primary hc-xs-block">__Send Reminder Messages__</button> | |
| 325 | + <button type="submit" class="button button-secondary hc-xs-block">× __Clear Logs__</button> | |
| 381 | 326 | </p> |
| 382 | 327 | </form> |
| 383 | 328 | <?php endif; ?> |
| 384 | - | |
| 385 | 329 | |
| 386 | 330 | <?php else: ?> |
| 387 | 331 | |
| 388 | 332 | <p> |