diff options
Diffstat (limited to 'src/components/mao-admin.js')
-rw-r--r-- | src/components/mao-admin.js | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js index 8cc93ca..3bcc4c9 100644 --- a/src/components/mao-admin.js +++ b/src/components/mao-admin.js @@ -43,13 +43,42 @@ class MaoAdmin extends connect(store)(PageViewElement) { <style> + paper-card { + display: block; + } + + paper-button { + display: block; + width: 50%; + } + + .requests-grid { + display: grid; + grid-gap: 10px; + + grid-template-columns: 1fr; + } + + + @media (min-width: 460px) { + .requests-grid { + grid-template-columns: 1fr 1fr; + } + } + </style> <section hidden="${!props.isAdmin}"> - Admin Stuff + <h2 class="underline">Hello Admin!</h2> + + <paper-button raised class="info" id="toggleRequestsBtn" on-tap="${() => this.toggleRequests()}">Show Hours Requests</paper-button> + + <div id="requests-grid" hidden="${props.requestsHidden}"> + Requests + </div> </section> `; @@ -58,12 +87,67 @@ class MaoAdmin extends connect(store)(PageViewElement) { static get properties() { return { // This is the data from the store. signedIn: Boolean, - isAdmin: Boolean + isAdmin: Boolean, + + requests: Array, + compList: Array, + + requestsHidden: Boolean }} _stateChanged(state) { this.signedIn = state.firebase.initialized; this.isAdmin = state.firebase.isAdmin; + + this.requests = state.firebase.requests; + this.compList = state.firebase.compList; + this.updateInformation(); + + this.requestsHidden = true; + } + + toggleRequests() { + this.requestsHidden = !this.requestsHidden; + + if(this.shadowRoot) { + var btn = this.shadowRoot.getElementById('toogleRequestsBtn'); + if(this.requestsHidden) { + btn.innerHTML = "Show Hours Requests"; + } else { + btn.innerHTML = "Hide Hours Requests"; + } + } + } + + updateInformation() { + if(this.shadowRoot) { + /* + var requestsGrid = this.shadowRoot.getElementById('requests-grid'); + postsGrid.innerHTML = ""; + + for(var i = 0; i < this.requests.length; i++) { + var paperCard = document.createElement('paper-card'); + var cardContent = document.createElement('div'); + var fourmAuthor = document.createElement('h4'); + var fourmSubject = document.createElement('h3'); + var fourmContent = document.createElement('p'); + + fourmAuthor.innerHTML = this.fourmPosts[i].email .replace('@communityschoolnaples.org', ''); + fourmSubject.innerHTML = this.fourmPosts[i].subject; + fourmContent.innerHTML = this.fourmPosts[i].content; + + cardContent.classList.add('card-content'); + cardContent.appendChild( fourmAuthor); + cardContent.appendChild( fourmSubject); + cardContent.appendChild( fourmContent); + + paperCard.elevation = 0; + paperCard.appendChild( cardContent); + + postsGrid.appendChild(paperCard); + */ + } + } } |