Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev' of https://github.com/erxes/erxes-community into m…
Browse files Browse the repository at this point in the history
…eeting
  • Loading branch information
enkhtuvshinD committed Oct 10, 2023
2 parents 9cd0175 + a75927b commit 355ebfd
Show file tree
Hide file tree
Showing 36 changed files with 350 additions and 152 deletions.
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "erxes",
"version": "0.4.27",
"version": "0.4.28",
"description": "Free and open fair-code licensed all-in-one growth marketing & management software",
"homepage": "https://erxes.io",
"repository": "https://github.com/erxes/erxes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ class GroupList extends React.Component<IProps> {
return currentGroup === id;
};

clearGroupFilter = () => {
router.setParams(this.props.history, { groupId: null });
};

renderEditAction(object: IUserGroupDocument) {
const trigger = (
<Button btnStyle="link">
Expand Down Expand Up @@ -152,18 +148,7 @@ class GroupList extends React.Component<IProps> {
return (
<>
<Header>{this.renderFormTrigger(trigger)}</Header>
<Section.Title>
{__('User groups')}
<Section.QuickButtons>
{router.getParam(this.props.history, 'groupId') && (
<a href="#cancel" tabIndex={0} onClick={this.clearGroupFilter}>
<Tip text={__('Clear filter')}>
<Icon icon="cancel-1" />
</Tip>
</a>
)}
</Section.QuickButtons>
</Section.Title>
<Section.Title>{__('User groups')}</Section.Title>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ class PermissionList extends React.Component<Props> {
return (
<Wrapper
header={
<Wrapper.Header title={__('Permissions')} breadcrumb={breadcrumb} />
<Wrapper.Header
title={__('Permissions')}
queryParams={queryParams}
breadcrumb={breadcrumb}
filterTitle={this.props.currentGroupName}
/>
}
actionBar={this.renderActionBar()}
leftSidebar={<GroupList queryParams={queryParams} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const FormContainer = (props: Props) => {
object,
callback
}: IButtonMutateProps) => {
if (!values.parentId) {
values.parentId = null;
}
return (
<ButtonMutate
mutation={
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { mutations, queries } from '@erxes/ui/src/team/graphql';

import ButtonMutate from '@erxes/ui/src/components/ButtonMutate';
import { IButtonMutateProps } from '@erxes/ui/src/types';
import Form from '../../components/unit/Form';
import { mutations, queries } from '@erxes/ui/src/team/graphql';
import { gql } from '@apollo/client';
import { useQuery } from '@apollo/client';
import { IButtonMutateProps } from '@erxes/ui/src/types';
import { IUnit } from '@erxes/ui/src/team/types';
import React from 'react';
import Spinner from '@erxes/ui/src/components/Spinner';
import { gql } from '@apollo/client';
import { useQuery } from '@apollo/client';

type Props = {
unit?: IUnit;
Expand All @@ -32,7 +33,11 @@ const FormContainer = (props: Props) => {
return (
<ButtonMutate
mutation={object._id ? mutations.unitsEdit : mutations.unitsAdd}
refetchQueries={['unitsMain']}
refetchQueries={[
{
query: gql(queries.units)
}
]}
variables={values}
isSubmitted={isSubmitted}
type="submit"
Expand Down
6 changes: 5 additions & 1 deletion packages/core-ui/src/modules/settings/team/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export const generateTree = (
level = -1,
parentKey = 'parentId'
) => {
const filtered = list.filter(c => c[parentKey] === parentId);
const filtered = list.filter(
c =>
c[parentKey] === parentId ||
(parentId === null && (!c[parentKey] || c[parentKey] === c._id))
);

if (filtered.length > 0) {
level++;
Expand Down
20 changes: 11 additions & 9 deletions packages/erxes-ui/src/components/filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import { removeParams, setParams } from '../../utils/router';

interface IProps extends IRouterProps {
queryParams?: any;
filterTitle?: string; // Define the prop here
}

const Filters = styled.div`
font-size: 0.9em;
`;

function Filter({ queryParams = {}, history }: IProps) {
function Filter({ queryParams = {}, filterTitle, history }: IProps) {
const onClickClose = paramKey => {
for (const key of paramKey) {
removeParams(history, key);
Expand Down Expand Up @@ -65,12 +66,12 @@ function Filter({ queryParams = {}, history }: IProps) {
const id = queryParams[paramKey];

let graphqlQuery = gql`
query ${type}Detail($id: String!) {
${type}Detail(_id: $id) {
${fields}
}
query ${type}Detail($id: String!) {
${type}Detail(_id: $id) {
${fields}
}
`;
}
`;

if (type === 'forum') {
graphqlQuery = gql`
Expand Down Expand Up @@ -138,16 +139,17 @@ function Filter({ queryParams = {}, history }: IProps) {
{renderFilterParam('awaitingResponse', true, 'Awaiting Response')}
{renderFilterWithData('brandId', 'brand')}
{renderFilterParam('integrationType', false)}
{renderFilterParam('departmentId', true, 'Department')}
{renderFilterParam('unitId', true, 'Unit')}
{renderFilterParam('branchId', true, 'Branch')}
{renderFilterWithData('tag', 'tag')}
{renderFilterWithData('segment', 'segment')}
{renderFilterParam('segmentData', true, 'Temporary segment')}
{renderFilterParam('kind', false)}
{renderFilterWithData('brand', 'brand')}
{renderFilterWithDate()}
{renderFilterWithData('form', 'form', '_id title')}
{renderFilterWithData('branchId', 'branch', '_id title')}
{renderFilterWithData('departmentId', 'department', '_id title')}
{renderFilterWithData('unitId', 'unit', '_id title')}
{renderFilterParam('groupId', true, filterTitle)}
</Filters>
);
}
Expand Down
8 changes: 7 additions & 1 deletion packages/erxes-ui/src/components/filter/createChipText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ const ChipText = (props: any) => {
const segment = query.segmentDetail;
const form = query.formDetail;
const forum = query.forumCategory;
const branch = query.branchDetail;
const department = query.departmentDetail;
const unit = query.unitDetail;

return (
(brand && brand.name) ||
(channel && channel.name) ||
(tag && tag.name) ||
(segment && segment.name) ||
(form && form.title) ||
(forum && forum.name)
(forum && forum.name) ||
(branch && branch.title) ||
(department && department.title) ||
(unit && unit.title)
);
};

Expand Down
13 changes: 11 additions & 2 deletions packages/erxes-ui/src/layout/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Props = {
queryParams?: any;
title: string;
additionalMenuItem?: React.ReactNode;
filterTitle?: string;
};

class Header extends React.Component<Props> {
Expand All @@ -33,15 +34,23 @@ class Header extends React.Component<Props> {
}

render() {
const { breadcrumb, submenu, queryParams, additionalMenuItem } = this.props;
const {
breadcrumb,
submenu,
queryParams,
additionalMenuItem,
filterTitle
} = this.props;

return (
<PageHeader>
{breadcrumb && <BreadCrumb breadcrumbs={breadcrumb} />}
{submenu && (
<Submenu items={submenu} additionalMenuItem={additionalMenuItem} />
)}
{queryParams && <Filter queryParams={queryParams} />}
{queryParams && (
<Filter queryParams={queryParams} filterTitle={filterTitle} />
)}
</PageHeader>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-contacts-api/src/graphql/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const types = (tagsEnabled, inboxEnabled) => `
}
type Customer @key(fields: "_id") @cacheControl(maxAge: 3) {
_id: String
_id: String!
state: String
createdAt: Date
modifiedAt: Date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ const exmFeedQueries = {
filter.contentType = { $in: contentTypes };
}

if (contentTypes && contentTypes.includes('bravo')) {
if (recipientType === 'recieved') {
filter.recipientIds = { $in: [user._id] };
} else if (recipientType === 'sent') {
filter.createdBy = user._id;
} else {
filter.$or.push(
{ recipientIds: { $in: [user._id] } },
{ createdBy: user._id }
);
}
}

if (isPinned !== undefined) {
if (isPinned) {
filter.isPinned = true;
Expand Down
31 changes: 31 additions & 0 deletions packages/plugin-imap-api/src/graphql/resolvers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@ const queries = {
const convertEmails = emails =>
(emails || []).map(item => ({ name: item.name, email: item.address }));

const getNewContentFromMessageBody = html => {
const startIndex = html.indexOf('<div dir="ltr">');

if (startIndex !== -1) {
const endIndex = html.indexOf('</div><br>', startIndex);

if (endIndex !== -1) {
const extractedContent = html.substring(
startIndex,
endIndex + '</div><br>'.length
);
return extractedContent;
}
}
};

const getRepliesFromMessageBody = html => {
const startIndex = html.indexOf('<div class="gmail_quote">');

if (startIndex !== -1) {
const endIndex = html.lastIndexOf('</div>');

if (endIndex !== -1) {
const extractedContent = html.substring(startIndex, endIndex);
return extractedContent;
}
}
};

return messages.map(message => {
return {
_id: message._id,
Expand All @@ -25,6 +54,8 @@ const queries = {
bcc: convertEmails(message.bcc),
subject: message.subject,
body: message.body,
newContent: getNewContentFromMessageBody(message.body),
replies: getRepliesFromMessageBody(message.body),
attachments: message.attachments
},
createdAt: message.createdAt
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-loans-api/src/models/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ export const loadContractClass = (models: IModels) => {
return {
contractId: contract._id,
status: SCHEDULE_STATUS.PENDING,
payDate: a.date,
payDate: a.payDate,

balance: a.balance,
interestNonce: a.interest,
interestNonce: a.interestNonce,
payment: a.payment,
total: a.interest + a.payment
total: a.total
};
});

Expand Down
Loading

0 comments on commit 355ebfd

Please sign in to comment.