-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomerPreview.vue
130 lines (126 loc) · 3.9 KB
/
customerPreview.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
<div class="customers-preview">
<a-space>
<template v-for="(customer, index) in props.dataCustomers">
<a-popover overlayClassName="customers-preview-overlay" :placement="props.placement" :auto-adjust-overflow="false">
<temlate v-if="customer?.fullName || customer.name">
<a-tag :color="colorStyle[index%4]" class="customers-full-name">
{{ customer.fullName ? customer.fullName : customer.name }}
</a-tag>
</temlate>
<temlate v-else>
<span class="info-not-updated-yet"> Họ tên chưa cập nhật </span>
</temlate>
<template #content>
<div class="sub-customer">
<div class="avatar">
<a-avatar v-if="customer.avatar != null" :src="customer.avatar" :size="100" />
<a-avatar v-else :style="`background-color: #${colorStyle[index]}`" :size="100">
<strong>{{ customer.firstName ? customer.firstName.charAt(0).toUpperCase() : 'N' }}</strong>
</a-avatar>
</div>
<p class="fullName">
<strong>
<span v-if="customer.fullName || customer.name">
{{ customer.fullName || customer.name}}
</span>
<span v-else class="info-not-updated-yet"> Họ tên chưa cập nhật </span>
</strong>
</p>
<p class="email">
<span class="icon"><mail-outlined /></span>
<span style="display: inline-block; width: 50px">Email:</span>
<span v-if="customer.email">
<a :href="`mailto:${customer.email}`">{{ customer.email }}</a>
</span>
<span v-else class="info-not-updated-yet"> Chưa cập nhật </span>
</p>
<p class="phone">
<span class="icon"><mobile-outlined /></span>
<span style="display: inline-block; width: 50px">Phone: </span>
<span v-if="customer.phone">
<a :href="`tel:${customer.phone}`">{{ customer.phone }}</a>
</span>
<span v-else class="info-not-updated-yet"> Chưa cập nhật </span>
</p>
<div class="button-view">
<NuxtLink :to="`/crm/customer/${customer.id}/detail`">Thông tin chi tiết</NuxtLink>
</div>
</div>
</template>
</a-popover>
</template>
</a-space>
</div>
</template>
<script setup>
import { MailOutlined, MobileOutlined } from '@ant-design/icons-vue';
import { watchEffect } from 'vue';
const colorStyle = ['#f50', '#2db7f5', '#87d068', '#108ee9'];
const props = defineProps({
dataCustomers: {
type: Array,
default: [],
},
placement: {
type: String,
default: 'top',
},
});
</script>
<style lang="scss">
.customers-preview {
.info-not-updated-yet {
font-style: italic;
color: #ccc;
}
}
.customers-preview-overlay {
position: absolute;
z-index: 10000;
padding-top: 10%;
padding-right: 32%;
.info-not-updated-yet {
font-style: italic;
color: #ccc;
}
.ant-popover-inner-content {
padding: 0;
}
.sub-customer {
width: 300px;
position: absolute;
bottom: 0;
left: 0;
background: #fff;
border-radius: 18px;
padding: 20px;
border: 1px solid rgba(0, 0, 0, 0.01);
box-shadow: 0 1px 10px #00000040;
.avatar {
margin-bottom: 20px;
}
.name {
font-size: 20px;
}
.icon {
width: 30px;
display: inline-block;
}
.button-view {
a {
padding: 10px 0;
border-radius: 10px;
border: 1px solid #e1e1e1;
display: block;
text-align: center;
color: #000;
font-weight: 500;
}
}
.ant-avatar-string {
font-size: 5rem;
}
}
}
</style>