From 65ebd84c61cf86c12f6180d931a0476d5f4b3cdb Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期二, 15 二月 2022 11:38:37 +0800
Subject: [PATCH] TODO#135406 [顧問] 預約單明細 - 點擊更多約訪紀錄時,改為展開而非導頁

---
 PAMapp/components/Appointment/AppointmentInterviewList.vue |  130 +++++++++++++++----------------------------
 1 files changed, 45 insertions(+), 85 deletions(-)

diff --git a/PAMapp/components/Appointment/AppointmentInterviewList.vue b/PAMapp/components/Appointment/AppointmentInterviewList.vue
index 66c1774..92fe2cc 100644
--- a/PAMapp/components/Appointment/AppointmentInterviewList.vue
+++ b/PAMapp/components/Appointment/AppointmentInterviewList.vue
@@ -1,63 +1,63 @@
 <template>
     <div>
-      <div class="interview__header">
-          <div class="mdTxt">蝝赤蝝����</div>
-          <div class="mdTxt text--underline text--primary"
-          @click="addInterview">+�憓�</div>
-      </div>
-
-      <template v-if="!interviewList.length">
-          <div class="record-card record-card--empty">
-            �蝝赤蝝����
-          </div>
-      </template>
-
-      <template v-if="interviewList.length">
-        <div class="interview--future">
-
-            <div class="record-card">
-                <div class="record-card-date">
-                    <span class="bold">01/10</span>
-                    <span class="mt-5 line-space">09:00</span>
-                </div>
-                <div class="record-card-content">
-                    <span>�����恥�蝝��璅��撱喉�����������靽</span>
-                </div>
-            </div>
+        <div class="interview__header">
+            <div class="mdTxt">蝝赤蝝����</div>
+            <div class="pam-link-button"
+            @click="addInterview">+�憓�</div>
         </div>
 
-        <section class="interview--past">
-            <div class="record-card">
-                <div class="record-card-date">
-                    <span class="bold">01/08</span>
-                    <span class="mt-5 line-space">09:00</span>
-                </div>
-                <div class="record-card-content">
-                    <span>�����縑���閰梯�Ⅳ嚗���������</span>
-                </div>
-            </div>
-        </section>
+        <InterviewCard :interviewList="displayAppointmentList"></InterviewCard>
 
-        <section class="more-log-action">
-                <div class="mdTxt text--primary text--underline">撅��憭�</div>
+        <section class="text--right mt-30 interview-check-more" v-if="interviewList.length > 3">
+                <div class="pam-link-button" @click="readAllList = !readAllList">
+                  {{ readAllList ?  '憿舐內頛��' : '撅��憭�' }}
+                  <i :class="readAllList ? 'icon-top' : 'icon-down'"></i>
+                  </div>
         </section>
-      </template>
     </div>
 </template>
 
 <script lang="ts">
-import { Vue, Component } from 'nuxt-property-decorator';
+import { Vue, Component, Prop, Watch, namespace } from 'nuxt-property-decorator';
+
+import { InterviewRecord } from '~/shared/models/appointment.model';
 
 @Component
 export default class AppointmentInterviewList extends Vue {
 
-  interviewList = [];
+  @Prop()
+  interviewList!: InterviewRecord[];
+
+  appointmentId!: string;
+  displayList: InterviewRecord[] = [];
+  readAllList = false;
+
+  get displayAppointmentList(): InterviewRecord[] {
+    return this.readAllList ? this.displayList : this.displayList.slice(0, 3);
+  }
+
+
+  //////////////////////////////////////////////////////////////////////
+
+  mounted() {
+      this.appointmentId = this.$route.params.appointmentId;
+  }
+
+  //////////////////////////////////////////////////////////////////////
+
+  @Watch('interviewList', {immediate: true})
+  updateInterviewList() {
+      if (this.interviewList && this.interviewList.length > 0) {
+          this.displayList = this.interviewList
+            .map((i) => ({ ...i, sortDate: new Date(i.interviewDate)}))
+            .sort((preItem, nextItem) => +nextItem.sortDate - +preItem.sortDate);
+      }
+  }
 
   //////////////////////////////////////////////////////////////////////
 
   addInterview(): void {
-    const appointmentId = this.$route.params.appointmentId;
-    this.$router.push(`/appointment/${appointmentId}/interview/new`);
+    this.$router.push(`/appointment/${this.appointmentId}/interview/new`);
   }
 
 }
@@ -69,48 +69,8 @@
   justify-content: space-between;
   margin-bottom  : 10px;
 }
-.interview--future{
-    border-bottom: 1px solid #CCCCCC;
-    padding-bottom: 17px;
-    margin-bottom: 17px;
-    .record{
-        display: flex;
-        justify-content: space-between;
-        margin-bottom: 10px;
-    }
-}
-.record-card {
-    height: 62px;
-    border: 1px solid #707070;
-    border-radius: 5px;
-    display: flex;
-    border-bottom: 1px solid #000;
-    .record-card-date{
-        display: flex;
-        flex-direction: column;
-        margin-left: 10px;
-        margin-right: 10px;
-        margin-top: 10px;
-    }
-    .record-card-content{
-        height: 42px;
-        margin-top: 10px;
-        margin-right: 10px;
-        line-height: 1.2;
-    }
-  &.record-card--empty {
-    align-items     : center;
-    background-color: #fff;
-    color           : $MID_GREY;
-    justify-content : center;
-  }
-}
-.line-space{
-    letter-spacing: 1px;
-}
-.more-log-action{
-    margin-top: 30px;
-    display: flex;
-    justify-content:flex-end;
+.interview-check-more{
+  display: flex;
+  justify-content: center;
 }
 </style>

--
Gitblit v1.8.0