diff --git a/src/components/global/requestForm.vue b/src/components/global/requestForm.vue
index 2577602..c015bbd 100644
--- a/src/components/global/requestForm.vue
+++ b/src/components/global/requestForm.vue
@@ -20,6 +20,7 @@ v-dialog(v-model="dialog" max-width="500px")
v-date-picker(v-model="dateFrom" @input="$refs.menuFrom.save(dateFrom); getDayOfWeek(dateFrom)" no-title scrollable)
v-spacer
v-btn(text color="grey" @click="menuFrom = false") Cancel
+
v-col(cols="6")
v-menu(ref="menuTo" v-model="menuTo" :close-on-content-click="false" :return-value.sync="dateTo"
transition="scale-transition" offset-y min-width="auto")
@@ -39,7 +40,7 @@ v-dialog(v-model="dialog" max-width="500px")
v-card-actions
v-spacer
v-btn(color="grey" text @click="dialog = false") Cancel
- v-btn(color="#F2594B" medium class="white--text" :disabled="disableBtn()" @click="dialog = false; submit()") Submit
+ v-btn(color="#F2594B" medium class="white--text" :disabled="disableBtn()" @click="submit(); this.dialog = false") Submit
@@ -100,6 +101,7 @@ export default class requestForm extends ScheduleBase {
if(response.data.length != 0) {
let schedule: schedule = response.data[0]
if(schedule[this.schedule_days[this.dayOfWeek-1]] != "00:00:00") {
+
this.$axios.post('/timeoff/create/', {
'start_date': this.dateFrom,
'end_date': this.dateTo,
@@ -140,4 +142,4 @@ export default class requestForm extends ScheduleBase {
\ No newline at end of file
+
diff --git a/src/components/global/requestsTable.vue b/src/components/global/requestsTable.vue
index e71d3c9..3a7fe74 100644
--- a/src/components/global/requestsTable.vue
+++ b/src/components/global/requestsTable.vue
@@ -36,6 +36,7 @@ div
template(v-slot:item.actions="{ item }")
v-icon(@click="triggerDialog(item.id, 1)" color="green") mdi-check
v-icon(@click="denyTimeoff(item.id, 2)" color="red") mdi-cancel
+ v-icon(@click="deleteTimeOffRequest(item.id)" color="red") mdi-delete-outline
v-menu(offset-y)
v-dialog(v-model="dialog" width="500")
v-card
@@ -198,15 +199,46 @@ export default class requestsTable extends ScheduleBase {
}
denyTimeoff(id: number, status: number) {
+ this.$axios.patch('/timeoff/'+ id + '/review_user_timeoff_request/', {
+ // 2 is becuase it's denied, 1 is approved, will fix magic number later
+ 'status': 2,
+ 'reason': this.reason
+ })
+ .then((response: any) => {
+ var removeIndex = this.timeoffRequests.map(item => item.id).indexOf(this.id)
+ this.timeoffRequests[removeIndex]['status'] = this.parseStatus(this.status)
+ this.requesterName = this.timeoffRequests[removeIndex]['user']
+ this.message = this.writeEmailMessage(this.timeoffRequests[removeIndex])
+ this.sendEmail = true
+ this.status = 0
+ this.reason = ''
+ this.id = 0
+ })
+ .catch((error) => {
+ console.log(error)
+ })
var removeIndex = this.timeoffRequests.map(item => item.id).indexOf(id)
this.timeoffRequests[removeIndex]['status'] = this.parseStatus(status)
this.requesterName = this.timeoffRequests[removeIndex]['user']
this.message = this.writeEmailMessage(this.timeoffRequests[removeIndex])
this.sendEmail = true
+ this.dialog = false
}
+
+ deleteTimeOffRequest(id: number) {
+ this.$axios.delete('/timeoff/'+ id + '/delete/')
+ .then((response: any) => {
+ var removeIndex = this.timeoffRequests.map(item => item.id).indexOf(id)
+ this.timeoffRequests.splice(removeIndex, 1)
+ })
+ .catch(function (error: any) {
+ console.log(error)
+ })
+ }
+
}
\ No newline at end of file
+