aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/mao-admin.js57
1 files changed, 53 insertions, 4 deletions
diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js
index 05357fc..19bf16e 100644
--- a/src/components/mao-admin.js
+++ b/src/components/mao-admin.js
@@ -17,7 +17,10 @@ import { store } from '../store.js';
// These are the shared styles needed by this element.
import { SharedStyles } from './shared-styles.js';
-import { ButtonSharedStyles } from './button-shared-styles.js'
+import { ButtonSharedStyles } from './button-shared-styles.js';
+
+//These are the actions needed by this element.
+import { archiveClass2019, archiveCompetitions2019 } from '../actions/firebaseFirestore.js';
// Import paper elements
import '@polymer/paper-input/paper-input.js';
@@ -56,10 +59,36 @@ class MaoAdmin extends connect(store)(PageViewElement) {
text-align: center;
}
+ .white {
+ background-color: white;
+
+ width: 50%;
+
+ display: block;
+ margin-right: auto;
+ margin-left: auto;
+ }
+
+ .search-grid {
+ display: grid;
+
+ grid-template-columns: 1fr;
+ }
+
+ .search-grid > paper-button {
+ display: grid;
+
+ background-color: white;
+ }
+
@media (min-width: 460px) {
.main-grid {
grid-template-columns: 1fr 1fr 1fr;
}
+
+ .search-grid {
+ grid-template-columns: 3fr 1fr;
+ }
}
</style>
@@ -72,7 +101,7 @@ class MaoAdmin extends connect(store)(PageViewElement) {
<div class="main-grid">
<paper-button raised class="info" id="toggleRequestsBtn" on-tap="${() => this.toggleRequests()}">Show Hours Requests</paper-button>
- <paper-button raised class="info" id="toggleRegistryBtn" on-tap="${() => this.toggleRegistry()}">Show Competitions And Registry</paper-button>
+ <paper-button raised class="info" id="toggleRegistryBtn" on-tap="${() => this.toggleRegistry()}">Show Comps & Registry</paper-button>
<paper-button raised class="info" id="toggleRegistryBtn" on-tap="${() => this.usersHidden = !this.usersHidden}">${props.usersHidden ? 'Show User Data' : 'Hide User Data'}</paper-button>
</div>
@@ -89,6 +118,8 @@ class MaoAdmin extends connect(store)(PageViewElement) {
</div>
<div hidden="${props.registryHidden}">
+ <paper-button on-tap="${() => this.confirmArchiveComps()}" class="white" raised>Archive Current Competitions</paper-button>
+ <br/>
<div id="registry-grid" class="main-grid"></div>
</div>
@@ -101,8 +132,14 @@ class MaoAdmin extends connect(store)(PageViewElement) {
</div>
<section hidden="${!props.isAdmin || props.usersHidden}">
- <label>Search feature</label>
- <paper-input id="search" oninput="${() => this.search()}" label="Search for keyword (ex. theta, mfoiani, 2019, ...ect)"></paper-input>
+
+ <div class="search-grid">
+
+ <paper-input id="search" oninput="${() => this.search()}" label="Search for keyword (ex. theta, mfoiani, 2019, ...ect)"></paper-input>
+
+ <paper-button raised on-tap="${() => this.confirmArchiveUsers()}">Archive Old Class</paper-button>
+
+ </div>
<br/>
@@ -204,6 +241,18 @@ class MaoAdmin extends connect(store)(PageViewElement) {
});
}
+ confirmArchiveUsers() {
+ if(confirm('This will archive current hours and set all accounts with zero hours. It will also hide those in the previous graduating class. Are you sure that you want to do this?')){
+ store.dispatch(archiveClass2019());
+ }
+ }
+
+ confirmArchiveComps() {
+ if(confirm('This will archive all current competitions and remove the registry for them. Are you sure that you want to do this?')) {
+ store.dispatch(archiveCompetitions2019());
+ }
+ }
+
updateInformation() {
if(this.shadowRoot) {
//update requests