CI / Tests (PHP 8.1) (pull_request) Successful in 46s
CI / Coding Standards (pull_request) Successful in 2m53s
CI / Tests (PHP 8.2) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 3s
CI / PHPStan (pull_request) Successful in 3m12s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m36s
CI / Build Plugin Zip (pull_request) Skipped
Front end: the student "upcoming lessons" panel now shows each booked offering's name and length next to the time, and renders only the soonest five lessons with a "Show all" reveal. GET /bookings returns offering_title and duration_minutes so the list needs no extra request. Admin: the Scheduler and My Lessons week/list views now show the booked offering, and each lesson links to a detail view showing the policy versions the student accepted (with acceptance time and IP) and their intake answers. On My Lessons an instructor may only open their own lessons; the studio Scheduler may open any. composer test / composer lint / composer cs all pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
122 lines
5.7 KiB
PHP
122 lines
5.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* @var array{lesson_id: int, student: string, instructor: string, offering: string, duration: int, recurrence: string, time: string, status: string, notes: string, payment_id: int, currency: string, total: float}|null $row
|
|
* @var list<array{question: string, answer: string}> $answers
|
|
* @var list<array{policy: string, version: string, accepted_at: string, ip: string}> $accepts
|
|
* @var string $backUrl
|
|
*/
|
|
?>
|
|
<div class="wrap">
|
|
<h1><?php esc_html_e('Lesson details', 'unsupervised-schedular'); ?></h1>
|
|
|
|
<p><a href="<?php echo esc_url($backUrl); ?>">« <?php esc_html_e('Back to lessons', 'unsupervised-schedular'); ?></a></p>
|
|
|
|
<?php if (null === $row) : ?>
|
|
<p><?php esc_html_e('This lesson could not be found.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<table class="form-table">
|
|
<tbody>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Lesson', 'unsupervised-schedular'); ?></th>
|
|
<td>
|
|
<?php echo esc_html($row['offering']); ?>
|
|
<?php if ($row['duration'] > 0) : ?>
|
|
<?php
|
|
/* translators: %d: lesson length in minutes */
|
|
echo esc_html(sprintf(__('(%d min)', 'unsupervised-schedular'), $row['duration']));
|
|
?>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Student', 'unsupervised-schedular'); ?></th>
|
|
<td><?php echo esc_html($row['student']); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Instructor', 'unsupervised-schedular'); ?></th>
|
|
<td><?php echo esc_html($row['instructor']); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Date/Time', 'unsupervised-schedular'); ?></th>
|
|
<td>
|
|
<?php echo esc_html($row['time']); ?>
|
|
<?php if ('weekly' === $row['recurrence']) : ?>
|
|
<em>(<?php esc_html_e('weekly', 'unsupervised-schedular'); ?>)</em>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Status', 'unsupervised-schedular'); ?></th>
|
|
<td><?php echo esc_html($row['status']); ?></td>
|
|
</tr>
|
|
<?php if ($row['payment_id'] > 0) : ?>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Total', 'unsupervised-schedular'); ?></th>
|
|
<td><?php echo esc_html($row['currency'] . ' ' . number_format($row['total'], 2)); ?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php if ('' !== $row['notes']) : ?>
|
|
<tr>
|
|
<th scope="row"><?php esc_html_e('Notes', 'unsupervised-schedular'); ?></th>
|
|
<td><?php echo esc_html($row['notes']); ?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h2><?php esc_html_e('Policies accepted', 'unsupervised-schedular'); ?></h2>
|
|
<?php if (empty($accepts)) : ?>
|
|
<p><?php esc_html_e('None recorded for this booking.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<table class="wp-list-table widefat fixed striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php esc_html_e('Policy', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Version', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Accepted', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('IP address', 'unsupervised-schedular'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($accepts as $acceptance) : ?>
|
|
<tr>
|
|
<td><?php echo esc_html($acceptance['policy']); ?></td>
|
|
<td><?php echo esc_html($acceptance['version']); ?></td>
|
|
<td><?php echo esc_html('' !== $acceptance['accepted_at'] ? (string) mysql2date('M j, Y g:i A', $acceptance['accepted_at']) : '—'); ?></td>
|
|
<td><?php echo esc_html('' !== $acceptance['ip'] ? $acceptance['ip'] : '—'); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
<h2><?php esc_html_e('Intake answers', 'unsupervised-schedular'); ?></h2>
|
|
<?php if (empty($answers)) : ?>
|
|
<p><?php esc_html_e('None recorded for this booking.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<table class="wp-list-table widefat fixed striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php esc_html_e('Question', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Answer', 'unsupervised-schedular'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($answers as $answer) : ?>
|
|
<tr>
|
|
<td><?php echo esc_html($answer['question']); ?></td>
|
|
<td><?php echo esc_html($answer['answer']); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|