From 1ada38e65257566aaec388ef23b4720236561466 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Fri, 26 May 2023 08:07:38 +0500 Subject: [PATCH] UBER-53: My Leads view (#3259) Signed-off-by: Vyacheslav Tumanov --- models/lead/src/index.ts | 11 ++ plugins/lead-assets/lang/en.json | 1 + plugins/lead-assets/lang/ru.json | 1 + .../src/components/MyLeads.svelte | 156 ++++++++++++++++++ plugins/lead-resources/src/index.ts | 4 +- plugins/lead-resources/src/plugin.ts | 4 +- 6 files changed, 175 insertions(+), 2 deletions(-) create mode 100644 plugins/lead-resources/src/components/MyLeads.svelte diff --git a/models/lead/src/index.ts b/models/lead/src/index.ts index 7e3518f194..9ef793800b 100644 --- a/models/lead/src/index.ts +++ b/models/lead/src/index.ts @@ -124,6 +124,13 @@ export function createModel (builder: Builder): void { hidden: false, navigatorModel: { specials: [ + { + id: 'my-leads', + label: lead.string.MyLeads, + icon: lead.icon.Lead, + component: lead.component.MyLeads, + position: 'top' + }, { id: 'customers', label: lead.string.Customers, @@ -378,6 +385,10 @@ export function createModel (builder: Builder): void { filters: ['attachedTo'] }) + builder.mixin(lead.class.Lead, core.class.Class, notification.mixin.ClassCollaborators, { + fields: ['createdBy', 'assignee'] + }) + builder.mixin(lead.mixin.Customer, core.class.Class, view.mixin.ClassFilters, { filters: ['_class'] }) diff --git a/plugins/lead-assets/lang/en.json b/plugins/lead-assets/lang/en.json index b9f7dfb0a4..9a7b227287 100644 --- a/plugins/lead-assets/lang/en.json +++ b/plugins/lead-assets/lang/en.json @@ -13,6 +13,7 @@ "Customer": "Customer", "Customers": "Customers", "Leads": "Leads", + "MyLeads": "My Leads", "SelectCustomer": "Select customer", "Lead": "Lead", "Assignee": "Assignee", diff --git a/plugins/lead-assets/lang/ru.json b/plugins/lead-assets/lang/ru.json index 20f5bfa9eb..94578a9acb 100644 --- a/plugins/lead-assets/lang/ru.json +++ b/plugins/lead-assets/lang/ru.json @@ -13,6 +13,7 @@ "Customer": "Клиент", "Customers": "Клиенты", "Leads": "Сделки", + "MyLeads": "Мои сделки", "SelectCustomer": "Выбрать клиента", "Lead": "Сделка", "Assignee": "Исполнитель", diff --git a/plugins/lead-resources/src/components/MyLeads.svelte b/plugins/lead-resources/src/components/MyLeads.svelte new file mode 100644 index 0000000000..133fc6dcca --- /dev/null +++ b/plugins/lead-resources/src/components/MyLeads.svelte @@ -0,0 +1,156 @@ + + + +
+
+ + {#if modeSelectorProps !== undefined} + + {/if} +
+
+
+
+ +
+ +
+ {#if viewlet} + + {/if} +
+ (resultQuery = e.detail)} /> + +{#if viewlet} + {#if loading} + + {:else} + + {/if} +{/if} diff --git a/plugins/lead-resources/src/index.ts b/plugins/lead-resources/src/index.ts index d69b341e6e..78793651a5 100644 --- a/plugins/lead-resources/src/index.ts +++ b/plugins/lead-resources/src/index.ts @@ -27,6 +27,7 @@ import CreateCustomer from './components/CreateCustomer.svelte' import NewItemsHeader from './components/NewItemsHeader.svelte' import { getLeadTitle } from './utils' import EditFunnel from './components/EditFunnel.svelte' +import MyLeads from './components/MyLeads.svelte' export default async (): Promise => ({ component: { @@ -40,7 +41,8 @@ export default async (): Promise => ({ Leads, CreateCustomer, NewItemsHeader, - EditFunnel + EditFunnel, + MyLeads }, function: { LeadTitleProvider: getLeadTitle diff --git a/plugins/lead-resources/src/plugin.ts b/plugins/lead-resources/src/plugin.ts index dcebe06304..480d410126 100644 --- a/plugins/lead-resources/src/plugin.ts +++ b/plugins/lead-resources/src/plugin.ts @@ -31,6 +31,7 @@ export default mergeIds(leadId, lead, { SelectCustomer: '' as IntlString, Customers: '' as IntlString, Leads: '' as IntlString, + MyLeads: '' as IntlString, NoLeadsForDocument: '' as IntlString, LeadPlaceholder: '' as IntlString, CreateCustomer: '' as IntlString, @@ -47,7 +48,8 @@ export default mergeIds(leadId, lead, { CreateCustomer: '' as AnyComponent, LeadsPresenter: '' as AnyComponent, CreateFunnel: '' as AnyComponent, - EditFunnel: '' as AnyComponent + EditFunnel: '' as AnyComponent, + MyLeads: '' as AnyComponent }, function: { LeadTitleProvider: '' as Resource<(client: Client, ref: Ref) => Promise>