@@ -1383,6 +1383,13 @@ async function showAddNestsModal() {
13831383 const overlay = $a ( '#admin-modal-overlay' ) ;
13841384 if ( ! content || ! overlay ) return ;
13851385
1386+ if ( ! $a ( '#custom-checkbox-style' ) ) {
1387+ const style = document . createElement ( 'style' ) ;
1388+ style . id = 'custom-checkbox-style' ;
1389+ style . textContent = '.custom-checkbox-label.checked .custom-checkbox-ui { background: var(--accent-1); border-color: var(--accent-1); } .custom-checkbox-label.checked .custom-checkbox-ui .custom-checkbox-check { display: block; }' ;
1390+ document . head . appendChild ( style ) ;
1391+ }
1392+
13861393 content . innerHTML = '<div style="text-align:center;padding:24px"><span class="spinner"></span> Loading available nests...</div>' ;
13871394 overlay . style . display = 'flex' ;
13881395
@@ -1405,7 +1412,7 @@ async function showAddNestsModal() {
14051412 <p style="color:var(--text-secondary);font-size:0.85rem;margin-bottom:16px">Select nests from the panel to make them available:</p>
14061413 <div id="add-nests-list" style="max-height:300px;overflow-y:auto;margin-bottom:16px">
14071414 ${ data . nests . map ( n => ahtml `
1408- <label style="display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);cursor:pointer" class="custom-checkbox-label">
1415+ <label style="display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);cursor:pointer" class="custom-checkbox-label" data-id=" ${ n . id } " >
14091416 <input type="checkbox" class="add-nest-checkbox" value="${ n . id } " data-name="${ n . name } " style="display:none" />
14101417 <span class="custom-checkbox-ui" style="width:20px;height:20px;border:2px solid var(--text-secondary);border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:var(--transition);background:transparent">
14111418 <svg class="custom-checkbox-check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="var(--bg-primary)" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" style="display:none"><polyline points="20 6 9 17 4 12"/></svg>
@@ -1414,10 +1421,6 @@ async function showAddNestsModal() {
14141421 </label>
14151422 ` ) . join ( '' ) }
14161423 </div>
1417- <style id="custom-checkbox-style">
1418- .custom-checkbox-label input:checked + .custom-checkbox-ui { background: var(--accent-1); border-color: var(--accent-1); }
1419- .custom-checkbox-label input:checked + .custom-checkbox-ui .custom-checkbox-check { display: block; }
1420- </style>
14211424 <div style="display:flex;gap:8px">
14221425 <button class="btn btn-primary btn-full" id="btn-confirm-add-nests" style="justify-content:center">Add Selected</button>
14231426 <button class="btn btn-ghost btn-full" onclick="closeAdminModal()" style="justify-content:center">Cancel</button>
@@ -1426,6 +1429,16 @@ async function showAddNestsModal() {
14261429 </div>
14271430 ` ;
14281431
1432+ document . querySelectorAll ( '.custom-checkbox-label' ) . forEach ( label => {
1433+ label . addEventListener ( 'click' , ( e ) => {
1434+ e . preventDefault ( ) ;
1435+ const cb = label . querySelector ( '.add-nest-checkbox' ) ;
1436+ if ( ! cb ) return ;
1437+ cb . checked = ! cb . checked ;
1438+ label . classList . toggle ( 'checked' , cb . checked ) ;
1439+ } ) ;
1440+ } ) ;
1441+
14291442 $a ( '#btn-confirm-add-nests' ) ?. addEventListener ( 'click' , async ( ) => {
14301443 const checked = document . querySelectorAll ( '.add-nest-checkbox:checked' ) ;
14311444 if ( checked . length === 0 ) {
0 commit comments