diff --git a/packages/core/src/data/resolvers/queries/structures.ts b/packages/core/src/data/resolvers/queries/structures.ts index 0c463de5247..1d3b587676c 100644 --- a/packages/core/src/data/resolvers/queries/structures.ts +++ b/packages/core/src/data/resolvers/queries/structures.ts @@ -112,7 +112,17 @@ const structureQueries = { type: 'department', params }); - return models.Departments.find(filter).sort({ order: 1 }); + const pipeline: any[] = [{ $match: filter }, { $sort: { order: 1 } }]; + + if (!!params?.ids?.length) { + pipeline.push({ + $addFields: { + __order: { $indexOfArray: [params.ids, '$_id'] } + } + }); + pipeline.push({ $sort: { __order: 1 } }); + } + return models.Departments.aggregate(pipeline); }, async departmentsMain( diff --git a/packages/plugin-clientportal-api/src/graphql/resolvers/mutations/clientPortalUser.ts b/packages/plugin-clientportal-api/src/graphql/resolvers/mutations/clientPortalUser.ts index 875177f4366..0eea67b244e 100644 --- a/packages/plugin-clientportal-api/src/graphql/resolvers/mutations/clientPortalUser.ts +++ b/packages/plugin-clientportal-api/src/graphql/resolvers/mutations/clientPortalUser.ts @@ -146,6 +146,8 @@ const clientPortalUserMutations = { args: ILoginParams, { models, requestInfo, res }: IContext ) => { + console.log('clientPortalLogin'); + const { token } = await models.ClientPortalUsers.login(args); const cookieOptions: any = {}; diff --git a/packages/plugin-clientportal-api/src/models/ClientPortalUser.ts b/packages/plugin-clientportal-api/src/models/ClientPortalUser.ts index 065c8dd19e6..689450f539d 100644 --- a/packages/plugin-clientportal-api/src/models/ClientPortalUser.ts +++ b/packages/plugin-clientportal-api/src/models/ClientPortalUser.ts @@ -724,6 +724,8 @@ export const loadClientPortalUserClass = (models: IModels) => { throw new Error('Invalid login'); } + console.log({ login, password, clientPortalId }); + const user = await models.ClientPortalUsers.findOne({ $or: [ { email: { $regex: new RegExp(`^${login}$`, 'i') } }, @@ -733,6 +735,8 @@ export const loadClientPortalUserClass = (models: IModels) => { clientPortalId }); + console.log('user passed'); + if (!user || !user.password) { throw new Error('Invalid login'); } @@ -741,8 +745,12 @@ export const loadClientPortalUserClass = (models: IModels) => { throw new Error('User is not verified'); } + console.log('config started'); + const cp = await models.ClientPortals.getConfig(clientPortalId); + console.log('config passed'); + if ( cp.manualVerificationConfig && user.type === 'customer' && diff --git a/packages/plugin-contacts-ui/src/customers/components/detail/CustomerDetails.tsx b/packages/plugin-contacts-ui/src/customers/components/detail/CustomerDetails.tsx index d7fc34dc909..f681ea81278 100755 --- a/packages/plugin-contacts-ui/src/customers/components/detail/CustomerDetails.tsx +++ b/packages/plugin-contacts-ui/src/customers/components/detail/CustomerDetails.tsx @@ -48,6 +48,7 @@ class CustomerDetails extends React.Component { @@ -121,7 +122,7 @@ class CustomerDetails extends React.Component { contentType="contacts:customer" extraTabs={[ { name: 'inbox:conversation', label: 'Conversation' }, - { name: 'email', label: 'Email' }, + { name: 'imap:email', label: 'Email' }, { name: 'cards:task', label: 'Task' }, // { name: 'sms', label: 'SMS' }, { name: 'engages:campaign', label: 'Campaign' } diff --git a/packages/ui-contacts/src/customers/components/common/ActionSection.tsx b/packages/ui-contacts/src/customers/components/common/ActionSection.tsx index f164a06dc2a..0dd1540fa37 100644 --- a/packages/ui-contacts/src/customers/components/common/ActionSection.tsx +++ b/packages/ui-contacts/src/customers/components/common/ActionSection.tsx @@ -1,5 +1,5 @@ import { Alert, __, confirm } from '@erxes/ui/src/utils'; -import { Box, MailBox, States } from '../../styles'; +import { Box, States } from '../../styles'; import { Actions } from '@erxes/ui/src/styles/main'; import Button from '@erxes/ui/src/components/Button'; @@ -13,7 +13,6 @@ import DropdownToggle from '@erxes/ui/src/components/DropdownToggle'; import { ICompany } from '@erxes/ui-contacts/src/companies/types'; import { ICustomer } from '../../types'; import Icon from '@erxes/ui/src/components/Icon'; -import MailForm from '@erxes/ui-inbox/src/settings/integrations/containers/mail/MailForm'; import ModalTrigger from '@erxes/ui/src/components/ModalTrigger'; import React from 'react'; import SmsForm from '@erxes/ui-inbox/src/settings/integrations/containers/telnyx/SmsForm'; @@ -42,44 +41,10 @@ class ActionSection extends React.Component { const { coc, cocType } = this.props; const { primaryPhone, primaryEmail } = coc; - const content = props => ( - - - - ); - const smsForm = props => ; return ( <> - - - - - - } - size="lg" - content={content} - paddingContent="less-padding" - enforceFocus={false} - />