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 github.com:erxes/erxes into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhsaikhan committed Oct 11, 2023
2 parents cff8e06 + 331d31f commit 199baf7
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-products-api/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const PRODUCT_INFO = {
code: 'Code',
name: 'Name',
shortName: 'Short name',
type: 'Type',
category: 'Category',
vendor: 'Vendor',
Expand All @@ -18,6 +19,7 @@ export const PRODUCT_INFO = {
ALL: [
{ field: 'code', label: 'Code' },
{ field: 'name', label: 'Name' },
{ field: 'shortName', label: 'Short name' },
{ field: 'type', label: 'Type' },
{ field: 'category', label: 'Category' },
{ field: 'vendor', label: 'Vendor' },
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-products-api/src/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
editorAttributes: async ({ subdomain }) => {
return [
{ value: 'name', name: 'Name' },
{ value: 'shortName', name: 'Short name' },
{ value: 'code', name: 'Code' },
{ value: 'price', name: 'Price' },
{ value: 'bulkQuantity', name: 'Bulk quantity' },
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-products-api/src/graphql/schema/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const types = (tagsAvailable, contactsAvailable) => `
type Product @key(fields: "_id") @cacheControl(maxAge: 3) {
_id: String!
name: String
shortName: String
status: String
code: String
type: String
Expand Down Expand Up @@ -88,6 +89,7 @@ export const types = (tagsAvailable, contactsAvailable) => `

const productParams = `
name: String,
shortName: String,
categoryId: String,
type: String,
description: String,
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-products-api/src/models/Products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const loadProductClass = (models: IModels, subdomain: string) => {
let tagIds: string[] = [];
let barcodes: string[] = [];
const name: string = productFields.name || '';
const shortName: string = productFields.shortName || '';
const type: string = productFields.type || '';
const description: string = productFields.description || '';
const barcodeDescription: string = productFields.barcodeDescription || '';
Expand Down Expand Up @@ -299,6 +300,7 @@ export const loadProductClass = (models: IModels, subdomain: string) => {
barcodeDescription,
mergedIds: productIds,
name,
shortName,
type,
uom: await models.Uoms.checkUOM({ ...productFields }),
description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ export interface ISubUom {

export interface IProduct {
name: string;
shortName?: string;
categoryId?: string;
categoryCode?: string;
type?: string;
scopeBrandIds?: string[];
description?: string;
barcodes?: string[];
variants: { [code: string]: { image?: IAttachment; name?: string } };
Expand Down Expand Up @@ -78,6 +80,7 @@ export interface IProductCategory {
name: string;
code: string;
order: string;
scopeBrandIds?: string[];
description?: string;
meta?: string;
parentId?: string;
Expand Down Expand Up @@ -109,6 +112,7 @@ export const productSchema = schemaWrapper(
new Schema({
_id: field({ pkey: true }),
name: field({ type: String, label: 'Name' }),
shortName: field({ type: String, optional: true, label: 'Short name' }),
code: field({ type: String, unique: true, label: 'Code' }),
categoryId: field({ type: String, label: 'Category' }),
type: field({
Expand Down
10 changes: 10 additions & 0 deletions packages/ui-products/src/components/ProductForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,16 @@ class Form extends React.Component<Props, State> {
/>
</FormGroup>

<FormGroup>
<ControlLabel required={true}>Short name</ControlLabel>
<FormControl
{...formProps}
name="shortName"
defaultValue={object.shortName}
required={true}
/>
</FormGroup>

<FormGroup>
<ControlLabel required={true}>Type</ControlLabel>
<FormControl
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-products/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const PRODUCT_CATEGORY_STATUSES = [
export const PRODUCT_INFO = {
code: 'Code',
name: 'Name',
shortName: 'Short name',
type: 'Type',
category: 'Category',
vendor: 'Vendor',
Expand All @@ -31,6 +32,7 @@ export const PRODUCT_INFO = {
ALL: [
{ field: 'code', label: 'Code' },
{ field: 'name', label: 'Name' },
{ field: 'shortName', label: 'Short name' },
{ field: 'type', label: 'Type' },
{ field: 'category', label: 'Category' },
{ field: 'vendor', label: 'Vendor' },
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-products/src/graphql/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const productParamsDef = `
$name: String,
$shortName: String,
$type: String,
$categoryId: String,
$description: String,
Expand Down Expand Up @@ -34,6 +35,7 @@ const productCategoryParamsDef = `

const productParams = `
name: $name,
shortName: $shortName,
type: $type,
categoryId: $categoryId,
description: $description,
Expand Down
1 change: 1 addition & 0 deletions packages/ui-products/src/graphql/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isEnabled } from '@erxes/ui/src/utils/core';
const productFields = `
_id
name
shortName
type
code
categoryId
Expand Down
1 change: 1 addition & 0 deletions packages/ui-products/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface IVariant {
export interface IProduct {
_id: string;
name: string;
shortName: string;
type: string;
categoryId: string;
description: string;
Expand Down

0 comments on commit 199baf7

Please sign in to comment.