Merge pull request #384 from frappe/develop
chore: Merge develop to main
This commit is contained in:
commit
6a7793b721
@ -611,10 +611,10 @@ def get_field_obj(field):
|
||||
"all_properties": field,
|
||||
}
|
||||
|
||||
obj["placeholder"] = "Add " + field.label + "..."
|
||||
obj["placeholder"] = field.placeholder or "Add " + field.label + "..."
|
||||
|
||||
if field.fieldtype == "Link":
|
||||
obj["placeholder"] = "Select " + field.label + "..."
|
||||
obj["placeholder"] = field.placeholder or "Select " + field.label + "..."
|
||||
obj["doctype"] = field.options
|
||||
elif field.fieldtype == "Select" and field.options:
|
||||
obj["options"] = [{"label": option, "value": option} for option in field.options.split("\n")]
|
||||
@ -686,6 +686,7 @@ def get_fields(doctype: str, allow_all_fieldtypes: bool = False):
|
||||
"mandatory_depends_on": field.mandatory_depends_on,
|
||||
"read_only_depends_on": field.read_only_depends_on,
|
||||
"link_filters": field.get("link_filters"),
|
||||
"placeholder": field.placeholder,
|
||||
})
|
||||
|
||||
return _fields
|
||||
|
||||
@ -48,6 +48,7 @@ def get_notifications():
|
||||
def mark_as_read(user=None, doc=None):
|
||||
user = user or frappe.session.user
|
||||
filters = {"to_user": user, "read": False}
|
||||
or_filters = []
|
||||
if doc:
|
||||
or_filters = [
|
||||
{"comment": doc},
|
||||
|
||||
@ -44,6 +44,7 @@ def get_fields_layout(doctype: str, type: str):
|
||||
"type": field.fieldtype,
|
||||
"options": field.options,
|
||||
"mandatory": field.reqd,
|
||||
"placeholder": field.placeholder,
|
||||
}
|
||||
section["fields"][section.get("fields").index(field["name"])] = field
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ frappe.ui.form.on("CRM Form Script", {
|
||||
function setupForm({ doc }) {
|
||||
return {
|
||||
actions: [],
|
||||
statuses: [],
|
||||
}
|
||||
}`.trim();
|
||||
}
|
||||
|
||||
@ -125,7 +125,6 @@ import { computed } from 'vue'
|
||||
const props = defineProps({
|
||||
fields: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
isLastSection: {
|
||||
type: Boolean,
|
||||
@ -146,7 +145,7 @@ const _fields = computed(() => {
|
||||
if (df?.depends_on) evaluate_depends_on(df.depends_on, field)
|
||||
all_fields.push({
|
||||
...field,
|
||||
filters: df.link_filters && JSON.parse(df.link_filters),
|
||||
filters: df?.link_filters && JSON.parse(df.link_filters),
|
||||
placeholder: field.placeholder || field.label,
|
||||
})
|
||||
})
|
||||
|
||||
@ -40,12 +40,12 @@
|
||||
v-for="(section, i) in sections.data"
|
||||
:key="section.label"
|
||||
class="flex flex-col py-1.5 px-1"
|
||||
:class="{ 'border-b': i !== sections.data.length - 1 }"
|
||||
:class="{ 'border-b': i !== sections.data?.length - 1 }"
|
||||
>
|
||||
<Section :is-opened="section.opened" :label="section.label">
|
||||
<SectionFields
|
||||
:fields="section.fields"
|
||||
:isLastSection="i == section.data.length - 1"
|
||||
:isLastSection="i == section.data?.length - 1"
|
||||
v-model="data"
|
||||
/>
|
||||
</Section>
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useDebounceFn, useStorage } from '@vueuse/core'
|
||||
|
||||
export function useActiveTabManager(tabs, storageKey) {
|
||||
const activieTab = useStorage(storageKey, 'activity')
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const preserveLastVisitedTab = useDebounceFn((tabName) => {
|
||||
activieTab.value = tabName.toLowerCase()
|
||||
}, 300)
|
||||
|
||||
function setActiveTabInUrl(tabName) {
|
||||
window.location.hash = '#' + tabName.toLowerCase()
|
||||
let hash = '#' + tabName.toLowerCase()
|
||||
router.push({ ...route, hash })
|
||||
}
|
||||
|
||||
function getActiveTabFromUrl() {
|
||||
@ -46,7 +48,6 @@ export function useActiveTabManager(tabs, storageKey) {
|
||||
|
||||
let lastVisitedTab = getActiveTabFromLocalStorage()
|
||||
if (lastVisitedTab) {
|
||||
setActiveTabInUrl(lastVisitedTab)
|
||||
return getTabIndex(lastVisitedTab)
|
||||
}
|
||||
|
||||
|
||||
@ -607,7 +607,7 @@ function contactOptions(contact) {
|
||||
options.push({
|
||||
label: __('Set as Primary Contact'),
|
||||
icon: h(SuccessIcon, { class: 'h-4 w-4' }),
|
||||
onClick: () => setPrimaryContact(contact),
|
||||
onClick: () => setPrimaryContact(contact.name),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -522,7 +522,7 @@ function contactOptions(contact) {
|
||||
options.push({
|
||||
label: __('Set as Primary Contact'),
|
||||
icon: h(SuccessIcon, { class: 'h-4 w-4' }),
|
||||
onClick: () => setPrimaryContact(contact),
|
||||
onClick: () => setPrimaryContact(contact.name),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -145,9 +145,14 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (to.name === 'Home' && isLoggedIn) {
|
||||
next({ name: 'Leads' })
|
||||
} else if (!isLoggedIn) {
|
||||
window.location.href = "/login?redirect-to=/crm";
|
||||
window.location.href = '/login?redirect-to=/crm'
|
||||
} else if (to.matched.length === 0) {
|
||||
next({ name: 'Invalid Page' })
|
||||
} else if (['Deal', 'Lead'].includes(to.name) && !to.hash) {
|
||||
let storageKey = to.name === 'Deal' ? 'lastDealTab' : 'lastLeadTab'
|
||||
const activeTab = localStorage.getItem(storageKey) || 'activity'
|
||||
const hash = '#' + activeTab
|
||||
next({ ...to, hash })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user