diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/mao-admin.js | 1 | ||||
-rw-r--r-- | src/components/mao-tutoring.js | 38 | ||||
-rw-r--r-- | src/components/request-element.js | 15 |
3 files changed, 31 insertions, 23 deletions
diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js index fc67cc2..6c8a2c9 100644 --- a/src/components/mao-admin.js +++ b/src/components/mao-admin.js @@ -161,6 +161,7 @@ class MaoAdmin extends connect(store)(PageViewElement) { requestElement.email = this.requests[i].email .replace('@communityschoolnaples.org', ''); requestElement.date = this.requests[i].day; + requestElement.location = this.requests[i].location; requestElement.time = this.requests[i].time; requestElement.trainee = this.requests[i].trainee; requestElement.uid = this.requests[i].uid; diff --git a/src/components/mao-tutoring.js b/src/components/mao-tutoring.js index 1782f91..6e9bbaf 100644 --- a/src/components/mao-tutoring.js +++ b/src/components/mao-tutoring.js @@ -162,17 +162,17 @@ class MaoTutoring extends connect(store)(PageViewElement) { </div> <div class="approved-card"> - <h3>Approved Hours</h3> + <h3>Approved Minutes</h3> <div class= "circle" - style= "background-color: #0f9d58;">${props.hours}</div> + style= "background-color: #0f9d58;">${props.hours*60}</div> </div> <div class="unapproved-card"> - <h3>Requested Hours</h3> + <h3>Requested Minutes</h3> <div class= "circle" - style= "background-color: #f4b400;">${props.requestedHours}</div> + style= "background-color: #f4b400;">${props.requestedHours*60}</div> </div> </div> @@ -193,8 +193,6 @@ class MaoTutoring extends connect(store)(PageViewElement) { <h3>Fill Fields</h3> - <p>How many hours of tutoring?</p> - <paper-input id= "timeField" label= "Time" @@ -206,6 +204,8 @@ class MaoTutoring extends connect(store)(PageViewElement) { <span slot="suffix">(minutes)</span> </paper-input> + <paper-input id="locationField" label="Location" type="text"></paper-input> + <paper-input id="traineeField" label="Trainee's Name" type="text"></paper-input> <vaadin-date-picker id="dateField" placeholder="Choose Date"> @@ -298,24 +298,28 @@ class MaoTutoring extends connect(store)(PageViewElement) { if(this.shadowRoot) { var timeElement = this.shadowRoot.getElementById('timeField'); var traineeElement = this.shadowRoot.getElementById('traineeField'); - var dateElement = this.shadowRoot.getElementById('dateField') + var locationElement = this.shadowRoot.getElementById('locationField'); + var dateElement = this.shadowRoot.getElementById('dateField'); - if( timeElement .value.trim() === "" || - traineeElement .value.trim() === "" || - dateElement .value === "") { + if( timeElement .value.trim() === "" || + locationElement .value.trim() === "" || + traineeElement .value.trim() === "" || + dateElement .value === "") { alert("Please fill out all fields when making hours request."); } else { if(confirm('Are you sure that you want to send this request for hours?')) { - const timeHours = (timeElement .value) + const timeHours = (timeElement .value) /60; - const traineeName = traineeElement.value; - const date = dateElement .value; + const location = locationElement .value; + const traineeName = traineeElement .value; + const date = dateElement .value; - store.dispatch(requestHours(timeHours, traineeName, date)); + store.dispatch(requestHours(timeHours, traineeName, location, date)); - timeElement .value = ""; - traineeElement .value = ""; - dateElement .value = ""; + timeElement .value = ""; + traineeElement .value = ""; + locationElement .value = ""; + dateElement .value = ""; } } } diff --git a/src/components/request-element.js b/src/components/request-element.js index 397e4f1..c2bfa34 100644 --- a/src/components/request-element.js +++ b/src/components/request-element.js @@ -49,8 +49,9 @@ class RequestElement extends connect(store)(LitElement) { <h3>From: ${'\t' + props.email.replace('@communityschoolnaples.org', '')}</h3> <h4>Date: ${'\t' + props.date}</h4> <div class="info-tab" hidden="${!props.infoTabOpen}"> - <p>Time: ${'\t' + this.time}</p> - <p>Trainee: ${'\t' + this.trainee}</p> + <p><em>Location:</em> ${'\t' + this.location }</p> + <p><em>Minutes: </em> ${'\t' + (this.time*60) }</p> + <p><em>Trainee: </em> ${'\t' + this.trainee }</p> </div> </div> <div hidden="${!props.infoTabOpen}" class="card-actions"> @@ -58,13 +59,13 @@ class RequestElement extends connect(store)(LitElement) { class="info" raised on-tap= "${() => this.approveHours()}"> - Approve Hours + Approve Time </paper-button> <paper-button class="alert" raised on-tap= "${() => this.rejectHours()}"> - Reject Hours + Reject Time </paper-button> </div> </paper-card> @@ -74,6 +75,7 @@ class RequestElement extends connect(store)(LitElement) { static get properties() { return { email: String, date: String, + location: String, time: Number, trainee: String, uid: String, @@ -87,6 +89,7 @@ class RequestElement extends connect(store)(LitElement) { this.email = "Unknown email"; this.date = "Unknown date"; + this.location = "Unknown location"; this.time = -1; this.trainee = "Unknown trainee"; this.uid = "Unknown uid"; @@ -104,13 +107,13 @@ class RequestElement extends connect(store)(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*60) + ' minutes for ' + this.email +' ?')) { store.dispatch(adminApproveHours(this.uid, this.time, this.docId)); } } rejectHours() { - if(confirm('Are you sure you want to REJECT ' + this.time + ' hours for ' + this.email +' ?')) { + if(confirm('Are you sure you want to REJECT ' + (this.time*60) + ' minutes for ' + this.email +' ?')) { store.dispatch(adminRejectHours(this.docId)); } } |