Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions assets/nursery.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
.uc-nursery .uc-nursery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 20px;
margin-top: 20px;
}

.uc-nursery .uc-nursery-child {
border: 1px solid #e1e5ee;
border-radius: 8px;
background: #fff;
padding: 16px;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
gap: 10px;
}

.uc-nursery .uc-nursery-child.status-checked_in {
border-color: #2f855a;
box-shadow: 0 0 0 3px rgba(47,133,90,0.2);
}

.uc-nursery .uc-nursery-child.status-expired {
opacity: 0.6;
}

.uc-nursery .uc-nursery-allergy,
.uc-label-allergy {
background: #fee2e2;
border-left: 4px solid #dc2626;
padding: 6px 10px;
border-radius: 4px;
font-weight: 600;
}

.uc-nursery .uc-nursery-actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
}

.uc-nursery-token-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 12px;
margin-top: 12px;
}

.uc-nursery-qr,
.uc-label-qr {
width: 160px;
height: 160px;
margin: 8px auto;
}

.uc-nursery-token-capture {
margin: 20px 0;
padding: 16px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
}

.uc-token-inline {
display: flex;
align-items: flex-end;
gap: 12px;
flex-wrap: wrap;
}

.uc-nursery-print .uc-card {
overflow: visible;
}

.uc-label-options {
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #e2e8f0;
}

.uc-label-options form {
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
}

.uc-label-grid {
display: grid;
gap: 16px;
}

.uc-label-grid.columns-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}

.uc-label-grid.columns-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}

.uc-label-grid.columns-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}

.uc-label-grid.columns-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}

.uc-label-card {
border: 1px solid #cbd5f5;
border-radius: 12px;
padding: 16px;
background: #fff;
min-height: 220px;
display: flex;
flex-direction: column;
gap: 8px;
justify-content: space-between;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.uc-label-grid.bleed-0 .uc-label-card { margin: 0; }
.uc-label-grid.bleed-8 .uc-label-card { margin: 8px; }
.uc-label-grid.bleed-12 .uc-label-card { margin: 12px; }
.uc-label-grid.bleed-16 .uc-label-card { margin: 16px; }
.uc-label-grid.bleed-24 .uc-label-card { margin: 24px; }
.uc-label-grid.bleed-32 .uc-label-card { margin: 32px; }
.uc-label-grid.bleed-48 .uc-label-card { margin: 48px; }

.uc-label-card h2 {
margin: 0;
font-size: 20px;
}

.uc-label-card small {
color: #475569;
}

@media print {
body.wp-admin #wpadminbar,
body.wp-admin #adminmenuwrap,
body.wp-admin #adminmenuback,
body.wp-admin #screen-meta,
body.wp-admin #screen-meta-links,
body.wp-admin .notice,
body.wp-admin .uc-toolbar,
body.wp-admin .uc-label-options {
display: none !important;
}
body.wp-admin #wpcontent {
margin-left: 0;
}
.uc-label-grid {
gap: 0;
}
.uc-label-card {
box-shadow: none;
border-color: #000;
}
}
27 changes: 27 additions & 0 deletions assets/nursery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(function(){
function renderQr(element, url) {
if (!element || !url) return;
while (element.firstChild) {
element.removeChild(element.firstChild);
}
new QRCode(element, {
text: url,
width: element.classList.contains('uc-label-qr') ? 220 : 160,
height: element.classList.contains('uc-label-qr') ? 220 : 160,
correctLevel: QRCode.CorrectLevel.M
});
}

function boot() {
var qrBlocks = document.querySelectorAll('.uc-nursery-qr[data-url], .uc-label-qr[data-url]');
qrBlocks.forEach(function(block){
renderQr(block, block.getAttribute('data-url'));
});
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', boot);
} else {
boot();
}
})();
10 changes: 10 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function menu() {
public function register_settings() {
register_setting('uc_expo_qr', UC_Expo_QR_Checkins::OPTION_EVENT, ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field']);
register_setting('uc_expo_qr', UC_Expo_QR_Checkins::OPTION_SECRET, ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field']);
register_setting('uc_expo_qr', UC_Expo_QR_Nursery::OPTION_ENABLE, ['type' => 'boolean', 'sanitize_callback' => [$this, 'sanitize_checkbox']]);

add_settings_section('uc_expo_qr_main', __('General', 'uc-expo'), function(){
echo '<p>'.esc_html__('Set the current event id (e.g., 2025-ATL). Use "Rotate Secret" to invalidate old QR signatures and generate new ones.', 'uc-expo').'</p>';
Expand All @@ -49,6 +50,15 @@ public function register_settings() {
echo '<input type="text" readonly value="'.$val.'" class="regular-text code" />';
submit_button(__('Rotate Secret', 'uc-expo'), 'secondary', 'uc_expo_rotate_secret', false, ['style'=>'margin-left:10px']);
}, 'uc_expo_qr', 'uc_expo_qr_main');

add_settings_field('nursery_mode', __('Nursery Mode', 'uc-expo'), function(){
$enabled = UC_Expo_QR_Nursery::instance()->is_enabled();
echo '<label><input type="checkbox" name="'.esc_attr(UC_Expo_QR_Nursery::OPTION_ENABLE).'" value="1" '.checked($enabled, true, false).' /> '.esc_html__('Enable UC Church Nursery check-ins (beta)', 'uc-expo').'</label>';
}, 'uc_expo_qr', 'uc_expo_qr_main');
}

public function sanitize_checkbox($value) {
return $value ? 1 : 0;
}

public function render_settings() {
Expand Down
Loading