HTML
xxxxxxxxxx
1
<template>
2
<section class="form-simple" >
3
<mdb-container>
4
<h3 class="my-2 text-center"> </h3>
5
<mdb-row name="master-row">
6
<mdb-col md="8" offset="2" name="master-col">
7
<mdb-card>
8
<mdb-card-body>
9
<h4 class="text-center font-weight-bold pt-1 pb-3"><strong>Manage IC List</strong></h4>
10
11
<p>Select the IC from the dropdown or add a new IC to the IC list.</p>
12
<hr color="black"/>
13
14
<!--
15
<h4 v-show="errorExists == true" class="font-weight-bold pl-0 my-2 text-center danger-color-dark text-white"><strong>Validation Failed</strong></h4>
16
<hr v-show="errorExists == true"/>
17
-->
18
19
<h5 v-if="submissionCompleted == true" class="font-weight-bold pl-0 my-2 text-center success-color-dark text-white"><strong>Submission Completed Successfully</strong></h5>
20
21
<mdb-row name="ic-row1" class="my-0">
22
<mdb-col name="ic-col" class="my-0" md="6">
23
<label class="font-weight-bold my-0">Incident Commander</label>
24
<mdb-select class="my-0" ref="ic" name="ic" id="ic" v-model="ic_list" color="primary" @getValue="getICDetail($event)">
25
</mdb-select>
26
</mdb-col>
27
</mdb-row>
28
<mdb-row name="ic-row2" class="my-0">
29
<mdb-col name="ic-col1" class="my-0" md="5">
30
<label class="font-weight-bold my-0">Current Rating</label>
31
<mdb-select class="my-0" v-model="ic_types" color="primary">
32
</mdb-select>
33
</mdb-col>
34
<mdb-col name="ic-col3" class="my-0 text-right" md="1">
35
<label class="font-weight-bold my-0">Trainee</label>
36
<mdb-input type="checkbox" ref="trainee" id="trainee" class="my-0 align-bottom" v-model="ic_record.trainee" color="primary" @click.native="ic_record.trainee = !(ic_record.trainee != false)" filled/>
37
</mdb-col>
38
</mdb-row>
39
<mdb-row name="ic-row3" class="my-0">
40
<mdb-col name="ic-col2" class="my-0" md="6">
41
<label class="font-weight-bold my-0">CAPID</label>
42
<mdb-input type="text" ref="capid" class="my-0 align-bottom" v-model="ic_capid" color="primary"/>{{ ic_record }}
43
</mdb-col>
44
</mdb-row>
45
46
<mdb-btn v-show="submissionCompleted != true" size="sm" class="md-primary md-raised float-right" color="primary" rounded @click="addCapids" ref="addCapids">Add CAP ID's</mdb-btn>
47
<mdb-btn v-show="submissionCompleted == true" size="sm" class="md-primary md-raised float-right" color="primary" rounded @click="goHome" ref="homeButton">Close</mdb-btn>
48
<mdb-btn v-show="submissionCompleted != true" size="sm" class="md-primary md-raised float-right" color="primary" rounded @click="goHome" ref="cancelButton">Cancel</mdb-btn>
49
50
</mdb-card-body>
51
</mdb-card>
52
</mdb-col>
53
</mdb-row>
54
</mdb-container>
55
</section>
56
</template>
SCSS
1
1
JS
xxxxxxxxxx
1
import { mdbRow, mdbCol, mdbCard, mdbCardBody, mdbInput, mdbBtn, mdbIcon, mdbContainer, mdbSelect} from 'mdbvue';
2
import {APIVars} from '../../src/config.js';
3
import axios from 'axios';
4
5
export default {
6
name: 'ManageICListPage',
7
components: {
8
mdbRow,
9
mdbCol,
10
mdbCard,
11
mdbCardBody,
12
mdbInput,
13
mdbBtn,
14
mdbIcon,
15
mdbContainer,
16
mdbSelect
17
},
18
data() {
19
return {
20
ic_record: {
21
alwaysavailable: null,
22
area: '',
23
areasort: null,
24
capid: '',
25
cellphone: null,
26
email: '',
27
homephone: null,
28
ictype: '',
29
ictypeweight: null,
30
id: null,
31
membersort: null,
32
mentor: '',
33
name: '',
34
radio: '',
35
sortpriority: null,
36
trainee: false,
37
workphone: null
38
},
39
ic_list: [],
40
ic_types: [
41
{ text: '', value: null, disabled: true, selected: true },
42
{ text: 'IC1', value: 'IC1' },
43
{ text: 'IC2', value: 'IC2' },
44
{ text: 'IC3', value: 'IC3' }
45
],
46
ic_trainee_status: false,
47
ic_capid: '',
48
submissionCompleted: false
49
};
50
},
51
created() {
52
// this.ic_record.alwaysavailable = null;
53
// this.ic_record.area = '';
54
// this.ic_record.areasort = null;
55
// this.ic_record.capid = '';
56
// this.ic_record.cellphone = null;
57
// this.ic_record.email = '';
58
// this.ic_record.homephone = null;
59
// this.ic_record.ictype = '';
60
// this.ic_record.ictypeweight = null;
61
// this.ic_record.id = null;
62
// this.ic_record.membersort = null;
63
// this.ic_record.mentor = '';
64
// this.ic_record.name = '';
65
// this.ic_record.radio = '';
66
// this.ic_record.sortpriority = null;
67
// this.ic_record.trainee = false;
68
// this.ic_record.workphone = null;
69
70
if (this.$adal.isAuthenticated() == false)
71
{
72
//this.$router.replace('HomePage');
73
}
74
else
75
{
76
//Create Axious Config Entry which contains headers and responseType
77
var config = {
78
headers: { 'Content-Type': 'application/json' },
79
responseType: 'text'
80
};
81
82
//Make the HTTP Post to validate the member
83
axios.post(APIVars.AdminToolsAPIBaseUrl + APIVars.GetICListRoute + '?wing=' + this.$parent.Wing + '&basic=1', config)
84
.then(response => {
85
console.log(response.data);
86
response.data.push({ text: '', value: null, disabled: true, selected: true });
87
this.ic_list = response.data;
88
})
89
.catch(e => {
90
// this.errors.push(e);
91
// console.log(e);
92
this.loading=0;
93
});
94
}
95
},
96
97
methods: {
98
getICDetail (event) {
99
//Create Axious Config Entry which contains headers and responseType
100
var config = {
101
headers: { 'Content-Type': 'application/json' },
102
responseType: 'text'
103
};
104
105
//Make the HTTP Post to validate the member
106
axios.post(APIVars.AdminToolsAPIBaseUrl + APIVars.GetICDetails + '?wing=' + this.$parent.Wing + '&capid=' + event, config)
107
.then(response => {
108
var json = response.data[0];
109
console.log(json);
110
this.ic_record = json;
111
this.ic_capid = json.capid;
112
this.selectICTypeOption(json.ictype);
113
this.ic_trainee_status = json.trainee;
114
})
115
.catch(e => {
116
// this.errors.push(e);
117
// console.log(e);
118
});
119
},
120
addCapids() {
121
//
122
},
123
goHome () {
124
this.$router.push({ name: "HomePage"});
125
},
126
selectICTypeOption(key) {
127
this.ic_types.forEach(option => {
128
129
if (option.value == key)
130
{
131
option.selected = true;
132
}
133
else
134
{
135
option.selected = false;
136
}
137
138
});
139
this.ic_types.sort();
140
},
141
setTraineeStatus(event) {
142
console.log(event);
143
}
144
}
145
};
146
147
Console errors: 0