Updated via schema editor on 2025-06-19 01:30

This commit is contained in:
Flatlogic Bot 2025-06-19 01:31:41 +00:00
parent a74660b879
commit da7c3a9bf4
17 changed files with 163 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -18,6 +18,7 @@ module.exports = class UnitsDBApi {
unit_number: data.unit_number || null,
balance: data.balance || null,
unit_factor: data.unit_factor || null,
cond_fee: data.cond_fee || null,
importHash: data.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -43,6 +44,7 @@ module.exports = class UnitsDBApi {
unit_number: item.unit_number || null,
balance: item.balance || null,
unit_factor: item.unit_factor || null,
cond_fee: item.cond_fee || null,
importHash: item.importHash || null,
createdById: currentUser.id,
updatedById: currentUser.id,
@ -73,6 +75,8 @@ module.exports = class UnitsDBApi {
if (data.unit_factor !== undefined)
updatePayload.unit_factor = data.unit_factor;
if (data.cond_fee !== undefined) updatePayload.cond_fee = data.cond_fee;
updatePayload.updatedById = currentUser.id;
await units.update(updatePayload, { transaction });
@ -262,6 +266,30 @@ module.exports = class UnitsDBApi {
}
}
if (filter.cond_feeRange) {
const [start, end] = filter.cond_feeRange;
if (start !== undefined && start !== null && start !== '') {
where = {
...where,
cond_fee: {
...where.cond_fee,
[Op.gte]: start,
},
};
}
if (end !== undefined && end !== null && end !== '') {
where = {
...where,
cond_fee: {
...where.cond_fee,
[Op.lte]: end,
},
};
}
}
if (filter.active !== undefined) {
where = {
...where,

View File

@ -0,0 +1,47 @@
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(
'units',
'cond_fee',
{
type: Sequelize.DataTypes.DECIMAL,
},
{ 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('units', 'cond_fee', { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

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

View File

@ -95,7 +95,7 @@ const MaintenanceRequestsData = [
description: 'Broken window in living room',
status: 'in_progress',
status: 'pending',
request_date: new Date('2023-09-25T14:30:00Z'),
},
@ -172,6 +172,8 @@ const UnitsData = [
balance: 250,
unit_factor: 3,
cond_fee: 53.45,
},
{
@ -181,7 +183,9 @@ const UnitsData = [
balance: 0,
unit_factor: 7,
unit_factor: 4,
cond_fee: 82.56,
},
{
@ -191,7 +195,9 @@ const UnitsData = [
balance: 150,
unit_factor: 8,
unit_factor: 3,
cond_fee: 49.53,
},
{
@ -201,7 +207,9 @@ const UnitsData = [
balance: 0,
unit_factor: 6,
unit_factor: 5,
cond_fee: 95.34,
},
];

View File

@ -31,6 +31,9 @@ router.use(checkCrudPermissions('units'));
* balance:
* type: integer
* format: int64
* cond_fee:
* type: integer
* format: int64
*/
@ -307,7 +310,13 @@ router.get(
const currentUser = req.currentUser;
const payload = await UnitsDBApi.findAll(req.query, { currentUser });
if (filetype && filetype === 'csv') {
const fields = ['id', 'unit_number', 'unit_factor', 'balance'];
const fields = [
'id',
'unit_number',
'unit_factor',
'balance',
'cond_fee',
];
const opts = { fields };
try {
const csv = parse(payload.rows, opts);

View File

@ -54,7 +54,7 @@ module.exports = class SearchService {
const columnsInt = {
budgets: ['year', 'total_budget', 'expenses'],
units: ['balance', 'unit_factor'],
units: ['balance', 'unit_factor', 'cond_fee'],
};
let allFoundRecords = [];

View File

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

View File

@ -72,6 +72,11 @@ const ListUnits = ({
<p className={'text-xs text-gray-500 '}>Unit Factor</p>
<p className={'line-clamp-2'}>{item.unit_factor}</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500 '}>Cond Fee</p>
<p className={'line-clamp-2'}>{item.cond_fee}</p>
</div>
</Link>
<ListActionsPopover
onDelete={onDelete}

View File

@ -98,6 +98,20 @@ export const loadColumns = async (
type: 'number',
},
{
field: 'cond_fee',
headerName: 'Cond Fee',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: hasUpdatePermission,
type: 'number',
},
{
field: 'actions',
type: 'actions',

View File

@ -43,6 +43,8 @@ const EditUnits = () => {
balance: '',
unit_factor: '',
cond_fee: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -122,6 +124,10 @@ const EditUnits = () => {
/>
</FormField>
<FormField label='Cond Fee'>
<Field type='number' name='cond_fee' placeholder='Cond Fee' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -43,6 +43,8 @@ const EditUnitsPage = () => {
balance: '',
unit_factor: '',
cond_fee: '',
};
const [initialValues, setInitialValues] = useState(initVals);
@ -120,6 +122,10 @@ const EditUnitsPage = () => {
/>
</FormField>
<FormField label='Cond Fee'>
<Field type='number' name='cond_fee' placeholder='Cond Fee' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -32,6 +32,7 @@ const UnitsTablesPage = () => {
{ label: 'UnitNumber', title: 'unit_number' },
{ label: 'Unit Factor', title: 'unit_factor', number: 'true' },
{ label: 'Balance', title: 'balance', number: 'true' },
{ label: 'Cond Fee', title: 'cond_fee', number: 'true' },
{ label: 'Owner', title: 'owner' },
]);

View File

@ -40,6 +40,8 @@ const initialValues = {
balance: '',
unit_factor: '',
cond_fee: '',
};
const UnitsNew = () => {
@ -95,6 +97,10 @@ const UnitsNew = () => {
/>
</FormField>
<FormField label='Cond Fee'>
<Field type='number' name='cond_fee' placeholder='Cond Fee' />
</FormField>
<BaseDivider />
<BaseButtons>
<BaseButton type='submit' color='info' label='Submit' />

View File

@ -32,6 +32,7 @@ const UnitsTablesPage = () => {
{ label: 'UnitNumber', title: 'unit_number' },
{ label: 'Unit Factor', title: 'unit_factor', number: 'true' },
{ label: 'Balance', title: 'balance', number: 'true' },
{ label: 'Cond Fee', title: 'cond_fee', number: 'true' },
{ label: 'Owner', title: 'owner' },
]);

View File

@ -75,6 +75,11 @@ const UnitsView = () => {
<p>{units?.unit_factor || 'No data'}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Cond Fee</p>
<p>{units?.cond_fee || 'No data'}</p>
</div>
<>
<p className={'block font-bold mb-2'}>Maintenance_requests Unit</p>
<CardBox

View File

@ -153,6 +153,8 @@ const UsersView = () => {
<th>Balance</th>
<th>Unit Factor</th>
<th>Cond Fee</th>
</tr>
</thead>
<tbody>
@ -170,6 +172,8 @@ const UsersView = () => {
<td data-label='balance'>{item.balance}</td>
<td data-label='unit_factor'>{item.unit_factor}</td>
<td data-label='cond_fee'>{item.cond_fee}</td>
</tr>
))}
</tbody>