@@ -3,10 +3,13 @@ import * as ui from "/src/modules/ui.js";
33import storage from "/src/modules/storage.js" ;
44import * as auth from "/src/modules/auth.js" ;
55import island from "/src/modules/island.js" ;
6+ import Element from "/src/modules/element.js" ;
67
78const domain = ( ( window . location . hostname . search ( 'check' ) != - 1 ) || ( window . location . hostname . search ( '127' ) != - 1 ) ) ? 'https://api.check.vssfalcons.com' : `http://${ document . domain } :5000` ;
89if ( window . location . pathname . split ( '?' ) [ 0 ] . endsWith ( '/admin' ) ) window . location . pathname = '/admin/' ;
910
11+ var period = document . getElementById ( "period-input" ) ?. value ;
12+
1013var courses = [ ] ;
1114var segments = [ ] ;
1215var questions = [ ] ;
2023 async function init ( ) {
2124 if ( ! storage . get ( "code" ) ) return window . location . href = '/' ;
2225 if ( ! storage . get ( "pwd" ) ) return auth . ta ( init ) ;
26+ // Populate seat code finder grid
27+ document . getElementById ( "seat-grid" ) . innerHTML = "" ;
28+ for ( let col = 1 ; col <= 5 ; col ++ ) {
29+ for ( let row = 6 ; row > 0 ; row -- ) {
30+ period = document . getElementById ( "period-input" ) . value ;
31+ const code = period + row . toString ( ) + col . toString ( ) ;
32+ const button = new Element ( "button" , "" , {
33+ click : ( ) => {
34+ document . getElementById ( "code-input" ) . value = code ;
35+ ui . view ( "settings/code" ) ;
36+ } ,
37+ } ) . element ;
38+ document . getElementById ( "seat-grid" ) . append ( button ) ;
39+ ui . addTooltip ( button , code ) ;
40+ }
41+ }
42+ document . getElementById ( "period-input" ) . addEventListener ( "change" , ( ) => {
43+ document . getElementById ( "seat-grid" ) . innerHTML = "" ;
44+ for ( let col = 1 ; col <= 5 ; col ++ ) {
45+ for ( let row = 6 ; row > 0 ; row -- ) {
46+ period = document . getElementById ( "period-input" ) . value ;
47+ const code = period + row . toString ( ) + col . toString ( ) ;
48+ const button = new Element ( "button" , "" , {
49+ click : ( ) => {
50+ document . getElementById ( "code-input" ) . value = code ;
51+ ui . view ( "settings/code" ) ;
52+ } ,
53+ } ) . element ;
54+ document . getElementById ( "seat-grid" ) . append ( button ) ;
55+ ui . addTooltip ( button , code ) ;
56+ }
57+ }
58+ } ) ;
2359 if ( document . querySelector ( '[data-logout]' ) ) document . querySelector ( '[data-logout]' ) . addEventListener ( 'click' , ( ) => auth . logout ( init ) ) ;
2460
2561 // Show clear data fix guide
0 commit comments