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
Show all changes
31 commits
Select commit Hold shift + click to select a range
908a144
move config on syncerkhet
munkhsaikhan Oct 9, 2023
179ff81
merge erkhet url
munkhsaikhan Oct 9, 2023
c9c4536
consume from erkhet check api_key
munkhsaikhan Oct 9, 2023
ecc3791
erkhet url for env
munkhsaikhan Oct 9, 2023
4bd6577
general config is many
munkhsaikhan Oct 10, 2023
49a48d4
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 10, 2023
95ae8fc
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 11, 2023
52bda67
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 11, 2023
cc3be97
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 12, 2023
e2e727c
product from erkhet with brand
munkhsaikhan Oct 12, 2023
05bb973
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 16, 2023
61d2438
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 23, 2023
2f42a59
product by brand
munkhsaikhan Oct 24, 2023
9a9dfa0
product category by brand
munkhsaikhan Oct 24, 2023
ace0eba
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 24, 2023
d5cad10
category
munkhsaikhan Oct 24, 2023
77009d1
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 25, 2023
60bd6ec
params
munkhsaikhan Oct 25, 2023
a237aa4
products to many erkhet
munkhsaikhan Oct 28, 2023
192e495
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 28, 2023
41b5a5b
customer to many erkhet
munkhsaikhan Oct 28, 2023
b6e21a5
trigger plugins map
Oct 30, 2023
a4f7efc
sales config first
munkhsaikhan Oct 30, 2023
6aa1c33
conflict experiment
dulguun0225 Oct 30, 2023
b8c7ae4
Merge branch 'dev' of github.com:erxes/erxes-community into manySynce…
munkhsaikhan Oct 30, 2023
f3a432b
Merge branch 'dev' of github.com:erxes/erxes into manySyncerkhet
munkhsaikhan Oct 30, 2023
c867513
sale config
munkhsaikhan Oct 30, 2023
db683da
send sale
munkhsaikhan Oct 31, 2023
8b359b8
hasPayment
munkhsaikhan Oct 31, 2023
ee39000
check products and prodCategories
munkhsaikhan Oct 31, 2023
13ffb48
send many erkhet sale
munkhsaikhan Oct 31, 2023
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
3 changes: 3 additions & 0 deletions packages/api-plugin-template.erxes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,6 @@ async function startServer() {
}

startServer();


