Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/erxes-ui/src/components/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ const Map = (props: IMapProps) => {
addListeners(marker, 'your location');
}
};

const isChildModal = localStorage.getItem('isChildModal');
return isChildModal === 'true' ? (
<MapContainer id={props.id + '1'} fullHeight={props.fullHeight} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ const clientPortalUserMutations = {
{ models, requestInfo, res }: IContext
) => {
const authHeader = requestInfo.headers.authorization;

if (!authHeader) {
throw new Error('Invalid refresh token');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ import { IContext } from '../../../connectionResolver';
const notificationQueries = {
async clientPortalNotificationCount(
_root,
_args,
{ all }: { all: boolean },
{ models, cpUser }: IContext
) {
if (!cpUser) {
throw new Error('You are not logged in');
}

return models.ClientPortalNotifications.find({
let qry: { receiver: string; isRead?: boolean } = {
receiver: cpUser._id,
isRead: false
}).countDocuments();
};

if (all) {
delete qry.isRead;
}

return models.ClientPortalNotifications.find(qry).countDocuments();
},

async clientPortalNotifications(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ ${
kbToggle: Boolean,
publicTaskToggle: Boolean,
ticketToggle: Boolean,
taskToggle: Boolean,
dealToggle: Boolean,
purchaseToggle: Boolean,

Expand Down Expand Up @@ -232,7 +231,7 @@ export const queries = (cardAvailable, kbAvailable, formsAvailable) => `
}
`;

export const mutations = cardAvailable => `
export const mutations = (cardAvailable) => `
clientPortalConfigUpdate (
_id: String
name: String
Expand All @@ -247,6 +246,7 @@ export const mutations = cardAvailable => `
knowledgeBaseLabel: String
knowledgeBaseTopicId: String
ticketLabel: String
dealLabel: String
taskLabel: String
dealLabel: String
purchaseLabel: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const params = `

export const queries = `
clientPortalNotifications(${params}): [ClientPortalNotification]
clientPortalNotificationCount: Int
clientPortalNotificationCount(all: Boolean): Int
clientPortalNotificationDetail(_id: String!): ClientPortalNotification
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,16 @@ export const clientPortalSchema = new Schema({
manualVerificationConfig: field({
type: {
userIds: field({ type: [String], required: true }),
verifyCustomer: field({ type: Boolean, optional: true, default: false }),
verifyCompany: field({ type: Boolean, optional: true, default: false })
verifyCustomer: field({
type: Boolean,
optional: true,
default: false
}),
verifyCompany: field({
type: Boolean,
optional: true,
default: false
})
},
optional: true
}),
Expand Down Expand Up @@ -229,7 +237,11 @@ export const clientPortalSchema = new Schema({

passwordVerificationConfig: field({
type: {
verifyByOTP: field({ type: Boolean, optional: true, default: false }),
verifyByOTP: field({
type: Boolean,
optional: true,
default: false
}),
emailSubject: field({ type: String, optional: true }),
emailContent: field({ type: String, optional: true }),
smsContent: field({ type: String, optional: true })
Expand Down
22 changes: 21 additions & 1 deletion packages/plugin-clientportal-ui/src/components/forms/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,27 @@ function General({
'ticketToggle',
ticketToggle || false
)}

{isEnabled('cards') &&
renderFeatureBlock(
'deals',
<>
{renderControl({
label: 'Deals',
subtitle: 'Shown name on menu',
formValueName: 'dealLabel',
formValue: dealLabel,
placeholder: 'Please enter a label for Deal'
})}
{renderBoardSelect({
type: 'deal',
stageId: dealStageId,
pipelineId: dealPipelineId,
boardId: dealBoardId
})}
</>,
'dealToggle',
dealToggle || false
)}
{isEnabled('cards') &&
renderFeatureBlock(
'deals',
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-clientportal-ui/src/graphql/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const createOrUpdateConfig = `
$kbToggle: Boolean
$publicTaskToggle: Boolean
$ticketToggle: Boolean
$dealToggle: Boolean
$taskToggle: Boolean
$dealToggle: Boolean
$purchaseToggle: Boolean
Expand Down Expand Up @@ -73,6 +74,7 @@ const createOrUpdateConfig = `
taskPublicPipelineId: $taskPublicPipelineId,
taskPublicLabel: $taskPublicLabel,
ticketLabel: $ticketLabel,
dealLabel: $dealLabel,
taskLabel: $taskLabel,
dealLabel: $dealLabel,
purchaseLabel: $purchaseLabel,
Expand Down Expand Up @@ -100,6 +102,7 @@ const createOrUpdateConfig = `
kbToggle: $kbToggle,
publicTaskToggle: $publicTaskToggle,
ticketToggle: $ticketToggle,
dealToggle: $dealToggle,
taskToggle: $taskToggle,
dealToggle: $dealToggle,
purchaseToggle: $purchaseToggle,
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-clientportal-ui/src/graphql/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const commonFields = `
kbToggle
publicTaskToggle
ticketToggle
dealToggle
taskToggle
dealToggle
purchaseToggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ class PollOptions extends React.Component<Props, State> {

return value;
};

renderOption = (option: IPollOption) => {
return (
<li key={option._id} onDoubleClick={this.showEditForm.bind(this, option)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const inventoryMutations = {
categoryOfId[cat._id] = cat;
}

const productCodes = products.map(p => p.code) || [];
const productCodes = products.map((p) => p.code) || [];
const response = await sendRequest({
url: process.env.ERKHET_URL + '/get-api/',
method: 'GET',
Expand All @@ -67,8 +67,8 @@ const inventoryMutations = {
const deleteProducts: any = [];
let matchedCount = 0;

let result = JSON.parse(response).map(r => r.fields);
const resultCodes = result.map(r => r.code) || [];
let result = JSON.parse(response).map((r) => r.fields);
const resultCodes = result.map((r) => r.code) || [];

const productByCode = {};
for (const product of products) {
Expand Down Expand Up @@ -139,7 +139,7 @@ const inventoryMutations = {
isRPC: true
});

const categoryCodes = categories.map(c => c.code);
const categoryCodes = categories.map((c) => c.code);

if (!categoryCodes) {
throw new Error('No category codes found.');
Expand All @@ -160,20 +160,22 @@ const inventoryMutations = {
if (!response || Object.keys(JSON.parse(response)).length === 0) {
throw new Error('Erkhet data not found.');
}
let result = JSON.parse(response).map(r => r.fields);
let result = JSON.parse(response).map((r) => r.fields);

// for update
const matchedErkhetData = result.filter(r => {
if (categoryCodes.find(p => p === r.code)) {
const matchedErkhetData = result.filter((r) => {
if (categoryCodes.find((p) => p === r.code)) {
return r;
}
});
// for create
const otherErkhetData = result.filter(r => !matchedErkhetData.includes(r));
const otherErkhetData = result.filter(
(r) => !matchedErkhetData.includes(r)
);
// for delete
let otherCategories: any[] = [];
for (const code of categoryCodes) {
if (result.every(r => r.code !== code)) {
if (result.every((r) => r.code !== code)) {
const response = await sendProductsMessage({
subdomain,
action: 'categories.findOne',
Expand Down