Skip to content

Commit 69f1415

Browse files
committed
fix: cannot add/create contact from deal
1 parent 99e6216 commit 69f1415

File tree

2 files changed

+124
-113
lines changed

2 files changed

+124
-113
lines changed

Diff for: frontend/src/components/SidePanelLayout.vue

+9-33
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,16 @@
1515
:opened="section.opened"
1616
>
1717
<template v-if="!preview" #actions>
18-
<div v-if="section.name == 'contacts_section'" class="pr-2">
19-
<Link
20-
value=""
21-
doctype="Contact"
22-
@change="(e) => addContact(e)"
23-
:onCreate="
24-
(value, close) => {
25-
_contact = {
26-
first_name: value,
27-
company_name: deal.data.organization,
28-
}
29-
showContactModal = true
30-
close()
31-
}
32-
"
18+
<slot name="actions" v-bind="{ section }">
19+
<Button
20+
v-if="section.showEditButton"
21+
variant="ghost"
22+
class="w-7 mr-2"
23+
@click="showSidePanelModal = true"
3324
>
34-
<template #target="{ togglePopover }">
35-
<Button
36-
class="h-7 px-3"
37-
variant="ghost"
38-
icon="plus"
39-
@click="togglePopover()"
40-
/>
41-
</template>
42-
</Link>
43-
</div>
44-
<Button
45-
v-else-if="section.showEditButton"
46-
variant="ghost"
47-
class="w-7 mr-2"
48-
@click="showSidePanelModal = true"
49-
>
50-
<EditIcon class="h-4 w-4" />
51-
</Button>
25+
<EditIcon class="h-4 w-4" />
26+
</Button>
27+
</slot>
5228
</template>
5329
<slot v-bind="{ section }">
5430
<FadedScrollableDiv

Diff for: frontend/src/pages/Deal.vue

