diff --git a/src/helpers/uriHelper.js b/src/helpers/uriHelper.js index 5140c822..67dfc690 100644 --- a/src/helpers/uriHelper.js +++ b/src/helpers/uriHelper.js @@ -5,8 +5,8 @@ export const vatsimAuthRedirectUrl = `${getAuthEndpoint()}/oauth/authorize?clien export const discordRedirectUrl = `https://discord.com/api/oauth2/authorize?client_id=546531280842653696&redirect_uri=https%3A%2F%2Fzmaartcc.net%2Fconnect%2Fdiscord&response_type=code&scope=identify`; function getClientId() { - // const ClientId = 1246; - const ClientId = 1188; + const ClientId = 1246; + // const ClientId = 1188; return ClientId; diff --git a/src/views/dashboard/training/Index.vue b/src/views/dashboard/training/Index.vue index 6ec676d0..8e7a761e 100644 --- a/src/views/dashboard/training/Index.vue +++ b/src/views/dashboard/training/Index.vue @@ -3,10 +3,10 @@
Training Requests
- + rel="noopener noreferrer" class="btn right">Training Information
Request
diff --git a/src/views/instructor/solocerts/Index.vue b/src/views/instructor/solocerts/Index.vue index 5cb61cc5..7f30c7da 100644 --- a/src/views/instructor/solocerts/Index.vue +++ b/src/views/instructor/solocerts/Index.vue @@ -2,7 +2,7 @@
-
Solo Certificates
+
VATUSA Solo Certificates
New
@@ -46,6 +46,51 @@
+
+
+
+
Tower Solo Certificates
+
+
+

There are no solo certificates on record for ZMA

+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
ControllerPositionExpiresOptions
{{user.fname}} {{user.lname}}TWR{{user.towersoloExpiration.slice(0,10)}} + delete +
+
@@ -61,13 +106,16 @@ export default { positions: ['MIA', 'FLL', 'TPA', 'PBI', 'RSW', 'NQX', 'ZMO'], certs: [], controllers: null, - loading: true - }; + loading: true, + towercerts: [] + } }, async mounted() { await this.getControllers(); await this.getSoloCerts(); + await this.getLocalCerts(); + this.loading = false; M.Tooltip.init(document.querySelectorAll('.tooltipped'), { @@ -86,12 +134,11 @@ export default { // Fetch and decode API data. // The API returns back base 64 encoded data with authentication blocks. The payload needs to be base64 decoded and then parsd for json. - const {data} = await vatusaApi.get('/solo'); - const payload = atob(data.payload); - var data1 = JSON.parse(payload); - for (const cert of data1.data) { - if(this.positions.includes(cert.position.slice(0, 3))) - this.certs.push(cert); + const {data} = await vatusaApi.get('/solo'); + + for (const cert of data.data) { + if(this.positions.includes(cert.position.slice(0, 3))) + this.certs.push(cert); } } catch(e) { @@ -106,27 +153,44 @@ export default { console.log(e); } }, - async deleteCert(id, cid, position) { + async getLocalCerts() { try { - const formData = new FormData(); - formData.append('id', id); - - // form data seems not to be passed when using the DELETE method. This works only when the ID is passed on the URL. - await vatusaApiAuth.delete('/solo?id='+id, {data: formData}); + const {data} = await zabApi.get('/training/solo'); + for (const user of data.data.users) { + this.towercerts.push(user); + } - this.toastSuccess('Solo Certification deleted'); + } catch(e) { + console.log(e); + } + }, + async deleteCert(id, cid, position) { + try { + const {data} = await zabApi.post('/training/solodelete/'+cid, { + position: position + }); + + if (position.slice(-3)==='APP' || position.slice(-3)==='CTR') + { + await vatusaApiAuth.delete('/solo?id='+id, { + id: id + }); + } + this.toastSuccess('Solo Certification deleted'); + this.certs = []; await this.getSoloCerts(); - + await this.getLocalCerts(); + this.$router.push('/ins/solo'); + this.$router.go(); this.$nextTick(() => { M.Modal.getInstance(document.querySelector('.modal_delete')).close(); - }); - + }); } catch(e) { - this.toastError(e); + this.toastError(e); } - }, + }, getName(cid2) { const controller = this.controllers.filter(i => { return i.cid === cid2; }); return controller[0].fname + ' ' + controller[0].lname; diff --git a/src/views/instructor/solocerts/New.vue b/src/views/instructor/solocerts/New.vue index 2bb31802..3ce109cc 100644 --- a/src/views/instructor/solocerts/New.vue +++ b/src/views/instructor/solocerts/New.vue @@ -14,6 +14,8 @@ Please ensure that the student's training records have been entered onto their ZMA and VATUSA record prior to issuance of any solo certification.

+ Tier 2 Solo Certifications should be entered as 'TWR', 'APP', or 'CTR'. +

Ensure that you enter solo certifications into the appropriate system in accordance with section 8.4 of the Miami ARTCC SOP. The student cannot take advantage of solo certifications that are not entered correctly. @@ -28,9 +30,17 @@
-
- - +
+ + +
@@ -88,18 +98,33 @@ export default { }); }, async submitCert() { - try { - const formData = new FormData(); - formData.append('cid', this.form.cid); - formData.append('position', this.form.position); - formData.append('expDate', this.$refs.expirationDate.value); - await vatusaApiAuth.post('/solo', formData); + console.log(this.form.position); + if (this.form.position === "TWR" || this.form.position === "APP" || this.form.position === "CTR") + { + try { + + await zabApi.post('/training/solo/'+this.form.cid, + { + cid: this.form.cid, + position: this.form.position, + expDate: this.$refs.expirationDate.value + }); + if (this.form.position.slice(-3)==='APP' || this.form.position.slice(-3)==='CTR') + await vatusaApiAuth.post('/solo', + { + cid: this.form.cid, + position: this.form.position, + expDate: this.$refs.expirationDate.value + }); + - this.toastSuccess('Solo Certification issued'); + this.toastSuccess('Solo Certification issued'); - this.$router.push('/ins/solo'); - } catch(e) { - this.toastError(e); + this.$router.push('/ins/solo'); + this.$router.go(); + } catch(e) { + this.toastError(e); + } } } }