/** @license Copyright (c) 2018 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ import { LitElement, html } from '@polymer/lit-element'; import { connect } from 'pwa-helpers/connect-mixin.js'; // This element is connected to the Redux store. import { store } from '../store.js'; //These are the actions needed by this element. import { adminApproveHours, adminRejectHours } from '../actions/firebase.js'; // We are lazy loading its reducer. import firebase from '../reducers/firebase.js'; store.addReducers({ firebase }); // Import button styles import { ButtonSharedStyles } from './button-shared-styles.js'; // Import paper elements import '@polymer/paper-card/paper-card.js'; import '@polymer/paper-button/paper-button.js'; class RequestElement extends connect(store)(LitElement) { _render(props) { return html` ${ButtonSharedStyles}

From: ${'\t' + props.email.replace('@communityschoolnaples.org', '')}

Date: ${'\t' + props.date}

`; } static get properties() { return { email: String, date: String, time: Number, trainee: String, uid: String, id: String, infoTabOpen: Boolean }}; constructor() { super(); this.email = "Unknown email"; this.date = "Unknown date"; this.time = -1; this.trainee = "Unknown trainee"; this.uid = "Unknown uid"; this.docId = "Unknown docId"; this.infoTabOpen = false; } _stateChanged(state) { //lmao just need this here for the memes } toggleTab() { this.infoTabOpen = !this.infoTabOpen; } approveHours() { if(confirm('Are you sure you want to APPROVE ' + this.time + ' hours 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 +' ?')) { store.dispatch(adminRejectHours(this.docId)); } } } window.customElements.define('request-element', RequestElement);