+115-80
Original file line numberDiff line numberDiff line change
@@ -125,102 +125,136 @@
125125
:sections="sections.data"
126126
:addContact="addContact"
127127
doctype="CRM Deal"
128-
v-slot="{ section }"
129128
@update="updateField"
130129
@reload="sections.reload"
131130
>
132-
<div v-if="section.name == 'contacts_section'" class="contacts-area">
133-
<div
134-
v-if="dealContacts?.loading && dealContacts?.data?.length == 0"
135-
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4"
136-
>
137-
<LoadingIndicator class="h-4 w-4" />
138-
<span>{{ __('Loading...') }}</span>
131+
<template #actions="{ section }">
132+
<div v-if="section.name == 'contacts_section'" class="pr-2">
133+
<Link
134+
value=""
135+
doctype="Contact"
136+
@change="(e) => addContact(e)"
137+
:onCreate="
138+
(value, close) => {
139+
_contact = {
140+
first_name: value,
141+
company_name: deal.data.organization,
142+
}
143+
showContactModal = true
144+
close()
145+
}
146+
"
147+
>
148+
<template #target="{ togglePopover }">
149+
<Button
150+
class="h-7 px-3"
151+
variant="ghost"
152+
icon="plus"
153+
@click="togglePopover()"
154+
/>
155+
</template>
156+
</Link>
139157
</div>
158+
</template>
159+
<template #default="{ section }">
140160
<div
141-
v-else-if="dealContacts?.data?.length"
142-
v-for="(contact, i) in dealContacts.data"
143-
:key="contact.name"
161+
v-if="section.name == 'contacts_section'"
162+
class="contacts-area"
144163
>
145-
<div class="px-2 pb-2.5" :class="[i == 0 ? 'pt-5' : 'pt-2.5']">
146-
<Section :opened="contact.opened">
147-
<template #header="{ opened, toggle }">
148-
<div
149-
class="flex cursor-pointer items-center justify-between gap-2 pr-1 text-base leading-5 text-ink-gray-7"
150-
>
164+
<div
165+
v-if="dealContacts?.loading && dealContacts?.data?.length == 0"
166+
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4"
167+
>
168+
<LoadingIndicator class="h-4 w-4" />
169+
<span>{{ __('Loading...') }}</span>
170+
</div>
171+
<div
172+
v-else-if="dealContacts?.data?.length"
173+
v-for="(contact, i) in dealContacts.data"
174+
:key="contact.name"
175+
>
176+
<div class="px-2 pb-2.5" :class="[i == 0 ? 'pt-5' : 'pt-2.5']">
177+
<Section :opened="contact.opened">
178+
<template #header="{ opened, toggle }">
151179
<div
152-
class="flex h-7 items-center gap-2 truncate"
153-
@click="toggle()"
180+
class="flex cursor-pointer items-center justify-between gap-2 pr-1 text-base leading-5 text-ink-gray-7"
154181
>
155-
<Avatar
156-
:label="contact.full_name"
157-
:image="contact.image"
158-
size="md"
159-
/>
160-
<div class="truncate">
161-
{{ contact.full_name }}
182+
<div
183+
class="flex h-7 items-center gap-2 truncate"
184+
@click="toggle()"
185+
>
186+
<Avatar
187+
:label="contact.full_name"
188+
:image="contact.image"
189+
size="md"
190+
/>
191+
<div class="truncate">
192+
{{ contact.full_name }}
193+
</div>
194+
<Badge
195+
v-if="contact.is_primary"
196+
class="ml-2"
197+
variant="outline"
198+
:label="__('Primary')"
199+
theme="green"
200+
/>
162201
</div>
163-
<Badge
164-
v-if="contact.is_primary"
165-
class="ml-2"
166-
variant="outline"
167-
:label="__('Primary')"
168-
theme="green"
169-
/>
170-
</div>
171-
<div class="flex items-center">
172-
<Dropdown :options="contactOptions(contact)">
202+
<div class="flex items-center">
203+
<Dropdown :options="contactOptions(contact)">
204+
<Button
205+
icon="more-horizontal"
206+
class="text-ink-gray-5"
207+
variant="ghost"
208+
/>
209+
</Dropdown>
173210
<Button
174-
icon="more-horizontal"
175-
class="text-ink-gray-5"
176211
variant="ghost"
177-
/>
178-
</Dropdown>
179-
<Button
180-
variant="ghost"
181-
@click="
182-
router.push({
183-
name: 'Contact',
184-
params: { contactId: contact.name },
185-
})
186-
"
187-
>
188-
<ArrowUpRightIcon class="h-4 w-4" />
189-
</Button>
190-
<Button variant="ghost" @click="toggle()">
191-
<FeatherIcon
192-
name="chevron-right"
193-
class="h-4 w-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
194-
:class="{ 'rotate-90': opened }"
195-
/>
196-
</Button>
212+
@click="
213+
router.push({
214+
name: 'Contact',
215+
params: { contactId: contact.name },
216+
})
217+
"
218+
>
219+
<ArrowUpRightIcon class="h-4 w-4" />
220+
</Button>
221+
<Button variant="ghost" @click="toggle()">
222+
<FeatherIcon
223+
name="chevron-right"
224+
class="h-4 w-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
225+
:class="{ 'rotate-90': opened }"
226+
/>
227+
</Button>
228+
</div>
229+
</div>
230+
</template>
231+
<div
232+
class="flex flex-col gap-1.5 text-base text-ink-gray-8"
233+
>
234+
<div class="flex items-center gap-3 pb-1.5 pl-1 pt-4">
235+
<Email2Icon class="h-4 w-4" />
236+
{{ contact.email }}
237+
</div>
238+
<div class="flex items-center gap-3 p-1 py-1.5">
239+
<PhoneIcon class="h-4 w-4" />
240+
{{ contact.mobile_no }}
197241
</div>
198242
</div>
199-
</template>
200-
<div class="flex flex-col gap-1.5 text-base text-ink-gray-8">
201-
<div class="flex items-center gap-3 pb-1.5 pl-1 pt-4">
202-
<Email2Icon class="h-4 w-4" />
203-
{{ contact.email }}
204-
</div>
205-
<div class="flex items-center gap-3 p-1 py-1.5">
206-
<PhoneIcon class="h-4 w-4" />
207-
{{ contact.mobile_no }}
208-
</div>
209-
</div>
210-
</Section>
243+
</Section>
244+
</div>
245+
<div
246+
v-if="i != dealContacts.data.length - 1"
247+
class="mx-2 h-px border-t border-outline-gray-modals"
248+
/>
211249
</div>
212250
<div
213-
v-if="i != dealContacts.data.length - 1"
214-
class="mx-2 h-px border-t border-outline-gray-modals"
215-
/>
216-
</div>
217-
<div
218-
v-else
219-
class="flex h-20 items-center justify-center text-base text-ink-gray-5"
220-
>
221-
{{ __('No contacts added') }}
251+
v-else
252+
class="flex h-20 items-center justify-center text-base text-ink-gray-5"
253+
>
254+
{{ __('No contacts added') }}
255+
</div>
222256
</div>
223-
</div>
257+
</template>
224258
</SidePanelLayout>
225259
</div>
226260
</Resizer>
@@ -278,6 +312,7 @@ import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
278312
import AssignTo from '@/components/AssignTo.vue'
279313
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
280314
import ContactModal from '@/components/Modals/ContactModal.vue'
315+
import Link from '@/components/Controls/Link.vue'
281316
import Section from '@/components/Section.vue'
282317
import SidePanelLayout from '@/components/SidePanelLayout.vue'
283318
import SLASection from '@/components/SLASection.vue'

0 commit comments

Comments
 (0)