Skip to content

Commit f4fb20c

Browse files
committed
refactor
1 parent a56d8a7 commit f4fb20c

File tree

10 files changed

+380
-323
lines changed

10 files changed

+380
-323
lines changed

src/components/NewTicket.vue

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
<b-form-select id="satisfaction" :options="SatisfactionArray" required v-model="form.Satisfaction"></b-form-select>
6969
</b-form-group>
7070

71-
<div class="submit-button">
71+
<div class="buttons-container">
72+
<b-button type="button" v-on:click="hideModal">Cancel</b-button>
7273
<b-button type="submit" variant="primary">Submit</b-button>
7374
</div>
7475

@@ -79,6 +80,7 @@
7980
<script>
8081
export default {
8182
name: "NewTicket",
83+
props: ["ticketsLength"],
8284
data: function() {
8385
return {
8486
form: {
@@ -126,9 +128,45 @@ export default {
126128
}
127129
},
128130
methods: {
131+
hideModal() {
132+
this.$emit('close-modal');
133+
this.form = {
134+
"Requestor": null,
135+
"RequestorSeniority": null,
136+
"ITOwner": null,
137+
"FiledAgainst": null,
138+
"TicketType": null,
139+
"Severity": null,
140+
"Priority": null,
141+
"daysOpen": null,
142+
"Satisfaction": null,
143+
"Ticket Creation Date": null
144+
};
145+
},
129146
onSubmit(evt) {
130147
evt.preventDefault();
131-
this.$emit('new-ticket-data', this.form);
148+
149+
let formData = this.form;
150+
151+
// get today's date
152+
let today = new Date();
153+
let dd = today.getDate();
154+
let mm = today.getMonth() + 1; //January is 0!
155+
let yyyy = today.getFullYear();
156+
157+
if (dd < 10) {
158+
dd = '0' + dd;
159+
}
160+
if (mm < 10) {
161+
mm = '0' + mm;
162+
}
163+
today = mm + '/' + dd + '/' + yyyy;
164+
165+
formData["Ticket Creation Date"] = today;
166+
formData.CustomCreated = true;
167+
formData.ticket = this.ticketsLength + 1;
168+
169+
this.$emit('new-ticket-data', formData);
132170
this.form = {
133171
"Requestor": null,
134172
"RequestorSeniority": null,
@@ -150,8 +188,11 @@ export default {
150188
.form-new-ticket {
151189
text-align: initial;
152190
153-
.submit-button {
191+
.buttons-container {
154192
text-align: center;
193+
button {
194+
margin: 0 10px;
195+
}
155196
}
156197
}
157198
</style>

src/components/TicketsTable.vue

Lines changed: 0 additions & 319 deletions
This file was deleted.

0 commit comments

Comments
 (0)