Updated via schema editor on 2025-07-09 18:54
This commit is contained in:
parent
5dab74c8fc
commit
53f8266cef
File diff suppressed because one or more lines are too long
@ -15,16 +15,15 @@ module.exports = class DocumentsDBApi {
|
||||
{
|
||||
id: data.id || undefined,
|
||||
|
||||
nameofemployee_organization: data.nameofemployee_organization || null,
|
||||
document_number: data.document_number || null,
|
||||
document_type: data.document_type || null,
|
||||
prepared_by: data.prepared_by || null,
|
||||
status: data.status || null,
|
||||
cash_balance: data.cash_balance || false,
|
||||
|
||||
payment_date: data.payment_date || null,
|
||||
amount: data.amount || null,
|
||||
description: data.description || null,
|
||||
date: data.date || null,
|
||||
payment_type: data.payment_type || null,
|
||||
Amount: data.Amount || null,
|
||||
project_code: data.project_code || null,
|
||||
document_status: data.document_status || null,
|
||||
shelf_number: data.shelf_number || null,
|
||||
approved_by: data.approved_by || null,
|
||||
importHash: data.importHash || null,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id,
|
||||
@ -32,10 +31,6 @@ module.exports = class DocumentsDBApi {
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await documents.setProject(data.project || null, {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await documents.setOrganizations(data.organizations || null, {
|
||||
transaction,
|
||||
});
|
||||
@ -51,16 +46,15 @@ module.exports = class DocumentsDBApi {
|
||||
const documentsData = data.map((item, index) => ({
|
||||
id: item.id || undefined,
|
||||
|
||||
nameofemployee_organization: item.nameofemployee_organization || null,
|
||||
document_number: item.document_number || null,
|
||||
document_type: item.document_type || null,
|
||||
prepared_by: item.prepared_by || null,
|
||||
status: item.status || null,
|
||||
cash_balance: item.cash_balance || false,
|
||||
|
||||
payment_date: item.payment_date || null,
|
||||
amount: item.amount || null,
|
||||
description: item.description || null,
|
||||
date: item.date || null,
|
||||
payment_type: item.payment_type || null,
|
||||
Amount: item.Amount || null,
|
||||
project_code: item.project_code || null,
|
||||
document_status: item.document_status || null,
|
||||
shelf_number: item.shelf_number || null,
|
||||
approved_by: item.approved_by || null,
|
||||
importHash: item.importHash || null,
|
||||
createdById: currentUser.id,
|
||||
updatedById: currentUser.id,
|
||||
@ -86,43 +80,36 @@ module.exports = class DocumentsDBApi {
|
||||
|
||||
const updatePayload = {};
|
||||
|
||||
if (data.nameofemployee_organization !== undefined)
|
||||
updatePayload.nameofemployee_organization =
|
||||
data.nameofemployee_organization;
|
||||
|
||||
if (data.document_number !== undefined)
|
||||
updatePayload.document_number = data.document_number;
|
||||
|
||||
if (data.document_type !== undefined)
|
||||
updatePayload.document_type = data.document_type;
|
||||
if (data.description !== undefined)
|
||||
updatePayload.description = data.description;
|
||||
|
||||
if (data.prepared_by !== undefined)
|
||||
updatePayload.prepared_by = data.prepared_by;
|
||||
if (data.date !== undefined) updatePayload.date = data.date;
|
||||
|
||||
if (data.status !== undefined) updatePayload.status = data.status;
|
||||
if (data.payment_type !== undefined)
|
||||
updatePayload.payment_type = data.payment_type;
|
||||
|
||||
if (data.cash_balance !== undefined)
|
||||
updatePayload.cash_balance = data.cash_balance;
|
||||
if (data.Amount !== undefined) updatePayload.Amount = data.Amount;
|
||||
|
||||
if (data.payment_date !== undefined)
|
||||
updatePayload.payment_date = data.payment_date;
|
||||
if (data.project_code !== undefined)
|
||||
updatePayload.project_code = data.project_code;
|
||||
|
||||
if (data.amount !== undefined) updatePayload.amount = data.amount;
|
||||
if (data.document_status !== undefined)
|
||||
updatePayload.document_status = data.document_status;
|
||||
|
||||
if (data.shelf_number !== undefined)
|
||||
updatePayload.shelf_number = data.shelf_number;
|
||||
|
||||
if (data.approved_by !== undefined)
|
||||
updatePayload.approved_by = data.approved_by;
|
||||
|
||||
updatePayload.updatedById = currentUser.id;
|
||||
|
||||
await documents.update(updatePayload, { transaction });
|
||||
|
||||
if (data.project !== undefined) {
|
||||
await documents.setProject(
|
||||
data.project,
|
||||
|
||||
{ transaction },
|
||||
);
|
||||
}
|
||||
|
||||
if (data.organizations !== undefined) {
|
||||
await documents.setOrganizations(
|
||||
data.organizations,
|
||||
@ -196,10 +183,6 @@ module.exports = class DocumentsDBApi {
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.project = await documents.getProject({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.organizations = await documents.getOrganizations({
|
||||
transaction,
|
||||
});
|
||||
@ -229,32 +212,6 @@ module.exports = class DocumentsDBApi {
|
||||
const transaction = (options && options.transaction) || undefined;
|
||||
|
||||
let include = [
|
||||
{
|
||||
model: db.projects,
|
||||
as: 'project',
|
||||
|
||||
where: filter.project
|
||||
? {
|
||||
[Op.or]: [
|
||||
{
|
||||
id: {
|
||||
[Op.in]: filter.project
|
||||
.split('|')
|
||||
.map((term) => Utils.uuid(term)),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: {
|
||||
[Op.or]: filter.project
|
||||
.split('|')
|
||||
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
: {},
|
||||
},
|
||||
|
||||
{
|
||||
model: db.organizations,
|
||||
as: 'organizations',
|
||||
@ -269,6 +226,17 @@ module.exports = class DocumentsDBApi {
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.nameofemployee_organization) {
|
||||
where = {
|
||||
...where,
|
||||
[Op.and]: Utils.ilike(
|
||||
'documents',
|
||||
'nameofemployee_organization',
|
||||
filter.nameofemployee_organization,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.document_number) {
|
||||
where = {
|
||||
...where,
|
||||
@ -280,10 +248,21 @@ module.exports = class DocumentsDBApi {
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.prepared_by) {
|
||||
if (filter.description) {
|
||||
where = {
|
||||
...where,
|
||||
[Op.and]: Utils.ilike('documents', 'prepared_by', filter.prepared_by),
|
||||
[Op.and]: Utils.ilike('documents', 'description', filter.description),
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.project_code) {
|
||||
where = {
|
||||
...where,
|
||||
[Op.and]: Utils.ilike(
|
||||
'documents',
|
||||
'project_code',
|
||||
filter.project_code,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@ -298,21 +277,14 @@ module.exports = class DocumentsDBApi {
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.approved_by) {
|
||||
where = {
|
||||
...where,
|
||||
[Op.and]: Utils.ilike('documents', 'approved_by', filter.approved_by),
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.payment_dateRange) {
|
||||
const [start, end] = filter.payment_dateRange;
|
||||
if (filter.dateRange) {
|
||||
const [start, end] = filter.dateRange;
|
||||
|
||||
if (start !== undefined && start !== null && start !== '') {
|
||||
where = {
|
||||
...where,
|
||||
payment_date: {
|
||||
...where.payment_date,
|
||||
date: {
|
||||
...where.date,
|
||||
[Op.gte]: start,
|
||||
},
|
||||
};
|
||||
@ -321,22 +293,22 @@ module.exports = class DocumentsDBApi {
|
||||
if (end !== undefined && end !== null && end !== '') {
|
||||
where = {
|
||||
...where,
|
||||
payment_date: {
|
||||
...where.payment_date,
|
||||
date: {
|
||||
...where.date,
|
||||
[Op.lte]: end,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.amountRange) {
|
||||
const [start, end] = filter.amountRange;
|
||||
if (filter.AmountRange) {
|
||||
const [start, end] = filter.AmountRange;
|
||||
|
||||
if (start !== undefined && start !== null && start !== '') {
|
||||
where = {
|
||||
...where,
|
||||
amount: {
|
||||
...where.amount,
|
||||
Amount: {
|
||||
...where.Amount,
|
||||
[Op.gte]: start,
|
||||
},
|
||||
};
|
||||
@ -345,8 +317,8 @@ module.exports = class DocumentsDBApi {
|
||||
if (end !== undefined && end !== null && end !== '') {
|
||||
where = {
|
||||
...where,
|
||||
amount: {
|
||||
...where.amount,
|
||||
Amount: {
|
||||
...where.Amount,
|
||||
[Op.lte]: end,
|
||||
},
|
||||
};
|
||||
@ -360,24 +332,17 @@ module.exports = class DocumentsDBApi {
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.document_type) {
|
||||
if (filter.payment_type) {
|
||||
where = {
|
||||
...where,
|
||||
document_type: filter.document_type,
|
||||
payment_type: filter.payment_type,
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.status) {
|
||||
if (filter.document_status) {
|
||||
where = {
|
||||
...where,
|
||||
status: filter.status,
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.cash_balance) {
|
||||
where = {
|
||||
...where,
|
||||
cash_balance: filter.cash_balance,
|
||||
document_status: filter.document_status,
|
||||
};
|
||||
}
|
||||
|
||||
@ -468,22 +433,22 @@ module.exports = class DocumentsDBApi {
|
||||
where = {
|
||||
[Op.or]: [
|
||||
{ ['id']: Utils.uuid(query) },
|
||||
Utils.ilike('documents', 'document_number', query),
|
||||
Utils.ilike('documents', 'id', query),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const records = await db.documents.findAll({
|
||||
attributes: ['id', 'document_number'],
|
||||
attributes: ['id', 'id'],
|
||||
where,
|
||||
limit: limit ? Number(limit) : undefined,
|
||||
offset: offset ? Number(offset) : undefined,
|
||||
orderBy: [['document_number', 'ASC']],
|
||||
orderBy: [['id', 'ASC']],
|
||||
});
|
||||
|
||||
return records.map((record) => ({
|
||||
id: record.id,
|
||||
label: record.document_number,
|
||||
label: record.id,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -169,6 +169,15 @@ module.exports = class OrganizationsDBApi {
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.departments_organizations =
|
||||
await organizations.getDepartments_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.places_organizations = await organizations.getPlaces_organizations({
|
||||
transaction,
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -295,22 +304,22 @@ module.exports = class OrganizationsDBApi {
|
||||
where = {
|
||||
[Op.or]: [
|
||||
{ ['id']: Utils.uuid(query) },
|
||||
Utils.ilike('organizations', 'name', query),
|
||||
Utils.ilike('organizations', 'id', query),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const records = await db.organizations.findAll({
|
||||
attributes: ['id', 'name'],
|
||||
attributes: ['id', 'id'],
|
||||
where,
|
||||
limit: limit ? Number(limit) : undefined,
|
||||
offset: offset ? Number(offset) : undefined,
|
||||
orderBy: [['name', 'ASC']],
|
||||
orderBy: [['id', 'ASC']],
|
||||
});
|
||||
|
||||
return records.map((record) => ({
|
||||
id: record.id,
|
||||
label: record.name,
|
||||
label: record.id,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -208,7 +208,7 @@ module.exports = class PaymentsDBApi {
|
||||
},
|
||||
},
|
||||
{
|
||||
document_number: {
|
||||
id: {
|
||||
[Op.or]: filter.document
|
||||
.split('|')
|
||||
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
||||
|
||||
@ -158,10 +158,6 @@ module.exports = class ProjectsDBApi {
|
||||
|
||||
const output = projects.get({ plain: true });
|
||||
|
||||
output.documents_project = await projects.getDocuments_project({
|
||||
transaction,
|
||||
});
|
||||
|
||||
output.field_site_payment_requisitions_project =
|
||||
await projects.getField_site_payment_requisitions_project({
|
||||
transaction,
|
||||
|
||||
36
backend/src/db/migrations/1751986477256.js
Normal file
36
backend/src/db/migrations/1751986477256.js
Normal file
@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
},
|
||||
};
|
||||
363
backend/src/db/migrations/1752087244997.js
Normal file
363
backend/src/db/migrations/1752087244997.js
Normal file
@ -0,0 +1,363 @@
|
||||
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.createTable(
|
||||
'organizations',
|
||||
{
|
||||
id: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
defaultValue: Sequelize.DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
createdById: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
references: {
|
||||
key: 'id',
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
updatedById: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
references: {
|
||||
key: 'id',
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
createdAt: { type: Sequelize.DataTypes.DATE },
|
||||
updatedAt: { type: Sequelize.DataTypes.DATE },
|
||||
deletedAt: { type: Sequelize.DataTypes.DATE },
|
||||
importHash: {
|
||||
type: Sequelize.DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
unique: true,
|
||||
},
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'organizations',
|
||||
'name',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.removeColumn('documents', 'document_numner', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'projectId', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'document_type', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'prepared_by', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'status', { transaction });
|
||||
|
||||
await queryInterface.removeColumn('documents', 'cash_balance', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'payment_date', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'amount', { transaction });
|
||||
|
||||
await queryInterface.removeColumn('documents', 'shelf_number', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'approved_by', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'document_number',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'description',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'date',
|
||||
{
|
||||
type: Sequelize.DataTypes.DATEONLY,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'payment_type',
|
||||
{
|
||||
type: Sequelize.DataTypes.ENUM,
|
||||
|
||||
values: ['BPV', 'JV', 'RV', 'CPV'],
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'Amount',
|
||||
{
|
||||
type: Sequelize.DataTypes.DECIMAL,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'project_code',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'document_status',
|
||||
{
|
||||
type: Sequelize.DataTypes.ENUM,
|
||||
|
||||
values: ['Approved', 'Complete', 'On progress', 'Filled'],
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'shelf_number',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.dropTable('organizations', { 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('documents', 'shelf_number', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'document_status', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'project_code', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'Amount', { transaction });
|
||||
|
||||
await queryInterface.removeColumn('documents', 'payment_type', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'date', { transaction });
|
||||
|
||||
await queryInterface.removeColumn('documents', 'description', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.removeColumn('documents', 'document_number', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'approved_by',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'shelf_number',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'amount',
|
||||
{
|
||||
type: Sequelize.DataTypes.DECIMAL,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'payment_date',
|
||||
{
|
||||
type: Sequelize.DataTypes.DATE,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'cash_balance',
|
||||
{
|
||||
type: Sequelize.DataTypes.BOOLEAN,
|
||||
|
||||
defaultValue: false,
|
||||
allowNull: false,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'status',
|
||||
{
|
||||
type: Sequelize.DataTypes.ENUM,
|
||||
|
||||
values: ['Filed', 'InProgress'],
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'prepared_by',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'document_type',
|
||||
{
|
||||
type: Sequelize.DataTypes.ENUM,
|
||||
|
||||
values: ['BPV', 'JV', 'RV'],
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'projectId',
|
||||
{
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
|
||||
references: {
|
||||
model: 'projects',
|
||||
key: 'id',
|
||||
},
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.addColumn(
|
||||
'documents',
|
||||
'document_numner',
|
||||
{
|
||||
type: Sequelize.DataTypes.TEXT,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await queryInterface.removeColumn('organizations', 'name', {
|
||||
transaction,
|
||||
});
|
||||
|
||||
await queryInterface.dropTable('organizations', { transaction });
|
||||
|
||||
await queryInterface.createTable(
|
||||
'organizations',
|
||||
{
|
||||
id: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
defaultValue: Sequelize.DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
createdById: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
references: {
|
||||
key: 'id',
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
updatedById: {
|
||||
type: Sequelize.DataTypes.UUID,
|
||||
references: {
|
||||
key: 'id',
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
createdAt: { type: Sequelize.DataTypes.DATE },
|
||||
updatedAt: { type: Sequelize.DataTypes.DATE },
|
||||
deletedAt: { type: Sequelize.DataTypes.DATE },
|
||||
importHash: {
|
||||
type: Sequelize.DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
unique: true,
|
||||
},
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
|
||||
await transaction.commit();
|
||||
} catch (err) {
|
||||
await transaction.rollback();
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -14,46 +14,49 @@ module.exports = function (sequelize, DataTypes) {
|
||||
primaryKey: true,
|
||||
},
|
||||
|
||||
nameofemployee_organization: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
|
||||
document_number: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
|
||||
document_type: {
|
||||
type: DataTypes.ENUM,
|
||||
|
||||
values: ['BPV', 'JV', 'RV'],
|
||||
},
|
||||
|
||||
prepared_by: {
|
||||
description: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
|
||||
status: {
|
||||
date: {
|
||||
type: DataTypes.DATEONLY,
|
||||
|
||||
get: function () {
|
||||
return this.getDataValue('date')
|
||||
? moment.utc(this.getDataValue('date')).format('YYYY-MM-DD')
|
||||
: null;
|
||||
},
|
||||
},
|
||||
|
||||
payment_type: {
|
||||
type: DataTypes.ENUM,
|
||||
|
||||
values: ['Filed', 'InProgress'],
|
||||
values: ['BPV', 'JV', 'RV', 'CPV'],
|
||||
},
|
||||
|
||||
cash_balance: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
},
|
||||
|
||||
payment_date: {
|
||||
type: DataTypes.DATE,
|
||||
},
|
||||
|
||||
amount: {
|
||||
Amount: {
|
||||
type: DataTypes.DECIMAL,
|
||||
},
|
||||
|
||||
shelf_number: {
|
||||
project_code: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
|
||||
approved_by: {
|
||||
document_status: {
|
||||
type: DataTypes.ENUM,
|
||||
|
||||
values: ['Approved', 'Complete', 'On progress', 'Filled'],
|
||||
},
|
||||
|
||||
shelf_number: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
|
||||
@ -83,14 +86,6 @@ module.exports = function (sequelize, DataTypes) {
|
||||
|
||||
//end loop
|
||||
|
||||
db.documents.belongsTo(db.projects, {
|
||||
as: 'project',
|
||||
foreignKey: {
|
||||
name: 'projectId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.documents.belongsTo(db.organizations, {
|
||||
as: 'organizations',
|
||||
foreignKey: {
|
||||
|
||||
@ -44,14 +44,6 @@ module.exports = function (sequelize, DataTypes) {
|
||||
projects.associate = (db) => {
|
||||
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
||||
|
||||
db.projects.hasMany(db.documents, {
|
||||
as: 'documents_project',
|
||||
foreignKey: {
|
||||
name: 'projectId',
|
||||
},
|
||||
constraints: false,
|
||||
});
|
||||
|
||||
db.projects.hasMany(db.field_site_payment_requisitions, {
|
||||
as: 'field_site_payment_requisitions_project',
|
||||
foreignKey: {
|
||||
|
||||
@ -118,6 +118,8 @@ module.exports = {
|
||||
'projects',
|
||||
'roles',
|
||||
'permissions',
|
||||
'departments',
|
||||
'places',
|
||||
'organizations',
|
||||
,
|
||||
];
|
||||
@ -795,6 +797,56 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('DELETE_PROJECTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_DEPARTMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('CREATE_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('READ_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('UPDATE_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('Administrator'),
|
||||
permissionId: getId('DELETE_PLACES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
@ -970,6 +1022,56 @@ primary key ("roles_permissionsId", "permissionId")
|
||||
permissionId: getId('DELETE_PERMISSIONS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_DEPARTMENTS'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_DEPARTMENTS'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('CREATE_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('READ_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('UPDATE_PLACES'),
|
||||
},
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
roles_permissionsId: getId('SuperAdmin'),
|
||||
permissionId: getId('DELETE_PLACES'),
|
||||
},
|
||||
|
||||
{
|
||||
createdAt,
|
||||
updatedAt,
|
||||
|
||||
@ -9,127 +9,77 @@ const Payments = db.payments;
|
||||
|
||||
const Projects = db.projects;
|
||||
|
||||
const Departments = db.departments;
|
||||
|
||||
const Places = db.places;
|
||||
|
||||
const Organizations = db.organizations;
|
||||
|
||||
const DocumentsData = [
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
nameofemployee_organization: 'Sheldon Glashow',
|
||||
|
||||
document_number: 'DOC001',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
description: 'Richard Feynman',
|
||||
|
||||
document_type: 'RV',
|
||||
date: new Date(Date.now()),
|
||||
|
||||
prepared_by: 'jdoe',
|
||||
payment_type: 'JV',
|
||||
|
||||
status: 'Filed',
|
||||
Amount: 13.65,
|
||||
|
||||
cash_balance: true,
|
||||
project_code: 'Noam Chomsky',
|
||||
|
||||
payment_date: new Date('2023-10-01T10:00:00Z'),
|
||||
|
||||
amount: 1000,
|
||||
document_status: 'Approved',
|
||||
|
||||
shelf_number: 'S001',
|
||||
|
||||
approved_by: 'asmith',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
nameofemployee_organization: 'Jean Piaget',
|
||||
|
||||
document_number: 'DOC002',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
description: 'Trofim Lysenko',
|
||||
|
||||
document_type: 'JV',
|
||||
date: new Date(Date.now()),
|
||||
|
||||
prepared_by: 'asmith',
|
||||
payment_type: 'BPV',
|
||||
|
||||
status: 'InProgress',
|
||||
Amount: 84.59,
|
||||
|
||||
cash_balance: false,
|
||||
project_code: 'Carl Linnaeus',
|
||||
|
||||
payment_date: new Date('2023-10-02T11:00:00Z'),
|
||||
|
||||
amount: 2000,
|
||||
document_status: 'Complete',
|
||||
|
||||
shelf_number: 'S002',
|
||||
|
||||
approved_by: 'bwhite',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
nameofemployee_organization: 'Charles Sherrington',
|
||||
|
||||
document_number: 'DOC003',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
description: 'Francis Galton',
|
||||
|
||||
document_type: 'RV',
|
||||
date: new Date(Date.now()),
|
||||
|
||||
prepared_by: 'bwhite',
|
||||
payment_type: 'CPV',
|
||||
|
||||
status: 'InProgress',
|
||||
Amount: 16.57,
|
||||
|
||||
cash_balance: true,
|
||||
project_code: 'Konrad Lorenz',
|
||||
|
||||
payment_date: new Date('2023-10-03T12:00:00Z'),
|
||||
|
||||
amount: 1500,
|
||||
document_status: 'Filled',
|
||||
|
||||
shelf_number: 'S003',
|
||||
|
||||
approved_by: 'cgreen',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
document_number: 'DOC004',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
document_type: 'BPV',
|
||||
|
||||
prepared_by: 'cgreen',
|
||||
|
||||
status: 'InProgress',
|
||||
|
||||
cash_balance: true,
|
||||
|
||||
payment_date: new Date('2023-10-04T13:00:00Z'),
|
||||
|
||||
amount: 2500,
|
||||
|
||||
shelf_number: 'S004',
|
||||
|
||||
approved_by: 'dblack',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
document_number: 'DOC005',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
document_type: 'BPV',
|
||||
|
||||
prepared_by: 'dblack',
|
||||
|
||||
status: 'InProgress',
|
||||
|
||||
cash_balance: true,
|
||||
|
||||
payment_date: new Date('2023-10-05T14:00:00Z'),
|
||||
|
||||
amount: 3000,
|
||||
|
||||
shelf_number: 'S005',
|
||||
|
||||
approved_by: 'jdoe',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
@ -147,15 +97,13 @@ const FieldSitePaymentRequisitionsData = [
|
||||
|
||||
departure_date: new Date('2023-10-01T08:00:00Z'),
|
||||
|
||||
arrival_place: 'London',
|
||||
|
||||
return_date: new Date('2023-10-10T18:00:00Z'),
|
||||
|
||||
requisition_date: new Date('2023-09-25T09:00:00Z'),
|
||||
|
||||
requested_amount: 5000,
|
||||
|
||||
payment_type: 'JV',
|
||||
payment_type: 'RV',
|
||||
|
||||
status: 'Paid',
|
||||
|
||||
@ -181,15 +129,13 @@ const FieldSitePaymentRequisitionsData = [
|
||||
|
||||
departure_date: new Date('2023-10-02T09:00:00Z'),
|
||||
|
||||
arrival_place: 'Paris',
|
||||
|
||||
return_date: new Date('2023-10-12T19:00:00Z'),
|
||||
|
||||
requisition_date: new Date('2023-09-26T10:00:00Z'),
|
||||
|
||||
requested_amount: 6000,
|
||||
|
||||
payment_type: 'JV',
|
||||
payment_type: 'RV',
|
||||
|
||||
status: 'Pending',
|
||||
|
||||
@ -215,8 +161,6 @@ const FieldSitePaymentRequisitionsData = [
|
||||
|
||||
departure_date: new Date('2023-10-03T10:00:00Z'),
|
||||
|
||||
arrival_place: 'Berlin',
|
||||
|
||||
return_date: new Date('2023-10-13T20:00:00Z'),
|
||||
|
||||
requisition_date: new Date('2023-09-27T11:00:00Z'),
|
||||
@ -225,7 +169,7 @@ const FieldSitePaymentRequisitionsData = [
|
||||
|
||||
payment_type: 'BPV',
|
||||
|
||||
status: 'Paid',
|
||||
status: 'Approved',
|
||||
|
||||
requester: 'bwhite',
|
||||
|
||||
@ -235,74 +179,6 @@ const FieldSitePaymentRequisitionsData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
department: 'Operations',
|
||||
|
||||
employee_name: 'Charlie Green',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
departure_place: 'Houston',
|
||||
|
||||
departure_date: new Date('2023-10-04T11:00:00Z'),
|
||||
|
||||
arrival_place: 'Tokyo',
|
||||
|
||||
return_date: new Date('2023-10-14T21:00:00Z'),
|
||||
|
||||
requisition_date: new Date('2023-09-28T12:00:00Z'),
|
||||
|
||||
requested_amount: 8000,
|
||||
|
||||
payment_type: 'JV',
|
||||
|
||||
status: 'Paid',
|
||||
|
||||
requester: 'cgreen',
|
||||
|
||||
approver: 'dblack',
|
||||
|
||||
due_date: new Date('2023-10-18T20:00:00Z'),
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
department: 'Investments',
|
||||
|
||||
employee_name: 'David Black',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
departure_place: 'Miami',
|
||||
|
||||
departure_date: new Date('2023-10-05T12:00:00Z'),
|
||||
|
||||
arrival_place: 'Sydney',
|
||||
|
||||
return_date: new Date('2023-10-15T22:00:00Z'),
|
||||
|
||||
requisition_date: new Date('2023-09-29T13:00:00Z'),
|
||||
|
||||
requested_amount: 9000,
|
||||
|
||||
payment_type: 'JV',
|
||||
|
||||
status: 'Approved',
|
||||
|
||||
requester: 'dblack',
|
||||
|
||||
approver: 'jdoe',
|
||||
|
||||
due_date: new Date('2023-10-19T21:00:00Z'),
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const PaymentsData = [
|
||||
@ -325,7 +201,7 @@ const PaymentsData = [
|
||||
|
||||
amount: 1000,
|
||||
|
||||
payment_type: 'Addition',
|
||||
payment_type: 'Subtraction',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
@ -341,30 +217,6 @@ const PaymentsData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
date: new Date('2023-10-04T13:00:00Z'),
|
||||
|
||||
amount: 1250,
|
||||
|
||||
payment_type: 'Addition',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
|
||||
date: new Date('2023-10-05T14:00:00Z'),
|
||||
|
||||
amount: 1500,
|
||||
|
||||
payment_type: 'Subtraction',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const ProjectsData = [
|
||||
@ -373,7 +225,7 @@ const ProjectsData = [
|
||||
|
||||
code: 'PA001',
|
||||
|
||||
type: 'MOH',
|
||||
type: 'Other',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
@ -385,7 +237,7 @@ const ProjectsData = [
|
||||
|
||||
code: 'PB002',
|
||||
|
||||
type: 'CDC',
|
||||
type: 'Other',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
@ -403,28 +255,32 @@ const ProjectsData = [
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const DepartmentsData = [
|
||||
{
|
||||
name: 'Project Delta',
|
||||
|
||||
code: 'PD004',
|
||||
|
||||
type: 'Other',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Project Epsilon',
|
||||
|
||||
code: 'PE005',
|
||||
|
||||
type: 'MOH',
|
||||
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
|
||||
const PlacesData = [
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
|
||||
{
|
||||
// type code here for "relation_one" field
|
||||
},
|
||||
];
|
||||
@ -441,14 +297,6 @@ const OrganizationsData = [
|
||||
{
|
||||
name: 'Financial Services Group',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Corporate Finance Co.',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Investment Partners',
|
||||
},
|
||||
];
|
||||
|
||||
// Similar logic for "relation_many"
|
||||
@ -486,85 +334,6 @@ async function associateUserWithOrganization() {
|
||||
if (User2?.setOrganization) {
|
||||
await User2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const User3 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (User3?.setOrganization) {
|
||||
await User3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const User4 = await Users.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (User4?.setOrganization) {
|
||||
await User4.setOrganization(relatedOrganization4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateDocumentWithProject() {
|
||||
const relatedProject0 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const Document0 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Document0?.setProject) {
|
||||
await Document0.setProject(relatedProject0);
|
||||
}
|
||||
|
||||
const relatedProject1 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const Document1 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Document1?.setProject) {
|
||||
await Document1.setProject(relatedProject1);
|
||||
}
|
||||
|
||||
const relatedProject2 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const Document2 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Document2?.setProject) {
|
||||
await Document2.setProject(relatedProject2);
|
||||
}
|
||||
|
||||
const relatedProject3 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const Document3 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Document3?.setProject) {
|
||||
await Document3.setProject(relatedProject3);
|
||||
}
|
||||
|
||||
const relatedProject4 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const Document4 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (Document4?.setProject) {
|
||||
await Document4.setProject(relatedProject4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateDocumentWithOrganization() {
|
||||
@ -600,28 +369,6 @@ async function associateDocumentWithOrganization() {
|
||||
if (Document2?.setOrganization) {
|
||||
await Document2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Document3 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Document3?.setOrganization) {
|
||||
await Document3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Document4 = await Documents.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (Document4?.setOrganization) {
|
||||
await Document4.setOrganization(relatedOrganization4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||
@ -660,30 +407,6 @@ async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||
if (FieldSitePaymentRequisition2?.setOrganization) {
|
||||
await FieldSitePaymentRequisition2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition3 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (FieldSitePaymentRequisition3?.setOrganization) {
|
||||
await FieldSitePaymentRequisition3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition4 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (FieldSitePaymentRequisition4?.setOrganization) {
|
||||
await FieldSitePaymentRequisition4.setOrganization(relatedOrganization4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateFieldSitePaymentRequisitionWithProject() {
|
||||
@ -722,30 +445,6 @@ async function associateFieldSitePaymentRequisitionWithProject() {
|
||||
if (FieldSitePaymentRequisition2?.setProject) {
|
||||
await FieldSitePaymentRequisition2.setProject(relatedProject2);
|
||||
}
|
||||
|
||||
const relatedProject3 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition3 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (FieldSitePaymentRequisition3?.setProject) {
|
||||
await FieldSitePaymentRequisition3.setProject(relatedProject3);
|
||||
}
|
||||
|
||||
const relatedProject4 = await Projects.findOne({
|
||||
offset: Math.floor(Math.random() * (await Projects.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition4 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (FieldSitePaymentRequisition4?.setProject) {
|
||||
await FieldSitePaymentRequisition4.setProject(relatedProject4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||
@ -784,30 +483,6 @@ async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||
if (FieldSitePaymentRequisition2?.setOrganization) {
|
||||
await FieldSitePaymentRequisition2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition3 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (FieldSitePaymentRequisition3?.setOrganization) {
|
||||
await FieldSitePaymentRequisition3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const FieldSitePaymentRequisition4 =
|
||||
await FieldSitePaymentRequisitions.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (FieldSitePaymentRequisition4?.setOrganization) {
|
||||
await FieldSitePaymentRequisition4.setOrganization(relatedOrganization4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithDocument() {
|
||||
@ -843,28 +518,6 @@ async function associatePaymentWithDocument() {
|
||||
if (Payment2?.setDocument) {
|
||||
await Payment2.setDocument(relatedDocument2);
|
||||
}
|
||||
|
||||
const relatedDocument3 = await Documents.findOne({
|
||||
offset: Math.floor(Math.random() * (await Documents.count())),
|
||||
});
|
||||
const Payment3 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Payment3?.setDocument) {
|
||||
await Payment3.setDocument(relatedDocument3);
|
||||
}
|
||||
|
||||
const relatedDocument4 = await Documents.findOne({
|
||||
offset: Math.floor(Math.random() * (await Documents.count())),
|
||||
});
|
||||
const Payment4 = await Payments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (Payment4?.setDocument) {
|
||||
await Payment4.setDocument(relatedDocument4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associatePaymentWithOrganization() {
|
||||
@ -900,27 +553,40 @@ async function associatePaymentWithOrganization() {
|
||||
if (Payment2?.setOrganization) {
|
||||
await Payment2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
async function associateProjectWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment3 = await Payments.findOne({
|
||||
const Project0 = await Projects.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
offset: 0,
|
||||
});
|
||||
if (Payment3?.setOrganization) {
|
||||
await Payment3.setOrganization(relatedOrganization3);
|
||||
if (Project0?.setOrganization) {
|
||||
await Project0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Payment4 = await Payments.findOne({
|
||||
const Project1 = await Projects.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
offset: 1,
|
||||
});
|
||||
if (Payment4?.setOrganization) {
|
||||
await Payment4.setOrganization(relatedOrganization4);
|
||||
if (Project1?.setOrganization) {
|
||||
await Project1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project2 = await Projects.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Project2?.setOrganization) {
|
||||
await Project2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -957,84 +623,75 @@ async function associateProjectWithOrganization() {
|
||||
if (Project2?.setOrganization) {
|
||||
await Project2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project3 = await Projects.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
});
|
||||
if (Project3?.setOrganization) {
|
||||
await Project3.setOrganization(relatedOrganization3);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project4 = await Projects.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
});
|
||||
if (Project4?.setOrganization) {
|
||||
await Project4.setOrganization(relatedOrganization4);
|
||||
}
|
||||
}
|
||||
|
||||
async function associateProjectWithOrganization() {
|
||||
async function associateDepartmentWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project0 = await Projects.findOne({
|
||||
const Department0 = await Departments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 0,
|
||||
});
|
||||
if (Project0?.setOrganization) {
|
||||
await Project0.setOrganization(relatedOrganization0);
|
||||
if (Department0?.setOrganization) {
|
||||
await Department0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project1 = await Projects.findOne({
|
||||
const Department1 = await Departments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 1,
|
||||
});
|
||||
if (Project1?.setOrganization) {
|
||||
await Project1.setOrganization(relatedOrganization1);
|
||||
if (Department1?.setOrganization) {
|
||||
await Department1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project2 = await Projects.findOne({
|
||||
const Department2 = await Departments.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Project2?.setOrganization) {
|
||||
await Project2.setOrganization(relatedOrganization2);
|
||||
if (Department2?.setOrganization) {
|
||||
await Department2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
const relatedOrganization3 = await Organizations.findOne({
|
||||
async function associatePlaceWithOrganization() {
|
||||
const relatedOrganization0 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project3 = await Projects.findOne({
|
||||
const Place0 = await Places.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 3,
|
||||
offset: 0,
|
||||
});
|
||||
if (Project3?.setOrganization) {
|
||||
await Project3.setOrganization(relatedOrganization3);
|
||||
if (Place0?.setOrganization) {
|
||||
await Place0.setOrganization(relatedOrganization0);
|
||||
}
|
||||
|
||||
const relatedOrganization4 = await Organizations.findOne({
|
||||
const relatedOrganization1 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Project4 = await Projects.findOne({
|
||||
const Place1 = await Places.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 4,
|
||||
offset: 1,
|
||||
});
|
||||
if (Project4?.setOrganization) {
|
||||
await Project4.setOrganization(relatedOrganization4);
|
||||
if (Place1?.setOrganization) {
|
||||
await Place1.setOrganization(relatedOrganization1);
|
||||
}
|
||||
|
||||
const relatedOrganization2 = await Organizations.findOne({
|
||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||
});
|
||||
const Place2 = await Places.findOne({
|
||||
order: [['id', 'ASC']],
|
||||
offset: 2,
|
||||
});
|
||||
if (Place2?.setOrganization) {
|
||||
await Place2.setOrganization(relatedOrganization2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1050,6 +707,10 @@ module.exports = {
|
||||
|
||||
await Projects.bulkCreate(ProjectsData);
|
||||
|
||||
await Departments.bulkCreate(DepartmentsData);
|
||||
|
||||
await Places.bulkCreate(PlacesData);
|
||||
|
||||
await Organizations.bulkCreate(OrganizationsData);
|
||||
|
||||
await Promise.all([
|
||||
@ -1057,8 +718,6 @@ module.exports = {
|
||||
|
||||
await associateUserWithOrganization(),
|
||||
|
||||
await associateDocumentWithProject(),
|
||||
|
||||
await associateDocumentWithOrganization(),
|
||||
|
||||
await associateFieldSitePaymentRequisitionWithOrganization(),
|
||||
@ -1074,6 +733,10 @@ module.exports = {
|
||||
await associateProjectWithOrganization(),
|
||||
|
||||
await associateProjectWithOrganization(),
|
||||
|
||||
await associateDepartmentWithOrganization(),
|
||||
|
||||
await associatePlaceWithOrganization(),
|
||||
]);
|
||||
},
|
||||
|
||||
@ -1090,6 +753,10 @@ module.exports = {
|
||||
|
||||
await queryInterface.bulkDelete('projects', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('departments', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('places', null, {});
|
||||
|
||||
await queryInterface.bulkDelete('organizations', null, {});
|
||||
},
|
||||
};
|
||||
|
||||
87
backend/src/db/seeders/20250709185404.js
Normal file
87
backend/src/db/seeders/20250709185404.js
Normal file
@ -0,0 +1,87 @@
|
||||
const { v4: uuid } = require('uuid');
|
||||
const db = require('../models');
|
||||
const Sequelize = require('sequelize');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* @param{import("sequelize").QueryInterface} queryInterface
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async up(queryInterface) {
|
||||
const createdAt = new Date();
|
||||
const updatedAt = new Date();
|
||||
|
||||
/** @type {Map<string, string>} */
|
||||
const idMap = new Map();
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @return {string}
|
||||
*/
|
||||
function getId(key) {
|
||||
if (idMap.has(key)) {
|
||||
return idMap.get(key);
|
||||
}
|
||||
const id = uuid();
|
||||
idMap.set(key, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
function createPermissions(name) {
|
||||
return [
|
||||
{
|
||||
id: getId(`CREATE_${name.toUpperCase()}`),
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name: `CREATE_${name.toUpperCase()}`,
|
||||
},
|
||||
{
|
||||
id: getId(`READ_${name.toUpperCase()}`),
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name: `READ_${name.toUpperCase()}`,
|
||||
},
|
||||
{
|
||||
id: getId(`UPDATE_${name.toUpperCase()}`),
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name: `UPDATE_${name.toUpperCase()}`,
|
||||
},
|
||||
{
|
||||
id: getId(`DELETE_${name.toUpperCase()}`),
|
||||
createdAt,
|
||||
updatedAt,
|
||||
name: `DELETE_${name.toUpperCase()}`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const entities = ['organizations'];
|
||||
|
||||
const createdPermissions = entities.flatMap(createPermissions);
|
||||
|
||||
// Add permissions to database
|
||||
await queryInterface.bulkInsert('permissions', createdPermissions);
|
||||
// Get permissions ids
|
||||
const permissionsIds = createdPermissions.map((p) => p.id);
|
||||
// Get admin role
|
||||
const adminRole = await db.roles.findOne({
|
||||
where: { name: config.roles.super_admin },
|
||||
});
|
||||
|
||||
if (adminRole) {
|
||||
// Add permissions to admin role if it exists
|
||||
await adminRole.addPermissions(permissionsIds);
|
||||
}
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete(
|
||||
'permissions',
|
||||
entities.flatMap(createPermissions),
|
||||
);
|
||||
},
|
||||
};
|
||||
@ -35,6 +35,10 @@ const rolesRoutes = require('./routes/roles');
|
||||
|
||||
const permissionsRoutes = require('./routes/permissions');
|
||||
|
||||
const departmentsRoutes = require('./routes/departments');
|
||||
|
||||
const placesRoutes = require('./routes/places');
|
||||
|
||||
const organizationsRoutes = require('./routes/organizations');
|
||||
|
||||
const getBaseUrl = (url) => {
|
||||
@ -144,6 +148,18 @@ app.use(
|
||||
permissionsRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/departments',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
departmentsRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/places',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
placesRoutes,
|
||||
);
|
||||
|
||||
app.use(
|
||||
'/api/organizations',
|
||||
passport.authenticate('jwt', { session: false }),
|
||||
|
||||
@ -22,20 +22,23 @@ router.use(checkCrudPermissions('documents'));
|
||||
* type: object
|
||||
* properties:
|
||||
|
||||
* nameofemployee_organization:
|
||||
* type: string
|
||||
* default: nameofemployee_organization
|
||||
* document_number:
|
||||
* type: string
|
||||
* default: document_number
|
||||
* prepared_by:
|
||||
* description:
|
||||
* type: string
|
||||
* default: prepared_by
|
||||
* default: description
|
||||
* project_code:
|
||||
* type: string
|
||||
* default: project_code
|
||||
* shelf_number:
|
||||
* type: string
|
||||
* default: shelf_number
|
||||
* approved_by:
|
||||
* type: string
|
||||
* default: approved_by
|
||||
|
||||
* amount:
|
||||
* Amount:
|
||||
* type: integer
|
||||
* format: int64
|
||||
|
||||
@ -327,13 +330,15 @@ router.get(
|
||||
if (filetype && filetype === 'csv') {
|
||||
const fields = [
|
||||
'id',
|
||||
'nameofemployee_organization',
|
||||
'document_number',
|
||||
'prepared_by',
|
||||
'description',
|
||||
'project_code',
|
||||
'shelf_number',
|
||||
'approved_by',
|
||||
|
||||
'amount',
|
||||
'payment_date',
|
||||
'Amount',
|
||||
|
||||
'date',
|
||||
];
|
||||
const opts = { fields };
|
||||
try {
|
||||
|
||||
@ -44,13 +44,15 @@ module.exports = class SearchService {
|
||||
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
||||
|
||||
documents: [
|
||||
'nameofemployee_organization',
|
||||
|
||||
'document_number',
|
||||
|
||||
'prepared_by',
|
||||
'description',
|
||||
|
||||
'project_code',
|
||||
|
||||
'shelf_number',
|
||||
|
||||
'approved_by',
|
||||
],
|
||||
|
||||
field_site_payment_requisitions: [
|
||||
@ -60,8 +62,6 @@ module.exports = class SearchService {
|
||||
|
||||
'departure_place',
|
||||
|
||||
'arrival_place',
|
||||
|
||||
'requester',
|
||||
|
||||
'approver',
|
||||
@ -72,7 +72,7 @@ module.exports = class SearchService {
|
||||
organizations: ['name'],
|
||||
};
|
||||
const columnsInt = {
|
||||
documents: ['amount'],
|
||||
documents: ['Amount'],
|
||||
|
||||
field_site_payment_requisitions: ['requested_amount'],
|
||||
|
||||
|
||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -62,7 +62,7 @@ const CardDocuments = ({
|
||||
href={`/documents/documents-view/?id=${item.id}`}
|
||||
className='text-lg font-bold leading-6 line-clamp-1'
|
||||
>
|
||||
{item.document_number}
|
||||
{item.id}
|
||||
</Link>
|
||||
|
||||
<div className='ml-auto '>
|
||||
@ -78,7 +78,31 @@ const CardDocuments = ({
|
||||
<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'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
DocumentNumber
|
||||
organizations
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.organizationsOneListFormatter(
|
||||
item.organizations,
|
||||
)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Nameofemployee Organization
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.nameofemployee_organization}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Document Number
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
@ -89,66 +113,31 @@ const CardDocuments = ({
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Project
|
||||
Description
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.projectsOneListFormatter(item.project)}
|
||||
{item.description}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>Date</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.dateFormatter(item.date)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
DocumentType
|
||||
Payment Type
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.document_type}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
PreparedBy
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.prepared_by}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Status
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.status}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
CashBalance
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.booleanFormatter(item.cash_balance)}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
PaymentDate
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{dataFormatter.dateTimeFormatter(item.payment_date)}
|
||||
{item.payment_type}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
@ -159,14 +148,36 @@ const CardDocuments = ({
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.amount}
|
||||
{item.Amount}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
ShelfNumber
|
||||
Project Code
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.project_code}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Document Status
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.document_status}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
Shelf Number
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
@ -174,17 +185,6 @@ const CardDocuments = ({
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||
ApprovedBy
|
||||
</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{item.approved_by}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@ -55,61 +55,69 @@ const ListDocuments = ({
|
||||
>
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>
|
||||
DocumentNumber
|
||||
organizations
|
||||
</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.organizationsOneListFormatter(
|
||||
item.organizations,
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>
|
||||
Nameofemployee Organization
|
||||
</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{item.nameofemployee_organization}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>
|
||||
Document Number
|
||||
</p>
|
||||
<p className={'line-clamp-2'}>{item.document_number}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Project</p>
|
||||
<p className={'text-xs text-gray-500 '}>Description</p>
|
||||
<p className={'line-clamp-2'}>{item.description}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Date</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.projectsOneListFormatter(item.project)}
|
||||
{dataFormatter.dateFormatter(item.date)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>DocumentType</p>
|
||||
<p className={'line-clamp-2'}>{item.document_type}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>PreparedBy</p>
|
||||
<p className={'line-clamp-2'}>{item.prepared_by}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Status</p>
|
||||
<p className={'line-clamp-2'}>{item.status}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>CashBalance</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.booleanFormatter(item.cash_balance)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>PaymentDate</p>
|
||||
<p className={'line-clamp-2'}>
|
||||
{dataFormatter.dateTimeFormatter(item.payment_date)}
|
||||
</p>
|
||||
<p className={'text-xs text-gray-500 '}>Payment Type</p>
|
||||
<p className={'line-clamp-2'}>{item.payment_type}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Amount</p>
|
||||
<p className={'line-clamp-2'}>{item.amount}</p>
|
||||
<p className={'line-clamp-2'}>{item.Amount}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>ShelfNumber</p>
|
||||
<p className={'text-xs text-gray-500 '}>Project Code</p>
|
||||
<p className={'line-clamp-2'}>{item.project_code}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>
|
||||
Document Status
|
||||
</p>
|
||||
<p className={'line-clamp-2'}>{item.document_status}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>Shelf Number</p>
|
||||
<p className={'line-clamp-2'}>{item.shelf_number}</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500 '}>ApprovedBy</p>
|
||||
<p className={'line-clamp-2'}>{item.approved_by}</p>
|
||||
</div>
|
||||
</Link>
|
||||
<ListActionsPopover
|
||||
onDelete={onDelete}
|
||||
|
||||
@ -39,20 +39,8 @@ export const loadColumns = async (
|
||||
|
||||
return [
|
||||
{
|
||||
field: 'document_number',
|
||||
headerName: 'DocumentNumber',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
headerClassName: 'datagrid--header',
|
||||
cellClassName: 'datagrid--cell',
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
},
|
||||
|
||||
{
|
||||
field: 'project',
|
||||
headerName: 'Project',
|
||||
field: 'organizations',
|
||||
headerName: 'organizations',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -65,14 +53,14 @@ export const loadColumns = async (
|
||||
type: 'singleSelect',
|
||||
getOptionValue: (value: any) => value?.id,
|
||||
getOptionLabel: (value: any) => value?.label,
|
||||
valueOptions: await callOptionsApi('projects'),
|
||||
valueOptions: await callOptionsApi('organizations'),
|
||||
valueGetter: (params: GridValueGetterParams) =>
|
||||
params?.value?.id ?? params?.value,
|
||||
},
|
||||
|
||||
{
|
||||
field: 'document_type',
|
||||
headerName: 'DocumentType',
|
||||
field: 'nameofemployee_organization',
|
||||
headerName: 'Nameofemployee Organization',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -83,8 +71,8 @@ export const loadColumns = async (
|
||||
},
|
||||
|
||||
{
|
||||
field: 'prepared_by',
|
||||
headerName: 'PreparedBy',
|
||||
field: 'document_number',
|
||||
headerName: 'Document Number',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -95,8 +83,8 @@ export const loadColumns = async (
|
||||
},
|
||||
|
||||
{
|
||||
field: 'status',
|
||||
headerName: 'Status',
|
||||
field: 'description',
|
||||
headerName: 'Description',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -107,8 +95,8 @@ export const loadColumns = async (
|
||||
},
|
||||
|
||||
{
|
||||
field: 'cash_balance',
|
||||
headerName: 'CashBalance',
|
||||
field: 'date',
|
||||
headerName: 'Date',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -117,12 +105,13 @@ export const loadColumns = async (
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
|
||||
type: 'boolean',
|
||||
type: 'date',
|
||||
valueGetter: (params: GridValueGetterParams) => new Date(params.row.date),
|
||||
},
|
||||
|
||||
{
|
||||
field: 'payment_date',
|
||||
headerName: 'PaymentDate',
|
||||
field: 'payment_type',
|
||||
headerName: 'Payment Type',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -130,14 +119,10 @@ export const loadColumns = async (
|
||||
cellClassName: 'datagrid--cell',
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
|
||||
type: 'dateTime',
|
||||
valueGetter: (params: GridValueGetterParams) =>
|
||||
new Date(params.row.payment_date),
|
||||
},
|
||||
|
||||
{
|
||||
field: 'amount',
|
||||
field: 'Amount',
|
||||
headerName: 'Amount',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
@ -151,8 +136,8 @@ export const loadColumns = async (
|
||||
},
|
||||
|
||||
{
|
||||
field: 'shelf_number',
|
||||
headerName: 'ShelfNumber',
|
||||
field: 'project_code',
|
||||
headerName: 'Project Code',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
@ -163,8 +148,20 @@ export const loadColumns = async (
|
||||
},
|
||||
|
||||
{
|
||||
field: 'approved_by',
|
||||
headerName: 'ApprovedBy',
|
||||
field: 'document_status',
|
||||
headerName: 'Document Status',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
headerClassName: 'datagrid--header',
|
||||
cellClassName: 'datagrid--cell',
|
||||
|
||||
editable: hasUpdatePermission,
|
||||
},
|
||||
|
||||
{
|
||||
field: 'shelf_number',
|
||||
headerName: 'Shelf Number',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
|
||||
@ -65,7 +65,7 @@ const CardOrganizations = ({
|
||||
href={`/organizations/organizations-view/?id=${item.id}`}
|
||||
className='text-lg font-bold leading-6 line-clamp-1'
|
||||
>
|
||||
{item.name}
|
||||
{item.id}
|
||||
</Link>
|
||||
|
||||
<div className='ml-auto '>
|
||||
|
||||
@ -17,7 +17,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
|
||||
const borders = useAppSelector((state) => state.style.borders);
|
||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||
|
||||
const style = FooterStyle.WITH_PROJECT_NAME;
|
||||
const style = FooterStyle.WITH_PAGES;
|
||||
|
||||
const design = FooterDesigns.DEFAULT_DESIGN;
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
|
||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||
const borders = useAppSelector((state) => state.style.borders);
|
||||
|
||||
const style = HeaderStyle.PAGES_LEFT;
|
||||
const style = HeaderStyle.PAGES_RIGHT;
|
||||
|
||||
const design = HeaderDesigns.DEFAULT_DESIGN;
|
||||
const design = HeaderDesigns.DESIGN_DIVERSITY;
|
||||
return (
|
||||
<header id='websiteHeader' className='overflow-hidden'>
|
||||
<div
|
||||
|
||||
@ -41,21 +41,21 @@ export default {
|
||||
|
||||
documentsManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.document_number);
|
||||
return val.map((item) => item.id);
|
||||
},
|
||||
documentsOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.document_number;
|
||||
return val.id;
|
||||
},
|
||||
documentsManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.document_number };
|
||||
return { id: item.id, label: item.id };
|
||||
});
|
||||
},
|
||||
documentsOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.document_number, id: val.id };
|
||||
return { label: val.id, id: val.id };
|
||||
},
|
||||
|
||||
projectsManyListFormatter(val) {
|
||||
@ -117,20 +117,20 @@ export default {
|
||||
|
||||
organizationsManyListFormatter(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => item.name);
|
||||
return val.map((item) => item.id);
|
||||
},
|
||||
organizationsOneListFormatter(val) {
|
||||
if (!val) return '';
|
||||
return val.name;
|
||||
return val.id;
|
||||
},
|
||||
organizationsManyListFormatterEdit(val) {
|
||||
if (!val || !val.length) return [];
|
||||
return val.map((item) => {
|
||||
return { id: item.id, label: item.name };
|
||||
return { id: item.id, label: item.id };
|
||||
});
|
||||
},
|
||||
organizationsOneListFormatterEdit(val) {
|
||||
if (!val) return '';
|
||||
return { label: val.name, id: val.id };
|
||||
return { label: val.id, id: val.id };
|
||||
},
|
||||
};
|
||||
|
||||
@ -76,6 +76,22 @@ const menuAside: MenuAsideItem[] = [
|
||||
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
||||
permissions: 'READ_PERMISSIONS',
|
||||
},
|
||||
{
|
||||
href: '/departments/departments-list',
|
||||
label: 'Departments',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_DEPARTMENTS',
|
||||
},
|
||||
{
|
||||
href: '/places/places-list',
|
||||
label: 'Places',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
icon: icon.mdiTable ?? icon.mdiTable,
|
||||
permissions: 'READ_PLACES',
|
||||
},
|
||||
{
|
||||
href: '/organizations/organizations-list',
|
||||
label: 'Organizations',
|
||||
|
||||
@ -36,6 +36,8 @@ const Dashboard = () => {
|
||||
const [projects, setProjects] = React.useState(loadingMessage);
|
||||
const [roles, setRoles] = React.useState(loadingMessage);
|
||||
const [permissions, setPermissions] = React.useState(loadingMessage);
|
||||
const [departments, setDepartments] = React.useState(loadingMessage);
|
||||
const [places, setPlaces] = React.useState(loadingMessage);
|
||||
const [organizations, setOrganizations] = React.useState(loadingMessage);
|
||||
|
||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||
@ -57,6 +59,8 @@ const Dashboard = () => {
|
||||
'projects',
|
||||
'roles',
|
||||
'permissions',
|
||||
'departments',
|
||||
'places',
|
||||
'organizations',
|
||||
];
|
||||
const fns = [
|
||||
@ -67,6 +71,8 @@ const Dashboard = () => {
|
||||
setProjects,
|
||||
setRoles,
|
||||
setPermissions,
|
||||
setDepartments,
|
||||
setPlaces,
|
||||
setOrganizations,
|
||||
];
|
||||
|
||||
@ -431,6 +437,70 @@ const Dashboard = () => {
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_DEPARTMENTS') && (
|
||||
<Link href={'/departments/departments-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Departments
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{departments}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={icon.mdiTable || icon.mdiTable}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_PLACES') && (
|
||||
<Link href={'/places/places-list'}>
|
||||
<div
|
||||
className={`${
|
||||
corners !== 'rounded-full' ? corners : 'rounded-3xl'
|
||||
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
|
||||
>
|
||||
<div className='flex justify-between align-center'>
|
||||
<div>
|
||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||
Places
|
||||
</div>
|
||||
<div className='text-3xl leading-tight font-semibold'>
|
||||
{places}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<BaseIcon
|
||||
className={`${iconsColor}`}
|
||||
w='w-16'
|
||||
h='h-16'
|
||||
size={48}
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
path={icon.mdiTable || icon.mdiTable}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{hasPermission(currentUser, 'READ_ORGANIZATIONS') && (
|
||||
<Link href={'/organizations/organizations-list'}>
|
||||
<div
|
||||
|
||||
137
frontend/src/pages/departments/[departmentsId].tsx
Normal file
137
frontend/src/pages/departments/[departmentsId].tsx
Normal file
@ -0,0 +1,137 @@
|
||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import { getPageTitle } from '../../config';
|
||||
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import FormField from '../../components/FormField';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import BaseButtons from '../../components/BaseButtons';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
||||
import FormFilePicker from '../../components/FormFilePicker';
|
||||
import FormImagePicker from '../../components/FormImagePicker';
|
||||
import { SelectField } from '../../components/SelectField';
|
||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import { RichTextField } from '../../components/RichTextField';
|
||||
|
||||
import { update, fetch } from '../../stores/departments/departmentsSlice';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const EditDepartments = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
const { departments } = useAppSelector((state) => state.departments);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { departmentsId } = router.query;
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id: departmentsId }));
|
||||
}, [departmentsId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof departments === 'object') {
|
||||
setInitialValues(departments);
|
||||
}
|
||||
}, [departments]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof departments === 'object') {
|
||||
const newInitialVal = { ...initVals };
|
||||
|
||||
Object.keys(initVals).forEach(
|
||||
(el) => (newInitialVal[el] = departments[el]),
|
||||
);
|
||||
|
||||
setInitialValues(newInitialVal);
|
||||
}
|
||||
}, [departments]);
|
||||
|
||||
const handleSubmit = async (data) => {
|
||||
await dispatch(update({ id: departmentsId, data }));
|
||||
await router.push('/departments/departments-list');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('Edit departments')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={'Edit departments'}
|
||||
main
|
||||
>
|
||||
{''}
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<Formik
|
||||
enableReinitialize
|
||||
initialValues={initialValues}
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
id='organizations'
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
||||
<BaseButton
|
||||
type='reset'
|
||||
color='danger'
|
||||
outline
|
||||
label='Cancel'
|
||||
onClick={() => router.push('/departments/departments-list')}
|
||||
/>
|
||||
</BaseButtons>
|
||||
</Form>
|
||||
</Formik>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
EditDepartments.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'UPDATE_DEPARTMENTS'}>
|
||||
{page}
|
||||
</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditDepartments;
|
||||
135
frontend/src/pages/departments/departments-edit.tsx
Normal file
135
frontend/src/pages/departments/departments-edit.tsx
Normal file
@ -0,0 +1,135 @@
|
||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import { getPageTitle } from '../../config';
|
||||
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import FormField from '../../components/FormField';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import BaseButtons from '../../components/BaseButtons';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
||||
import FormFilePicker from '../../components/FormFilePicker';
|
||||
import FormImagePicker from '../../components/FormImagePicker';
|
||||
import { SelectField } from '../../components/SelectField';
|
||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import { RichTextField } from '../../components/RichTextField';
|
||||
|
||||
import { update, fetch } from '../../stores/departments/departmentsSlice';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const EditDepartmentsPage = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
const { departments } = useAppSelector((state) => state.departments);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { id } = router.query;
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id: id }));
|
||||
}, [id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof departments === 'object') {
|
||||
setInitialValues(departments);
|
||||
}
|
||||
}, [departments]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof departments === 'object') {
|
||||
const newInitialVal = { ...initVals };
|
||||
Object.keys(initVals).forEach(
|
||||
(el) => (newInitialVal[el] = departments[el]),
|
||||
);
|
||||
setInitialValues(newInitialVal);
|
||||
}
|
||||
}, [departments]);
|
||||
|
||||
const handleSubmit = async (data) => {
|
||||
await dispatch(update({ id: id, data }));
|
||||
await router.push('/departments/departments-list');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('Edit departments')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={'Edit departments'}
|
||||
main
|
||||
>
|
||||
{''}
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<Formik
|
||||
enableReinitialize
|
||||
initialValues={initialValues}
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
id='organizations'
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
||||
<BaseButton
|
||||
type='reset'
|
||||
color='danger'
|
||||
outline
|
||||
label='Cancel'
|
||||
onClick={() => router.push('/departments/departments-list')}
|
||||
/>
|
||||
</BaseButtons>
|
||||
</Form>
|
||||
</Formik>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
EditDepartmentsPage.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'UPDATE_DEPARTMENTS'}>
|
||||
{page}
|
||||
</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditDepartmentsPage;
|
||||
88
frontend/src/pages/departments/departments-view.tsx
Normal file
88
frontend/src/pages/departments/departments-view.tsx
Normal file
@ -0,0 +1,88 @@
|
||||
import React, { ReactElement, useEffect } from 'react';
|
||||
import Head from 'next/head';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { fetch } from '../../stores/departments/departmentsSlice';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import { getPageTitle } from '../../config';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import CardBox from '../../components/CardBox';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import { mdiChartTimelineVariant } from '@mdi/js';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import FormField from '../../components/FormField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const DepartmentsView = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const { departments } = useAppSelector((state) => state.departments);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { id } = router.query;
|
||||
|
||||
function removeLastCharacter(str) {
|
||||
console.log(str, `str`);
|
||||
return str.slice(0, -1);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id }));
|
||||
}, [dispatch, id]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('View departments')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={removeLastCharacter('View departments')}
|
||||
main
|
||||
>
|
||||
<BaseButton
|
||||
color='info'
|
||||
label='Edit'
|
||||
href={`/departments/departments-edit/?id=${id}`}
|
||||
/>
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{departments?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
<BaseButton
|
||||
color='info'
|
||||
label='Back'
|
||||
onClick={() => router.push('/departments/departments-list')}
|
||||
/>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
DepartmentsView.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'READ_DEPARTMENTS'}>
|
||||
{page}
|
||||
</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default DepartmentsView;
|
||||
@ -38,27 +38,25 @@ const EditDocuments = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
|
||||
nameofemployee_organization: '',
|
||||
|
||||
document_number: '',
|
||||
|
||||
project: null,
|
||||
description: '',
|
||||
|
||||
document_type: '',
|
||||
date: new Date(),
|
||||
|
||||
prepared_by: '',
|
||||
payment_type: '',
|
||||
|
||||
status: '',
|
||||
Amount: '',
|
||||
|
||||
cash_balance: false,
|
||||
project_code: '',
|
||||
|
||||
payment_date: new Date(),
|
||||
|
||||
amount: '',
|
||||
document_status: '',
|
||||
|
||||
shelf_number: '',
|
||||
|
||||
approved_by: '',
|
||||
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
@ -115,86 +113,6 @@ const EditDocuments = () => {
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='DocumentNumber'>
|
||||
<Field name='document_number' placeholder='DocumentNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project' labelFor='project'>
|
||||
<Field
|
||||
name='project'
|
||||
id='project'
|
||||
component={SelectField}
|
||||
options={initialValues.project}
|
||||
itemRef={'projects'}
|
||||
showField={'name'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='DocumentType' labelFor='document_type'>
|
||||
<Field
|
||||
name='document_type'
|
||||
id='document_type'
|
||||
component='select'
|
||||
>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PreparedBy'>
|
||||
<Field name='prepared_by' placeholder='PreparedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Status' labelFor='status'>
|
||||
<Field name='status' id='status' component='select'>
|
||||
<option value='Filed'>Filed</option>
|
||||
|
||||
<option value='InProgress'>InProgress</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='CashBalance' labelFor='cash_balance'>
|
||||
<Field
|
||||
name='cash_balance'
|
||||
id='cash_balance'
|
||||
component={SwitchField}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PaymentDate'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
selected={
|
||||
initialValues.payment_date
|
||||
? new Date(
|
||||
dayjs(initialValues.payment_date).format(
|
||||
'YYYY-MM-DD hh:mm',
|
||||
),
|
||||
)
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
setInitialValues({ ...initialValues, payment_date: date })
|
||||
}
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ShelfNumber'>
|
||||
<Field name='shelf_number' placeholder='ShelfNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ApprovedBy'>
|
||||
<Field name='approved_by' placeholder='ApprovedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
@ -202,10 +120,81 @@ const EditDocuments = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Nameofemployee Organization'>
|
||||
<Field
|
||||
name='nameofemployee_organization'
|
||||
placeholder='Nameofemployee Organization'
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Number'>
|
||||
<Field name='document_number' placeholder='Document Number' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Description'>
|
||||
<Field name='description' placeholder='Description' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Date'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.date
|
||||
? new Date(
|
||||
dayjs(initialValues.date).format('YYYY-MM-DD hh:mm'),
|
||||
)
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
setInitialValues({ ...initialValues, date: date })
|
||||
}
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Payment Type' labelFor='payment_type'>
|
||||
<Field name='payment_type' id='payment_type' component='select'>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
|
||||
<option value='CPV'>CPV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='Amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project Code'>
|
||||
<Field name='project_code' placeholder='Project Code' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Status' labelFor='document_status'>
|
||||
<Field
|
||||
name='document_status'
|
||||
id='document_status'
|
||||
component='select'
|
||||
>
|
||||
<option value='Approved'>Approved</option>
|
||||
|
||||
<option value='Complete'>Complete</option>
|
||||
|
||||
<option value='On progress'>On progress</option>
|
||||
|
||||
<option value='Filled'>Filled</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Shelf Number'>
|
||||
<Field name='shelf_number' placeholder='Shelf Number' />
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
|
||||
@ -38,27 +38,25 @@ const EditDocumentsPage = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
|
||||
nameofemployee_organization: '',
|
||||
|
||||
document_number: '',
|
||||
|
||||
project: null,
|
||||
description: '',
|
||||
|
||||
document_type: '',
|
||||
date: new Date(),
|
||||
|
||||
prepared_by: '',
|
||||
payment_type: '',
|
||||
|
||||
status: '',
|
||||
Amount: '',
|
||||
|
||||
cash_balance: false,
|
||||
project_code: '',
|
||||
|
||||
payment_date: new Date(),
|
||||
|
||||
amount: '',
|
||||
document_status: '',
|
||||
|
||||
shelf_number: '',
|
||||
|
||||
approved_by: '',
|
||||
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
@ -113,86 +111,6 @@ const EditDocumentsPage = () => {
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='DocumentNumber'>
|
||||
<Field name='document_number' placeholder='DocumentNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project' labelFor='project'>
|
||||
<Field
|
||||
name='project'
|
||||
id='project'
|
||||
component={SelectField}
|
||||
options={initialValues.project}
|
||||
itemRef={'projects'}
|
||||
showField={'name'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='DocumentType' labelFor='document_type'>
|
||||
<Field
|
||||
name='document_type'
|
||||
id='document_type'
|
||||
component='select'
|
||||
>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PreparedBy'>
|
||||
<Field name='prepared_by' placeholder='PreparedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Status' labelFor='status'>
|
||||
<Field name='status' id='status' component='select'>
|
||||
<option value='Filed'>Filed</option>
|
||||
|
||||
<option value='InProgress'>InProgress</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='CashBalance' labelFor='cash_balance'>
|
||||
<Field
|
||||
name='cash_balance'
|
||||
id='cash_balance'
|
||||
component={SwitchField}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PaymentDate'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
showTimeSelect
|
||||
selected={
|
||||
initialValues.payment_date
|
||||
? new Date(
|
||||
dayjs(initialValues.payment_date).format(
|
||||
'YYYY-MM-DD hh:mm',
|
||||
),
|
||||
)
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
setInitialValues({ ...initialValues, payment_date: date })
|
||||
}
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ShelfNumber'>
|
||||
<Field name='shelf_number' placeholder='ShelfNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ApprovedBy'>
|
||||
<Field name='approved_by' placeholder='ApprovedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
@ -200,10 +118,81 @@ const EditDocumentsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Nameofemployee Organization'>
|
||||
<Field
|
||||
name='nameofemployee_organization'
|
||||
placeholder='Nameofemployee Organization'
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Number'>
|
||||
<Field name='document_number' placeholder='Document Number' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Description'>
|
||||
<Field name='description' placeholder='Description' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Date'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd'
|
||||
selected={
|
||||
initialValues.date
|
||||
? new Date(
|
||||
dayjs(initialValues.date).format('YYYY-MM-DD hh:mm'),
|
||||
)
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
setInitialValues({ ...initialValues, date: date })
|
||||
}
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Payment Type' labelFor='payment_type'>
|
||||
<Field name='payment_type' id='payment_type' component='select'>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
|
||||
<option value='CPV'>CPV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='Amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project Code'>
|
||||
<Field name='project_code' placeholder='Project Code' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Status' labelFor='document_status'>
|
||||
<Field
|
||||
name='document_status'
|
||||
id='document_status'
|
||||
component='select'
|
||||
>
|
||||
<option value='Approved'>Approved</option>
|
||||
|
||||
<option value='Complete'>Complete</option>
|
||||
|
||||
<option value='On progress'>On progress</option>
|
||||
|
||||
<option value='Filled'>Filled</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Shelf Number'>
|
||||
<Field name='shelf_number' placeholder='Shelf Number' />
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
|
||||
@ -29,27 +29,28 @@ const DocumentsTablesPage = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([
|
||||
{ label: 'DocumentNumber', title: 'document_number' },
|
||||
{ label: 'PreparedBy', title: 'prepared_by' },
|
||||
{ label: 'ShelfNumber', title: 'shelf_number' },
|
||||
{ label: 'ApprovedBy', title: 'approved_by' },
|
||||
{
|
||||
label: 'Nameofemployee Organization',
|
||||
title: 'nameofemployee_organization',
|
||||
},
|
||||
{ label: 'Document Number', title: 'document_number' },
|
||||
{ label: 'Description', title: 'description' },
|
||||
{ label: 'Project Code', title: 'project_code' },
|
||||
{ label: 'Shelf Number', title: 'shelf_number' },
|
||||
|
||||
{ label: 'Amount', title: 'amount', number: 'true' },
|
||||
{ label: 'PaymentDate', title: 'payment_date', date: 'true' },
|
||||
|
||||
{ label: 'Project', title: 'project' },
|
||||
{ label: 'Amount', title: 'Amount', number: 'true' },
|
||||
|
||||
{
|
||||
label: 'DocumentType',
|
||||
title: 'document_type',
|
||||
label: 'Payment Type',
|
||||
title: 'payment_type',
|
||||
type: 'enum',
|
||||
options: ['BPV', 'JV', 'RV'],
|
||||
options: ['BPV', 'JV', 'RV', 'CPV'],
|
||||
},
|
||||
{
|
||||
label: 'Status',
|
||||
title: 'status',
|
||||
label: 'Document Status',
|
||||
title: 'document_status',
|
||||
type: 'enum',
|
||||
options: ['Filed', 'InProgress'],
|
||||
options: ['Approved', 'Complete', 'On progress', 'Filled'],
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
@ -33,27 +33,26 @@ import { useRouter } from 'next/router';
|
||||
import moment from 'moment';
|
||||
|
||||
const initialValues = {
|
||||
organizations: '',
|
||||
|
||||
nameofemployee_organization: '',
|
||||
|
||||
document_number: '',
|
||||
|
||||
project: '',
|
||||
description: '',
|
||||
|
||||
document_type: 'BPV',
|
||||
date: '',
|
||||
dateDate: '',
|
||||
|
||||
prepared_by: '',
|
||||
payment_type: 'BPV',
|
||||
|
||||
status: 'Filed',
|
||||
Amount: '',
|
||||
|
||||
cash_balance: false,
|
||||
project_code: '',
|
||||
|
||||
payment_date: '',
|
||||
|
||||
amount: '',
|
||||
document_status: 'Approved',
|
||||
|
||||
shelf_number: '',
|
||||
|
||||
approved_by: '',
|
||||
|
||||
organizations: '',
|
||||
};
|
||||
|
||||
const DocumentsNew = () => {
|
||||
@ -83,74 +82,6 @@ const DocumentsNew = () => {
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='DocumentNumber'>
|
||||
<Field name='document_number' placeholder='DocumentNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project' labelFor='project'>
|
||||
<Field
|
||||
name='project'
|
||||
id='project'
|
||||
component={SelectField}
|
||||
options={[]}
|
||||
itemRef={'projects'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='DocumentType' labelFor='document_type'>
|
||||
<Field
|
||||
name='document_type'
|
||||
id='document_type'
|
||||
component='select'
|
||||
>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PreparedBy'>
|
||||
<Field name='prepared_by' placeholder='PreparedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Status' labelFor='status'>
|
||||
<Field name='status' id='status' component='select'>
|
||||
<option value='Filed'>Filed</option>
|
||||
|
||||
<option value='InProgress'>InProgress</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='CashBalance' labelFor='cash_balance'>
|
||||
<Field
|
||||
name='cash_balance'
|
||||
id='cash_balance'
|
||||
component={SwitchField}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PaymentDate'>
|
||||
<Field
|
||||
type='datetime-local'
|
||||
name='payment_date'
|
||||
placeholder='PaymentDate'
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ShelfNumber'>
|
||||
<Field name='shelf_number' placeholder='ShelfNumber' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ApprovedBy'>
|
||||
<Field name='approved_by' placeholder='ApprovedBy' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
@ -161,6 +92,65 @@ const DocumentsNew = () => {
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Nameofemployee Organization'>
|
||||
<Field
|
||||
name='nameofemployee_organization'
|
||||
placeholder='Nameofemployee Organization'
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Number'>
|
||||
<Field name='document_number' placeholder='Document Number' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Description'>
|
||||
<Field name='description' placeholder='Description' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Date'>
|
||||
<Field type='date' name='date' placeholder='Date' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Payment Type' labelFor='payment_type'>
|
||||
<Field name='payment_type' id='payment_type' component='select'>
|
||||
<option value='BPV'>BPV</option>
|
||||
|
||||
<option value='JV'>JV</option>
|
||||
|
||||
<option value='RV'>RV</option>
|
||||
|
||||
<option value='CPV'>CPV</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Amount'>
|
||||
<Field type='number' name='Amount' placeholder='Amount' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Project Code'>
|
||||
<Field name='project_code' placeholder='Project Code' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='Document Status' labelFor='document_status'>
|
||||
<Field
|
||||
name='document_status'
|
||||
id='document_status'
|
||||
component='select'
|
||||
>
|
||||
<option value='Approved'>Approved</option>
|
||||
|
||||
<option value='Complete'>Complete</option>
|
||||
|
||||
<option value='On progress'>On progress</option>
|
||||
|
||||
<option value='Filled'>Filled</option>
|
||||
</Field>
|
||||
</FormField>
|
||||
|
||||
<FormField label='Shelf Number'>
|
||||
<Field name='shelf_number' placeholder='Shelf Number' />
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
|
||||
@ -29,27 +29,28 @@ const DocumentsTablesPage = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([
|
||||
{ label: 'DocumentNumber', title: 'document_number' },
|
||||
{ label: 'PreparedBy', title: 'prepared_by' },
|
||||
{ label: 'ShelfNumber', title: 'shelf_number' },
|
||||
{ label: 'ApprovedBy', title: 'approved_by' },
|
||||
{
|
||||
label: 'Nameofemployee Organization',
|
||||
title: 'nameofemployee_organization',
|
||||
},
|
||||
{ label: 'Document Number', title: 'document_number' },
|
||||
{ label: 'Description', title: 'description' },
|
||||
{ label: 'Project Code', title: 'project_code' },
|
||||
{ label: 'Shelf Number', title: 'shelf_number' },
|
||||
|
||||
{ label: 'Amount', title: 'amount', number: 'true' },
|
||||
{ label: 'PaymentDate', title: 'payment_date', date: 'true' },
|
||||
|
||||
{ label: 'Project', title: 'project' },
|
||||
{ label: 'Amount', title: 'Amount', number: 'true' },
|
||||
|
||||
{
|
||||
label: 'DocumentType',
|
||||
title: 'document_type',
|
||||
label: 'Payment Type',
|
||||
title: 'payment_type',
|
||||
type: 'enum',
|
||||
options: ['BPV', 'JV', 'RV'],
|
||||
options: ['BPV', 'JV', 'RV', 'CPV'],
|
||||
},
|
||||
{
|
||||
label: 'Status',
|
||||
title: 'status',
|
||||
label: 'Document Status',
|
||||
title: 'document_status',
|
||||
type: 'enum',
|
||||
options: ['Filed', 'InProgress'],
|
||||
options: ['Approved', 'Complete', 'On progress', 'Filled'],
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
@ -59,81 +59,70 @@ const DocumentsView = () => {
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>DocumentNumber</p>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{documents?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>
|
||||
Nameofemployee Organization
|
||||
</p>
|
||||
<p>{documents?.nameofemployee_organization}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Document Number</p>
|
||||
<p>{documents?.document_number}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Project</p>
|
||||
|
||||
<p>{documents?.project?.name ?? 'No data'}</p>
|
||||
<p className={'block font-bold mb-2'}>Description</p>
|
||||
<p>{documents?.description}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>DocumentType</p>
|
||||
<p>{documents?.document_type ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>PreparedBy</p>
|
||||
<p>{documents?.prepared_by}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Status</p>
|
||||
<p>{documents?.status ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<FormField label='CashBalance'>
|
||||
<SwitchField
|
||||
field={{ name: 'cash_balance', value: documents?.cash_balance }}
|
||||
form={{ setFieldValue: () => null }}
|
||||
disabled
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='PaymentDate'>
|
||||
{documents.payment_date ? (
|
||||
<FormField label='Date'>
|
||||
{documents.date ? (
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
dateFormat='yyyy-MM-dd'
|
||||
showTimeSelect
|
||||
selected={
|
||||
documents.payment_date
|
||||
? new Date(
|
||||
dayjs(documents.payment_date).format(
|
||||
'YYYY-MM-DD hh:mm',
|
||||
),
|
||||
)
|
||||
documents.date
|
||||
? new Date(dayjs(documents.date).format('YYYY-MM-DD hh:mm'))
|
||||
: null
|
||||
}
|
||||
disabled
|
||||
/>
|
||||
) : (
|
||||
<p>No PaymentDate</p>
|
||||
<p>No Date</p>
|
||||
)}
|
||||
</FormField>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Payment Type</p>
|
||||
<p>{documents?.payment_type ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Amount</p>
|
||||
<p>{documents?.amount || 'No data'}</p>
|
||||
<p>{documents?.Amount || 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>ShelfNumber</p>
|
||||
<p className={'block font-bold mb-2'}>Project Code</p>
|
||||
<p>{documents?.project_code}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Document Status</p>
|
||||
<p>{documents?.document_status ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Shelf Number</p>
|
||||
<p>{documents?.shelf_number}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>ApprovedBy</p>
|
||||
<p>{documents?.approved_by}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{documents?.organizations?.name ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Payments Document</p>
|
||||
<CardBox
|
||||
|
||||
@ -53,8 +53,6 @@ const EditField_site_payment_requisitions = () => {
|
||||
|
||||
departure_date: new Date(),
|
||||
|
||||
arrival_place: '',
|
||||
|
||||
return_date: new Date(),
|
||||
|
||||
requisition_date: new Date(),
|
||||
@ -140,7 +138,7 @@ const EditField_site_payment_requisitions = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organization}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
)}
|
||||
@ -187,10 +185,6 @@ const EditField_site_payment_requisitions = () => {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='ArrivalPlace'>
|
||||
<Field name='arrival_place' placeholder='ArrivalPlace' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ReturnDate'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
@ -294,7 +288,7 @@ const EditField_site_payment_requisitions = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -53,8 +53,6 @@ const EditField_site_payment_requisitionsPage = () => {
|
||||
|
||||
departure_date: new Date(),
|
||||
|
||||
arrival_place: '',
|
||||
|
||||
return_date: new Date(),
|
||||
|
||||
requisition_date: new Date(),
|
||||
@ -138,7 +136,7 @@ const EditField_site_payment_requisitionsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organization}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
)}
|
||||
@ -185,10 +183,6 @@ const EditField_site_payment_requisitionsPage = () => {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField label='ArrivalPlace'>
|
||||
<Field name='arrival_place' placeholder='ArrivalPlace' />
|
||||
</FormField>
|
||||
|
||||
<FormField label='ReturnDate'>
|
||||
<DatePicker
|
||||
dateFormat='yyyy-MM-dd hh:mm'
|
||||
@ -292,7 +286,7 @@ const EditField_site_payment_requisitionsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -65,8 +65,7 @@ const Field_site_payment_requisitionsView = () => {
|
||||
<p className={'block font-bold mb-2'}>Organization</p>
|
||||
|
||||
<p>
|
||||
{field_site_payment_requisitions?.organization?.name ??
|
||||
'No data'}
|
||||
{field_site_payment_requisitions?.organization?.id ?? 'No data'}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@ -113,11 +112,6 @@ const Field_site_payment_requisitionsView = () => {
|
||||
)}
|
||||
</FormField>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>ArrivalPlace</p>
|
||||
<p>{field_site_payment_requisitions?.arrival_place}</p>
|
||||
</div>
|
||||
|
||||
<FormField label='ReturnDate'>
|
||||
{field_site_payment_requisitions.return_date ? (
|
||||
<DatePicker
|
||||
@ -212,8 +206,7 @@ const Field_site_payment_requisitionsView = () => {
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>
|
||||
{field_site_payment_requisitions?.organizations?.name ??
|
||||
'No data'}
|
||||
{field_site_payment_requisitions?.organizations?.id ?? 'No data'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@ -126,23 +126,23 @@ const OrganizationsView = () => {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>DocumentNumber</th>
|
||||
<th>Nameofemployee Organization</th>
|
||||
|
||||
<th>DocumentType</th>
|
||||
<th>Document Number</th>
|
||||
|
||||
<th>PreparedBy</th>
|
||||
<th>Description</th>
|
||||
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
|
||||
<th>CashBalance</th>
|
||||
|
||||
<th>PaymentDate</th>
|
||||
<th>Payment Type</th>
|
||||
|
||||
<th>Amount</th>
|
||||
|
||||
<th>ShelfNumber</th>
|
||||
<th>Project Code</th>
|
||||
|
||||
<th>ApprovedBy</th>
|
||||
<th>Document Status</th>
|
||||
|
||||
<th>Shelf Number</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -157,31 +157,31 @@ const OrganizationsView = () => {
|
||||
)
|
||||
}
|
||||
>
|
||||
<td data-label='nameofemployee_organization'>
|
||||
{item.nameofemployee_organization}
|
||||
</td>
|
||||
|
||||
<td data-label='document_number'>
|
||||
{item.document_number}
|
||||
</td>
|
||||
|
||||
<td data-label='document_type'>
|
||||
{item.document_type}
|
||||
<td data-label='description'>{item.description}</td>
|
||||
|
||||
<td data-label='date'>
|
||||
{dataFormatter.dateFormatter(item.date)}
|
||||
</td>
|
||||
|
||||
<td data-label='prepared_by'>{item.prepared_by}</td>
|
||||
<td data-label='payment_type'>{item.payment_type}</td>
|
||||
|
||||
<td data-label='status'>{item.status}</td>
|
||||
<td data-label='Amount'>{item.Amount}</td>
|
||||
|
||||
<td data-label='cash_balance'>
|
||||
{dataFormatter.booleanFormatter(item.cash_balance)}
|
||||
<td data-label='project_code'>{item.project_code}</td>
|
||||
|
||||
<td data-label='document_status'>
|
||||
{item.document_status}
|
||||
</td>
|
||||
|
||||
<td data-label='payment_date'>
|
||||
{dataFormatter.dateTimeFormatter(item.payment_date)}
|
||||
</td>
|
||||
|
||||
<td data-label='amount'>{item.amount}</td>
|
||||
|
||||
<td data-label='shelf_number'>{item.shelf_number}</td>
|
||||
|
||||
<td data-label='approved_by'>{item.approved_by}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@ -213,8 +213,6 @@ const OrganizationsView = () => {
|
||||
|
||||
<th>DepartureDate</th>
|
||||
|
||||
<th>ArrivalPlace</th>
|
||||
|
||||
<th>ReturnDate</th>
|
||||
|
||||
<th>RequisitionDate</th>
|
||||
@ -263,10 +261,6 @@ const OrganizationsView = () => {
|
||||
)}
|
||||
</td>
|
||||
|
||||
<td data-label='arrival_place'>
|
||||
{item.arrival_place}
|
||||
</td>
|
||||
|
||||
<td data-label='return_date'>
|
||||
{dataFormatter.dateTimeFormatter(
|
||||
item.return_date,
|
||||
@ -327,8 +321,6 @@ const OrganizationsView = () => {
|
||||
|
||||
<th>DepartureDate</th>
|
||||
|
||||
<th>ArrivalPlace</th>
|
||||
|
||||
<th>ReturnDate</th>
|
||||
|
||||
<th>RequisitionDate</th>
|
||||
@ -377,10 +369,6 @@ const OrganizationsView = () => {
|
||||
)}
|
||||
</td>
|
||||
|
||||
<td data-label='arrival_place'>
|
||||
{item.arrival_place}
|
||||
</td>
|
||||
|
||||
<td data-label='return_date'>
|
||||
{dataFormatter.dateTimeFormatter(
|
||||
item.return_date,
|
||||
@ -558,6 +546,72 @@ const OrganizationsView = () => {
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Departments organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.departments_organizations &&
|
||||
Array.isArray(organizations.departments_organizations) &&
|
||||
organizations.departments_organizations.map(
|
||||
(item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/departments/departments-view/?id=${item.id}`,
|
||||
)
|
||||
}
|
||||
></tr>
|
||||
),
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.departments_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Places organizations</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{organizations.places_organizations &&
|
||||
Array.isArray(organizations.places_organizations) &&
|
||||
organizations.places_organizations.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(`/places/places-view/?id=${item.id}`)
|
||||
}
|
||||
></tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!organizations?.places_organizations?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
<BaseButton
|
||||
|
||||
@ -108,7 +108,7 @@ const EditPayments = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.document}
|
||||
itemRef={'documents'}
|
||||
showField={'document_number'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
@ -148,7 +148,7 @@ const EditPayments = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ const EditPaymentsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.document}
|
||||
itemRef={'documents'}
|
||||
showField={'document_number'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
@ -146,7 +146,7 @@ const EditPaymentsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ const PaymentsView = () => {
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Document</p>
|
||||
|
||||
<p>{payments?.document?.document_number ?? 'No data'}</p>
|
||||
<p>{payments?.document?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<FormField label='PaymentDate'>
|
||||
@ -94,7 +94,7 @@ const PaymentsView = () => {
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{payments?.organizations?.name ?? 'No data'}</p>
|
||||
<p>{payments?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
135
frontend/src/pages/places/[placesId].tsx
Normal file
135
frontend/src/pages/places/[placesId].tsx
Normal file
@ -0,0 +1,135 @@
|
||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import { getPageTitle } from '../../config';
|
||||
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import FormField from '../../components/FormField';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import BaseButtons from '../../components/BaseButtons';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
||||
import FormFilePicker from '../../components/FormFilePicker';
|
||||
import FormImagePicker from '../../components/FormImagePicker';
|
||||
import { SelectField } from '../../components/SelectField';
|
||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import { RichTextField } from '../../components/RichTextField';
|
||||
|
||||
import { update, fetch } from '../../stores/places/placesSlice';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const EditPlaces = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
const { places } = useAppSelector((state) => state.places);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { placesId } = router.query;
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id: placesId }));
|
||||
}, [placesId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof places === 'object') {
|
||||
setInitialValues(places);
|
||||
}
|
||||
}, [places]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof places === 'object') {
|
||||
const newInitialVal = { ...initVals };
|
||||
|
||||
Object.keys(initVals).forEach((el) => (newInitialVal[el] = places[el]));
|
||||
|
||||
setInitialValues(newInitialVal);
|
||||
}
|
||||
}, [places]);
|
||||
|
||||
const handleSubmit = async (data) => {
|
||||
await dispatch(update({ id: placesId, data }));
|
||||
await router.push('/places/places-list');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('Edit places')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={'Edit places'}
|
||||
main
|
||||
>
|
||||
{''}
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<Formik
|
||||
enableReinitialize
|
||||
initialValues={initialValues}
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
id='organizations'
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
||||
<BaseButton
|
||||
type='reset'
|
||||
color='danger'
|
||||
outline
|
||||
label='Cancel'
|
||||
onClick={() => router.push('/places/places-list')}
|
||||
/>
|
||||
</BaseButtons>
|
||||
</Form>
|
||||
</Formik>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
EditPlaces.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'UPDATE_PLACES'}>
|
||||
{page}
|
||||
</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditPlaces;
|
||||
133
frontend/src/pages/places/places-edit.tsx
Normal file
133
frontend/src/pages/places/places-edit.tsx
Normal file
@ -0,0 +1,133 @@
|
||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
||||
import Head from 'next/head';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import CardBox from '../../components/CardBox';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import { getPageTitle } from '../../config';
|
||||
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import FormField from '../../components/FormField';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import BaseButtons from '../../components/BaseButtons';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
||||
import FormFilePicker from '../../components/FormFilePicker';
|
||||
import FormImagePicker from '../../components/FormImagePicker';
|
||||
import { SelectField } from '../../components/SelectField';
|
||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import { RichTextField } from '../../components/RichTextField';
|
||||
|
||||
import { update, fetch } from '../../stores/places/placesSlice';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const EditPlacesPage = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const initVals = {
|
||||
organizations: null,
|
||||
};
|
||||
const [initialValues, setInitialValues] = useState(initVals);
|
||||
|
||||
const { places } = useAppSelector((state) => state.places);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { id } = router.query;
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id: id }));
|
||||
}, [id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof places === 'object') {
|
||||
setInitialValues(places);
|
||||
}
|
||||
}, [places]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof places === 'object') {
|
||||
const newInitialVal = { ...initVals };
|
||||
Object.keys(initVals).forEach((el) => (newInitialVal[el] = places[el]));
|
||||
setInitialValues(newInitialVal);
|
||||
}
|
||||
}, [places]);
|
||||
|
||||
const handleSubmit = async (data) => {
|
||||
await dispatch(update({ id: id, data }));
|
||||
await router.push('/places/places-list');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('Edit places')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={'Edit places'}
|
||||
main
|
||||
>
|
||||
{''}
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<Formik
|
||||
enableReinitialize
|
||||
initialValues={initialValues}
|
||||
onSubmit={(values) => handleSubmit(values)}
|
||||
>
|
||||
<Form>
|
||||
<FormField label='organizations' labelFor='organizations'>
|
||||
<Field
|
||||
name='organizations'
|
||||
id='organizations'
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type='submit' color='info' label='Submit' />
|
||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
||||
<BaseButton
|
||||
type='reset'
|
||||
color='danger'
|
||||
outline
|
||||
label='Cancel'
|
||||
onClick={() => router.push('/places/places-list')}
|
||||
/>
|
||||
</BaseButtons>
|
||||
</Form>
|
||||
</Formik>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
EditPlacesPage.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'UPDATE_PLACES'}>
|
||||
{page}
|
||||
</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default EditPlacesPage;
|
||||
86
frontend/src/pages/places/places-view.tsx
Normal file
86
frontend/src/pages/places/places-view.tsx
Normal file
@ -0,0 +1,86 @@
|
||||
import React, { ReactElement, useEffect } from 'react';
|
||||
import Head from 'next/head';
|
||||
import DatePicker from 'react-datepicker';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
import dayjs from 'dayjs';
|
||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { fetch } from '../../stores/places/placesSlice';
|
||||
import { saveFile } from '../../helpers/fileSaver';
|
||||
import dataFormatter from '../../helpers/dataFormatter';
|
||||
import ImageField from '../../components/ImageField';
|
||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
||||
import { getPageTitle } from '../../config';
|
||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
||||
import SectionMain from '../../components/SectionMain';
|
||||
import CardBox from '../../components/CardBox';
|
||||
import BaseButton from '../../components/BaseButton';
|
||||
import BaseDivider from '../../components/BaseDivider';
|
||||
import { mdiChartTimelineVariant } from '@mdi/js';
|
||||
import { SwitchField } from '../../components/SwitchField';
|
||||
import FormField from '../../components/FormField';
|
||||
|
||||
import { hasPermission } from '../../helpers/userPermissions';
|
||||
|
||||
const PlacesView = () => {
|
||||
const router = useRouter();
|
||||
const dispatch = useAppDispatch();
|
||||
const { places } = useAppSelector((state) => state.places);
|
||||
|
||||
const { currentUser } = useAppSelector((state) => state.auth);
|
||||
|
||||
const { id } = router.query;
|
||||
|
||||
function removeLastCharacter(str) {
|
||||
console.log(str, `str`);
|
||||
return str.slice(0, -1);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetch({ id }));
|
||||
}, [dispatch, id]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{getPageTitle('View places')}</title>
|
||||
</Head>
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton
|
||||
icon={mdiChartTimelineVariant}
|
||||
title={removeLastCharacter('View places')}
|
||||
main
|
||||
>
|
||||
<BaseButton
|
||||
color='info'
|
||||
label='Edit'
|
||||
href={`/places/places-edit/?id=${id}`}
|
||||
/>
|
||||
</SectionTitleLineWithButton>
|
||||
<CardBox>
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{places?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
<BaseButton
|
||||
color='info'
|
||||
label='Back'
|
||||
onClick={() => router.push('/places/places-list')}
|
||||
/>
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
PlacesView.getLayout = function getLayout(page: ReactElement) {
|
||||
return (
|
||||
<LayoutAuthenticated permission={'READ_PLACES'}>{page}</LayoutAuthenticated>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlacesView;
|
||||
@ -129,7 +129,7 @@ const EditProjects = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organization}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
)}
|
||||
@ -141,7 +141,7 @@ const EditProjects = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ const EditProjectsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organization}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
)}
|
||||
@ -139,7 +139,7 @@ const EditProjectsPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -77,93 +77,16 @@ const ProjectsView = () => {
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Organization</p>
|
||||
|
||||
<p>{projects?.organization?.name ?? 'No data'}</p>
|
||||
<p>{projects?.organization?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>organizations</p>
|
||||
|
||||
<p>{projects?.organizations?.name ?? 'No data'}</p>
|
||||
<p>{projects?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>Documents Project</p>
|
||||
<CardBox
|
||||
className='mb-6 border border-gray-300 rounded overflow-hidden'
|
||||
hasTable
|
||||
>
|
||||
<div className='overflow-x-auto'>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>DocumentNumber</th>
|
||||
|
||||
<th>DocumentType</th>
|
||||
|
||||
<th>PreparedBy</th>
|
||||
|
||||
<th>Status</th>
|
||||
|
||||
<th>CashBalance</th>
|
||||
|
||||
<th>PaymentDate</th>
|
||||
|
||||
<th>Amount</th>
|
||||
|
||||
<th>ShelfNumber</th>
|
||||
|
||||
<th>ApprovedBy</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{projects.documents_project &&
|
||||
Array.isArray(projects.documents_project) &&
|
||||
projects.documents_project.map((item: any) => (
|
||||
<tr
|
||||
key={item.id}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/documents/documents-view/?id=${item.id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
<td data-label='document_number'>
|
||||
{item.document_number}
|
||||
</td>
|
||||
|
||||
<td data-label='document_type'>
|
||||
{item.document_type}
|
||||
</td>
|
||||
|
||||
<td data-label='prepared_by'>{item.prepared_by}</td>
|
||||
|
||||
<td data-label='status'>{item.status}</td>
|
||||
|
||||
<td data-label='cash_balance'>
|
||||
{dataFormatter.booleanFormatter(item.cash_balance)}
|
||||
</td>
|
||||
|
||||
<td data-label='payment_date'>
|
||||
{dataFormatter.dateTimeFormatter(item.payment_date)}
|
||||
</td>
|
||||
|
||||
<td data-label='amount'>{item.amount}</td>
|
||||
|
||||
<td data-label='shelf_number'>{item.shelf_number}</td>
|
||||
|
||||
<td data-label='approved_by'>{item.approved_by}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{!projects?.documents_project?.length && (
|
||||
<div className={'text-center py-4'}>No data</div>
|
||||
)}
|
||||
</CardBox>
|
||||
</>
|
||||
|
||||
<>
|
||||
<p className={'block font-bold mb-2'}>
|
||||
Field_site_payment_requisitions Project
|
||||
@ -184,8 +107,6 @@ const ProjectsView = () => {
|
||||
|
||||
<th>DepartureDate</th>
|
||||
|
||||
<th>ArrivalPlace</th>
|
||||
|
||||
<th>ReturnDate</th>
|
||||
|
||||
<th>RequisitionDate</th>
|
||||
@ -234,10 +155,6 @@ const ProjectsView = () => {
|
||||
)}
|
||||
</td>
|
||||
|
||||
<td data-label='arrival_place'>
|
||||
{item.arrival_place}
|
||||
</td>
|
||||
|
||||
<td data-label='return_date'>
|
||||
{dataFormatter.dateTimeFormatter(
|
||||
item.return_date,
|
||||
|
||||
@ -183,7 +183,7 @@ const EditUsers = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ const EditUsersPage = () => {
|
||||
component={SelectField}
|
||||
options={initialValues.organizations}
|
||||
itemRef={'organizations'}
|
||||
showField={'name'}
|
||||
showField={'id'}
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ const UsersView = () => {
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Organizations</p>
|
||||
|
||||
<p>{users?.organizations?.name ?? 'No data'}</p>
|
||||
<p>{users?.organizations?.id ?? 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
@ -77,7 +77,7 @@ export default function WebSite() {
|
||||
<FeaturesSection
|
||||
projectName={'Nimona E-filling System'}
|
||||
image={['Dashboard showcasing CRM features']}
|
||||
withBg={0}
|
||||
withBg={1}
|
||||
features={features_points}
|
||||
mainText={`Unlock Efficiency with Gojo CRM Features`}
|
||||
subTitle={`Explore the powerful features of ${projectName} designed to streamline your law firm's operations and enhance productivity.`}
|
||||
|
||||
@ -115,7 +115,7 @@ export default function WebSite() {
|
||||
<FeaturesSection
|
||||
projectName={'Nimona E-filling System'}
|
||||
image={['Feature-rich CRM dashboard view']}
|
||||
withBg={1}
|
||||
withBg={0}
|
||||
features={features_points}
|
||||
mainText={`Discover the Power of Gojo CRM`}
|
||||
subTitle={`Explore the robust features of ${projectName} that are designed to elevate your law firm's efficiency and client management capabilities.`}
|
||||
|
||||
@ -11,6 +11,8 @@ import paymentsSlice from './payments/paymentsSlice';
|
||||
import projectsSlice from './projects/projectsSlice';
|
||||
import rolesSlice from './roles/rolesSlice';
|
||||
import permissionsSlice from './permissions/permissionsSlice';
|
||||
import departmentsSlice from './departments/departmentsSlice';
|
||||
import placesSlice from './places/placesSlice';
|
||||
import organizationsSlice from './organizations/organizationsSlice';
|
||||
|
||||
export const store = configureStore({
|
||||
@ -27,6 +29,8 @@ export const store = configureStore({
|
||||
projects: projectsSlice,
|
||||
roles: rolesSlice,
|
||||
permissions: permissionsSlice,
|
||||
departments: departmentsSlice,
|
||||
places: placesSlice,
|
||||
organizations: organizationsSlice,
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user