forked from DevExpress/devextreme-ui-template-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrm-contact-details.vue
182 lines (162 loc) · 4.25 KB
/
crm-contact-details.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
<dx-scroll-view class="view-wrapper-scroll">
<div class="view-wrapper">
<dx-toolbar class="toolbar-details theme-dependent">
<dx-toolbar-item location="before">
<dx-button
icon="arrowleft"
styling-mode="text"
/>
</dx-toolbar-item>
<dx-toolbar-item
location="before"
:text="contactName"
class="contact-name-toolbar-item"
/>
<dx-toolbar-item
location="after"
locate-in-menu="auto"
>
<div>
<dx-button
text="Terminate"
type="default"
styling-mode="contained"
/>
</div>
</dx-toolbar-item>
<dx-toolbar-item
location="after"
>
<dx-drop-down-button
text="Actions"
:drop-down-options="{ width: 'auto' }"
styling-mode="text"
>
<dx-drop-down-item text="Assign to Me" />
<dx-drop-down-item text="Archive" />
</dx-drop-down-button>
</dx-toolbar-item>
<dx-toolbar-item
location="after"
locate-in-menu="auto"
>
<div>
<div class="separator" />
</div>
</dx-toolbar-item>
<dx-toolbar-item
location="after"
locate-in-menu="auto"
widget="dxButton"
show-text="inMenu"
:options="copyOptions"
/>
<dx-toolbar-item
location="after"
locate-in-menu="auto"
widget="dxButton"
show-text="inMenu"
:options="refreshOptions"
/>
</dx-toolbar>
<div class="panels">
<div class="left">
<contact-form
:contact-data="contactData"
:is-editing="false"
:is-loading="isLoading"
/>
</div>
<div class="right">
<contact-cards
:is-loading="isLoading"
:contact-name="contactData?.name"
:contact-id="contactId"
:tasks="contactData?.tasks"
:activities="contactData?.activities"
/>
</div>
</div>
</div>
</dx-scroll-view>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { DxScrollView } from 'devextreme-vue/scroll-view';
import { DxButton } from 'devextreme-vue/button';
import { DxDropDownButton, DxItem as DxDropDownItem } from 'devextreme-vue/drop-down-button';
import {
DxToolbar,
DxItem as DxToolbarItem,
} from 'devextreme-vue/toolbar';
// eslint-disable-next-line import/no-unresolved
import { getContact } from 'dx-template-gallery-data';
import type { Contact } from '@/types/contact';
import ContactForm from '@/components/library/contact-form.vue';
import ContactCards from '@/components/utils/contact-cards.vue';
const contactId = 12;
const contactName = ref('');
const contactData = ref<Contact>();
const isLoading = ref(false);
async function loadData() {
isLoading.value = true;
const data = await getContact(contactId);
contactData.value = data;
contactName.value = data.name;
isLoading.value = false;
}
const refresh = () => {
loadData();
};
onMounted(() => {
loadData();
});
const copyOptions = {
text: 'Copy',
icon: 'copy',
stylingMode: 'text',
};
const refreshOptions = {
text: 'Refresh',
icon: 'refresh',
onClick: refresh,
stylingMode: 'text',
};
</script>
<style scoped lang="scss">
@use "@/variables" as *;
@use "sass:math";
@media only screen and (max-width: 875px) {
:deep(.contact-name-toolbar-item) {
min-width: calc(var(--left-panel-width) + var(--right-panel-width) - 145px);
}
}
.dx-toolbar {
margin-bottom: calc(var(--toolbar-margin-bottom) / 2);
:deep(.dx-toolbar-label > div) {
@include header();
}
}
.view-wrapper {
--left-panel-width: 400px;
--right-panel-width: 360px;
padding-top: var(--content-padding);
padding-bottom: var(--content-padding);
.panels {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20px;
.left {
flex: 1 var(--left-panel-width);
margin-top: 8px;
}
.right {
flex: 1 calc(100% - var(--left-panel-width) - 20px);
margin-top: 8px;
min-width: 340px;
}
}
}
</style>