diff options
-rw-r--r-- | src/actions/firebase.js | 14 | ||||
-rw-r--r-- | src/components/mao-admin.js | 15 | ||||
-rw-r--r-- | src/components/registry-element.js | 33 |
3 files changed, 41 insertions, 21 deletions
diff --git a/src/actions/firebase.js b/src/actions/firebase.js index 49d6768..83aca5e 100644 --- a/src/actions/firebase.js +++ b/src/actions/firebase.js @@ -229,10 +229,18 @@ export const snapshotAdminCompList = () => (dispatch) => { docRef.onSnapshot((querySnapshot) => { var compList = []; querySnapshot.forEach((doc) => { - compList.push({ - ...doc.data(), - name: doc.id + var divisonData = []; + for(var i = 0; i < doc.data().uids.length; i++) { + var docRefDivison = firestore.collection('users').doc(doc.data().uids[i]); + docRefDivison.get().then((docUser) => { + divisonData.push(docUser.data().divison); }); + } + compList.push({ + ...doc.data(), + name: doc.id, + divisons: divisonData + }); }); dispatch(updateAdminCompList(compList)); }); diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js index dc78616..12a9e16 100644 --- a/src/components/mao-admin.js +++ b/src/components/mao-admin.js @@ -102,6 +102,13 @@ class MaoAdmin extends connect(store)(PageViewElement) { `; } + constructor() { + super(); + + this.requestsHidden = true; + this.registryHidden = true; + } + static get properties() { return { // This is the data from the store. signedIn: Boolean, @@ -121,9 +128,6 @@ class MaoAdmin extends connect(store)(PageViewElement) { this.requests = state.firebase.requests; this.registry = state.firebase.compList; - this.requestsHidden = true; - this.registryHidden = true; - this.updateInformation(); } @@ -182,8 +186,9 @@ class MaoAdmin extends connect(store)(PageViewElement) { for(var i = 0; i<this.registry.length; i++) { var registryElement = document.createElement('registry-element'); - registryElement.name = this.registry[i].name; - registryElement.emails = this.registry[i].emails; + registryElement.name = this.registry[i].name; + registryElement.emails = this.registry[i].emails; + registryElement.divisons = this.registry[i].divisons; registryGrid.appendChild(registryElement); } diff --git a/src/components/registry-element.js b/src/components/registry-element.js index a5ce075..79ef03f 100644 --- a/src/components/registry-element.js +++ b/src/components/registry-element.js @@ -37,13 +37,17 @@ class RegistryElement extends LitElement { } .thetas { - color: #f09300; + color: #00bfff; } .alphas { color: #7baaf7; } + .other { + color: #000000; + } + ol, h4 { text-align: left; word-break: break-all; @@ -70,9 +74,9 @@ class RegistryElement extends LitElement { </ol> - <!--h4>Stats</h4> - <ol id="name-list-stats"> - </ol--> + <h4 class="other">Other</h4> + <ol class="other" id="name-list-other"> + </ol> </div> </div> </paper-card> @@ -80,8 +84,9 @@ class RegistryElement extends LitElement { } static get properties() { return { - name: String, - emails: Array, + name: String, + emails: Array, + divisions: Array, infoTabOpen: Boolean }}; @@ -89,8 +94,9 @@ class RegistryElement extends LitElement { constructor() { super(); - this.name = ""; - this.emails = []; + this.name = ""; + this.emails = []; + this.divisons = []; this.infoTabOpen = false; } @@ -108,23 +114,24 @@ class RegistryElement extends LitElement { var thetas = this.shadowRoot.getElementById('name-list-theta'); var alphas = this.shadowRoot.getElementById('name-list-alpha'); var mus = this.shadowRoot.getElementById('name-list-mu'); - //var stats = this.shadowRoot.getElementById('name-list-stats'); + var other = this.shadowRoot.getElementById('name-list-other'); thetas.innerHTML = ""; alphas.innerHTML = ""; mus .innerHTML = ""; + other .innerHTML = ""; for(var i=0; i<this.emails.length; i++) { var listElement = document .createElement('li'); listElement.innerHTML = this.emails[i] .replace('@communityschoolnaples.org', ''); - if (this.emails[i].includes('2019')) { + if (this.divisons[i].includes('Mu')) { mus .appendChild(listElement); - } else if (this.emails[i].includes('2020')) { + } else if (this.divisons[i].includes('Theta')) { alphas .appendChild(listElement) - } else if (this.emails[i].includes('2019')) { + } else if (this.divisons[i].includes('Alpha')) { thetas .appendChild(listElement) } else { - thetas .appendChild(listElement); + other .appendChild(listElement); } } |