diff --git a/crm/api/doc.py b/crm/api/doc.py index 84a84458f..de1b82dc7 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -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 diff --git a/crm/api/notifications.py b/crm/api/notifications.py index 972fa58e9..2067b8f0c 100644 --- a/crm/api/notifications.py +++ b/crm/api/notifications.py @@ -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}, diff --git a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py index 3129c4780..72bbcf78d 100644 --- a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py +++ b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py @@ -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 diff --git a/crm/fcrm/doctype/crm_form_script/crm_form_script.js b/crm/fcrm/doctype/crm_form_script/crm_form_script.js index 2c8c2ff1b..0fbea0bb7 100644 --- a/crm/fcrm/doctype/crm_form_script/crm_form_script.js +++ b/crm/fcrm/doctype/crm_form_script/crm_form_script.js @@ -48,6 +48,7 @@ frappe.ui.form.on("CRM Form Script", { function setupForm({ doc }) { return { actions: [], + statuses: [], } }`.trim(); } diff --git a/frontend/src/components/SectionFields.vue b/frontend/src/components/SectionFields.vue index f2029aa20..dfaff47f2 100644 --- a/frontend/src/components/SectionFields.vue +++ b/frontend/src/components/SectionFields.vue @@ -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, }) }) diff --git a/frontend/src/components/Settings/SidePanelModal.vue b/frontend/src/components/Settings/SidePanelModal.vue index 0e3665ad0..a35c74089 100644 --- a/frontend/src/components/Settings/SidePanelModal.vue +++ b/frontend/src/components/Settings/SidePanelModal.vue @@ -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 }" >
diff --git a/frontend/src/composables/useActiveTabManager.js b/frontend/src/composables/useActiveTabManager.js index 5b9cd4848..3de4c48fb 100644 --- a/frontend/src/composables/useActiveTabManager.js +++ b/frontend/src/composables/useActiveTabManager.js @@ -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) } diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index 9429cd6cb..64eba3a08 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -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), }) } diff --git a/frontend/src/pages/MobileDeal.vue b/frontend/src/pages/MobileDeal.vue index 08b8a54d2..b6d6e7318 100644 --- a/frontend/src/pages/MobileDeal.vue +++ b/frontend/src/pages/MobileDeal.vue @@ -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), }) } diff --git a/frontend/src/router.js b/frontend/src/router.js index 9490d4f04..3c7e9604e 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -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() }