<template>
|
<div>
|
<template v-if="!interviewList.length">
|
<div class="record-card record-card--empty">
|
無約訪紀錄
|
</div>
|
</template>
|
|
<template v-else>
|
<div class="interview--future">
|
<div class="record-card mb-10"
|
v-for="(item, index) in futureList"
|
:key="index + 'feature'"
|
@click="editInterview(item)"
|
>
|
<div class="record-card-date">
|
<div>
|
<UiDateFormat
|
class="date bold"
|
:date="item.interviewDate"
|
onlyShowSection="DAY" />
|
</div>
|
<div>
|
<UiDateFormat
|
class="time mt-5 line-space"
|
:date="item.interviewDate"
|
onlyShowSection="TIME" />
|
</div>
|
</div>
|
<div class="record-card-content">
|
<span>{{item.content}}</span>
|
</div>
|
</div>
|
</div>
|
|
<section class="interview--past" v-if="pastList.length">
|
<div class="record-card mb-10"
|
v-for="(item, index) in pastList"
|
:key="index + 'past'"
|
@click="editInterview(item)"
|
>
|
<div class="record-card-date">
|
<div>
|
<UiDateFormat
|
class="date bold"
|
:date="item.interviewDate"
|
onlyShowSection="DAY" />
|
</div>
|
<div>
|
<UiDateFormat
|
class="time mt-5 line-space"
|
:date="item.interviewDate"
|
onlyShowSection="TIME" />
|
</div>
|
</div>
|
<div class="record-card-content">
|
<span>{{item.content}}</span>
|
</div>
|
</div>
|
</section>
|
</template>
|
</div>
|
</template>
|
|
<script lang="ts">
|
import { Component, Prop, Vue, Watch } from "nuxt-property-decorator";
|
import { InterviewRecord } from "~/shared/models/appointment.model";
|
|
@Component
|
export default class InterviewCard extends Vue {
|
|
@Prop()
|
interviewList!: InterviewRecord[];
|
|
futureList: InterviewRecord[] = [];
|
pastList: InterviewRecord[] = [];
|
|
appointmentId!: number;
|
|
mounted() {
|
this.appointmentId = +this.$route.params.appointmentId;
|
}
|
|
@Watch('interviewList', {immediate: true})
|
onInterviewListChange() {
|
if (this.interviewList.length > 0) {
|
this.futureList = this.interviewList
|
.filter(item => new Date(item.interviewDate).getTime() >= new Date().getTime())
|
.sort((preItem, nextItem) => +new Date(nextItem.interviewDate) - +new Date(preItem.interviewDate));
|
this.pastList = this.interviewList
|
.filter(item => new Date(item.interviewDate).getTime() < new Date().getTime())
|
.sort((preItem, nextItem) => +new Date(nextItem.interviewDate) - +new Date(preItem.interviewDate));
|
}
|
|
}
|
|
editInterview(interviewRecord) {
|
this.$router.push(`/appointment/${this.appointmentId}/interview/${interviewRecord.id}`);
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.interview--future{
|
.record{
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 10px;
|
}
|
}
|
.interview--past {
|
border-top: 1px solid #CCCCCC;
|
padding-top: 17px;
|
margin-top: 17px;
|
}
|
.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;
|
}
|
</style>
|