46 lines
1.8 KiB
JavaScript
46 lines
1.8 KiB
JavaScript
const STATUS = { active: 'Active', disabled: 'Disabled' };
|
|
|
|
const rcpacompetitors = {
|
|
service: 'rcpa',
|
|
module: 'competitor',
|
|
title: 'RCPA Competitor',
|
|
subtitle: 'RCPA',
|
|
baseUrl: '/rcpacompetitor',
|
|
listPath: '/rcpacompetitors',
|
|
missingParentMessage: 'SKU not found',
|
|
parentParam: { urlKey: 'id', apiKey: 'sku_id' },
|
|
parentField: { urlKey: 'id', field: 'sku_id' },
|
|
listFields: [
|
|
{ key: 'actions', title: 'Actions', buttons: ['edit', 'delete'] },
|
|
{ key: 'title', title: 'Title', type: 'text' },
|
|
{ key: 'status', title: 'Status', type: 'select' },
|
|
],
|
|
listButtons: [
|
|
{ title: 'Add New', to: '/rcpacompetitor/addnew' },
|
|
{ title: 'Back to Products', to: '/rcpaproducts' },
|
|
],
|
|
formFields: () => [
|
|
{ key: 'company', title: 'Company', type: 'text', required: true },
|
|
{ key: 'brand', title: 'Brand', type: 'text', required: true },
|
|
{ key: 'title', title: 'Product Name', type: 'text', required: true },
|
|
{ key: 'status', title: 'Status', type: 'select', required: true, values: STATUS },
|
|
{ key: 'description', title: 'Description', type: 'textarea', required: true, fullwidth: true },
|
|
{ key: 'mrp_value', title: 'MRP Value', type: 'number', required: true },
|
|
{ key: 'pts_value', title: 'PTS Value', type: 'number', required: true },
|
|
{ key: 'ptr_value', title: 'PTR Value', type: 'number', required: true },
|
|
{ key: 'nrv_value', title: 'NRV Value', type: 'number', required: true },
|
|
{ key: 'sort_order', title: 'Sort Order', type: 'number', required: true },
|
|
],
|
|
beforeForm: (item, _mode, ctx) => ({
|
|
...item,
|
|
product_id: item.product_id || ctx?.searchParams?.get('product_id') || '',
|
|
}),
|
|
beforeSave: (data) => {
|
|
const payload = { ...data };
|
|
if (!payload.product_id) delete payload.product_id;
|
|
return payload;
|
|
},
|
|
};
|
|
|
|
export default rcpacompetitors;
|