diff --git a/packages/plugin-products-api/src/constants.ts b/packages/plugin-products-api/src/constants.ts index 8c7f38de23..73333822b1 100644 --- a/packages/plugin-products-api/src/constants.ts +++ b/packages/plugin-products-api/src/constants.ts @@ -1,6 +1,7 @@ export const PRODUCT_INFO = { code: 'Code', name: 'Name', + shortName: 'Short name', type: 'Type', category: 'Category', vendor: 'Vendor', @@ -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' }, diff --git a/packages/plugin-products-api/src/documents.ts b/packages/plugin-products-api/src/documents.ts index 434f514478..f68b89092a 100644 --- a/packages/plugin-products-api/src/documents.ts +++ b/packages/plugin-products-api/src/documents.ts @@ -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' }, diff --git a/packages/plugin-products-api/src/graphql/schema/product.ts b/packages/plugin-products-api/src/graphql/schema/product.ts index a4992ae112..b58aca80c9 100644 --- a/packages/plugin-products-api/src/graphql/schema/product.ts +++ b/packages/plugin-products-api/src/graphql/schema/product.ts @@ -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 @@ -88,6 +89,7 @@ export const types = (tagsAvailable, contactsAvailable) => ` const productParams = ` name: String, + shortName: String, categoryId: String, type: String, description: String, diff --git a/packages/plugin-products-api/src/models/Products.ts b/packages/plugin-products-api/src/models/Products.ts index c59e560704..99db066379 100644 --- a/packages/plugin-products-api/src/models/Products.ts +++ b/packages/plugin-products-api/src/models/Products.ts @@ -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 || ''; @@ -299,6 +300,7 @@ export const loadProductClass = (models: IModels, subdomain: string) => { barcodeDescription, mergedIds: productIds, name, + shortName, type, uom: await models.Uoms.checkUOM({ ...productFields }), description, diff --git a/packages/plugin-products-api/src/models/definitions/products.ts b/packages/plugin-products-api/src/models/definitions/products.ts index 34e903386e..8cec1003ba 100644 --- a/packages/plugin-products-api/src/models/definitions/products.ts +++ b/packages/plugin-products-api/src/models/definitions/products.ts @@ -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 } }; @@ -78,6 +80,7 @@ export interface IProductCategory { name: string; code: string; order: string; + scopeBrandIds?: string[]; description?: string; meta?: string; parentId?: string; @@ -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({ diff --git a/packages/ui-products/src/components/ProductForm.tsx b/packages/ui-products/src/components/ProductForm.tsx index fc27aafdbd..160b7918c3 100644 --- a/packages/ui-products/src/components/ProductForm.tsx +++ b/packages/ui-products/src/components/ProductForm.tsx @@ -570,6 +570,16 @@ class Form extends React.Component { /> + + Short name + + + Type