Some checks failed
CI / Coding Standards (push) Failing after 2m31s
CI / PHPStan (push) Failing after 50s
CI / Tests (PHP 8.1) (push) Successful in 50s
CI / Tests (PHP 8.2) (push) Successful in 48s
CI / Tests (PHP 8.3) (push) Successful in 40s
CI / No Debug Code (push) Successful in 2s
- Custom DB tables for availability slots and lesson bookings - Instructor (wp-admin) and student (front-end) roles with custom capabilities - REST API under us-scheduler/v1 for availability CRUD and booking - [us_booking] and [us_student_login] shortcodes for student front end - PHPUnit + Brain\Monkey unit test suite (29 tests) - Gitea Actions CI: lint, PHPStan, tests on PHP 8.1/8.2/8.3, no-debug check - Feature docs under docs/features/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
3.1 KiB
PHP
68 lines
3.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
/** @var list<\Unsupervised\Schedular\Model\AvailabilitySlot> $slots */
|
|
?>
|
|
<div class="wrap">
|
|
<h1><?php esc_html_e('My Availability', 'unsupervised-schedular'); ?></h1>
|
|
|
|
<h2><?php esc_html_e('Add Slot', 'unsupervised-schedular'); ?></h2>
|
|
<form method="post">
|
|
<?php wp_nonce_field('usc_availability_action'); ?>
|
|
<input type="hidden" name="usc_action" value="add">
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><label for="start_dt"><?php esc_html_e('Start', 'unsupervised-schedular'); ?></label></th>
|
|
<td><input type="datetime-local" name="start_dt" id="start_dt" required></td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="end_dt"><?php esc_html_e('End', 'unsupervised-schedular'); ?></label></th>
|
|
<td><input type="datetime-local" name="end_dt" id="end_dt" required></td>
|
|
</tr>
|
|
</table>
|
|
<?php submit_button(esc_html__('Add Slot', 'unsupervised-schedular')); ?>
|
|
</form>
|
|
|
|
<h2><?php esc_html_e('Current Slots', 'unsupervised-schedular'); ?></h2>
|
|
|
|
<?php if (empty($slots)) : ?>
|
|
<p><?php esc_html_e('No availability slots configured.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<table class="wp-list-table widefat fixed striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php esc_html_e('Start', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('End', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Status', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Actions', 'unsupervised-schedular'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($slots as $slot) : ?>
|
|
<tr>
|
|
<td><?php echo esc_html($slot->startDt); ?></td>
|
|
<td><?php echo esc_html($slot->endDt); ?></td>
|
|
<td><?php echo $slot->isBooked ? esc_html__('Booked', 'unsupervised-schedular') : esc_html__('Available', 'unsupervised-schedular'); ?></td>
|
|
<td>
|
|
<?php if (! $slot->isBooked) : ?>
|
|
<form method="post" style="display:inline;">
|
|
<?php wp_nonce_field('usc_availability_action'); ?>
|
|
<input type="hidden" name="usc_action" value="delete">
|
|
<input type="hidden" name="slot_id" value="<?php echo esc_attr((string) $slot->id); ?>">
|
|
<button type="submit" class="button button-small button-link-delete">
|
|
<?php esc_html_e('Delete', 'unsupervised-schedular'); ?>
|
|
</button>
|
|
</form>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|