From 879adfaac8db6a72e92bf607004e5f0c207d081e Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 8 Mar 2024 14:59:33 +0100 Subject: [PATCH] refs #6755 restore fix --- .../ticket/front/descriptor-menu/index.html | 1 + modules/ticket/front/descriptor-menu/index.js | 45 ++++++++++++------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index cb7eeb8ee..0b9b1b2a1 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -86,6 +86,7 @@ translate> Delete ticket + {{$ctrl.canRestoreTicket}} { + console.log(res); + console.log(res.data.creationDate); + if (res && res.data) { + console.log(res.data); + const now = Date.vnNew(); + const maxDate = new Date(res.data.creationDate); + maxDate.setHours(maxDate.getHours() + 1); + console.log(now, maxDatenow); + console.log(now.getTime(), maxDate.getTime()); + if (now <= maxDate) + return this.canRestoreTicket = true; + } + this.canRestoreTicket = false; + }) + .catch(() => { + console.log('ENTRY'); + this.canRestoreTicket = false; + }); } get isInvoiced() { @@ -172,21 +200,6 @@ class Controller extends Section { }); } - get canRestoreTicket() { - const isDeleted = this.ticket.isDeleted; - const now = Date.vnNew(); - const maxDate = new Date(this.ticket.updated); - maxDate.setHours(maxDate.getHours() + 1); - - return isDeleted && (now <= maxDate); - // return this.$http.get(`TicketLogs`).then(res => { - // if (res && res.data.length) - // console.log(res.data); - // console.log(res); - // return true; - // }); - } - restoreTicket() { return this.$http.post(`Tickets/${this.id}/restore`) .then(() => this.reload())