Skip to content

Commit

Permalink
Release v1.3.0 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdconn00 authored Feb 28, 2024
1 parent 826de7d commit 21201f1
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 144 deletions.
2 changes: 1 addition & 1 deletion src/views/admin/AdminSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Events
<div class="secondary-content"><i class="material-icons">event</i></div>
</router-link>
<router-link to="/admin/feedback" class="collection-item" v-if="requiresAuth(['atm', 'datm', 'ta'])">
<router-link to="/admin/feedback" class="collection-item" v-if="requiresAuth(['atm', 'datm', 'ta', 'ec'])">
Feedback
<div class="secondary-content"><i class="material-icons">feedback</i></div>
</router-link>
Expand Down
17 changes: 5 additions & 12 deletions src/views/admin/controllers/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,12 @@ export default {
const hasCerts = certs.map(cert => cert.code);
let certsToShow = [];
certs.forEach(cert => {
if(cert.class === "major" || cert.class === "center") {
if(cert.class === "tier-one" || cert.class === "tier-two") {
certsToShow.push(cert);
} else {
const certPos = cert.code.slice(-3);
if(!hasCerts.includes(`p50${certPos}`)) {
certsToShow.push(cert);
}
}
});
certsToShow = certsToShow.sort((a, b) => a.class.localeCompare(b.class, 'en', { numeric: true }) || a.order - b.order)
return certsToShow;
},
sort(p) {
Expand Down Expand Up @@ -342,15 +339,11 @@ export default {
background: $cert_training;
}
&.cert_center {
&.cert_tier-one {
background-color: $secondary-color-dark;
}
&.cert_major {
background: $secondary-color;
}
&.cert_minor {
&.cert_tier-two {
background: $secondary-color-light;
}
}
Expand Down
96 changes: 57 additions & 39 deletions src/views/admin/controllers/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,60 @@
<i v-else class="material-icons red-text text-darken-1">remove_circle</i>
</div>
</div>
<div class="input-field col s12">
<label for="certs" class="active">Certifications</label>
<div class="input-field col s5">
<label for="certs" class="active">Endorsements</label>
<div id="certs_container">
<span
id="enroute"
:class="{active: form.certs.enroute}"
class="cert cert_major"
@click="toggleCert">Center</span>
<span
id="p50"
:class="{active: form.certs.p50}"
class="cert cert_major"
@click="toggleCert">P50</span>
<span
id="kphxtower"
:class="{active: form.certs.kphxtower}"
class="cert cert_major"
@click="toggleCert">KPHX TWR</span>
<span
id="zab"
:class="{active: form.certs.zab}"
class="cert cert_center"
@click="toggleCert">Albuquerque Center</span>
<span
id="p50app"
:class="{active: form.certs.p50app}"
class="cert cert_major"
@click="toggleCert">Major Approach</span>
<span
id="p50twr"
:class="{active: form.certs.p50twr}"
class="cert cert_major"
@click="toggleCert">Major Tower</span>
id="kphxground"
:class="{active: form.certs.kphxground}"
class="cert cert_major"
@click="toggleCert">KPHX GND</span>
</div>
<div id="tier_one_explainer">
<p class="endorsement_category_explainer">Tier One</p>
</div>
</div>
<div class="input-field col s7">
<div id="certs_container">
<span
id="p50gnd"
:class="{active: form.certs.p50gnd}"
class="cert cert_major"
@click="toggleCert">Major Ground</span>
id="kabq"
:class="{active: form.certs.kabq}"
class="cert cert_minor m-1"
style="margin-left: 0"
@click="toggleCert">KABQ</span>
<span
id="app"
:class="{active: form.certs.app}"
class="cert cert_minor"
@click="toggleCert">Minor Approach</span>
id="kflg"
:class="{active: form.certs.kflg}"
class="cert cert_minor tier_two_button"
@click="toggleCert">KFLG</span>
<span
id="twr"
:class="{active: form.certs.twr}"
class="cert cert_minor"
@click="toggleCert">Minor Tower</span>
id="kluf"
:class="{active: form.certs.kluf}"
class="cert cert_minor tier_two_button"
@click="toggleCert">KLUF</span>
<span
id="gnd"
:class="{active: form.certs.gnd}"
class="cert cert_minor"
@click="toggleCert">Minor Ground</span>
id="ksaf"
:class="{active: form.certs.ksaf}"
class="cert cert_minor tier_two_button"
@click="toggleCert">KSAF</span>
</div>
<div id="tier_two_explainer">
<p class="endorsement_category_explainer">Tier Two</p>
</div>
</div>
<div class="input-field col s12">
Expand Down Expand Up @@ -116,13 +132,6 @@ export default {
oi: '',
vis: false,
certs: {
zab: false,
p50app: false,
p50twr: false,
p50gnd: false,
app: false,
twr: false,
gnd: false
},
roles: {
atm: false,
Expand Down Expand Up @@ -256,4 +265,13 @@ export default {
#certs_container, #roles_container {
margin-top: 5px;
}
.endorsement_category_explainer {
text-style: italic;
font-size: 10px;
}
.tier_two_button {
margin: 0 5px;
}
</style>
16 changes: 15 additions & 1 deletion src/views/admin/feedback/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</div>
</div>
</div>
<div class="modal-footer">
<div class="modal-footer" v-if="requiresAuth(['atm', 'datm', 'ta'])">
<a href="#!" class="waves-effect waves-light btn" @click="approveFeedback(feedback._id)">Approve</a>
<a href="#!" class="waves-effect waves-light btn-flat" @click="rejectFeedback(feedback._id)">Reject</a>
</div>
Expand All @@ -85,6 +85,7 @@
<script>
import {zabApi} from '@/helpers/axios.js';
import RecentFeedback from './Recent.vue';
import { mapState } from 'vuex';
export default {
name: 'Feedback',
Expand All @@ -107,6 +108,14 @@ export default {
});
},
methods: {
requiresAuth(roles) {
const havePermissions = roles.some(r => this.user.data.roleCodes.includes(r));
if(havePermissions) {
return true;
} else {
return false;
}
},
async getUnapproved() {
const {data} = await zabApi.get('/feedback/unapproved');
this.unapproved = data.data;
Expand Down Expand Up @@ -149,6 +158,11 @@ export default {
const ratings = ['Poor', 'Below Average', 'Average', 'Above Average', 'Excellent'];
return ratings[rating - 1];
}
},
computed: {
...mapState('user', [
'user'
])
}
};
</script>
Expand Down
20 changes: 7 additions & 13 deletions src/views/controllers/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ export default {
if(!certs) return [];
const hasCerts = certs.map((cert) => cert.code);
let certsToShow = [];
certs.forEach((cert) => {
if(cert.class === "major" || cert.class === "center") certsToShow.push(cert);
else {
const certPos = cert.code.slice(-3);
if(!hasCerts.includes(`p50${certPos}`)) {
certsToShow.push(cert);
}
certs.forEach(cert => {
if(cert.class === "tier-one" || cert.class === "tier-two") {
certsToShow.push(cert);
}
});
certsToShow = certsToShow.sort((a, b) => a.class.localeCompare(b.class, 'en', { numeric: true }) || a.order - b.order)
return certsToShow;
},
sec2hm(secs) {
Expand Down Expand Up @@ -215,15 +213,11 @@ export default {
background: $cert_training;
}
&.cert_center {
&.cert_tier-one {
background-color: $secondary-color-dark;
}
&.cert_major {
background: $secondary-color;
}
&.cert_minor {
&.cert_tier-two {
background: $secondary-color-light;
}
}
Expand Down
33 changes: 13 additions & 20 deletions src/views/controllers/Roster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,13 @@ export default {
if (!certs) return [];
const hasCerts = certs.map((cert) => cert.code);
let certsToShow = [];
certs.forEach((cert) => {
if (cert.class === "major" || cert.class === "center")
certsToShow.push(cert);
else {
const certPos = cert.code.slice(-3);
if (!hasCerts.includes(`p50${certPos}`)) {
certsToShow.push(cert);
}
}
});
certs.forEach(cert => {
if(cert.class === "tier-one" || cert.class === "tier-two") {
certsToShow.push(cert);
}
});
certsToShow = certsToShow.sort((a, b) => a.class.localeCompare(b.class, 'en', { numeric: true }) || a.order - b.order)
return certsToShow;
},
},
Expand Down Expand Up @@ -272,17 +269,13 @@ td {
background: $cert_training;
}
&.cert_center {
background-color: $secondary-color-dark;
}
&.cert_tier-one {
background-color: $secondary-color-dark;
}
&.cert_major {
background: $secondary-color;
}
&.cert_minor {
background: $secondary-color-light;
}
&.cert_tier-two {
background: $secondary-color-light;
}
}
.tooltipped {
Expand Down
32 changes: 17 additions & 15 deletions src/views/dashboard/training/Request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,29 @@ export default {
},
computed: {
filteredMilestones() {
const certs = this.user.data.certCodes;
const userCerts = this.user.data.certCodes;
const rating = this.user.data.rating;
if(this.milestones) {
const minorPrerequisites = ["obs", "gnd", "twr", "app"];
const majorPrerequisites = ["obs", "gnd", "p50gnd", "p50twr", "p50app"];
const minorPrerequisites = ["obs"];
const majorPrerequisites = ["obs", "kabq", "kphxground", "kphxtower", "p50"];
let milestonesShowed = this.milestones.filter((milestone) => {
if(this.user.data.vis) return (milestone.certCode.substring(0, 3) === "vis" && milestone.rating <= rating) || milestone.code === "GT1";
else {
return ( // This is still slightly hard to understand. It returns the milestones that haven't been completed yet for the rating, or the P50 equivelant (if no major cert has been attained yet) and next rating's milestones, or center milestones if all other certs have been attained.
!certs.includes(milestone.certCode) &&
(
milestone.code === "GT1" ||
(milestone.certCode.substring(0, 3) === "p50" && certs.includes(milestone.certCode.slice(-3)) && certs.includes(majorPrerequisites[milestone.rating - 1])) ||
(milestone.certCode.substring(0, 3) !== "p50" && (certs.includes(minorPrerequisites[milestone.rating - 1]) || (milestone.rating === "1" && certs.length === 0)) && milestone.certCode !== "zab") ||
(milestone.certCode === "zab" && certs.includes("p50app"))
) &&
milestone.certCode.substring(0, 3) !== "vis"
);
const milestoneAvailableAtRating = milestone.availableAtRatings.includes(rating); // Milestones available for rating.
let userHasTierOneForCurrentRating = false;
// See if the user has a tier one cert for their current rating.
if (rating == 2) {
userHasTierOneForCurrentRating = userCerts.includes('kphxground');
} else if (rating == 3) {
userHasTierOneForCurrentRating = userCerts.includes('kphxtower');
}
else if (rating == 4) {
userHasTierOneForCurrentRating = userCerts.includes('p50');
}
// Return milestones available to user (hide tier one if they have the cert already).
return milestoneAvailableAtRating && !(milestone.hiddenWhenControllerHasTierOne && userHasTierOneForCurrentRating)
});
return milestonesShowed;
Expand Down
Loading

0 comments on commit 21201f1

Please sign in to comment.