Updated via schema editor on 2025-07-17 10:52

This commit is contained in:
Flatlogic Bot 2025-07-17 10:53:13 +00:00
parent efd7c4a158
commit 8588cf351b
23 changed files with 686 additions and 68 deletions

File diff suppressed because one or more lines are too long

View File

@ -15,13 +15,15 @@ module.exports = class AssetsDBApi {
{ {
id: data.id || undefined, id: data.id || undefined,
asset_name: data.asset_name || null, asset_make: data.asset_make || null,
asset_type: data.asset_type || null, asset_type: data.asset_type || null,
purchase_date: data.purchase_date || null, purchase_date: data.purchase_date || null,
maintenance_due_date: data.maintenance_due_date || null, maintenance_due_date: data.maintenance_due_date || null,
asset_po: data.asset_po || null, asset_po: data.asset_po || null,
asset_eol: data.asset_eol || null, asset_eol: data.asset_eol || null,
asset_purchase_price: data.asset_purchase_price || null, asset_purchase_price: data.asset_purchase_price || null,
asset_model: data.asset_model || null,
asset_tag: data.asset_tag || null,
importHash: data.importHash || null, importHash: data.importHash || null,
createdById: currentUser.id, createdById: currentUser.id,
updatedById: currentUser.id, updatedById: currentUser.id,
@ -44,13 +46,15 @@ module.exports = class AssetsDBApi {
const assetsData = data.map((item, index) => ({ const assetsData = data.map((item, index) => ({
id: item.id || undefined, id: item.id || undefined,
asset_name: item.asset_name || null, asset_make: item.asset_make || null,
asset_type: item.asset_type || null, asset_type: item.asset_type || null,
purchase_date: item.purchase_date || null, purchase_date: item.purchase_date || null,
maintenance_due_date: item.maintenance_due_date || null, maintenance_due_date: item.maintenance_due_date || null,
asset_po: item.asset_po || null, asset_po: item.asset_po || null,
asset_eol: item.asset_eol || null, asset_eol: item.asset_eol || null,
asset_purchase_price: item.asset_purchase_price || null, asset_purchase_price: item.asset_purchase_price || null,
asset_model: item.asset_model || null,
asset_tag: item.asset_tag || null,
importHash: item.importHash || null, importHash: item.importHash || null,
createdById: currentUser.id, createdById: currentUser.id,
updatedById: currentUser.id, updatedById: currentUser.id,
@ -73,8 +77,8 @@ module.exports = class AssetsDBApi {
const updatePayload = {}; const updatePayload = {};
if (data.asset_name !== undefined) if (data.asset_make !== undefined)
updatePayload.asset_name = data.asset_name; updatePayload.asset_make = data.asset_make;
if (data.asset_type !== undefined) if (data.asset_type !== undefined)
updatePayload.asset_type = data.asset_type; updatePayload.asset_type = data.asset_type;
@ -92,6 +96,11 @@ module.exports = class AssetsDBApi {
if (data.asset_purchase_price !== undefined) if (data.asset_purchase_price !== undefined)
updatePayload.asset_purchase_price = data.asset_purchase_price; updatePayload.asset_purchase_price = data.asset_purchase_price;
if (data.asset_model !== undefined)
updatePayload.asset_model = data.asset_model;
if (data.asset_tag !== undefined) updatePayload.asset_tag = data.asset_tag;
updatePayload.updatedById = currentUser.id; updatePayload.updatedById = currentUser.id;
await assets.update(updatePayload, { transaction }); await assets.update(updatePayload, { transaction });
@ -220,10 +229,10 @@ module.exports = class AssetsDBApi {
}; };
} }
if (filter.asset_name) { if (filter.asset_make) {
where = { where = {
...where, ...where,
[Op.and]: Utils.ilike('assets', 'asset_name', filter.asset_name), [Op.and]: Utils.ilike('assets', 'asset_make', filter.asset_make),
}; };
} }
@ -245,6 +254,20 @@ module.exports = class AssetsDBApi {
}; };
} }
if (filter.asset_model) {
where = {
...where,
[Op.and]: Utils.ilike('assets', 'asset_model', filter.asset_model),
};
}
if (filter.asset_tag) {
where = {
...where,
[Op.and]: Utils.ilike('assets', 'asset_tag', filter.asset_tag),
};
}
if (filter.purchase_dateRange) { if (filter.purchase_dateRange) {
const [start, end] = filter.purchase_dateRange; const [start, end] = filter.purchase_dateRange;
@ -393,22 +416,22 @@ module.exports = class AssetsDBApi {
where = { where = {
[Op.or]: [ [Op.or]: [
{ ['id']: Utils.uuid(query) }, { ['id']: Utils.uuid(query) },
Utils.ilike('assets', 'asset_name', query), Utils.ilike('assets', 'asset_make', query),
], ],
}; };
} }
const records = await db.assets.findAll({ const records = await db.assets.findAll({
attributes: ['id', 'asset_name'], attributes: ['id', 'asset_make'],
where, where,
limit: limit ? Number(limit) : undefined, limit: limit ? Number(limit) : undefined,
offset: offset ? Number(offset) : undefined, offset: offset ? Number(offset) : undefined,
orderBy: [['asset_name', 'ASC']], orderBy: [['asset_make', 'ASC']],
}); });
return records.map((record) => ({ return records.map((record) => ({
id: record.id, id: record.id,
label: record.asset_name, label: record.asset_make,
})); }));
} }
}; };

View File

@ -0,0 +1,68 @@
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.renameColumn('assets', 'asset_name', 'asset_make', {
transaction,
});
await queryInterface.addColumn(
'assets',
'asset_model',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await queryInterface.addColumn(
'assets',
'asset_tag',
{
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('assets', 'asset_tag', { transaction });
await queryInterface.removeColumn('assets', 'asset_model', {
transaction,
});
await queryInterface.renameColumn('assets', 'asset_make', 'asset_name', {
transaction,
});
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -14,7 +14,7 @@ module.exports = function (sequelize, DataTypes) {
primaryKey: true, primaryKey: true,
}, },
asset_name: { asset_make: {
type: DataTypes.TEXT, type: DataTypes.TEXT,
}, },
@ -44,6 +44,14 @@ module.exports = function (sequelize, DataTypes) {
type: DataTypes.TEXT, type: DataTypes.TEXT,
}, },
asset_model: {
type: DataTypes.TEXT,
},
asset_tag: {
type: DataTypes.TEXT,
},
importHash: { importHash: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: true, allowNull: true,

View File

@ -13,9 +13,9 @@ const SoftwareLicenses = db.software_licenses;
const AssetsData = [ const AssetsData = [
{ {
asset_name: 'Dell Laptop', asset_make: 'Francis Crick',
asset_type: 'Hardware', asset_type: 'Software',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -23,17 +23,21 @@ const AssetsData = [
maintenance_due_date: new Date('2023-01-15T00:00:00Z'), maintenance_due_date: new Date('2023-01-15T00:00:00Z'),
asset_po: 'Ernst Mayr', asset_po: 'Anton van Leeuwenhoek',
asset_eol: new Date(Date.now()), asset_eol: new Date(Date.now()),
asset_purchase_price: 'Tycho Brahe', asset_purchase_price: 'Lucretius',
asset_model: 'Galileo Galilei',
asset_tag: 'Charles Darwin',
}, },
{ {
asset_name: 'HP Printer', asset_make: 'Stephen Hawking',
asset_type: 'Hardware', asset_type: 'Software',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -41,17 +45,21 @@ const AssetsData = [
maintenance_due_date: new Date('2022-06-10T00:00:00Z'), maintenance_due_date: new Date('2022-06-10T00:00:00Z'),
asset_po: 'Frederick Sanger', asset_po: 'Dmitri Mendeleev',
asset_eol: new Date(Date.now()), asset_eol: new Date(Date.now()),
asset_purchase_price: 'Antoine Laurent Lavoisier', asset_purchase_price: 'William Bayliss',
asset_model: 'Dmitri Mendeleev',
asset_tag: 'Pierre Simon de Laplace',
}, },
{ {
asset_name: 'Microsoft 365', asset_make: 'Franz Boas',
asset_type: 'Hardware', asset_type: 'Software',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -59,11 +67,59 @@ const AssetsData = [
maintenance_due_date: new Date('2023-03-01T00:00:00Z'), maintenance_due_date: new Date('2023-03-01T00:00:00Z'),
asset_po: 'Lucretius', asset_po: 'Ernest Rutherford',
asset_eol: new Date(Date.now()), asset_eol: new Date(Date.now()),
asset_purchase_price: 'Francis Galton', asset_purchase_price: 'James Clerk Maxwell',
asset_model: 'Hans Bethe',
asset_tag: 'Erwin Schrodinger',
},
{
asset_make: 'Neils Bohr',
asset_type: 'Hardware',
// type code here for "relation_one" field
purchase_date: new Date('2021-11-20T00:00:00Z'),
maintenance_due_date: new Date('2022-11-20T00:00:00Z'),
asset_po: 'J. Robert Oppenheimer',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'John Bardeen',
asset_model: 'Max Born',
asset_tag: 'Jonas Salk',
},
{
asset_make: 'Emil Kraepelin',
asset_type: 'Software',
// type code here for "relation_one" field
purchase_date: new Date('2022-05-05T00:00:00Z'),
maintenance_due_date: new Date('2023-05-05T00:00:00Z'),
asset_po: 'J. Robert Oppenheimer',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'B. F. Skinner',
asset_model: 'Ernst Haeckel',
asset_tag: 'Johannes Kepler',
}, },
]; ];
@ -97,6 +153,26 @@ const ComplianceCertificatesData = [
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
{
certificate_name: 'HIPAA Compliance',
issue_date: new Date('2020-09-10T00:00:00Z'),
expiry_date: new Date('2022-09-10T00:00:00Z'),
// type code here for "relation_one" field
},
{
certificate_name: 'PCI DSS',
issue_date: new Date('2021-11-01T00:00:00Z'),
expiry_date: new Date('2023-11-01T00:00:00Z'),
// type code here for "relation_one" field
},
]; ];
const DepartmentsData = [ const DepartmentsData = [
@ -117,6 +193,18 @@ const DepartmentsData = [
// type code here for "relation_many" field // type code here for "relation_many" field
}, },
{
name: 'Lynn Margulis',
// type code here for "relation_many" field
},
{
name: 'Edward O. Wilson',
// type code here for "relation_many" field
},
]; ];
const EmployeesData = [ const EmployeesData = [
@ -143,7 +231,7 @@ const EmployeesData = [
// type code here for "relation_one" field // type code here for "relation_one" field
status: 'Active', status: 'Inactive',
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
@ -157,6 +245,34 @@ const EmployeesData = [
// type code here for "relation_one" field // type code here for "relation_one" field
status: 'Inactive',
// type code here for "relation_one" field
},
{
first_name: 'Bob',
last_name: 'Brown',
email: 'bob.brown@example.com',
// type code here for "relation_one" field
status: 'Active',
// type code here for "relation_one" field
},
{
first_name: 'Charlie',
last_name: 'Davis',
email: 'charlie.davis@example.com',
// type code here for "relation_one" field
status: 'Active', status: 'Active',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -167,7 +283,7 @@ const SoftwareLicensesData = [
{ {
software_name: 'Microsoft 365', software_name: 'Microsoft 365',
license_type: 'Salesforce', license_type: 'Microsoft365',
expiry_date: new Date('2023-12-31T00:00:00Z'), expiry_date: new Date('2023-12-31T00:00:00Z'),
}, },
@ -175,7 +291,7 @@ const SoftwareLicensesData = [
{ {
software_name: 'Salesforce', software_name: 'Salesforce',
license_type: 'Salesforce', license_type: 'Microsoft365',
expiry_date: new Date('2023-06-30T00:00:00Z'), expiry_date: new Date('2023-06-30T00:00:00Z'),
}, },
@ -183,10 +299,26 @@ const SoftwareLicensesData = [
{ {
software_name: 'Adobe Creative Cloud', software_name: 'Adobe Creative Cloud',
license_type: 'Salesforce', license_type: 'Microsoft365',
expiry_date: new Date('2023-09-15T00:00:00Z'), expiry_date: new Date('2023-09-15T00:00:00Z'),
}, },
{
software_name: 'Slack',
license_type: 'Microsoft365',
expiry_date: new Date('2023-11-20T00:00:00Z'),
},
{
software_name: 'Zoom',
license_type: 'Salesforce',
expiry_date: new Date('2023-08-25T00:00:00Z'),
},
]; ];
// Similar logic for "relation_many" // Similar logic for "relation_many"
@ -224,6 +356,28 @@ async function associateAssetWithAssigned_to() {
if (Asset2?.setAssigned_to) { if (Asset2?.setAssigned_to) {
await Asset2.setAssigned_to(relatedAssigned_to2); await Asset2.setAssigned_to(relatedAssigned_to2);
} }
const relatedAssigned_to3 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const Asset3 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Asset3?.setAssigned_to) {
await Asset3.setAssigned_to(relatedAssigned_to3);
}
const relatedAssigned_to4 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const Asset4 = await Assets.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Asset4?.setAssigned_to) {
await Asset4.setAssigned_to(relatedAssigned_to4);
}
} }
async function associateComplianceCertificateWithAssigned_to() { async function associateComplianceCertificateWithAssigned_to() {
@ -259,6 +413,28 @@ async function associateComplianceCertificateWithAssigned_to() {
if (ComplianceCertificate2?.setAssigned_to) { if (ComplianceCertificate2?.setAssigned_to) {
await ComplianceCertificate2.setAssigned_to(relatedAssigned_to2); await ComplianceCertificate2.setAssigned_to(relatedAssigned_to2);
} }
const relatedAssigned_to3 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const ComplianceCertificate3 = await ComplianceCertificates.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (ComplianceCertificate3?.setAssigned_to) {
await ComplianceCertificate3.setAssigned_to(relatedAssigned_to3);
}
const relatedAssigned_to4 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const ComplianceCertificate4 = await ComplianceCertificates.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (ComplianceCertificate4?.setAssigned_to) {
await ComplianceCertificate4.setAssigned_to(relatedAssigned_to4);
}
} }
// Similar logic for "relation_many" // Similar logic for "relation_many"
@ -296,6 +472,28 @@ async function associateEmployeeWithManager() {
if (Employee2?.setManager) { if (Employee2?.setManager) {
await Employee2.setManager(relatedManager2); await Employee2.setManager(relatedManager2);
} }
const relatedManager3 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const Employee3 = await Employees.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Employee3?.setManager) {
await Employee3.setManager(relatedManager3);
}
const relatedManager4 = await Employees.findOne({
offset: Math.floor(Math.random() * (await Employees.count())),
});
const Employee4 = await Employees.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Employee4?.setManager) {
await Employee4.setManager(relatedManager4);
}
} }
async function associateEmployeeWithDepartment() { async function associateEmployeeWithDepartment() {
@ -331,6 +529,28 @@ async function associateEmployeeWithDepartment() {
if (Employee2?.setDepartment) { if (Employee2?.setDepartment) {
await Employee2.setDepartment(relatedDepartment2); await Employee2.setDepartment(relatedDepartment2);
} }
const relatedDepartment3 = await Departments.findOne({
offset: Math.floor(Math.random() * (await Departments.count())),
});
const Employee3 = await Employees.findOne({
order: [['id', 'ASC']],
offset: 3,
});
if (Employee3?.setDepartment) {
await Employee3.setDepartment(relatedDepartment3);
}
const relatedDepartment4 = await Departments.findOne({
offset: Math.floor(Math.random() * (await Departments.count())),
});
const Employee4 = await Employees.findOne({
order: [['id', 'ASC']],
offset: 4,
});
if (Employee4?.setDepartment) {
await Employee4.setDepartment(relatedDepartment4);
}
} }
module.exports = { module.exports = {

View File

@ -20,15 +20,21 @@ router.use(checkCrudPermissions('assets'));
* type: object * type: object
* properties: * properties:
* asset_name: * asset_make:
* type: string * type: string
* default: asset_name * default: asset_make
* asset_po: * asset_po:
* type: string * type: string
* default: asset_po * default: asset_po
* asset_purchase_price: * asset_purchase_price:
* type: string * type: string
* default: asset_purchase_price * default: asset_purchase_price
* asset_model:
* type: string
* default: asset_model
* asset_tag:
* type: string
* default: asset_tag
* *
*/ */
@ -308,9 +314,11 @@ router.get(
if (filetype && filetype === 'csv') { if (filetype && filetype === 'csv') {
const fields = [ const fields = [
'id', 'id',
'asset_name', 'asset_make',
'asset_po', 'asset_po',
'asset_purchase_price', 'asset_purchase_price',
'asset_model',
'asset_tag',
'purchase_date', 'purchase_date',
'maintenance_due_date', 'maintenance_due_date',

View File

@ -43,7 +43,17 @@ module.exports = class SearchService {
const tableColumns = { const tableColumns = {
users: ['firstName', 'lastName', 'phoneNumber', 'email'], users: ['firstName', 'lastName', 'phoneNumber', 'email'],
assets: ['asset_name', 'asset_po', 'asset_purchase_price'], assets: [
'asset_make',
'asset_po',
'asset_purchase_price',
'asset_model',
'asset_tag',
],
compliance_certificates: ['certificate_name'], compliance_certificates: ['certificate_name'],

View File

@ -62,7 +62,7 @@ const CardAssets = ({
href={`/assets/assets-view/?id=${item.id}`} href={`/assets/assets-view/?id=${item.id}`}
className='text-lg font-bold leading-6 line-clamp-1' className='text-lg font-bold leading-6 line-clamp-1'
> >
{item.asset_name} {item.asset_make}
</Link> </Link>
<div className='ml-auto '> <div className='ml-auto '>
@ -78,11 +78,11 @@ const CardAssets = ({
<dl className='divide-y divide-stone-300 dark:divide-dark-700 px-6 py-4 text-sm leading-6 h-64 overflow-y-auto'> <dl className='divide-y divide-stone-300 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'> <div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'> <dt className=' text-gray-500 dark:text-dark-600'>
AssetName Asset Make
</dt> </dt>
<dd className='flex items-start gap-x-2'> <dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'> <div className='font-medium line-clamp-4'>
{item.asset_name} {item.asset_make}
</div> </div>
</dd> </dd>
</div> </div>
@ -137,7 +137,7 @@ const CardAssets = ({
<div className='flex justify-between gap-x-4 py-3'> <div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'> <dt className=' text-gray-500 dark:text-dark-600'>
P) Number PO Number
</dt> </dt>
<dd className='flex items-start gap-x-2'> <dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'> <div className='font-medium line-clamp-4'>
@ -167,6 +167,28 @@ const CardAssets = ({
</div> </div>
</dd> </dd>
</div> </div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Asset Model
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.asset_model}
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Asset Tag
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.asset_tag}
</div>
</dd>
</div>
</dl> </dl>
</li> </li>
))} ))}

View File

@ -52,8 +52,8 @@ const ListAssets = ({
} }
> >
<div className={'flex-1 px-3'}> <div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>AssetName</p> <p className={'text-xs text-gray-500 '}>Asset Make</p>
<p className={'line-clamp-2'}>{item.asset_name}</p> <p className={'line-clamp-2'}>{item.asset_make}</p>
</div> </div>
<div className={'flex-1 px-3'}> <div className={'flex-1 px-3'}>
@ -89,7 +89,7 @@ const ListAssets = ({
</div> </div>
<div className={'flex-1 px-3'}> <div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>P) Number</p> <p className={'text-xs text-gray-500 '}>PO Number</p>
<p className={'line-clamp-2'}>{item.asset_po}</p> <p className={'line-clamp-2'}>{item.asset_po}</p>
</div> </div>
@ -108,6 +108,16 @@ const ListAssets = ({
{item.asset_purchase_price} {item.asset_purchase_price}
</p> </p>
</div> </div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Asset Model</p>
<p className={'line-clamp-2'}>{item.asset_model}</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Asset Tag</p>
<p className={'line-clamp-2'}>{item.asset_tag}</p>
</div>
</Link> </Link>
<ListActionsPopover <ListActionsPopover
onDelete={onDelete} onDelete={onDelete}

View File

@ -39,8 +39,8 @@ export const loadColumns = async (
return [ return [
{ {
field: 'asset_name', field: 'asset_make',
headerName: 'AssetName', headerName: 'Asset Make',
flex: 1, flex: 1,
minWidth: 120, minWidth: 120,
filterable: false, filterable: false,
@ -116,7 +116,7 @@ export const loadColumns = async (
{ {
field: 'asset_po', field: 'asset_po',
headerName: 'P) Number', headerName: 'PO Number',
flex: 1, flex: 1,
minWidth: 120, minWidth: 120,
filterable: false, filterable: false,
@ -154,6 +154,30 @@ export const loadColumns = async (
editable: hasUpdatePermission, editable: hasUpdatePermission,
}, },
{
field: 'asset_model',
headerName: 'Asset Model',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'asset_tag',
headerName: 'Asset Tag',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{ {
field: 'actions', field: 'actions',
type: 'actions', type: 'actions',

View File

@ -19,7 +19,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
const style = FooterStyle.WITH_PAGES; const style = FooterStyle.WITH_PAGES;
const design = FooterDesigns.DESIGN_DIVERSITY; const design = FooterDesigns.DEFAULT_DESIGN;
return ( return (
<div <div

View File

@ -92,6 +92,32 @@ const menuAside: MenuAsideItem[] = [
label: 'Profile', label: 'Profile',
icon: icon.mdiAccountCircle, icon: icon.mdiAccountCircle,
}, },
// Reporting Links
{
href: '/assets-assigned',
label: 'Assets Assigned by User',
icon: icon.mdiAccountMultipleOutline ?? icon.mdiTable,
permissions: 'READ_ASSETS',
},
{
href: '/assets-available',
label: 'Assets Available',
icon: icon.mdiStorage ?? icon.mdiTable,
permissions: 'READ_ASSETS',
},
{
href: '/assets-in-stock',
label: 'Assets in Stock',
icon: icon.mdiCubeOutline ?? icon.mdiTable,
permissions: 'READ_ASSETS',
},
{
href: '/employees-status',
label: 'Employees (Active/Inactive)',
icon: icon.mdiAccountCircle ?? icon.mdiTable,
permissions: 'READ_EMPLOYEES',
},
{ {
href: '/home', href: '/home',

View File

@ -0,0 +1,32 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { mdiChartTimelineVariant } from '@mdi/js';
import { getPageTitle } from '../config';
import LayoutAuthenticated from '../layouts/Authenticated';
import SectionMain from '../components/SectionMain';
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton';
import CardBox from '../components/CardBox';
import TableAssets from '../components/Assets/TableAssets';
const AssetsAssignedReport = () => (
<>
<Head>
<title>{getPageTitle('Assets Assigned by User')}</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={mdiChartTimelineVariant}
title="Assets Assigned by User"
/>
<CardBox className="mb-6" hasTable>
<TableAssets showGrid={false} />
</CardBox>
</SectionMain>
</>
);
AssetsAssignedReport.getLayout = (page: ReactElement) => (
<LayoutAuthenticated permission="READ_ASSETS">{page}</LayoutAuthenticated>
);
export default AssetsAssignedReport;

View File

@ -0,0 +1,32 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { mdiChartTimelineVariant } from '@mdi/js';
import { getPageTitle } from '../config';
import LayoutAuthenticated from '../layouts/Authenticated';
import SectionMain from '../components/SectionMain';
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton';
import CardBox from '../components/CardBox';
import TableAssets from '../components/Assets/TableAssets';
const AssetsAvailableReport = () => (
<>
<Head>
<title>{getPageTitle('Assets Available')}</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={mdiChartTimelineVariant}
title="Assets Available"
/>
<CardBox className="mb-6" hasTable>
<TableAssets showGrid={false} />
</CardBox>
</SectionMain>
</>
);
AssetsAvailableReport.getLayout = (page: ReactElement) => (
<LayoutAuthenticated permission="READ_ASSETS">{page}</LayoutAuthenticated>
);
export default AssetsAvailableReport;

View File

@ -0,0 +1,32 @@
import React, { ReactElement } from 'react';
import Head from 'next/head';
import { mdiChartTimelineVariant } from '@mdi/js';
import { getPageTitle } from '../config';
import LayoutAuthenticated from '../layouts/Authenticated';
import SectionMain from '../components/SectionMain';
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton';
import CardBox from '../components/CardBox';
import TableAssets from '../components/Assets/TableAssets';
const AssetsInStockReport = () => (
<>
<Head>
<title>{getPageTitle('Assets in Stock')}</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={mdiChartTimelineVariant}
title="Assets in Stock"
/>
<CardBox className="mb-6" hasTable>
<TableAssets showGrid={false} />
</CardBox>
</SectionMain>
</>
);
AssetsInStockReport.getLayout = (page: ReactElement) => (
<LayoutAuthenticated permission="READ_ASSETS">{page}</LayoutAuthenticated>
);
export default AssetsInStockReport;

View File

@ -36,7 +36,7 @@ const EditAssets = () => {
const router = useRouter(); const router = useRouter();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const initVals = { const initVals = {
asset_name: '', asset_make: '',
asset_type: '', asset_type: '',
@ -51,6 +51,10 @@ const EditAssets = () => {
asset_eol: new Date(), asset_eol: new Date(),
asset_purchase_price: '', asset_purchase_price: '',
asset_model: '',
asset_tag: '',
}; };
const [initialValues, setInitialValues] = useState(initVals); const [initialValues, setInitialValues] = useState(initVals);
@ -103,8 +107,8 @@ const EditAssets = () => {
onSubmit={(values) => handleSubmit(values)} onSubmit={(values) => handleSubmit(values)}
> >
<Form> <Form>
<FormField label='AssetName'> <FormField label='Asset Make'>
<Field name='asset_name' placeholder='AssetName' /> <Field name='asset_make' placeholder='Asset Make' />
</FormField> </FormField>
<FormField label='AssetType' labelFor='asset_type'> <FormField label='AssetType' labelFor='asset_type'>
@ -167,8 +171,8 @@ const EditAssets = () => {
/> />
</FormField> </FormField>
<FormField label='P) Number'> <FormField label='PO Number'>
<Field name='asset_po' placeholder='P) Number' /> <Field name='asset_po' placeholder='PO Number' />
</FormField> </FormField>
<FormField label='Asset Eol'> <FormField label='Asset Eol'>
@ -197,6 +201,14 @@ const EditAssets = () => {
/> />
</FormField> </FormField>
<FormField label='Asset Model'>
<Field name='asset_model' placeholder='Asset Model' />
</FormField>
<FormField label='Asset Tag'>
<Field name='asset_tag' placeholder='Asset Tag' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -36,7 +36,7 @@ const EditAssetsPage = () => {
const router = useRouter(); const router = useRouter();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const initVals = { const initVals = {
asset_name: '', asset_make: '',
asset_type: '', asset_type: '',
@ -51,6 +51,10 @@ const EditAssetsPage = () => {
asset_eol: new Date(), asset_eol: new Date(),
asset_purchase_price: '', asset_purchase_price: '',
asset_model: '',
asset_tag: '',
}; };
const [initialValues, setInitialValues] = useState(initVals); const [initialValues, setInitialValues] = useState(initVals);
@ -101,8 +105,8 @@ const EditAssetsPage = () => {
onSubmit={(values) => handleSubmit(values)} onSubmit={(values) => handleSubmit(values)}
> >
<Form> <Form>
<FormField label='AssetName'> <FormField label='Asset Make'>
<Field name='asset_name' placeholder='AssetName' /> <Field name='asset_make' placeholder='Asset Make' />
</FormField> </FormField>
<FormField label='AssetType' labelFor='asset_type'> <FormField label='AssetType' labelFor='asset_type'>
@ -165,8 +169,8 @@ const EditAssetsPage = () => {
/> />
</FormField> </FormField>
<FormField label='P) Number'> <FormField label='PO Number'>
<Field name='asset_po' placeholder='P) Number' /> <Field name='asset_po' placeholder='PO Number' />
</FormField> </FormField>
<FormField label='Asset Eol'> <FormField label='Asset Eol'>
@ -195,6 +199,14 @@ const EditAssetsPage = () => {
/> />
</FormField> </FormField>
<FormField label='Asset Model'>
<Field name='asset_model' placeholder='Asset Model' />
</FormField>
<FormField label='Asset Tag'>
<Field name='asset_tag' placeholder='Asset Tag' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -29,9 +29,11 @@ const AssetsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([ const [filters] = useState([
{ label: 'AssetName', title: 'asset_name' }, { label: 'Asset Make', title: 'asset_make' },
{ label: 'P) Number', title: 'asset_po' }, { label: 'PO Number', title: 'asset_po' },
{ label: 'Asset Purchase Price', title: 'asset_purchase_price' }, { label: 'Asset Purchase Price', title: 'asset_purchase_price' },
{ label: 'Asset Model', title: 'asset_model' },
{ label: 'Asset Tag', title: 'asset_tag' },
{ label: 'PurchaseDate', title: 'purchase_date', date: 'true' }, { label: 'PurchaseDate', title: 'purchase_date', date: 'true' },
{ {

View File

@ -33,7 +33,7 @@ import { useRouter } from 'next/router';
import moment from 'moment'; import moment from 'moment';
const initialValues = { const initialValues = {
asset_name: '', asset_make: '',
asset_type: 'Hardware', asset_type: 'Hardware',
@ -48,6 +48,10 @@ const initialValues = {
asset_eol: '', asset_eol: '',
asset_purchase_price: '', asset_purchase_price: '',
asset_model: '',
asset_tag: '',
}; };
const AssetsNew = () => { const AssetsNew = () => {
@ -77,8 +81,8 @@ const AssetsNew = () => {
onSubmit={(values) => handleSubmit(values)} onSubmit={(values) => handleSubmit(values)}
> >
<Form> <Form>
<FormField label='AssetName'> <FormField label='Asset Make'>
<Field name='asset_name' placeholder='AssetName' /> <Field name='asset_make' placeholder='Asset Make' />
</FormField> </FormField>
<FormField label='AssetType' labelFor='asset_type'> <FormField label='AssetType' labelFor='asset_type'>
@ -115,8 +119,8 @@ const AssetsNew = () => {
/> />
</FormField> </FormField>
<FormField label='P) Number'> <FormField label='PO Number'>
<Field name='asset_po' placeholder='P) Number' /> <Field name='asset_po' placeholder='PO Number' />
</FormField> </FormField>
<FormField label='Asset Eol'> <FormField label='Asset Eol'>
@ -134,6 +138,14 @@ const AssetsNew = () => {
/> />
</FormField> </FormField>
<FormField label='Asset Model'>
<Field name='asset_model' placeholder='Asset Model' />
</FormField>
<FormField label='Asset Tag'>
<Field name='asset_tag' placeholder='Asset Tag' />
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type='submit' color='info' label='Submit' /> <BaseButton type='submit' color='info' label='Submit' />

View File

@ -29,9 +29,11 @@ const AssetsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([ const [filters] = useState([
{ label: 'AssetName', title: 'asset_name' }, { label: 'Asset Make', title: 'asset_make' },
{ label: 'P) Number', title: 'asset_po' }, { label: 'PO Number', title: 'asset_po' },
{ label: 'Asset Purchase Price', title: 'asset_purchase_price' }, { label: 'Asset Purchase Price', title: 'asset_purchase_price' },
{ label: 'Asset Model', title: 'asset_model' },
{ label: 'Asset Tag', title: 'asset_tag' },
{ label: 'PurchaseDate', title: 'purchase_date', date: 'true' }, { label: 'PurchaseDate', title: 'purchase_date', date: 'true' },
{ {

View File

@ -55,8 +55,8 @@ const AssetsView = () => {
</SectionTitleLineWithButton> </SectionTitleLineWithButton>
<CardBox> <CardBox>
<div className={'mb-4'}> <div className={'mb-4'}>
<p className={'block font-bold mb-2'}>AssetName</p> <p className={'block font-bold mb-2'}>Asset Make</p>
<p>{assets?.asset_name}</p> <p>{assets?.asset_make}</p>
</div> </div>
<div className={'mb-4'}> <div className={'mb-4'}>
@ -111,7 +111,7 @@ const AssetsView = () => {
</FormField> </FormField>
<div className={'mb-4'}> <div className={'mb-4'}>
<p className={'block font-bold mb-2'}>P) Number</p> <p className={'block font-bold mb-2'}>PO Number</p>
<p>{assets?.asset_po}</p> <p>{assets?.asset_po}</p>
</div> </div>
@ -139,6 +139,16 @@ const AssetsView = () => {
<p>{assets?.asset_purchase_price}</p> <p>{assets?.asset_purchase_price}</p>
</div> </div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Asset Model</p>
<p>{assets?.asset_model}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Asset Tag</p>
<p>{assets?.asset_tag}</p>
</div>
<BaseDivider /> <BaseDivider />
<BaseButton <BaseButton

View File

@ -0,0 +1,44 @@
import React, { ReactElement, useState } from 'react';
import Head from 'next/head';
import { mdiChartTimelineVariant } from '@mdi/js';
import { getPageTitle } from '../config';
import LayoutAuthenticated from '../layouts/Authenticated';
import SectionMain from '../components/SectionMain';
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton';
import CardBox from '../components/CardBox';
import TableEmployees from '../components/Employees/TableEmployees';
const EmployeesStatusReport = () ={
const [filters] = useState([
{ label: 'Status', title: 'status', type: 'enum', options: ['Active', 'Inactive'] },
]);
const [filterItems, setFilterItems] = useState([]);
return (
<>
<Head>
<title>{getPageTitle('Employees (Active/Inactive)')}</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={mdiChartTimelineVariant}
title="Employees (Active/Inactive)"
/>
<CardBox className="mb-6" hasTable>
<TableEmployees
filterItems={filterItems}
setFilterItems={setFilterItems}
filters={filters}
showGrid={false}
/>
</CardBox>
</SectionMain>
</>
);
};
EmployeesStatusReport.getLayout = (page: ReactElement) => (
<LayoutAuthenticated permission="READ_EMPLOYEES">{page}</LayoutAuthenticated>
);
export default EmployeesStatusReport;

View File

@ -96,7 +96,7 @@ const EmployeesView = () => {
<table> <table>
<thead> <thead>
<tr> <tr>
<th>AssetName</th> <th>Asset Make</th>
<th>AssetType</th> <th>AssetType</th>
@ -104,11 +104,15 @@ const EmployeesView = () => {
<th>MaintenanceDueDate</th> <th>MaintenanceDueDate</th>
<th>P) Number</th> <th>PO Number</th>
<th>Asset Eol</th> <th>Asset Eol</th>
<th>Asset Purchase Price</th> <th>Asset Purchase Price</th>
<th>Asset Model</th>
<th>Asset Tag</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -121,7 +125,7 @@ const EmployeesView = () => {
router.push(`/assets/assets-view/?id=${item.id}`) router.push(`/assets/assets-view/?id=${item.id}`)
} }
> >
<td data-label='asset_name'>{item.asset_name}</td> <td data-label='asset_make'>{item.asset_make}</td>
<td data-label='asset_type'>{item.asset_type}</td> <td data-label='asset_type'>{item.asset_type}</td>
@ -146,6 +150,10 @@ const EmployeesView = () => {
<td data-label='asset_purchase_price'> <td data-label='asset_purchase_price'>
{item.asset_purchase_price} {item.asset_purchase_price}
</td> </td>
<td data-label='asset_model'>{item.asset_model}</td>
<td data-label='asset_tag'>{item.asset_tag}</td>
</tr> </tr>
))} ))}
</tbody> </tbody>