From 1cafee82b5a28e83506abb7639d9522d946133f8 Mon Sep 17 00:00:00 2001 From: TatsatJha Date: Wed, 13 Aug 2025 13:53:41 -0700 Subject: [PATCH 1/3] submit before resetting form --- src/components/global/requestForm.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/global/requestForm.vue b/src/components/global/requestForm.vue index 2577602..43a8c99 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,16 @@ 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") { + + // TODO - fix this request + // the form data is not being sent to the server + console.log(this.dateFrom) + console.log(this.dateTo) + console.log(this.startTime) + console.log(this.endTime) + console.log(this.allDay) + console.log(this.type) + console.log(this.reason) this.$axios.post('/timeoff/create/', { 'start_date': this.dateFrom, 'end_date': this.dateTo, @@ -140,4 +151,4 @@ export default class requestForm extends ScheduleBase { \ No newline at end of file + From 721655b373be48119e5c336c91fdebeb4d48b84f Mon Sep 17 00:00:00 2001 From: TatsatJha Date: Tue, 19 Aug 2025 11:28:49 -0700 Subject: [PATCH 2/3] [diging/schedule-client#73]fix listed bugs in timeoff table --- src/components/global/requestsTable.vue | 34 ++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) 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 + From 3cf3aaef9e1d8a0e4cc6ff3072caa7616faf149d Mon Sep 17 00:00:00 2001 From: TatsatJha Date: Tue, 19 Aug 2025 11:30:34 -0700 Subject: [PATCH 3/3] update request form --- src/components/global/requestForm.vue | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/components/global/requestForm.vue b/src/components/global/requestForm.vue index 43a8c99..c015bbd 100644 --- a/src/components/global/requestForm.vue +++ b/src/components/global/requestForm.vue @@ -102,15 +102,6 @@ export default class requestForm extends ScheduleBase { let schedule: schedule = response.data[0] if(schedule[this.schedule_days[this.dayOfWeek-1]] != "00:00:00") { - // TODO - fix this request - // the form data is not being sent to the server - console.log(this.dateFrom) - console.log(this.dateTo) - console.log(this.startTime) - console.log(this.endTime) - console.log(this.allDay) - console.log(this.type) - console.log(this.reason) this.$axios.post('/timeoff/create/', { 'start_date': this.dateFrom, 'end_date': this.dateTo,