// conflict test
4 changes: 3 additions & 1 deletion packages/erxes-ui/src/brands/containers/SelectBrands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default ({
initialValue,
multi = true,
label,
customOption,
name
}: {
queryParams?: IQueryParams;
Expand All @@ -46,6 +47,7 @@ export default ({
generateOptions={generateBrandOptions}
onSelect={onSelect}
multi={multi}
customOption={customOption}
/>
);
};
};
9 changes: 8 additions & 1 deletion packages/erxes-ui/src/components/filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ function Filter({ queryParams = {}, filterTitle, history }: IProps) {
{renderFilterParam('status', false)}
{renderFilterParam('state', false)}
{renderFilterParam('categoryApprovalState', false)}
{renderFilterWithData('categoryId', 'forum')}
{location.href.includes('forum') &&
renderFilterWithData('categoryId', 'forum')}
{location.href.includes('product') &&
renderFilterWithData(
'categoryId',
'productCategory',
'_id, code, name'
)}
{renderFilterParam('participating', true)}
{renderFilterParam('unassigned', true)}
{renderFilterParam('awaitingResponse', true, 'Awaiting Response')}
Expand Down
4 changes: 3 additions & 1 deletion packages/erxes-ui/src/components/filter/createChipText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ChipText = (props: any) => {
const branch = query.branchDetail;
const department = query.departmentDetail;
const unit = query.unitDetail;
const productCategory = query.productCategoryDetail;

return (
(brand && brand.name) ||
Expand All @@ -26,7 +27,8 @@ const ChipText = (props: any) => {
(forum && forum.name) ||
(branch && branch.title) ||
(department && department.title) ||
(unit && unit.title)
(unit && unit.title) ||
(productCategory && `${productCategory.code} - ${productCategory.name}`)
);
};

Expand Down
14 changes: 10 additions & 4 deletions packages/plugin-pos-api/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { IPosDocument } from './models/definitions/pos';
import {
sendCoreMessage,
sendPricingMessage,
sendProductsMessage
sendProductsMessage,
sendSyncerkhetMessage
} from './messageBroker';
import { USER_FIELDS } from './contants';

Expand Down Expand Up @@ -45,7 +46,7 @@ export const getConfigData = async (subdomain: string, pos: IPosDocument) => {
}

if (pos.erkhetConfig && pos.erkhetConfig.isSyncErkhet) {
const configs = await sendCoreMessage({
const configs = await sendSyncerkhetMessage({
subdomain,
action: 'getConfig',
data: { code: 'ERKHET', defaultValue: {} },
Expand All @@ -54,7 +55,7 @@ export const getConfigData = async (subdomain: string, pos: IPosDocument) => {

data.pos.erkhetConfig = {
...pos.erkhetConfig,
getRemainderApiUrl: configs.getRemainderApiUrl,
url: process.env.ERKHET_URL,
apiKey: configs.apiKey,
apiSecret: configs.apiSecret,
apiToken: configs.apiToken
Expand Down Expand Up @@ -309,7 +310,12 @@ export const unfetchOrderInfo = async (req, res) => {
const models = await generateModels(subdomain);

const { orderId, token } = req.body;
let erkhetConfig = await getConfig(subdomain, 'ERKHET', {});
let erkhetConfig = await sendSyncerkhetMessage({
subdomain,
action: 'getConfig',
data: { code: 'ERKHET', defaultValue: {} },
isRPC: true
});

if (
!erkhetConfig ||
Expand Down
10 changes: 3 additions & 7 deletions packages/plugin-posclient-api/src/graphql/utils/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ export const checkRemainders = async (

if (config.erkhetConfig && config.erkhetConfig.getRemainder) {
const configs = config.erkhetConfig;
if (
configs &&
configs.getRemainderApiUrl &&
configs.apiKey &&
configs.apiSecret
) {
if (configs && configs.url && configs.apiKey && configs.apiSecret) {
try {
let account = configs.account;
let location = configs.location;
Expand All @@ -35,7 +30,8 @@ export const checkRemainders = async (

if (account && location) {
const response = await sendRequest({
url: configs.getRemainderApiUrl,
url: `${configs.url ||
'https://erkhet.biz'}/get-api/?kind=remainder`,
method: 'GET',
params: {
kind: 'remainder',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface IQueryParams {
categoryId?: string;
searchValue?: string;
vendorId?: string;
brand?: string;
tag: string;
page?: number;
perPage?: number;
Expand All @@ -44,6 +45,7 @@ const generateFilter = async (
categoryId,
searchValue,
vendorId,
brand,
tag,
ids,
excludeIds,
Expand Down Expand Up @@ -131,6 +133,10 @@ const generateFilter = async (
filter.vendorId = vendorId;
}

if (brand) {
filter.scopeBrandIds = { $in: [brand] };
}

return filter;
};

Expand All @@ -140,6 +146,7 @@ const generateFilterCat = async ({
withChild,
searchValue,
meta,
brand,
status
}) => {
const filter: any = {};
Expand Down Expand Up @@ -170,6 +177,10 @@ const generateFilterCat = async ({
}
}

if (brand) {
filter.scopeBrandIds = { $in: [brand] };
}

if (meta) {
if (!isNaN(meta)) {
filter.meta = { $lte: Number(meta) };
Expand Down Expand Up @@ -391,7 +402,7 @@ const productQueries = {

async productCategories(
_root,
{ parentId, withChild, searchValue, status, meta },
{ parentId, withChild, searchValue, status, brand, meta },
{ models }: IContext
) {
const filter = await generateFilterCat({
Expand All @@ -400,6 +411,7 @@ const productQueries = {
parentId,
withChild,
searchValue,
brand,
meta
});

Expand All @@ -412,7 +424,7 @@ const productQueries = {

async productCategoriesTotalCount(
_root,
{ parentId, searchValue, status, withChild, meta },
{ parentId, searchValue, status, withChild, brand, meta },
{ models }: IContext
) {
const filter = await generateFilterCat({
Expand All @@ -421,6 +433,7 @@ const productQueries = {
withChild,
searchValue,
status,
brand,
meta
});
return models.ProductCategories.find(filter).countDocuments();
Expand Down
7 changes: 6 additions & 1 deletion packages/plugin-products-api/src/graphql/schema/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const types = (tagsAvailable, contactsAvailable) => `
parentId: String
code: String!
order: String!
scopeBrandIds: [String]
attachment: Attachment
status: String
isRoot: Boolean
Expand Down Expand Up @@ -66,6 +67,7 @@ export const types = (tagsAvailable, contactsAvailable) => `
attachment: Attachment
attachmentMore: [Attachment]
vendorId: String
scopeBrandIds: [String]
uom: String
subUoms: JSON

Expand Down Expand Up @@ -102,6 +104,7 @@ const productParams = `
attachment: AttachmentInput,
attachmentMore: [AttachmentInput],
vendorId: String,
scopeBrandIds: [String]
uom: String,
subUoms: JSON,
taxType: String,
Expand All @@ -114,6 +117,7 @@ const productCategoryParams = `
description: String,
meta: String,
parentId: String,
scopeBrandIds: [String]
attachment: AttachmentInput,
status: String
maskType: String
Expand All @@ -128,6 +132,7 @@ const productsQueryParams = `
categoryId: String,
searchValue: String,
vendorId: String,
brand: String
tag: String,
ids: [String],
excludeIds: Boolean,
Expand All @@ -139,7 +144,7 @@ const productsQueryParams = `
`;

export const queries = `
productCategories(parentId: String, withChild: Boolean, searchValue: String, status: String, meta: String): [ProductCategory]
productCategories(parentId: String, withChild: Boolean, searchValue: String, status: String, meta: String, brand: String): [ProductCategory]
productCategoriesTotalCount(parentId: String, withChild: Boolean, searchValue: String, status: String, meta: String): Int
productCategoryDetail(_id: String): ProductCategory
products(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class List extends React.Component<IProps, State> {
header={
<Wrapper.Header
title={__('Product & Service')}
queryParams={queryParams}
breadcrumb={breadcrumb}
/>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { __, router } from '@erxes/ui/src/utils';
import { router, __ } from '@erxes/ui/src/utils';

import Button from '@erxes/ui/src/components/Button';
import CategoryForm from '@erxes/ui-products/src/containers/CategoryForm';
import CategoryStatusFilter from '../product/filters/CategoryStatusFilter';
import CollapsibleList from '@erxes/ui/src/components/collapsibleList/CollapsibleList';
import { Header } from '@erxes/ui-settings/src/styles';
import { IProductCategory } from '../../types';
import BrandFilter from '@erxes/ui/src/brands/components/BrandFilter';
import { IBrand } from '@erxes/ui/src/brands/types';
import Button from '@erxes/ui/src/components/Button';
import CollapsibleList from '@erxes/ui/src/components/collapsibleList/CollapsibleList';
import Icon from '@erxes/ui/src/components/Icon';
import ModalTrigger from '@erxes/ui/src/components/ModalTrigger';
import ProductTypeFilter from '../product/filters/ProdcutTypeFilter';
import React from 'react';
import SegmentFilter from '../product/filters/SegmentFilter';
import Sidebar from '@erxes/ui/src/layout/components/Sidebar';
import { SidebarList } from '@erxes/ui/src/layout/styles';
import TagFilter from '../../containers/TagFilter';
import Tip from '@erxes/ui/src/components/Tip';
import Sidebar from '@erxes/ui/src/layout/components/Sidebar';
import Wrapper from '@erxes/ui/src/layout/components/Wrapper';
import { SidebarList } from '@erxes/ui/src/layout/styles';
import { isEnabled } from '@erxes/ui/src/utils/core';
import { pluginsOfProductCategoryActions } from 'coreui/pluginUtils';
import React from 'react';
import TagFilter from '../../containers/TagFilter';
import { IProductCategory } from '../../types';
import CategoryStatusFilter from '../product/filters/CategoryStatusFilter';
import ProductTypeFilter from '../product/filters/ProdcutTypeFilter';
import SegmentFilter from '../product/filters/SegmentFilter';

const { Section } = Wrapper.Sidebar;

Expand All @@ -28,6 +30,8 @@ interface IProps {
productCategories: IProductCategory[];
productCategoriesCount: number;
loading: boolean;
brands: IBrand[];
brandsLoading: boolean;
}

class List extends React.Component<IProps> {
Expand Down Expand Up @@ -141,6 +145,11 @@ class List extends React.Component<IProps> {
)}
<CategoryStatusFilter />
<ProductTypeFilter />
<BrandFilter
counts={{}}
brands={this.props.brands}
loading={this.props.brandsLoading}
/>
{isEnabled('tags') && <TagFilter />}
</Sidebar>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export default withProps<Props>(
categoryId: queryParams.categoryId,
status: queryParams.productStatus,
tag: queryParams.tag,
brand: queryParams.brand,
searchValue: queryParams.searchValue,
type: queryParams.type,
segment: queryParams.segment,
Expand Down
Loading