From 0c669a9cf2ac6c2605953ecad7e116f206866de8 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期一, 24 一月 2022 09:40:13 +0800
Subject: [PATCH] fixed: 系統通知紀錄-若僅 mail 則無預約時間

---
 PAMapp/components/Client/ClientCard.vue |   63 ++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index faa1c35..294eb5f 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -14,7 +14,7 @@
             </div>
 
             <div class="pl-10">
-                <div class="smTxt_bold name">{{ client.name }}</div>
+                <div class="smTxt_bold name">{{ client.name || 'NO NAME' }}</div>
                 <div  v-if="client.communicateStatus === contactStatus.RESERVED" class="my-10 xsTxt">������</div>
                 <div
                   class="xsTxt mb-10 mt-10"
@@ -25,10 +25,12 @@
                   class="xsTxt mb-10 mt-10"
                   v-else>
                   皛踵�漲
-                  <span v-if="client.satisfactionScore" class="xsTxt">{{ client.satisfactionScore }}</span>
+                  <span v-if="client.satisfactionScore" class="xsTxt text--primary">
+                    <UiReviewScore :score="client.satisfactionScore"></UiReviewScore>
+                  </span>
                   <span v-else class="xsTxt text--mid_grey">�憛�</span>
                 </div>
-                <div class="professionals" v-if="client.communicateStatus === contactStatus.RESERVED">
+                <div class="professionals mb-10" v-if="client.communicateStatus === contactStatus.RESERVED">
                     <template v-if="client.requirement">
                         <span
                             v-for="(item, index) in requirements"
@@ -168,17 +170,20 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Action, namespace, Watch } from 'nuxt-property-decorator';
+import { Vue, Component, Prop, namespace, Watch } from 'nuxt-property-decorator';
 
 import appointmentService from '~/shared/services/appointment.service';
 import myConsultantService from '~/shared/services/my-consultant.service';
 import UtilsService from '~/shared/services/utils.service';
 import { hideReviews } from '~/shared/const/hide-reviews';
 import { ElRow } from 'element-ui/types/row';
-import { Appointment, AppointmentMemoInfo, ToInformAppointment } from '~/shared/models/appointment.model';
+import { Appointment, AppointmentMemoInfo } from '~/shared/models/appointment.model';
 import { ContactStatus } from '~/shared/models/enum/contact-status';
+import reviewsService from '~/shared/services/reviews.service';
 
-const localStorage = namespace('localStorage');
+const appointmentStore = namespace('appointment.store');
+const localStorage     = namespace('localStorage');
+
 @Component({
     filters: {
         formatNumber(index: number) {
@@ -199,11 +204,17 @@
     }
 })
 export default class ClientList extends Vue {
-    @Action
-    updateMyAppointment!: (data: Appointment) => void;
-
     @Prop()
     client!: Appointment;
+
+    @appointmentStore.Action
+    updateMyAppointmentList!: (data: Appointment) => void;
+
+    @appointmentStore.Action
+    getAppointmentDetail!: (appointmentId: number) => Promise<Appointment>;
+
+    @appointmentStore.Getter
+    appointmentProgress!: ContactStatus;
 
     @localStorage.Mutation
     storageClearAppointmentIdFromMsg!: () => void;
@@ -246,7 +257,10 @@
     //////////////////////////////////////////////////////////////////////
 
     viewAppointmentDetail(): void {
-      this.$router.push(`/appointment/${this.client.id}`);
+      this.getAppointmentDetail(this.client.id).then((_) => {
+        this.readAppointment();
+        this.$router.push(`/appointment/${this.client.id}`);
+      });
     }
 
     showAddInterviewDialog(): void {
@@ -254,15 +268,16 @@
     }
 
     navigateToCloseAppointment(): void {
-      this.$router.push(`/appointment/${this.client.id}/close`);
-    }
-
-    makeAppointment(): void {
-      alert('MAKE AN APPOINTMENT!');
+      this.getAppointmentDetail(this.client.id).then((_) => {
+        this.$router.push(`/appointment/${this.client.id}/close`);
+      });
     }
 
     inviteReview(): void {
-      this.isShowInviteReviewDialog = true ;
+        reviewsService.sendSatisfactionToClient(this.client.id).then(res => {
+            this.isShowInviteReviewDialog = true ;
+        })
+
     }
 
     openDetail() {
@@ -275,22 +290,26 @@
 
     markAppointment() {
         myConsultantService.markAsContact(this.client.id).then(data => {
-            this.updateMyAppointment(data);
+            this.updateMyAppointmentList(data);
             this.isShowInformDialog = false;
         })
     }
 
     closeInformDialog(): void {
-      const unread = !this.client.consultantReadTime;
+        this.readAppointment();
+        this.isEdit = false;
+        this.clearAppointmentIdFromMsg();
+    }
+
+    private readAppointment(): void {
+        const unread = !this.client.consultantReadTime;
         if (unread) {
             appointmentService.recordRead(this.client.id).then((_) => {
                 const updatedClient = {...this.client};
                 updatedClient.consultantReadTime = new Date().toString();
-                this.updateMyAppointment(updatedClient);
+                this.updateMyAppointmentList(updatedClient);
             });
         };
-        this.isEdit = false;
-        this.clearAppointmentIdFromMsg();
     }
 
     private clearAppointmentIdFromMsg() {
@@ -347,7 +366,7 @@
         this.memo = this.memoInfo.content;
     }
 
-      get newAppointment(): boolean {
+    get newAppointment(): boolean {
       return !this.client.consultantViewTime
             && this.client.communicateStatus === 'reserved';
     }

--
Gitblit v1.8.0