Skip to content

Commit

Permalink
Merge pull request #510 from frappe/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik authored Jan 3, 2025
2 parents f9592cc + 70c5e9c commit d16261e
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 236 deletions.
2 changes: 1 addition & 1 deletion crm/fcrm/doctype/crm_deal/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_deal(name):

deal["fields_meta"] = get_fields_meta("CRM Deal")
deal["_form_script"] = get_form_script("CRM Deal")
deal["_assign"] = get_assigned_users("CRM Deal", deal.name, deal.owner)
deal["_assign"] = get_assigned_users("CRM Deal", deal.name)
return deal


Expand Down
2 changes: 1 addition & 1 deletion crm/fcrm/doctype/crm_lead/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def get_lead(name):

lead["fields_meta"] = get_fields_meta("CRM Lead")
lead["_form_script"] = get_form_script("CRM Lead")
lead["_assign"] = get_assigned_users("CRM Lead", lead.name, lead.owner)
lead["_assign"] = get_assigned_users("CRM Lead", lead.name)
return lead
31 changes: 31 additions & 0 deletions frontend/src/components/AssignTo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<component
v-if="assignees?.length"
:is="assignees?.length == 1 ? 'Button' : 'div'"
>
<MultipleAvatar :avatars="assignees" @click="showAssignmentModal = true" />
</component>
<Button v-else @click="showAssignmentModal = true">
{{ __('Assign to') }}
</Button>
<AssignmentModal
v-if="showAssignmentModal"
v-model="showAssignmentModal"
v-model:assignees="assignees"
:doctype="doctype"
:doc="data"
/>
</template>
<script setup>
import MultipleAvatar from '@/components/MultipleAvatar.vue'
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
import { ref } from 'vue'
const props = defineProps({
data: Object,
doctype: String,
})
const showAssignmentModal = ref(false)
const assignees = defineModel()
</script>
6 changes: 5 additions & 1 deletion frontend/src/components/FieldLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@
<Link
v-else-if="field.fieldtype === 'User'"
class="form-control"
:value="getUser(data[field.fieldname]).full_name"
:value="
data[field.fieldname] &&
getUser(data[field.fieldname]).full_name
"
:doctype="field.options"
:filters="field.filters"
@change="(v) => (data[field.fieldname] = v)"
Expand All @@ -160,6 +163,7 @@
>
<template #prefix>
<UserAvatar
v-if="data[field.fieldname]"
class="mr-2"
:user="data[field.fieldname]"
size="sm"
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/components/Modals/AssignmentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ const addValue = (value) => {
}
function updateAssignees() {
if (assignees.value.length === 0) {
error.value = 'Please select at least one assignee'
return
}
const removedAssignees = oldAssignees.value
.filter(
(assignee) => !assignees.value.find((a) => a.name === assignee.name),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/SidePanelLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
field.mandatory_via_depends_on)
"
class="text-ink-red-3"
>*</span
> *</span
>
</div>
</Tooltip>
Expand Down
22 changes: 6 additions & 16 deletions frontend/src/pages/Deal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
</template>
<template #right-header>
<CustomActions v-if="customActions" :actions="customActions" />
<component :is="deal.data._assignedTo?.length == 1 ? 'Button' : 'div'">
<MultipleAvatar
:avatars="deal.data._assignedTo"
@click="showAssignmentModal = true"
/>
</component>
<AssignTo
v-model="deal.data._assignedTo"
:data="deal.data"
doctype="CRM Deal"
/>
<Dropdown :options="statusOptions('deal', updateField, customStatuses)">
<template #default="{ open }">
<Button
Expand Down Expand Up @@ -237,13 +236,6 @@
afterInsert: (doc) => addContact(doc.name),
}"
/>
<AssignmentModal
v-if="showAssignmentModal"
v-model="showAssignmentModal"
v-model:assignees="deal.data._assignedTo"
:doc="deal.data"
doctype="CRM Deal"
/>
<FilesUploader
v-if="deal.data?.name"
v-model="showFilesUploader"
Expand Down Expand Up @@ -278,9 +270,8 @@ import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import LayoutHeader from '@/components/LayoutHeader.vue'
import Activities from '@/components/Activities/Activities.vue'
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
import AssignTo from '@/components/AssignTo.vue'
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
import MultipleAvatar from '@/components/MultipleAvatar.vue'
import ContactModal from '@/components/Modals/ContactModal.vue'
import Section from '@/components/Section.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue'
Expand Down Expand Up @@ -390,7 +381,6 @@ onBeforeUnmount(() => {
const reload = ref(false)
const showOrganizationModal = ref(false)
const showAssignmentModal = ref(false)
const showFilesUploader = ref(false)
const _organization = ref({})
Expand Down
22 changes: 6 additions & 16 deletions frontend/src/pages/Lead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
</template>
<template #right-header>
<CustomActions v-if="customActions" :actions="customActions" />
<component :is="lead.data._assignedTo?.length == 1 ? 'Button' : 'div'">
<MultipleAvatar
:avatars="lead.data._assignedTo"
@click="showAssignmentModal = true"
/>
</component>
<AssignTo
v-model="lead.data._assignedTo"
:data="lead.data"
doctype="CRM Lead"
/>
<Dropdown :options="statusOptions('lead', updateField, customStatuses)">
<template #default="{ open }">
<Button
Expand Down Expand Up @@ -180,13 +179,6 @@
</div>
</Resizer>
</div>
<AssignmentModal
v-if="showAssignmentModal"
v-model="showAssignmentModal"
v-model:assignees="lead.data._assignedTo"
:doc="lead.data"
doctype="CRM Lead"
/>
<Dialog
v-model="showConvertToDealModal"
:options="{
Expand Down Expand Up @@ -286,9 +278,8 @@ import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import LayoutHeader from '@/components/LayoutHeader.vue'
import Activities from '@/components/Activities/Activities.vue'
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
import AssignTo from '@/components/AssignTo.vue'
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
import MultipleAvatar from '@/components/MultipleAvatar.vue'
import Link from '@/components/Controls/Link.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue'
Expand Down Expand Up @@ -373,7 +364,6 @@ onMounted(() => {
})
const reload = ref(false)
const showAssignmentModal = ref(false)
const showFilesUploader = ref(false)
function updateLead(fieldname, value, callback) {
Expand Down
Loading

0 comments on commit d16261e

Please sign in to comment.