diff options
| author | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-01 20:46:52 -0400 |
|---|---|---|
| committer | Michael Foiani <mfoiani2019@communiyschoolnaples.org> | 2018-08-01 20:46:52 -0400 |
| commit | 32fed7906a39e4bfa4d98fee1bdc5340d22cb63f (patch) | |
| tree | 719f7bd92384927a0a6b994f67f020541be68723 /src/components | |
| parent | 7070c6f28d0e1fb6b519b44a83314c4bdb7a004d (diff) | |
Fixed small glitch where snapshot would fire twice because the field in the database was called 'date.' Annoying. Also, fixed other bugs and finished the admin requests viewing, but need to connect the 'approve hours button.'
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/mao-admin.js | 19 | ||||
| -rw-r--r-- | src/components/request-element.js | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js index c63f952..724c0c9 100644 --- a/src/components/mao-admin.js +++ b/src/components/mao-admin.js @@ -16,7 +16,7 @@ import { connect } from 'pwa-helpers/connect-mixin.js'; import { store } from '../store.js'; //These are the actions needed by this element. -import { approveHours } from '../actions/firebase.js'; +//import { approveHours } from '../actions/firebase.js'; // We are lazy loading its reducer. import firebase from '../reducers/firebase.js'; @@ -79,10 +79,12 @@ class MaoAdmin extends connect(store)(PageViewElement) { <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> + <br/> + <div hidden="${props.requestsHidden}"> + <div id="requests-grid" class="requests-grid"></div> + </div> + </section> `; } @@ -113,7 +115,7 @@ class MaoAdmin extends connect(store)(PageViewElement) { this.requestsHidden = !this.requestsHidden; if(this.shadowRoot) { - var btn = this.shadowRoot.getElementById('toogleRequestsBtn'); + var btn = this.shadowRoot.getElementById('toggleRequestsBtn'); if(this.requestsHidden) { btn.innerHTML = "Show Hours Requests"; } else { @@ -125,7 +127,7 @@ class MaoAdmin extends connect(store)(PageViewElement) { updateInformation() { if(this.shadowRoot) { //update requests - var requestGrid = this.shadowRoot.getElementById('request-grid'); + var requestGrid = this.shadowRoot.getElementById('requests-grid'); requestGrid.innerHTML = ""; for(var i = 0; i<this.requests.length; i++) { @@ -133,19 +135,18 @@ class MaoAdmin extends connect(store)(PageViewElement) { requestElement.email = this.requests[i].email .replace('@communityschoolnaples.org', ''); + requestElement.date = this.requests[i].day; requestElement.time = this.requests[i].time; requestElement.trainee = this.requests[i].trainee; requestElement.uid = this.requests[i].uid; - requestElement.on-approve-hours = "${() => this.approveHours()}" - requestGrid.appendChild(requestElement); } } } approveHours() { - alert("Approve hours") + alert("Approve hours"); } diff --git a/src/components/request-element.js b/src/components/request-element.js index d5aca82..55c9588 100644 --- a/src/components/request-element.js +++ b/src/components/request-element.js @@ -50,6 +50,7 @@ class RequestElement extends LitElement { class="info" raised on-tap= "${() => this.approveHours()}"> + Approve Hours </paper-button> </div> </paper-card> @@ -58,6 +59,7 @@ class RequestElement extends LitElement { static get properties() { return { email: String, + date: String, time: Number, trainee: String, uid: String, @@ -69,6 +71,7 @@ class RequestElement extends LitElement { super(); this.email = "Unknown email"; + this.date = "Unknown date"; this.time = -1; this.trainee = "Unknown trainee"; this.uid = "Unknown uid"; @@ -81,10 +84,9 @@ class RequestElement extends LitElement { } approveHours() { - if(confirm('Are you sure you want to approve' + this.time + 'hours for + ' + this.email +'?')) { + if(confirm('Are you sure you want to approve ' + this.time + ' hours for ' + this.email +' ?')) { this.dispatchEvent(new CustomEvent('approve-hours')); } - } |
