Compare commits

..

No commits in common. "3e6dcc3a4267c2a0a0618a04b4824e537b8274bb" and "eb182a210f9f19a3bf274e7ae68d9cba327c0e96" have entirely different histories.

24 changed files with 63 additions and 192 deletions

5
.gitignore vendored
View File

@ -1,8 +1,3 @@
node_modules/
*/node_modules/
*/build/
**/node_modules/
**/build/
.DS_Store
.env

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,6 @@ module.exports = class LeadsDBApi {
country: data.country || null,
company_size: data.company_size || null,
conversion_likelihood: data.conversion_likelihood || null,
notes: data.notes || null,
importHash: data.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -52,7 +51,6 @@ module.exports = class LeadsDBApi {
country: item.country || null,
company_size: item.company_size || null,
conversion_likelihood: item.conversion_likelihood || null,
notes: item.notes || null,
importHash: item.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -87,8 +85,6 @@ module.exports = class LeadsDBApi {
if (data.conversion_likelihood !== undefined)
updatePayload.conversion_likelihood = data.conversion_likelihood;
if (data.notes !== undefined) updatePayload.notes = data.notes;
updatePayload.updatedById = currentUser.id;
await leads.update(updatePayload, { transaction });
@ -276,13 +272,6 @@ module.exports = class LeadsDBApi {
};
}
if (filter.notes) {
where = {
...where,
[Op.and]: Utils.ilike('leads', 'notes', filter.notes),
};
}
if (filter.conversion_likelihoodRange) {
const [start, end] = filter.conversion_likelihoodRange;

View File

@ -1,47 +0,0 @@
module.exports = {
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async up(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.addColumn(
'leads',
'notes',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.removeColumn('leads', 'notes', { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -36,10 +36,6 @@ module.exports = function (sequelize, DataTypes) {
type: DataTypes.DECIMAL,
},
notes: {
type: DataTypes.TEXT,
},
importHash: {
type: DataTypes.STRING(255),
allowNull: true,

View File

@ -47,6 +47,16 @@ const CampaignsData = [
// type code here for "relation_many" field
},
{
title: 'Year-End Bonanza',
start_date: new Date('2023-11-01T00:00:00Z'),
end_date: new Date('2023-11-30T23:59:59Z'),
// type code here for "relation_many" field
},
];
const LeadsData = [
@ -57,15 +67,13 @@ const LeadsData = [
country: 'USA',
company_size: 'Medium',
company_size: 'Small',
conversion_likelihood: 0.75,
// type code here for "relation_one" field
// type code here for "relation_one" field
notes: 'Arthur Eddington',
},
{
@ -75,15 +83,13 @@ const LeadsData = [
country: 'Canada',
company_size: 'Medium',
company_size: 'Small',
conversion_likelihood: 0.6,
// type code here for "relation_one" field
// type code here for "relation_one" field
notes: 'Max von Laue',
},
{
@ -93,15 +99,13 @@ const LeadsData = [
country: 'UK',
company_size: 'Large',
company_size: 'Medium',
conversion_likelihood: 0.85,
// type code here for "relation_one" field
// type code here for "relation_one" field
notes: 'Max von Laue',
},
{
@ -118,8 +122,22 @@ const LeadsData = [
// type code here for "relation_one" field
// type code here for "relation_one" field
},
notes: 'Edward Teller',
{
name: 'Soylent Corp',
contact: 'frank.thorn@soylent.com',
country: 'Australia',
company_size: 'Small',
conversion_likelihood: 0.55,
// type code here for "relation_one" field
// type code here for "relation_one" field
},
];
@ -147,6 +165,12 @@ const StagesData = [
order: 4,
},
{
name: 'Negotiation',
order: 5,
},
];
// Similar logic for "relation_many"
@ -197,6 +221,17 @@ async function associateLeadWithStage() {
if (Lead3?.setStage) {
await Lead3.setStage(relatedStage3);
}
const relatedStage4 = await Stages.findOne({
offset: Math.floor(Math.random() * (await Stages.count())),
});
const Lead4 = await Leads.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Lead4?.setStage) {
await Lead4.setStage(relatedStage4);
}
}
async function associateLeadWithOwner() {
@ -243,6 +278,17 @@ async function associateLeadWithOwner() {
if (Lead3?.setOwner) {
await Lead3.setOwner(relatedOwner3);
}
const relatedOwner4 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Lead4 = await Leads.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Lead4?.setOwner) {
await Lead4.setOwner(relatedOwner4);
}
}
module.exports = {

View File

@ -29,9 +29,6 @@ router.use(checkCrudPermissions('leads'));
* country:
* type: string
* default: country
* notes:
* type: string
* default: notes
* conversion_likelihood:
* type: integer
@ -318,7 +315,6 @@ router.get(
'name',
'contact',
'country',
'notes',
'conversion_likelihood',
];

View File

@ -45,7 +45,7 @@ module.exports = class SearchService {
campaigns: ['title'],
leads: ['name', 'contact', 'country', 'notes'],
leads: ['name', 'contact', 'country'],
stages: ['name'],
};

View File

@ -1 +0,0 @@
{}

View File

@ -3,9 +3,6 @@ import Link from 'next/link';
import moment from 'moment';
import ListActionsPopover from '../ListActionsPopover';
import { DragSourceMonitor, useDrag } from 'react-dnd';
import countryFlags from './countryFlags';
import dataFormatter from '../../helpers/dataFormatter';
type Props = {
item: any;
@ -40,19 +37,13 @@ const KanbanCard = ({
isDragging ? 'cursor-grabbing' : 'cursor-grab'
}`}
>
<div className={'flex items-center space-x-2'}>
<div className={'flex items-center justify-between'}>
<Link
href={`/${entityName}/${entityName}-view/?id=${item.id}`}
className={'text-base font-semibold'}
>
{countryFlags[item.country] ? `${countryFlags[item.country]} ` : ''}
{item[showFieldName] ?? 'No data'}
</Link>
{item.owner && (
<span className='text-xs bg-blue-100 text-blue-800 px-1.5 py-0.5 rounded'>
{dataFormatter.usersOneListFormatter(item.owner)}
</span>
)}
</div>
<div className={'flex items-center justify-between'}>
<p>{moment(item.createdAt).format('MMM DD hh:mm a')}</p>

View File

@ -161,7 +161,7 @@ const KanbanColumn = ({
<CardBox
hasComponentLayout
className={
'w-56 rounded-md h-fit max-h-full overflow-hidden flex flex-col'
'w-72 rounded-md h-fit max-h-full overflow-hidden flex flex-col'
}
>
<div className={'flex items-center justify-between p-3'}>

View File

@ -1,31 +0,0 @@
const countryFlags: { [key: string]: string } = {
Germany: '🇩🇪',
France: '🇫🇷',
Spain: '🇪🇸',
Italy: '🇮🇹',
Netherlands: '🇳🇱',
Belgium: '🇧🇪',
Sweden: '🇸🇪',
Poland: '🇵🇱',
Romania: '🇷🇴',
Portugal: '🇵🇹',
Ireland: '🇮🇪',
Greece: '🇬🇷',
'Czech Republic': '🇨🇿',
USA: '🇺🇸',
UK: '🇬🇧',
'United Kingdom': '🇬🇧',
'United States': '🇺🇸',
Canada: '🇨🇦',
Australia: '🇦🇺',
Brazil: '🇧🇷',
Argentina: '🇦🇷',
Mexico: '🇲🇽',
Chile: '🇨🇱',
India: '🇮🇳',
Pakistan: '🇵🇰',
};
export default countryFlags;

View File

@ -144,13 +144,6 @@ const CardLeads = ({
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>Notes</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>{item.notes}</div>
</dd>
</div>
</dl>
</li>
))}

View File

@ -93,11 +93,6 @@ const ListLeads = ({
{dataFormatter.usersOneListFormatter(item.owner)}
</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Notes</p>
<p className={'line-clamp-2'}>{item.notes}</p>
</div>
</Link>
<ListActionsPopover
onDelete={onDelete}

View File

@ -140,18 +140,6 @@ export const loadColumns = async (
params?.value?.id ?? params?.value,
},
{
field: 'notes',
headerName: 'Notes',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'actions',
type: 'actions',

View File

@ -116,8 +116,6 @@ const CampaignsView = () => {
<th>CompanySize</th>
<th>ConversionLikelihood</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@ -141,8 +139,6 @@ const CampaignsView = () => {
<td data-label='conversion_likelihood'>
{item.conversion_likelihood}
</td>
<td data-label='notes'>{item.notes}</td>
</tr>
))}
</tbody>

View File

@ -49,8 +49,6 @@ const EditLeads = () => {
stage: null,
owner: null,
notes: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -155,10 +153,6 @@ const EditLeads = () => {
></Field>
</FormField>
<FormField label='Notes'>
<Field name='notes' placeholder='Notes' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -49,8 +49,6 @@ const EditLeadsPage = () => {
stage: null,
owner: null,
notes: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -153,10 +151,6 @@ const EditLeadsPage = () => {
></Field>
</FormField>
<FormField label='Notes'>
<Field name='notes' placeholder='Notes' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -32,7 +32,6 @@ const LeadsTablesPage = () => {
{ label: 'Name', title: 'name' },
{ label: 'Contact', title: 'contact' },
{ label: 'Country', title: 'country' },
{ label: 'Notes', title: 'notes' },
{
label: 'ConversionLikelihood',

View File

@ -46,8 +46,6 @@ const initialValues = {
stage: '',
owner: '',
notes: '',
};
const LeadsNew = () => {
@ -127,10 +125,6 @@ const LeadsNew = () => {
></Field>
</FormField>
<FormField label='Notes'>
<Field name='notes' placeholder='Notes' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -32,7 +32,6 @@ const LeadsTablesPage = () => {
{ label: 'Name', title: 'name' },
{ label: 'Contact', title: 'contact' },
{ label: 'Country', title: 'country' },
{ label: 'Notes', title: 'notes' },
{
label: 'ConversionLikelihood',

View File

@ -91,11 +91,6 @@ const LeadsView = () => {
<p>{leads?.owner?.firstName ?? 'No data'}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Notes</p>
<p>{leads?.notes}</p>
</div>
<BaseDivider />
<BaseButton

View File

@ -83,8 +83,6 @@ const StagesView = () => {
<th>CompanySize</th>
<th>ConversionLikelihood</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@ -108,8 +106,6 @@ const StagesView = () => {
<td data-label='conversion_likelihood'>
{item.conversion_likelihood}
</td>
<td data-label='notes'>{item.notes}</td>
</tr>
))}
</tbody>

View File

@ -157,8 +157,6 @@ const UsersView = () => {
<th>CompanySize</th>
<th>ConversionLikelihood</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
@ -182,8 +180,6 @@ const UsersView = () => {
<td data-label='conversion_likelihood'>
{item.conversion_likelihood}
</td>
<td data-label='notes'>{item.notes}</td>
</tr>
))}
</tbody>