diff --git a/.codeclimate.yml b/.codeclimate.yml index 2fca0d306..ac38c27bb 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -31,7 +31,4 @@ exclude_patterns: - "**/*.yml" - "app/javascript/dashboard/i18n/locale" - "**/*.stories.js" - - "stories/**/*" - - "**/*.stories.js" - - "**/stories/" - - "app/javascript/**/*.stories.js" + - "stories/" diff --git a/app/javascript/dashboard/i18n/locale/en/contact.json b/app/javascript/dashboard/i18n/locale/en/contact.json index 24bcbc27e..051aad27e 100644 --- a/app/javascript/dashboard/i18n/locale/en/contact.json +++ b/app/javascript/dashboard/i18n/locale/en/contact.json @@ -131,6 +131,7 @@ }, "CONTACTS_PAGE": { "HEADER": "Contacts", + "FIELDS": "Contact fields", "SEARCH_BUTTON": "Search", "SEARCH_INPUT_PLACEHOLDER": "Search for contacts", "LIST": { @@ -204,5 +205,33 @@ "PLACEHOLDER": "Eg: 11901 " } } + }, + "MERGE_CONTACTS": { + "TITLE": "Merge contacts", + "DESCRIPTION": "Merge contact is helpful when you have duplicated entries of the same contact. Merging action takes a primary contact and a child contact. After merging, all details in the primary contact will remain the same. If the primary contact doesn't have a field, then the value from the child contact will be used after merging. If a conflict happens, fields in primary contact will remain unaffected, but fields from secondary will be copied to the custom attributes in the primary contact.", + "PRIMARY": { + "TITLE": "Primary contact" + }, + "CHILD": { + "TITLE": "Contact to merge", + "PLACEHOLDER": "Choose a contact" + }, + "SUMMARY": { + "TITLE": "Summary", + "DELETE_WARNING": "Contact of %{childContactName}will be deleted.", + "ATTRIBUTE_WARNING": "Contact details of %{childContactName} will be copied to %{primaryContactName}." + }, + "SEARCH": { + "ERROR": "ERROR_MESSAGE" + }, + "FORM": { + "SUBMIT": " Merge contacts", + "CANCEL": "Cancel", + "CHILD_CONTACT": { + "ERROR": "Select a child contact to merge" + }, + "SUCCESS_MESSAGE": "Contact merged successfully", + "ERROR_MESSAGE": "Could not merge contcts, try again!" + } } } diff --git a/app/javascript/dashboard/modules/contact/components/ContactDropdownItem.vue b/app/javascript/dashboard/modules/contact/components/ContactDropdownItem.vue new file mode 100644 index 000000000..3263f57b6 --- /dev/null +++ b/app/javascript/dashboard/modules/contact/components/ContactDropdownItem.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/app/javascript/dashboard/modules/contact/components/MergeContact.vue b/app/javascript/dashboard/modules/contact/components/MergeContact.vue new file mode 100644 index 000000000..432d00cde --- /dev/null +++ b/app/javascript/dashboard/modules/contact/components/MergeContact.vue @@ -0,0 +1,209 @@ + + + + + diff --git a/app/javascript/dashboard/modules/contact/components/MergeContactSummary.vue b/app/javascript/dashboard/modules/contact/components/MergeContactSummary.vue new file mode 100644 index 000000000..5d028bd6a --- /dev/null +++ b/app/javascript/dashboard/modules/contact/components/MergeContactSummary.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/app/javascript/dashboard/modules/contact/stories/ContactIntro.stories.js b/app/javascript/dashboard/modules/contact/stories/ContactIntro.stories.js index ddaeb22e8..8c860ebd0 100644 --- a/app/javascript/dashboard/modules/contact/stories/ContactIntro.stories.js +++ b/app/javascript/dashboard/modules/contact/stories/ContactIntro.stories.js @@ -10,7 +10,7 @@ const Template = (args, { argTypes }) => ({ props: Object.keys(argTypes), components: { ContactIntro }, template: - '', + '', }); export const DefaultContactIntro = Template.bind({}); diff --git a/app/javascript/dashboard/modules/contact/stories/MergeContact.stories.js b/app/javascript/dashboard/modules/contact/stories/MergeContact.stories.js new file mode 100644 index 000000000..3700ba0f1 --- /dev/null +++ b/app/javascript/dashboard/modules/contact/stories/MergeContact.stories.js @@ -0,0 +1,32 @@ +import { action } from '@storybook/addon-actions'; +import MergeContact from 'dashboard/modules/contact/components/MergeContact'; + +export default { + title: 'Components/Contact/MergeContacts', + component: MergeContact, + argTypes: { + 'primary-contact': { + defaultValue: '{}', + control: { + type: 'object', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { MergeContact }, + template: + '', +}); + +export const List = Template.bind({}); +List.args = { + primaryContact: { + id: 12, + name: 'Mason Mount', + }, + onSearch: action('Search'), + onSubmit: action('Submit'), +}; diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue index a8642fa15..55d2308fd 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue @@ -359,7 +359,7 @@ export default { margin-bottom: var(--space-normal); border-bottom: 1px solid var(--color-border-light); } - .multiselect-wrap--small { + .conversation--actions .multiselect-wrap--small { .multiselect { padding-left: var(--space-medium); box-sizing: border-box;