Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,8 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
*/node_modules/
|
*/node_modules/
|
||||||
*/build/
|
*/build/
|
||||||
|
|
||||||
**/node_modules/
|
|
||||||
**/build/
|
|
||||||
.DS_Store
|
|
||||||
.env
|
|
||||||
File diff suppressed because one or more lines are too long
@ -16,26 +16,6 @@ module.exports = class CompaniesDBApi {
|
|||||||
{
|
{
|
||||||
id: data.id || undefined,
|
id: data.id || undefined,
|
||||||
|
|
||||||
name: data.name
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
address: data.address
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
email: data.email
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
phonenumber: data.phonenumber
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
importHash: data.importHash || null,
|
importHash: data.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -54,26 +34,6 @@ module.exports = class CompaniesDBApi {
|
|||||||
const companiesData = data.map((item, index) => ({
|
const companiesData = data.map((item, index) => ({
|
||||||
id: item.id || undefined,
|
id: item.id || undefined,
|
||||||
|
|
||||||
name: item.name
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
address: item.address
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
email: item.email
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
phonenumber: item.phonenumber
|
|
||||||
||
|
|
||||||
null
|
|
||||||
,
|
|
||||||
|
|
||||||
importHash: item.importHash || null,
|
importHash: item.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -94,14 +54,6 @@ module.exports = class CompaniesDBApi {
|
|||||||
|
|
||||||
const updatePayload = {};
|
const updatePayload = {};
|
||||||
|
|
||||||
if (data.name !== undefined) updatePayload.name = data.name;
|
|
||||||
|
|
||||||
if (data.address !== undefined) updatePayload.address = data.address;
|
|
||||||
|
|
||||||
if (data.email !== undefined) updatePayload.email = data.email;
|
|
||||||
|
|
||||||
if (data.phonenumber !== undefined) updatePayload.phonenumber = data.phonenumber;
|
|
||||||
|
|
||||||
updatePayload.updatedById = currentUser.id;
|
updatePayload.updatedById = currentUser.id;
|
||||||
|
|
||||||
await companies.update(updatePayload, {transaction});
|
await companies.update(updatePayload, {transaction});
|
||||||
@ -197,50 +149,6 @@ module.exports = class CompaniesDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.name) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'companies',
|
|
||||||
'name',
|
|
||||||
filter.name,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.address) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'companies',
|
|
||||||
'address',
|
|
||||||
filter.address,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.email) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'companies',
|
|
||||||
'email',
|
|
||||||
filter.email,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.phonenumber) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'companies',
|
|
||||||
'phonenumber',
|
|
||||||
filter.phonenumber,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.active !== undefined) {
|
if (filter.active !== undefined) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
@ -311,7 +219,7 @@ module.exports = class CompaniesDBApi {
|
|||||||
{ ['id']: Utils.uuid(query) },
|
{ ['id']: Utils.uuid(query) },
|
||||||
Utils.ilike(
|
Utils.ilike(
|
||||||
'companies',
|
'companies',
|
||||||
'name',
|
'id',
|
||||||
query,
|
query,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -319,16 +227,16 @@ module.exports = class CompaniesDBApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const records = await db.companies.findAll({
|
const records = await db.companies.findAll({
|
||||||
attributes: [ 'id', 'name' ],
|
attributes: [ 'id', 'id' ],
|
||||||
where,
|
where,
|
||||||
limit: limit ? Number(limit) : undefined,
|
limit: limit ? Number(limit) : undefined,
|
||||||
offset: offset ? Number(offset) : undefined,
|
offset: offset ? Number(offset) : undefined,
|
||||||
orderBy: [['name', 'ASC']],
|
orderBy: [['id', 'ASC']],
|
||||||
});
|
});
|
||||||
|
|
||||||
return records.map((record) => ({
|
return records.map((record) => ({
|
||||||
id: record.id,
|
id: record.id,
|
||||||
label: record.name,
|
label: record.id,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,54 +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(
|
|
||||||
'companies',
|
|
||||||
'name',
|
|
||||||
{
|
|
||||||
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(
|
|
||||||
'companies',
|
|
||||||
'name',
|
|
||||||
{ transaction }
|
|
||||||
);
|
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,54 +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(
|
|
||||||
'companies',
|
|
||||||
'address',
|
|
||||||
{
|
|
||||||
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(
|
|
||||||
'companies',
|
|
||||||
'address',
|
|
||||||
{ transaction }
|
|
||||||
);
|
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,54 +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(
|
|
||||||
'companies',
|
|
||||||
'email',
|
|
||||||
{
|
|
||||||
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(
|
|
||||||
'companies',
|
|
||||||
'email',
|
|
||||||
{ transaction }
|
|
||||||
);
|
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,54 +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(
|
|
||||||
'companies',
|
|
||||||
'phonenumber',
|
|
||||||
{
|
|
||||||
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(
|
|
||||||
'companies',
|
|
||||||
'phonenumber',
|
|
||||||
{ transaction }
|
|
||||||
);
|
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,38 +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 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 transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,38 +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 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 transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -14,26 +14,6 @@ module.exports = function(sequelize, DataTypes) {
|
|||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
name: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
address: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
email: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
phonenumber: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
importHash: {
|
importHash: {
|
||||||
type: DataTypes.STRING(255),
|
type: DataTypes.STRING(255),
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
|
|||||||
@ -17,19 +17,6 @@ const { parse } = require('json2csv');
|
|||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
|
|
||||||
* name:
|
|
||||||
* type: string
|
|
||||||
* default: name
|
|
||||||
* address:
|
|
||||||
* type: string
|
|
||||||
* default: address
|
|
||||||
* email:
|
|
||||||
* type: string
|
|
||||||
* default: email
|
|
||||||
* phonenumber:
|
|
||||||
* type: string
|
|
||||||
* default: phonenumber
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,7 +272,7 @@ router.get('/', wrapAsync(async (req, res) => {
|
|||||||
req.query, { currentUser }
|
req.query, { currentUser }
|
||||||
);
|
);
|
||||||
if (filetype && filetype === 'csv') {
|
if (filetype && filetype === 'csv') {
|
||||||
const fields = ['id','name','address','email','phonenumber',
|
const fields = ['id',
|
||||||
|
|
||||||
];
|
];
|
||||||
const opts = { fields };
|
const opts = { fields };
|
||||||
|
|||||||
@ -71,18 +71,6 @@ module.exports = class SearchService {
|
|||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
"companies": [
|
|
||||||
|
|
||||||
"name",
|
|
||||||
|
|
||||||
"address",
|
|
||||||
|
|
||||||
"email",
|
|
||||||
|
|
||||||
"phonenumber",
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
};
|
};
|
||||||
const columnsInt = {
|
const columnsInt = {
|
||||||
|
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@ -46,7 +46,7 @@ const CardCompanies = ({
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Link href={`/companies/companies-view/?id=${item.id}`} className='text-lg font-bold leading-6 line-clamp-1'>
|
<Link href={`/companies/companies-view/?id=${item.id}`} className='text-lg font-bold leading-6 line-clamp-1'>
|
||||||
{item.name}
|
{item.id}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className='ml-auto'>
|
<div className='ml-auto'>
|
||||||
@ -61,51 +61,6 @@ const CardCompanies = ({
|
|||||||
</div>
|
</div>
|
||||||
<dl className='divide-y dark:divide-dark-700 px-6 py-4 text-sm leading-6 h-64 overflow-y-auto'>
|
<dl className='divide-y dark:divide-dark-700 px-6 py-4 text-sm leading-6 h-64 overflow-y-auto'>
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Name</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.name }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Address</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.address }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Email</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.email }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Phonenumber</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.phonenumber }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Buildings</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.buildings }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -35,31 +35,6 @@ const ListCompanies = ({ companies, loading, onDelete, currentPage, numPages, on
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Name</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.name }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Address</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.address }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Email</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.email }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Phonenumber</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.phonenumber }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Buildings</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.buildings }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</Link>
|
</Link>
|
||||||
<ListActionsPopover
|
<ListActionsPopover
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
|
|||||||
@ -27,71 +27,6 @@ export const loadColumns = async (
|
|||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
|
|
||||||
{
|
|
||||||
field: 'name',
|
|
||||||
headerName: 'Name',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
field: 'address',
|
|
||||||
headerName: 'Address',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
field: 'email',
|
|
||||||
headerName: 'Email',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
field: 'phonenumber',
|
|
||||||
headerName: 'Phonenumber',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
field: 'buildings',
|
|
||||||
headerName: 'Buildings',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
type: 'actions',
|
type: 'actions',
|
||||||
|
|||||||
@ -115,15 +115,6 @@ const CardUsers = ({
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className='text-gray-500 dark:text-dark-600'>Reimbursements</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{ item.reimbursements }
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -65,11 +65,6 @@ const ListUsers = ({ users, loading, onDelete, currentPage, numPages, onPageChan
|
|||||||
<p className={'line-clamp-2'}>{ item.avatar }</p>
|
<p className={'line-clamp-2'}>{ item.avatar }</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
|
||||||
<p className={'text-xs text-gray-500'}>Reimbursements</p>
|
|
||||||
<p className={'line-clamp-2'}>{ item.reimbursements }</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</Link>
|
</Link>
|
||||||
<ListActionsPopover
|
<ListActionsPopover
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
|
|||||||
@ -106,19 +106,6 @@ export const loadColumns = async (
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
field: 'reimbursements',
|
|
||||||
headerName: 'Reimbursements',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
type: 'actions',
|
type: 'actions',
|
||||||
|
|||||||
@ -96,42 +96,23 @@ export default {
|
|||||||
return {label: val.station_id, id: val.id}
|
return {label: val.station_id, id: val.id}
|
||||||
},
|
},
|
||||||
|
|
||||||
reimbursementsManyListFormatter(val) {
|
|
||||||
if (!val || !val.length) return []
|
|
||||||
return val.map((item) => item.request_date)
|
|
||||||
},
|
|
||||||
reimbursementsOneListFormatter(val) {
|
|
||||||
if (!val) return ''
|
|
||||||
return val.request_date
|
|
||||||
},
|
|
||||||
reimbursementsManyListFormatterEdit(val) {
|
|
||||||
if (!val || !val.length) return []
|
|
||||||
return val.map((item) => {
|
|
||||||
return {id: item.id, label: item.request_date}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
reimbursementsOneListFormatterEdit(val) {
|
|
||||||
if (!val) return ''
|
|
||||||
return {label: val.request_date, id: val.id}
|
|
||||||
},
|
|
||||||
|
|
||||||
companiesManyListFormatter(val) {
|
companiesManyListFormatter(val) {
|
||||||
if (!val || !val.length) return []
|
if (!val || !val.length) return []
|
||||||
return val.map((item) => item.name)
|
return val.map((item) => item.id)
|
||||||
},
|
},
|
||||||
companiesOneListFormatter(val) {
|
companiesOneListFormatter(val) {
|
||||||
if (!val) return ''
|
if (!val) return ''
|
||||||
return val.name
|
return val.id
|
||||||
},
|
},
|
||||||
companiesManyListFormatterEdit(val) {
|
companiesManyListFormatterEdit(val) {
|
||||||
if (!val || !val.length) return []
|
if (!val || !val.length) return []
|
||||||
return val.map((item) => {
|
return val.map((item) => {
|
||||||
return {id: item.id, label: item.name}
|
return {id: item.id, label: item.id}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
companiesOneListFormatterEdit(val) {
|
companiesOneListFormatterEdit(val) {
|
||||||
if (!val) return ''
|
if (!val) return ''
|
||||||
return {label: val.name, id: val.id}
|
return {label: val.id, id: val.id}
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ const EditBuildings = () => {
|
|||||||
options={initialValues.company}
|
options={initialValues.company}
|
||||||
itemRef={'companies'}
|
itemRef={'companies'}
|
||||||
|
|
||||||
showField={'name'}
|
showField={'id'}
|
||||||
|
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|||||||
@ -112,7 +112,7 @@ const EditBuildingsPage = () => {
|
|||||||
options={initialValues.company}
|
options={initialValues.company}
|
||||||
itemRef={'companies'}
|
itemRef={'companies'}
|
||||||
|
|
||||||
showField={'name'}
|
showField={'id'}
|
||||||
|
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|||||||
@ -62,7 +62,7 @@ const BuildingsView = () => {
|
|||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Company</p>
|
<p className={'block font-bold mb-2'}>Company</p>
|
||||||
|
|
||||||
<p>{buildings?.company?.name ?? 'No data'}</p>
|
<p>{buildings?.company?.id ?? 'No data'}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -32,14 +32,6 @@ const EditCompanies = () => {
|
|||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const initVals = {
|
const initVals = {
|
||||||
|
|
||||||
'name': '',
|
|
||||||
|
|
||||||
'address': '',
|
|
||||||
|
|
||||||
'email': '',
|
|
||||||
|
|
||||||
'phonenumber': '',
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const [initialValues, setInitialValues] = useState(initVals)
|
const [initialValues, setInitialValues] = useState(initVals)
|
||||||
|
|
||||||
@ -90,42 +82,6 @@ const EditCompanies = () => {
|
|||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Name"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="name"
|
|
||||||
placeholder="Name"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Address"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="address"
|
|
||||||
placeholder="Address"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Email"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="email"
|
|
||||||
placeholder="Email"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Phonenumber"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="phonenumber"
|
|
||||||
placeholder="Phonenumber"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type="submit" color="info" label="Submit" />
|
<BaseButton type="submit" color="info" label="Submit" />
|
||||||
|
|||||||
@ -33,14 +33,6 @@ const EditCompaniesPage = () => {
|
|||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const initVals = {
|
const initVals = {
|
||||||
|
|
||||||
'name': '',
|
|
||||||
|
|
||||||
'address': '',
|
|
||||||
|
|
||||||
'email': '',
|
|
||||||
|
|
||||||
'phonenumber': '',
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const [initialValues, setInitialValues] = useState(initVals)
|
const [initialValues, setInitialValues] = useState(initVals)
|
||||||
|
|
||||||
@ -88,42 +80,6 @@ const EditCompaniesPage = () => {
|
|||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Name"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="name"
|
|
||||||
placeholder="Name"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Address"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="address"
|
|
||||||
placeholder="Address"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Email"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="email"
|
|
||||||
placeholder="Email"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Phonenumber"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="phonenumber"
|
|
||||||
placeholder="Phonenumber"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type="submit" color="info" label="Submit" />
|
<BaseButton type="submit" color="info" label="Submit" />
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const CompaniesTablesPage = () => {
|
|||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([{label: 'Name', title: 'name'},{label: 'Address', title: 'address'},{label: 'Email', title: 'email'},{label: 'Phonenumber', title: 'phonenumber'},
|
const [filters] = useState([
|
||||||
|
|
||||||
]);
|
]);
|
||||||
const addFilter = () => {
|
const addFilter = () => {
|
||||||
|
|||||||
@ -25,14 +25,6 @@ import { useRouter } from 'next/router'
|
|||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
|
|
||||||
name: '',
|
|
||||||
|
|
||||||
address: '',
|
|
||||||
|
|
||||||
email: '',
|
|
||||||
|
|
||||||
phonenumber: '',
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompaniesNew = () => {
|
const CompaniesNew = () => {
|
||||||
@ -61,42 +53,6 @@ const CompaniesNew = () => {
|
|||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Name"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="name"
|
|
||||||
placeholder="Name"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Address"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="address"
|
|
||||||
placeholder="Address"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Email"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="email"
|
|
||||||
placeholder="Email"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField
|
|
||||||
label="Phonenumber"
|
|
||||||
>
|
|
||||||
<Field
|
|
||||||
name="phonenumber"
|
|
||||||
placeholder="Phonenumber"
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type="submit" color="info" label="Submit" />
|
<BaseButton type="submit" color="info" label="Submit" />
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const CompaniesTablesPage = () => {
|
|||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([{label: 'Name', title: 'name'},{label: 'Address', title: 'address'},{label: 'Email', title: 'email'},{label: 'Phonenumber', title: 'phonenumber'},
|
const [filters] = useState([
|
||||||
|
|
||||||
]);
|
]);
|
||||||
const addFilter = () => {
|
const addFilter = () => {
|
||||||
|
|||||||
@ -49,26 +49,6 @@ const CompaniesView = () => {
|
|||||||
</SectionTitleLineWithButton>
|
</SectionTitleLineWithButton>
|
||||||
<CardBox>
|
<CardBox>
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>Name</p>
|
|
||||||
<p>{companies?.name}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>Address</p>
|
|
||||||
<p>{companies?.address}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>Email</p>
|
|
||||||
<p>{companies?.email}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>Phonenumber</p>
|
|
||||||
<p>{companies?.phonenumber}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<p className={'block font-bold mb-2'}>Buildings Company</p>
|
<p className={'block font-bold mb-2'}>Buildings Company</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user