Updated via schema editor on 2025-07-17 09:30

This commit is contained in:
Flatlogic Bot 2025-07-17 09:30:45 +00:00
parent ff9eaea061
commit 898a1a5bd3
20 changed files with 439 additions and 15 deletions

5
.gitignore vendored
View File

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

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,9 @@ module.exports = class AssetsDBApi {
asset_type: data.asset_type || null,
purchase_date: data.purchase_date || null,
maintenance_due_date: data.maintenance_due_date || null,
asset_po: data.asset_po || null,
asset_eol: data.asset_eol || null,
asset_purchase_price: data.asset_purchase_price || null,
importHash: data.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -45,6 +48,9 @@ module.exports = class AssetsDBApi {
asset_type: item.asset_type || null,
purchase_date: item.purchase_date || null,
maintenance_due_date: item.maintenance_due_date || null,
asset_po: item.asset_po || null,
asset_eol: item.asset_eol || null,
asset_purchase_price: item.asset_purchase_price || null,
importHash: item.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -79,6 +85,13 @@ module.exports = class AssetsDBApi {
if (data.maintenance_due_date !== undefined)
updatePayload.maintenance_due_date = data.maintenance_due_date;
if (data.asset_po !== undefined) updatePayload.asset_po = data.asset_po;
if (data.asset_eol !== undefined) updatePayload.asset_eol = data.asset_eol;
if (data.asset_purchase_price !== undefined)
updatePayload.asset_purchase_price = data.asset_purchase_price;
updatePayload.updatedById = currentUser.id;
await assets.update(updatePayload, { transaction });
@ -214,6 +227,24 @@ module.exports = class AssetsDBApi {
};
}
if (filter.asset_po) {
where = {
...where,
[Op.and]: Utils.ilike('assets', 'asset_po', filter.asset_po),
};
}
if (filter.asset_purchase_price) {
where = {
...where,
[Op.and]: Utils.ilike(
'assets',
'asset_purchase_price',
filter.asset_purchase_price,
),
};
}
if (filter.calendarStart && filter.calendarEnd) {
where = {
...where,
@ -280,6 +311,30 @@ module.exports = class AssetsDBApi {
}
}
if (filter.asset_eolRange) {
const [start, end] = filter.asset_eolRange;
if (start !== undefined && start !== null && start !== '') {
where = {
...where,
asset_eol: {
...where.asset_eol,
[Op.gte]: start,
},
};
}
if (end !== undefined && end !== null && end !== '') {
where = {
...where,
asset_eol: {
...where.asset_eol,
[Op.lte]: end,
},
};
}
}
if (filter.active !== undefined) {
where = {
...where,

View File

@ -0,0 +1,71 @@
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(
'assets',
'asset_po',
{
type: Sequelize.DataTypes.TEXT,
},
{ transaction },
);
await queryInterface.addColumn(
'assets',
'asset_eol',
{
type: Sequelize.DataTypes.DATE,
},
{ transaction },
);
await queryInterface.addColumn(
'assets',
'asset_purchase_price',
{
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_purchase_price', {
transaction,
});
await queryInterface.removeColumn('assets', 'asset_eol', { transaction });
await queryInterface.removeColumn('assets', 'asset_po', { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -32,6 +32,18 @@ module.exports = function (sequelize, DataTypes) {
type: DataTypes.DATE,
},
asset_po: {
type: DataTypes.TEXT,
},
asset_eol: {
type: DataTypes.DATE,
},
asset_purchase_price: {
type: DataTypes.TEXT,
},
importHash: {
type: DataTypes.STRING(255),
allowNull: true,

View File

@ -15,25 +15,37 @@ const AssetsData = [
{
asset_name: 'Dell Laptop',
asset_type: 'Hardware',
asset_type: 'Software',
// type code here for "relation_one" field
purchase_date: new Date('2022-01-15T00:00:00Z'),
maintenance_due_date: new Date('2023-01-15T00:00:00Z'),
asset_po: 'Alexander Fleming',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'Francis Crick',
},
{
asset_name: 'HP Printer',
asset_type: 'Hardware',
asset_type: 'Software',
// type code here for "relation_one" field
purchase_date: new Date('2021-06-10T00:00:00Z'),
maintenance_due_date: new Date('2022-06-10T00:00:00Z'),
asset_po: 'Sigmund Freud',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'Ernest Rutherford',
},
{
@ -46,18 +58,30 @@ const AssetsData = [
purchase_date: new Date('2022-03-01T00:00:00Z'),
maintenance_due_date: new Date('2023-03-01T00:00:00Z'),
asset_po: 'Christiaan Huygens',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'Charles Sherrington',
},
{
asset_name: 'Salesforce License',
asset_type: 'Hardware',
asset_type: 'Software',
// 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: 'George Gaylord Simpson',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'Pierre Simon de Laplace',
},
{
@ -70,6 +94,12 @@ const AssetsData = [
purchase_date: new Date('2022-05-05T00:00:00Z'),
maintenance_due_date: new Date('2023-05-05T00:00:00Z'),
asset_po: 'Alfred Binet',
asset_eol: new Date(Date.now()),
asset_purchase_price: 'Enrico Fermi',
},
];
@ -145,13 +175,13 @@ const DepartmentsData = [
},
{
name: 'B. F. Skinner',
name: 'Arthur Eddington',
// type code here for "relation_many" field
},
{
name: 'Isaac Newton',
name: 'Hans Bethe',
// type code here for "relation_many" field
},
@ -167,7 +197,7 @@ const EmployeesData = [
// type code here for "relation_one" field
status: 'Active',
status: 'Inactive',
// type code here for "relation_one" field
},
@ -181,7 +211,7 @@ const EmployeesData = [
// type code here for "relation_one" field
status: 'Active',
status: 'Inactive',
// type code here for "relation_one" field
},
@ -209,7 +239,7 @@ const EmployeesData = [
// type code here for "relation_one" field
status: 'Inactive',
status: 'Active',
// type code here for "relation_one" field
},
@ -257,7 +287,7 @@ const SoftwareLicensesData = [
{
software_name: 'Slack',
license_type: 'Salesforce',
license_type: 'Microsoft365',
expiry_date: new Date('2023-11-20T00:00:00Z'),
},

View File

@ -23,6 +23,12 @@ router.use(checkCrudPermissions('assets'));
* asset_name:
* type: string
* default: asset_name
* asset_po:
* type: string
* default: asset_po
* asset_purchase_price:
* type: string
* default: asset_purchase_price
*
*/
@ -303,9 +309,12 @@ router.get(
const fields = [
'id',
'asset_name',
'asset_po',
'asset_purchase_price',
'purchase_date',
'maintenance_due_date',
'asset_eol',
];
const opts = { fields };
try {

View File

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

View File

@ -0,0 +1 @@
{}

View File

@ -134,6 +134,39 @@ const CardAssets = ({
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
P) Number
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.asset_po}
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Asset Eol
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{dataFormatter.dateTimeFormatter(item.asset_eol)}
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className=' text-gray-500 dark:text-dark-600'>
Asset Purchase Price
</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{item.asset_purchase_price}
</div>
</dd>
</div>
</dl>
</li>
))}

View File

@ -87,6 +87,27 @@ const ListAssets = ({
)}
</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>P) Number</p>
<p className={'line-clamp-2'}>{item.asset_po}</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Asset Eol</p>
<p className={'line-clamp-2'}>
{dataFormatter.dateTimeFormatter(item.asset_eol)}
</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>
Asset Purchase Price
</p>
<p className={'line-clamp-2'}>
{item.asset_purchase_price}
</p>
</div>
</Link>
<ListActionsPopover
onDelete={onDelete}

View File

@ -114,6 +114,46 @@ export const loadColumns = async (
new Date(params.row.maintenance_due_date),
},
{
field: 'asset_po',
headerName: 'P) Number',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'asset_eol',
headerName: 'Asset Eol',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
type: 'dateTime',
valueGetter: (params: GridValueGetterParams) =>
new Date(params.row.asset_eol),
},
{
field: 'asset_purchase_price',
headerName: 'Asset Purchase Price',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
},
{
field: 'actions',
type: 'actions',

View File

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

View File

@ -45,6 +45,12 @@ const EditAssets = () => {
purchase_date: new Date(),
maintenance_due_date: new Date(),
asset_po: '',
asset_eol: new Date(),
asset_purchase_price: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -161,6 +167,36 @@ const EditAssets = () => {
/>
</FormField>
<FormField label='P) Number'>
<Field name='asset_po' placeholder='P) Number' />
</FormField>
<FormField label='Asset Eol'>
<DatePicker
dateFormat='yyyy-MM-dd hh:mm'
showTimeSelect
selected={
initialValues.asset_eol
? new Date(
dayjs(initialValues.asset_eol).format(
'YYYY-MM-DD hh:mm',
),
)
: null
}
onChange={(date) =>
setInitialValues({ ...initialValues, asset_eol: date })
}
/>
</FormField>
<FormField label='Asset Purchase Price'>
<Field
name='asset_purchase_price'
placeholder='Asset Purchase Price'
/>
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -45,6 +45,12 @@ const EditAssetsPage = () => {
purchase_date: new Date(),
maintenance_due_date: new Date(),
asset_po: '',
asset_eol: new Date(),
asset_purchase_price: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -159,6 +165,36 @@ const EditAssetsPage = () => {
/>
</FormField>
<FormField label='P) Number'>
<Field name='asset_po' placeholder='P) Number' />
</FormField>
<FormField label='Asset Eol'>
<DatePicker
dateFormat='yyyy-MM-dd hh:mm'
showTimeSelect
selected={
initialValues.asset_eol
? new Date(
dayjs(initialValues.asset_eol).format(
'YYYY-MM-DD hh:mm',
),
)
: null
}
onChange={(date) =>
setInitialValues({ ...initialValues, asset_eol: date })
}
/>
</FormField>
<FormField label='Asset Purchase Price'>
<Field
name='asset_purchase_price'
placeholder='Asset Purchase Price'
/>
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -30,6 +30,8 @@ const AssetsTablesPage = () => {
const [filters] = useState([
{ label: 'AssetName', title: 'asset_name' },
{ label: 'P) Number', title: 'asset_po' },
{ label: 'Asset Purchase Price', title: 'asset_purchase_price' },
{ label: 'PurchaseDate', title: 'purchase_date', date: 'true' },
{
@ -37,6 +39,7 @@ const AssetsTablesPage = () => {
title: 'maintenance_due_date',
date: 'true',
},
{ label: 'Asset Eol', title: 'asset_eol', date: 'true' },
{ label: 'AssignedTo', title: 'assigned_to' },

View File

@ -42,6 +42,12 @@ const initialValues = {
purchase_date: '',
maintenance_due_date: '',
asset_po: '',
asset_eol: '',
asset_purchase_price: '',
};
const AssetsNew = () => {
@ -122,6 +128,25 @@ const AssetsNew = () => {
/>
</FormField>
<FormField label='P) Number'>
<Field name='asset_po' placeholder='P) Number' />
</FormField>
<FormField label='Asset Eol'>
<Field
type='datetime-local'
name='asset_eol'
placeholder='Asset Eol'
/>
</FormField>
<FormField label='Asset Purchase Price'>
<Field
name='asset_purchase_price'
placeholder='Asset Purchase Price'
/>
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -30,6 +30,8 @@ const AssetsTablesPage = () => {
const [filters] = useState([
{ label: 'AssetName', title: 'asset_name' },
{ label: 'P) Number', title: 'asset_po' },
{ label: 'Asset Purchase Price', title: 'asset_purchase_price' },
{ label: 'PurchaseDate', title: 'purchase_date', date: 'true' },
{
@ -37,6 +39,7 @@ const AssetsTablesPage = () => {
title: 'maintenance_due_date',
date: 'true',
},
{ label: 'Asset Eol', title: 'asset_eol', date: 'true' },
{ label: 'AssignedTo', title: 'assigned_to' },

View File

@ -110,6 +110,35 @@ const AssetsView = () => {
)}
</FormField>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>P) Number</p>
<p>{assets?.asset_po}</p>
</div>
<FormField label='Asset Eol'>
{assets.asset_eol ? (
<DatePicker
dateFormat='yyyy-MM-dd hh:mm'
showTimeSelect
selected={
assets.asset_eol
? new Date(
dayjs(assets.asset_eol).format('YYYY-MM-DD hh:mm'),
)
: null
}
disabled
/>
) : (
<p>No Asset Eol</p>
)}
</FormField>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Asset Purchase Price</p>
<p>{assets?.asset_purchase_price}</p>
</div>
<BaseDivider />
<BaseButton

View File

@ -103,6 +103,12 @@ const EmployeesView = () => {
<th>PurchaseDate</th>
<th>MaintenanceDueDate</th>
<th>P) Number</th>
<th>Asset Eol</th>
<th>Asset Purchase Price</th>
</tr>
</thead>
<tbody>
@ -130,6 +136,16 @@ const EmployeesView = () => {
item.maintenance_due_date,
)}
</td>
<td data-label='asset_po'>{item.asset_po}</td>
<td data-label='asset_eol'>
{dataFormatter.dateTimeFormatter(item.asset_eol)}
</td>
<td data-label='asset_purchase_price'>
{item.asset_purchase_price}
</td>
</tr>
))}
</tbody>