fix: highlight status button on lead/deal page
This commit is contained in:
parent
fe47bf8af1
commit
8da8472e93
@ -11,7 +11,9 @@
|
|||||||
v-model="newDeal[field.name]"
|
v-model="newDeal[field.name]"
|
||||||
>
|
>
|
||||||
<template v-if="field.name == 'status'" #prefix>
|
<template v-if="field.name == 'status'" #prefix>
|
||||||
<IndicatorIcon :class="getDealStatus(newDeal[field.name]).color" />
|
<IndicatorIcon
|
||||||
|
:class="getDealStatus(newDeal[field.name]).iconColorClass"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl
|
<FormControl
|
||||||
@ -43,31 +45,6 @@
|
|||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Dropdown
|
|
||||||
v-else-if="field.type === 'dropdown'"
|
|
||||||
:options="statusOptions('deal')"
|
|
||||||
class="w-full flex-1"
|
|
||||||
>
|
|
||||||
<template #default="{ open }">
|
|
||||||
<Button
|
|
||||||
:label="newDeal[field.name]"
|
|
||||||
class="w-full justify-between"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<IndicatorIcon
|
|
||||||
:class="getDealStatus(newDeal[field.name]).color"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #default>{{ newDeal[field.name] }}</template>
|
|
||||||
<template #suffix>
|
|
||||||
<FeatherIcon
|
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
|
||||||
class="h-4 text-gray-600"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Dropdown>
|
|
||||||
<FormControl v-else type="text" v-model="newDeal[field.name]" />
|
<FormControl v-else type="text" v-model="newDeal[field.name]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
v-model="newLead[field.name]"
|
v-model="newLead[field.name]"
|
||||||
>
|
>
|
||||||
<template v-if="field.name == 'status'" #prefix>
|
<template v-if="field.name == 'status'" #prefix>
|
||||||
<IndicatorIcon :class="getLeadStatus(newLead[field.name]).color" />
|
<IndicatorIcon :class="getLeadStatus(newLead[field.name]).iconColorClass" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl
|
<FormControl
|
||||||
@ -43,31 +43,6 @@
|
|||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Dropdown
|
|
||||||
v-else-if="field.type === 'dropdown'"
|
|
||||||
:options="statusOptions('lead')"
|
|
||||||
class="w-full flex-1"
|
|
||||||
>
|
|
||||||
<template #default="{ open }">
|
|
||||||
<Button
|
|
||||||
:label="newLead[field.name]"
|
|
||||||
class="w-full justify-between"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<IndicatorIcon
|
|
||||||
:class="getLeadStatus(newLead[field.name]).color"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #default>{{ newLead[field.name] }}</template>
|
|
||||||
<template #suffix>
|
|
||||||
<FeatherIcon
|
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
|
||||||
class="h-4 text-gray-600"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Dropdown>
|
|
||||||
<FormControl v-else type="text" v-model="newLead[field.name]" />
|
<FormControl v-else type="text" v-model="newLead[field.name]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -390,7 +390,7 @@ function getLeadRowObject(lead) {
|
|||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
label: lead.status,
|
label: lead.status,
|
||||||
color: getLeadStatus(lead.status)?.color,
|
color: getLeadStatus(lead.status)?.iconColorClass,
|
||||||
},
|
},
|
||||||
email: lead.email,
|
email: lead.email,
|
||||||
mobile_no: lead.mobile_no,
|
mobile_no: lead.mobile_no,
|
||||||
@ -415,7 +415,7 @@ function getDealRowObject(deal) {
|
|||||||
annual_revenue: formatNumberIntoCurrency(deal.annual_revenue),
|
annual_revenue: formatNumberIntoCurrency(deal.annual_revenue),
|
||||||
status: {
|
status: {
|
||||||
label: deal.status,
|
label: deal.status,
|
||||||
color: getDealStatus(deal.status)?.color,
|
color: getDealStatus(deal.status)?.iconColorClass,
|
||||||
},
|
},
|
||||||
email: deal.email,
|
email: deal.email,
|
||||||
mobile_no: deal.mobile_no,
|
mobile_no: deal.mobile_no,
|
||||||
|
|||||||
@ -20,14 +20,17 @@
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<Dropdown :options="statusOptions('deal', updateField)">
|
<Dropdown :options="statusOptions('deal', updateField)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button :label="deal.data.status">
|
<Button
|
||||||
|
:label="deal.data.status"
|
||||||
|
:class="getDealStatus(deal.data.status).colorClass"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<IndicatorIcon :class="getDealStatus(deal.data.status).color" />
|
<IndicatorIcon />
|
||||||
</template>
|
</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<FeatherIcon
|
<FeatherIcon
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||||
class="h-4 text-gray-600"
|
class="h-4"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@ -150,7 +150,7 @@ const rows = computed(() => {
|
|||||||
} else if (row == 'status') {
|
} else if (row == 'status') {
|
||||||
_rows[row] = {
|
_rows[row] = {
|
||||||
label: deal.status,
|
label: deal.status,
|
||||||
color: getDealStatus(deal.status)?.color,
|
color: getDealStatus(deal.status)?.iconColorClass,
|
||||||
}
|
}
|
||||||
} else if (row == 'deal_owner') {
|
} else if (row == 'deal_owner') {
|
||||||
_rows[row] = {
|
_rows[row] = {
|
||||||
|
|||||||
@ -20,15 +20,19 @@
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<Dropdown :options="statusOptions('lead', updateField)">
|
<Dropdown :options="statusOptions('lead', updateField)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button :label="lead.data.status">
|
<Button
|
||||||
|
:label="lead.data.status"
|
||||||
|
:class="getLeadStatus(lead.data.status).colorClass"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<IndicatorIcon :class="getLeadStatus(lead.data.status).color" />
|
<IndicatorIcon />
|
||||||
</template>
|
</template>
|
||||||
<template #suffix
|
<template #suffix>
|
||||||
><FeatherIcon
|
<FeatherIcon
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||||
class="h-4 text-gray-600"
|
class="h-4"
|
||||||
/></template>
|
/>
|
||||||
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|||||||
@ -152,7 +152,7 @@ const rows = computed(() => {
|
|||||||
} else if (row == 'status') {
|
} else if (row == 'status') {
|
||||||
_rows[row] = {
|
_rows[row] = {
|
||||||
label: lead.status,
|
label: lead.status,
|
||||||
color: getLeadStatus(lead.status)?.color,
|
color: getLeadStatus(lead.status)?.iconColorClass,
|
||||||
}
|
}
|
||||||
} else if (row == 'lead_owner') {
|
} else if (row == 'lead_owner') {
|
||||||
_rows[row] = {
|
_rows[row] = {
|
||||||
|
|||||||
@ -454,7 +454,7 @@ function getLeadRowObject(lead) {
|
|||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
label: lead.status,
|
label: lead.status,
|
||||||
color: getLeadStatus(lead.status)?.color,
|
color: getLeadStatus(lead.status)?.iconColorClass,
|
||||||
},
|
},
|
||||||
email: lead.email,
|
email: lead.email,
|
||||||
mobile_no: lead.mobile_no,
|
mobile_no: lead.mobile_no,
|
||||||
@ -479,7 +479,7 @@ function getDealRowObject(deal) {
|
|||||||
annual_revenue: formatNumberIntoCurrency(deal.annual_revenue),
|
annual_revenue: formatNumberIntoCurrency(deal.annual_revenue),
|
||||||
status: {
|
status: {
|
||||||
label: deal.status,
|
label: deal.status,
|
||||||
color: getDealStatus(deal.status)?.color,
|
color: getDealStatus(deal.status)?.iconColorClass,
|
||||||
},
|
},
|
||||||
email: deal.email,
|
email: deal.email,
|
||||||
mobile_no: deal.mobile_no,
|
mobile_no: deal.mobile_no,
|
||||||
|
|||||||
@ -16,10 +16,8 @@ export const statusesStore = defineStore('crm-statuses', () => {
|
|||||||
auto: true,
|
auto: true,
|
||||||
transform(statuses) {
|
transform(statuses) {
|
||||||
for (let status of statuses) {
|
for (let status of statuses) {
|
||||||
status.color =
|
status.colorClass = colorClasses(status.color)
|
||||||
status.color == 'black'
|
status.iconColorClass = colorClasses(status.color, true)
|
||||||
? '!text-gray-900'
|
|
||||||
: `!text-${status.color}-600`
|
|
||||||
leadStatusesByName[status.name] = status
|
leadStatusesByName[status.name] = status
|
||||||
}
|
}
|
||||||
return statuses
|
return statuses
|
||||||
@ -35,16 +33,27 @@ export const statusesStore = defineStore('crm-statuses', () => {
|
|||||||
auto: true,
|
auto: true,
|
||||||
transform(statuses) {
|
transform(statuses) {
|
||||||
for (let status of statuses) {
|
for (let status of statuses) {
|
||||||
status.color =
|
status.colorClass = colorClasses(status.color)
|
||||||
status.color == 'black'
|
status.iconColorClass = colorClasses(status.color, true)
|
||||||
? '!text-gray-900'
|
|
||||||
: `!text-${status.color}-600`
|
|
||||||
dealStatusesByName[status.name] = status
|
dealStatusesByName[status.name] = status
|
||||||
}
|
}
|
||||||
return statuses
|
return statuses
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function colorClasses(color, onlyIcon = false) {
|
||||||
|
let textColor = `!text-${color}-600`
|
||||||
|
if (color == 'black') {
|
||||||
|
textColor = '!text-gray-900'
|
||||||
|
} else if (['gray', 'green'].includes(color)) {
|
||||||
|
textColor = `!text-${color}-700`
|
||||||
|
}
|
||||||
|
|
||||||
|
let bgColor = `!bg-${color}-100 hover:!bg-${color}-200 active:!bg-${color}-300`
|
||||||
|
|
||||||
|
return [textColor, onlyIcon ? '' : bgColor]
|
||||||
|
}
|
||||||
|
|
||||||
function getLeadStatus(name) {
|
function getLeadStatus(name) {
|
||||||
return leadStatusesByName[name]
|
return leadStatusesByName[name]
|
||||||
}
|
}
|
||||||
@ -60,7 +69,10 @@ export const statusesStore = defineStore('crm-statuses', () => {
|
|||||||
for (const status in statusesByName) {
|
for (const status in statusesByName) {
|
||||||
options.push({
|
options.push({
|
||||||
label: statusesByName[status].name,
|
label: statusesByName[status].name,
|
||||||
icon: () => h(IndicatorIcon, { class: statusesByName[status].color }),
|
icon: () =>
|
||||||
|
h(IndicatorIcon, {
|
||||||
|
class: statusesByName[status].iconColorClass,
|
||||||
|
}),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
action && action('status', statusesByName[status].name)
|
action && action('status', statusesByName[status].name)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,7 +6,7 @@ module.exports = {
|
|||||||
'./node_modules/frappe-ui/src/components/**/*.{vue,js,ts,jsx,tsx}',
|
'./node_modules/frappe-ui/src/components/**/*.{vue,js,ts,jsx,tsx}',
|
||||||
'../node_modules/frappe-ui/src/components/**/*.{vue,js,ts,jsx,tsx}',
|
'../node_modules/frappe-ui/src/components/**/*.{vue,js,ts,jsx,tsx}',
|
||||||
],
|
],
|
||||||
safelist: [{ pattern: /!text-/ }],
|
safelist: [{ pattern: /(!text|!bg|hover:!bg)-/ }],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user