| | |
| | | |
| | | <script lang='ts'> |
| | | import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator'; |
| | | |
| | | import authService from '~/shared/services/auth.service'; |
| | | import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model'; |
| | | |
| | | @Component |
| | |
| | | .map((item) => ({ ...item, formatDate: new Date(item.updateTime || item.createTime)})) |
| | | .sort((preItem, nextItem) => +nextItem.formatDate - +preItem.formatDate ); |
| | | |
| | | // format contacted list |
| | | this.myConsultantList.filter((consultant) => consultant.appointments!.length) |
| | | .forEach((consultant) => { |
| | | consultant.appointments!.forEach((appointment) => { |
| | | const consultantWithAppointmentId: ConsultantWithAppointmentId = { |
| | | ...consultant, |
| | | appointmentId: appointment.id, |
| | | appointmentDate: appointment.appointmentDate, |
| | | appointmentScore: appointment.satisfactionScore, |
| | | appointmentStatus: appointment.communicateStatus, |
| | | }; |
| | | this.contactedList.push(consultantWithAppointmentId); |
| | | }) |
| | | }); |
| | | if (authService.isUserLogin()) { |
| | | this.myConsultantList.filter((consultant) => consultant.appointments!.length) |
| | | .forEach((consultant) => { |
| | | consultant.appointments!.forEach((appointment) => { |
| | | const consultantWithAppointmentId: ConsultantWithAppointmentId = { |
| | | ...consultant, |
| | | appointmentId: appointment.id, |
| | | appointmentDate: appointment.appointmentDate, |
| | | appointmentScore: appointment.satisfactionScore, |
| | | appointmentStatus: appointment.communicateStatus, |
| | | }; |
| | | this.contactedList.push(consultantWithAppointmentId); |
| | | }) |
| | | }); |
| | | |
| | | this.contactedList = this.contactedList |
| | | .filter((appointment) => appointment['appointmentStatus'] === 'contacted') |
| | | .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)})) |
| | | .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime); |
| | | this.contactedList = this.contactedList |
| | | .filter((appointment) => appointment['appointmentStatus'] !== 'reserved') |
| | | .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)})) |
| | | .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime); |
| | | } |
| | | |
| | | } |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |