Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/global/requestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

</template>

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -140,4 +142,4 @@ export default class requestForm extends ScheduleBase {

<style scoped>

</style>
</style>
34 changes: 33 additions & 1 deletion src/components/global/requestsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}

}
</script>

<style scoped>

</style>
</style>