Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
File diff suppressed because one or more lines are too long
@ -15,15 +15,16 @@ module.exports = class DocumentsDBApi {
|
|||||||
{
|
{
|
||||||
id: data.id || undefined,
|
id: data.id || undefined,
|
||||||
|
|
||||||
nameofemployee_organization: data.nameofemployee_organization || null,
|
|
||||||
document_number: data.document_number || null,
|
document_number: data.document_number || null,
|
||||||
description: data.description || null,
|
document_type: data.document_type || null,
|
||||||
date: data.date || null,
|
prepared_by: data.prepared_by || null,
|
||||||
payment_type: data.payment_type || null,
|
status: data.status || null,
|
||||||
Amount: data.Amount || null,
|
cash_balance: data.cash_balance || false,
|
||||||
project_code: data.project_code || null,
|
|
||||||
document_status: data.document_status || null,
|
payment_date: data.payment_date || null,
|
||||||
|
amount: data.amount || null,
|
||||||
shelf_number: data.shelf_number || null,
|
shelf_number: data.shelf_number || null,
|
||||||
|
approved_by: data.approved_by || null,
|
||||||
importHash: data.importHash || null,
|
importHash: data.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -31,6 +32,10 @@ module.exports = class DocumentsDBApi {
|
|||||||
{ transaction },
|
{ transaction },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await documents.setProject(data.project || null, {
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
await documents.setOrganizations(data.organizations || null, {
|
await documents.setOrganizations(data.organizations || null, {
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
@ -46,15 +51,16 @@ module.exports = class DocumentsDBApi {
|
|||||||
const documentsData = data.map((item, index) => ({
|
const documentsData = data.map((item, index) => ({
|
||||||
id: item.id || undefined,
|
id: item.id || undefined,
|
||||||
|
|
||||||
nameofemployee_organization: item.nameofemployee_organization || null,
|
|
||||||
document_number: item.document_number || null,
|
document_number: item.document_number || null,
|
||||||
description: item.description || null,
|
document_type: item.document_type || null,
|
||||||
date: item.date || null,
|
prepared_by: item.prepared_by || null,
|
||||||
payment_type: item.payment_type || null,
|
status: item.status || null,
|
||||||
Amount: item.Amount || null,
|
cash_balance: item.cash_balance || false,
|
||||||
project_code: item.project_code || null,
|
|
||||||
document_status: item.document_status || null,
|
payment_date: item.payment_date || null,
|
||||||
|
amount: item.amount || null,
|
||||||
shelf_number: item.shelf_number || null,
|
shelf_number: item.shelf_number || null,
|
||||||
|
approved_by: item.approved_by || null,
|
||||||
importHash: item.importHash || null,
|
importHash: item.importHash || null,
|
||||||
createdById: currentUser.id,
|
createdById: currentUser.id,
|
||||||
updatedById: currentUser.id,
|
updatedById: currentUser.id,
|
||||||
@ -80,36 +86,43 @@ module.exports = class DocumentsDBApi {
|
|||||||
|
|
||||||
const updatePayload = {};
|
const updatePayload = {};
|
||||||
|
|
||||||
if (data.nameofemployee_organization !== undefined)
|
|
||||||
updatePayload.nameofemployee_organization =
|
|
||||||
data.nameofemployee_organization;
|
|
||||||
|
|
||||||
if (data.document_number !== undefined)
|
if (data.document_number !== undefined)
|
||||||
updatePayload.document_number = data.document_number;
|
updatePayload.document_number = data.document_number;
|
||||||
|
|
||||||
if (data.description !== undefined)
|
if (data.document_type !== undefined)
|
||||||
updatePayload.description = data.description;
|
updatePayload.document_type = data.document_type;
|
||||||
|
|
||||||
if (data.date !== undefined) updatePayload.date = data.date;
|
if (data.prepared_by !== undefined)
|
||||||
|
updatePayload.prepared_by = data.prepared_by;
|
||||||
|
|
||||||
if (data.payment_type !== undefined)
|
if (data.status !== undefined) updatePayload.status = data.status;
|
||||||
updatePayload.payment_type = data.payment_type;
|
|
||||||
|
|
||||||
if (data.Amount !== undefined) updatePayload.Amount = data.Amount;
|
if (data.cash_balance !== undefined)
|
||||||
|
updatePayload.cash_balance = data.cash_balance;
|
||||||
|
|
||||||
if (data.project_code !== undefined)
|
if (data.payment_date !== undefined)
|
||||||
updatePayload.project_code = data.project_code;
|
updatePayload.payment_date = data.payment_date;
|
||||||
|
|
||||||
if (data.document_status !== undefined)
|
if (data.amount !== undefined) updatePayload.amount = data.amount;
|
||||||
updatePayload.document_status = data.document_status;
|
|
||||||
|
|
||||||
if (data.shelf_number !== undefined)
|
if (data.shelf_number !== undefined)
|
||||||
updatePayload.shelf_number = data.shelf_number;
|
updatePayload.shelf_number = data.shelf_number;
|
||||||
|
|
||||||
|
if (data.approved_by !== undefined)
|
||||||
|
updatePayload.approved_by = data.approved_by;
|
||||||
|
|
||||||
updatePayload.updatedById = currentUser.id;
|
updatePayload.updatedById = currentUser.id;
|
||||||
|
|
||||||
await documents.update(updatePayload, { transaction });
|
await documents.update(updatePayload, { transaction });
|
||||||
|
|
||||||
|
if (data.project !== undefined) {
|
||||||
|
await documents.setProject(
|
||||||
|
data.project,
|
||||||
|
|
||||||
|
{ transaction },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.organizations !== undefined) {
|
if (data.organizations !== undefined) {
|
||||||
await documents.setOrganizations(
|
await documents.setOrganizations(
|
||||||
data.organizations,
|
data.organizations,
|
||||||
@ -183,6 +196,10 @@ module.exports = class DocumentsDBApi {
|
|||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
output.project = await documents.getProject({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
output.organizations = await documents.getOrganizations({
|
output.organizations = await documents.getOrganizations({
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
@ -212,6 +229,32 @@ module.exports = class DocumentsDBApi {
|
|||||||
const transaction = (options && options.transaction) || undefined;
|
const transaction = (options && options.transaction) || undefined;
|
||||||
|
|
||||||
let include = [
|
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,
|
model: db.organizations,
|
||||||
as: 'organizations',
|
as: 'organizations',
|
||||||
@ -226,17 +269,6 @@ module.exports = class DocumentsDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.nameofemployee_organization) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'documents',
|
|
||||||
'nameofemployee_organization',
|
|
||||||
filter.nameofemployee_organization,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.document_number) {
|
if (filter.document_number) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
@ -248,21 +280,10 @@ module.exports = class DocumentsDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.description) {
|
if (filter.prepared_by) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
[Op.and]: Utils.ilike('documents', 'description', filter.description),
|
[Op.and]: Utils.ilike('documents', 'prepared_by', filter.prepared_by),
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.project_code) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'documents',
|
|
||||||
'project_code',
|
|
||||||
filter.project_code,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,14 +298,21 @@ module.exports = class DocumentsDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.dateRange) {
|
if (filter.approved_by) {
|
||||||
const [start, end] = filter.dateRange;
|
where = {
|
||||||
|
...where,
|
||||||
|
[Op.and]: Utils.ilike('documents', 'approved_by', filter.approved_by),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.payment_dateRange) {
|
||||||
|
const [start, end] = filter.payment_dateRange;
|
||||||
|
|
||||||
if (start !== undefined && start !== null && start !== '') {
|
if (start !== undefined && start !== null && start !== '') {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
date: {
|
payment_date: {
|
||||||
...where.date,
|
...where.payment_date,
|
||||||
[Op.gte]: start,
|
[Op.gte]: start,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -293,22 +321,22 @@ module.exports = class DocumentsDBApi {
|
|||||||
if (end !== undefined && end !== null && end !== '') {
|
if (end !== undefined && end !== null && end !== '') {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
date: {
|
payment_date: {
|
||||||
...where.date,
|
...where.payment_date,
|
||||||
[Op.lte]: end,
|
[Op.lte]: end,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.AmountRange) {
|
if (filter.amountRange) {
|
||||||
const [start, end] = filter.AmountRange;
|
const [start, end] = filter.amountRange;
|
||||||
|
|
||||||
if (start !== undefined && start !== null && start !== '') {
|
if (start !== undefined && start !== null && start !== '') {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
Amount: {
|
amount: {
|
||||||
...where.Amount,
|
...where.amount,
|
||||||
[Op.gte]: start,
|
[Op.gte]: start,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -317,8 +345,8 @@ module.exports = class DocumentsDBApi {
|
|||||||
if (end !== undefined && end !== null && end !== '') {
|
if (end !== undefined && end !== null && end !== '') {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
Amount: {
|
amount: {
|
||||||
...where.Amount,
|
...where.amount,
|
||||||
[Op.lte]: end,
|
[Op.lte]: end,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -332,17 +360,24 @@ module.exports = class DocumentsDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.payment_type) {
|
if (filter.document_type) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
payment_type: filter.payment_type,
|
document_type: filter.document_type,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.document_status) {
|
if (filter.status) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
document_status: filter.document_status,
|
status: filter.status,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.cash_balance) {
|
||||||
|
where = {
|
||||||
|
...where,
|
||||||
|
cash_balance: filter.cash_balance,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,22 +468,22 @@ module.exports = class DocumentsDBApi {
|
|||||||
where = {
|
where = {
|
||||||
[Op.or]: [
|
[Op.or]: [
|
||||||
{ ['id']: Utils.uuid(query) },
|
{ ['id']: Utils.uuid(query) },
|
||||||
Utils.ilike('documents', 'id', query),
|
Utils.ilike('documents', 'document_number', query),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const records = await db.documents.findAll({
|
const records = await db.documents.findAll({
|
||||||
attributes: ['id', 'id'],
|
attributes: ['id', 'document_number'],
|
||||||
where,
|
where,
|
||||||
limit: limit ? Number(limit) : undefined,
|
limit: limit ? Number(limit) : undefined,
|
||||||
offset: offset ? Number(offset) : undefined,
|
offset: offset ? Number(offset) : undefined,
|
||||||
orderBy: [['id', 'ASC']],
|
orderBy: [['document_number', 'ASC']],
|
||||||
});
|
});
|
||||||
|
|
||||||
return records.map((record) => ({
|
return records.map((record) => ({
|
||||||
id: record.id,
|
id: record.id,
|
||||||
label: record.id,
|
label: record.document_number,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -20,7 +20,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
|
|||||||
employee_name: data.employee_name || null,
|
employee_name: data.employee_name || null,
|
||||||
departure_place: data.departure_place || null,
|
departure_place: data.departure_place || null,
|
||||||
departure_date: data.departure_date || null,
|
departure_date: data.departure_date || null,
|
||||||
arrival_place: data.arrival_place || null,
|
|
||||||
return_date: data.return_date || null,
|
return_date: data.return_date || null,
|
||||||
requisition_date: data.requisition_date || null,
|
requisition_date: data.requisition_date || null,
|
||||||
requested_amount: data.requested_amount || null,
|
requested_amount: data.requested_amount || null,
|
||||||
@ -69,7 +68,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
|
|||||||
employee_name: item.employee_name || null,
|
employee_name: item.employee_name || null,
|
||||||
departure_place: item.departure_place || null,
|
departure_place: item.departure_place || null,
|
||||||
departure_date: item.departure_date || null,
|
departure_date: item.departure_date || null,
|
||||||
arrival_place: item.arrival_place || null,
|
|
||||||
return_date: item.return_date || null,
|
return_date: item.return_date || null,
|
||||||
requisition_date: item.requisition_date || null,
|
requisition_date: item.requisition_date || null,
|
||||||
requested_amount: item.requested_amount || null,
|
requested_amount: item.requested_amount || null,
|
||||||
@ -122,9 +120,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
|
|||||||
if (data.departure_date !== undefined)
|
if (data.departure_date !== undefined)
|
||||||
updatePayload.departure_date = data.departure_date;
|
updatePayload.departure_date = data.departure_date;
|
||||||
|
|
||||||
if (data.arrival_place !== undefined)
|
|
||||||
updatePayload.arrival_place = data.arrival_place;
|
|
||||||
|
|
||||||
if (data.return_date !== undefined)
|
if (data.return_date !== undefined)
|
||||||
updatePayload.return_date = data.return_date;
|
updatePayload.return_date = data.return_date;
|
||||||
|
|
||||||
@ -359,17 +354,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.arrival_place) {
|
|
||||||
where = {
|
|
||||||
...where,
|
|
||||||
[Op.and]: Utils.ilike(
|
|
||||||
'field_site_payment_requisitions',
|
|
||||||
'arrival_place',
|
|
||||||
filter.arrival_place,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.requester) {
|
if (filter.requester) {
|
||||||
where = {
|
where = {
|
||||||
...where,
|
...where,
|
||||||
@ -632,26 +616,22 @@ module.exports = class Field_site_payment_requisitionsDBApi {
|
|||||||
where = {
|
where = {
|
||||||
[Op.or]: [
|
[Op.or]: [
|
||||||
{ ['id']: Utils.uuid(query) },
|
{ ['id']: Utils.uuid(query) },
|
||||||
Utils.ilike(
|
Utils.ilike('field_site_payment_requisitions', 'id', query),
|
||||||
'field_site_payment_requisitions',
|
|
||||||
'employee_name',
|
|
||||||
query,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const records = await db.field_site_payment_requisitions.findAll({
|
const records = await db.field_site_payment_requisitions.findAll({
|
||||||
attributes: ['id', 'employee_name'],
|
attributes: ['id', 'id'],
|
||||||
where,
|
where,
|
||||||
limit: limit ? Number(limit) : undefined,
|
limit: limit ? Number(limit) : undefined,
|
||||||
offset: offset ? Number(offset) : undefined,
|
offset: offset ? Number(offset) : undefined,
|
||||||
orderBy: [['employee_name', 'ASC']],
|
orderBy: [['id', 'ASC']],
|
||||||
});
|
});
|
||||||
|
|
||||||
return records.map((record) => ({
|
return records.map((record) => ({
|
||||||
id: record.id,
|
id: record.id,
|
||||||
label: record.employee_name,
|
label: record.id,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -169,15 +169,6 @@ module.exports = class OrganizationsDBApi {
|
|||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
output.departments_organizations =
|
|
||||||
await organizations.getDepartments_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
output.places_organizations = await organizations.getPlaces_organizations({
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,22 +295,22 @@ module.exports = class OrganizationsDBApi {
|
|||||||
where = {
|
where = {
|
||||||
[Op.or]: [
|
[Op.or]: [
|
||||||
{ ['id']: Utils.uuid(query) },
|
{ ['id']: Utils.uuid(query) },
|
||||||
Utils.ilike('organizations', 'id', query),
|
Utils.ilike('organizations', 'name', query),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const records = await db.organizations.findAll({
|
const records = await db.organizations.findAll({
|
||||||
attributes: ['id', 'id'],
|
attributes: ['id', 'name'],
|
||||||
where,
|
where,
|
||||||
limit: limit ? Number(limit) : undefined,
|
limit: limit ? Number(limit) : undefined,
|
||||||
offset: offset ? Number(offset) : undefined,
|
offset: offset ? Number(offset) : undefined,
|
||||||
orderBy: [['id', 'ASC']],
|
orderBy: [['name', 'ASC']],
|
||||||
});
|
});
|
||||||
|
|
||||||
return records.map((record) => ({
|
return records.map((record) => ({
|
||||||
id: record.id,
|
id: record.id,
|
||||||
label: record.id,
|
label: record.name,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -208,7 +208,7 @@ module.exports = class PaymentsDBApi {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: {
|
document_number: {
|
||||||
[Op.or]: filter.document
|
[Op.or]: filter.document
|
||||||
.split('|')
|
.split('|')
|
||||||
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
.map((term) => ({ [Op.iLike]: `%${term}%` })),
|
||||||
|
|||||||
@ -158,6 +158,10 @@ module.exports = class ProjectsDBApi {
|
|||||||
|
|
||||||
const output = projects.get({ plain: true });
|
const output = projects.get({ plain: true });
|
||||||
|
|
||||||
|
output.documents_project = await projects.getDocuments_project({
|
||||||
|
transaction,
|
||||||
|
});
|
||||||
|
|
||||||
output.field_site_payment_requisitions_project =
|
output.field_site_payment_requisitions_project =
|
||||||
await projects.getField_site_payment_requisitions_project({
|
await projects.getField_site_payment_requisitions_project({
|
||||||
transaction,
|
transaction,
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
/**
|
|
||||||
* @param {QueryInterface} queryInterface
|
|
||||||
* @param {Sequelize} Sequelize
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
*/
|
|
||||||
async up(queryInterface, Sequelize) {
|
|
||||||
/**
|
|
||||||
* @type {Transaction}
|
|
||||||
*/
|
|
||||||
const transaction = await queryInterface.sequelize.transaction();
|
|
||||||
try {
|
|
||||||
await queryInterface.addColumn(
|
|
||||||
'documents',
|
|
||||||
'nameofemployee_organization',
|
|
||||||
{
|
|
||||||
type: Sequelize.DataTypes.TEXT,
|
|
||||||
},
|
|
||||||
{ transaction },
|
|
||||||
);
|
|
||||||
|
|
||||||
await queryInterface.renameColumn(
|
|
||||||
'documents',
|
|
||||||
'document_number',
|
|
||||||
'document_numner',
|
|
||||||
{ 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.renameColumn(
|
|
||||||
'documents',
|
|
||||||
'document_numner',
|
|
||||||
'document_number',
|
|
||||||
{ transaction },
|
|
||||||
);
|
|
||||||
|
|
||||||
await queryInterface.removeColumn(
|
|
||||||
'documents',
|
|
||||||
'nameofemployee_organization',
|
|
||||||
{ transaction },
|
|
||||||
);
|
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
} catch (err) {
|
|
||||||
await transaction.rollback();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@ -1,363 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
/**
|
|
||||||
* @param {QueryInterface} queryInterface
|
|
||||||
* @param {Sequelize} Sequelize
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
*/
|
|
||||||
async up(queryInterface, Sequelize) {
|
|
||||||
/**
|
|
||||||
* @type {Transaction}
|
|
||||||
*/
|
|
||||||
const transaction = await queryInterface.sequelize.transaction();
|
|
||||||
try {
|
|
||||||
await queryInterface.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,49 +14,46 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
nameofemployee_organization: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
},
|
|
||||||
|
|
||||||
document_number: {
|
document_number: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
|
||||||
description: {
|
document_type: {
|
||||||
|
type: DataTypes.ENUM,
|
||||||
|
|
||||||
|
values: ['BPV', 'JV', 'RV'],
|
||||||
|
},
|
||||||
|
|
||||||
|
prepared_by: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
|
||||||
date: {
|
status: {
|
||||||
type: DataTypes.DATEONLY,
|
|
||||||
|
|
||||||
get: function () {
|
|
||||||
return this.getDataValue('date')
|
|
||||||
? moment.utc(this.getDataValue('date')).format('YYYY-MM-DD')
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
payment_type: {
|
|
||||||
type: DataTypes.ENUM,
|
type: DataTypes.ENUM,
|
||||||
|
|
||||||
values: ['BPV', 'JV', 'RV', 'CPV'],
|
values: ['Filed', 'InProgress'],
|
||||||
},
|
},
|
||||||
|
|
||||||
Amount: {
|
cash_balance: {
|
||||||
|
type: DataTypes.BOOLEAN,
|
||||||
|
|
||||||
|
allowNull: false,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
payment_date: {
|
||||||
|
type: DataTypes.DATE,
|
||||||
|
},
|
||||||
|
|
||||||
|
amount: {
|
||||||
type: DataTypes.DECIMAL,
|
type: DataTypes.DECIMAL,
|
||||||
},
|
},
|
||||||
|
|
||||||
project_code: {
|
shelf_number: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
|
||||||
document_status: {
|
approved_by: {
|
||||||
type: DataTypes.ENUM,
|
|
||||||
|
|
||||||
values: ['Approved', 'Complete', 'On progress', 'Filled'],
|
|
||||||
},
|
|
||||||
|
|
||||||
shelf_number: {
|
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -86,6 +83,14 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
|
|
||||||
//end loop
|
//end loop
|
||||||
|
|
||||||
|
db.documents.belongsTo(db.projects, {
|
||||||
|
as: 'project',
|
||||||
|
foreignKey: {
|
||||||
|
name: 'projectId',
|
||||||
|
},
|
||||||
|
constraints: false,
|
||||||
|
});
|
||||||
|
|
||||||
db.documents.belongsTo(db.organizations, {
|
db.documents.belongsTo(db.organizations, {
|
||||||
as: 'organizations',
|
as: 'organizations',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
|||||||
@ -44,6 +44,14 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
projects.associate = (db) => {
|
projects.associate = (db) => {
|
||||||
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
|
/// 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, {
|
db.projects.hasMany(db.field_site_payment_requisitions, {
|
||||||
as: 'field_site_payment_requisitions_project',
|
as: 'field_site_payment_requisitions_project',
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
|||||||
@ -118,8 +118,6 @@ module.exports = {
|
|||||||
'projects',
|
'projects',
|
||||||
'roles',
|
'roles',
|
||||||
'permissions',
|
'permissions',
|
||||||
'departments',
|
|
||||||
'places',
|
|
||||||
'organizations',
|
'organizations',
|
||||||
,
|
,
|
||||||
];
|
];
|
||||||
@ -797,56 +795,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('DELETE_PROJECTS'),
|
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,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
@ -1022,56 +970,6 @@ primary key ("roles_permissionsId", "permissionId")
|
|||||||
permissionId: getId('DELETE_PERMISSIONS'),
|
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,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
|||||||
@ -9,77 +9,131 @@ const Payments = db.payments;
|
|||||||
|
|
||||||
const Projects = db.projects;
|
const Projects = db.projects;
|
||||||
|
|
||||||
|
const Organizations = db.organizations;
|
||||||
|
|
||||||
const Departments = db.departments;
|
const Departments = db.departments;
|
||||||
|
|
||||||
const Places = db.places;
|
const Places = db.places;
|
||||||
|
|
||||||
const Organizations = db.organizations;
|
|
||||||
|
|
||||||
const DocumentsData = [
|
const DocumentsData = [
|
||||||
{
|
{
|
||||||
// type code here for "relation_one" field
|
|
||||||
|
|
||||||
nameofemployee_organization: 'Sheldon Glashow',
|
|
||||||
|
|
||||||
document_number: 'DOC001',
|
document_number: 'DOC001',
|
||||||
|
|
||||||
description: 'Richard Feynman',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
date: new Date(Date.now()),
|
document_type: 'RV',
|
||||||
|
|
||||||
payment_type: 'JV',
|
prepared_by: 'jdoe',
|
||||||
|
|
||||||
Amount: 13.65,
|
status: 'InProgress',
|
||||||
|
|
||||||
project_code: 'Noam Chomsky',
|
cash_balance: true,
|
||||||
|
|
||||||
document_status: 'Approved',
|
payment_date: new Date('2023-10-01T10:00:00Z'),
|
||||||
|
|
||||||
|
amount: 1000,
|
||||||
|
|
||||||
shelf_number: 'S001',
|
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',
|
document_number: 'DOC002',
|
||||||
|
|
||||||
description: 'Trofim Lysenko',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
date: new Date(Date.now()),
|
document_type: 'BPV',
|
||||||
|
|
||||||
payment_type: 'BPV',
|
prepared_by: 'asmith',
|
||||||
|
|
||||||
Amount: 84.59,
|
status: 'InProgress',
|
||||||
|
|
||||||
project_code: 'Carl Linnaeus',
|
cash_balance: false,
|
||||||
|
|
||||||
document_status: 'Complete',
|
payment_date: new Date('2023-10-02T11:00:00Z'),
|
||||||
|
|
||||||
|
amount: 2000,
|
||||||
|
|
||||||
shelf_number: 'S002',
|
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',
|
document_number: 'DOC003',
|
||||||
|
|
||||||
description: 'Francis Galton',
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
date: new Date(Date.now()),
|
document_type: 'JV',
|
||||||
|
|
||||||
payment_type: 'CPV',
|
prepared_by: 'bwhite',
|
||||||
|
|
||||||
Amount: 16.57,
|
status: 'InProgress',
|
||||||
|
|
||||||
project_code: 'Konrad Lorenz',
|
cash_balance: true,
|
||||||
|
|
||||||
document_status: 'Filled',
|
payment_date: new Date('2023-10-03T12:00:00Z'),
|
||||||
|
|
||||||
|
amount: 1500,
|
||||||
|
|
||||||
shelf_number: 'S003',
|
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: 'Filed',
|
||||||
|
|
||||||
|
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: 'Filed',
|
||||||
|
|
||||||
|
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
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -103,7 +157,7 @@ const FieldSitePaymentRequisitionsData = [
|
|||||||
|
|
||||||
requested_amount: 5000,
|
requested_amount: 5000,
|
||||||
|
|
||||||
payment_type: 'RV',
|
payment_type: 'BPV',
|
||||||
|
|
||||||
status: 'Paid',
|
status: 'Paid',
|
||||||
|
|
||||||
@ -169,7 +223,7 @@ const FieldSitePaymentRequisitionsData = [
|
|||||||
|
|
||||||
payment_type: 'BPV',
|
payment_type: 'BPV',
|
||||||
|
|
||||||
status: 'Approved',
|
status: 'Pending',
|
||||||
|
|
||||||
requester: 'bwhite',
|
requester: 'bwhite',
|
||||||
|
|
||||||
@ -179,6 +233,70 @@ const FieldSitePaymentRequisitionsData = [
|
|||||||
|
|
||||||
// type code here for "relation_one" field
|
// 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'),
|
||||||
|
|
||||||
|
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: 'Approved',
|
||||||
|
|
||||||
|
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'),
|
||||||
|
|
||||||
|
return_date: new Date('2023-10-15T22:00:00Z'),
|
||||||
|
|
||||||
|
requisition_date: new Date('2023-09-29T13:00:00Z'),
|
||||||
|
|
||||||
|
requested_amount: 9000,
|
||||||
|
|
||||||
|
payment_type: 'RV',
|
||||||
|
|
||||||
|
status: 'Pending',
|
||||||
|
|
||||||
|
requester: 'dblack',
|
||||||
|
|
||||||
|
approver: 'jdoe',
|
||||||
|
|
||||||
|
due_date: new Date('2023-10-19T21:00:00Z'),
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const PaymentsData = [
|
const PaymentsData = [
|
||||||
@ -189,7 +307,7 @@ const PaymentsData = [
|
|||||||
|
|
||||||
amount: 500,
|
amount: 500,
|
||||||
|
|
||||||
payment_type: 'Subtraction',
|
payment_type: 'Addition',
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
@ -213,6 +331,30 @@ const PaymentsData = [
|
|||||||
|
|
||||||
amount: 750,
|
amount: 750,
|
||||||
|
|
||||||
|
payment_type: 'Addition',
|
||||||
|
|
||||||
|
// 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: 'Subtraction',
|
||||||
|
|
||||||
|
// 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',
|
payment_type: 'Subtraction',
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
@ -225,7 +367,7 @@ const ProjectsData = [
|
|||||||
|
|
||||||
code: 'PA001',
|
code: 'PA001',
|
||||||
|
|
||||||
type: 'Other',
|
type: 'CDC',
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
@ -237,7 +379,7 @@ const ProjectsData = [
|
|||||||
|
|
||||||
code: 'PB002',
|
code: 'PB002',
|
||||||
|
|
||||||
type: 'Other',
|
type: 'MOH',
|
||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
@ -255,6 +397,52 @@ const ProjectsData = [
|
|||||||
|
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Project Delta',
|
||||||
|
|
||||||
|
code: 'PD004',
|
||||||
|
|
||||||
|
type: 'CDC',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Project Epsilon',
|
||||||
|
|
||||||
|
code: 'PE005',
|
||||||
|
|
||||||
|
type: 'Other',
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const OrganizationsData = [
|
||||||
|
{
|
||||||
|
name: 'Global Finance Inc.',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Legal Solutions Ltd.',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Financial Services Group',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Corporate Finance Co.',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Investment Partners',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const DepartmentsData = [
|
const DepartmentsData = [
|
||||||
@ -269,6 +457,14 @@ const DepartmentsData = [
|
|||||||
{
|
{
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// type code here for "relation_one" field
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const PlacesData = [
|
const PlacesData = [
|
||||||
@ -283,19 +479,13 @@ const PlacesData = [
|
|||||||
{
|
{
|
||||||
// type code here for "relation_one" field
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
];
|
|
||||||
|
|
||||||
const OrganizationsData = [
|
|
||||||
{
|
{
|
||||||
name: 'Global Finance Inc.',
|
// type code here for "relation_one" field
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'Legal Solutions Ltd.',
|
// type code here for "relation_one" field
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'Financial Services Group',
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -334,6 +524,85 @@ async function associateUserWithOrganization() {
|
|||||||
if (User2?.setOrganization) {
|
if (User2?.setOrganization) {
|
||||||
await User2.setOrganization(relatedOrganization2);
|
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() {
|
async function associateDocumentWithOrganization() {
|
||||||
@ -369,6 +638,28 @@ async function associateDocumentWithOrganization() {
|
|||||||
if (Document2?.setOrganization) {
|
if (Document2?.setOrganization) {
|
||||||
await Document2.setOrganization(relatedOrganization2);
|
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() {
|
async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||||
@ -407,6 +698,30 @@ async function associateFieldSitePaymentRequisitionWithOrganization() {
|
|||||||
if (FieldSitePaymentRequisition2?.setOrganization) {
|
if (FieldSitePaymentRequisition2?.setOrganization) {
|
||||||
await FieldSitePaymentRequisition2.setOrganization(relatedOrganization2);
|
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() {
|
async function associateFieldSitePaymentRequisitionWithProject() {
|
||||||
@ -445,6 +760,30 @@ async function associateFieldSitePaymentRequisitionWithProject() {
|
|||||||
if (FieldSitePaymentRequisition2?.setProject) {
|
if (FieldSitePaymentRequisition2?.setProject) {
|
||||||
await FieldSitePaymentRequisition2.setProject(relatedProject2);
|
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() {
|
async function associateFieldSitePaymentRequisitionWithOrganization() {
|
||||||
@ -483,6 +822,30 @@ async function associateFieldSitePaymentRequisitionWithOrganization() {
|
|||||||
if (FieldSitePaymentRequisition2?.setOrganization) {
|
if (FieldSitePaymentRequisition2?.setOrganization) {
|
||||||
await FieldSitePaymentRequisition2.setOrganization(relatedOrganization2);
|
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() {
|
async function associatePaymentWithDocument() {
|
||||||
@ -518,6 +881,28 @@ async function associatePaymentWithDocument() {
|
|||||||
if (Payment2?.setDocument) {
|
if (Payment2?.setDocument) {
|
||||||
await Payment2.setDocument(relatedDocument2);
|
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() {
|
async function associatePaymentWithOrganization() {
|
||||||
@ -553,40 +938,27 @@ async function associatePaymentWithOrganization() {
|
|||||||
if (Payment2?.setOrganization) {
|
if (Payment2?.setOrganization) {
|
||||||
await Payment2.setOrganization(relatedOrganization2);
|
await Payment2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async function associateProjectWithOrganization() {
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
const relatedOrganization0 = await Organizations.findOne({
|
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Project0 = await Projects.findOne({
|
const Payment3 = await Payments.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 0,
|
offset: 3,
|
||||||
});
|
});
|
||||||
if (Project0?.setOrganization) {
|
if (Payment3?.setOrganization) {
|
||||||
await Project0.setOrganization(relatedOrganization0);
|
await Payment3.setOrganization(relatedOrganization3);
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedOrganization1 = await Organizations.findOne({
|
const relatedOrganization4 = await Organizations.findOne({
|
||||||
offset: Math.floor(Math.random() * (await Organizations.count())),
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
});
|
});
|
||||||
const Project1 = await Projects.findOne({
|
const Payment4 = await Payments.findOne({
|
||||||
order: [['id', 'ASC']],
|
order: [['id', 'ASC']],
|
||||||
offset: 1,
|
offset: 4,
|
||||||
});
|
});
|
||||||
if (Project1?.setOrganization) {
|
if (Payment4?.setOrganization) {
|
||||||
await Project1.setOrganization(relatedOrganization1);
|
await Payment4.setOrganization(relatedOrganization4);
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,6 +995,85 @@ async function associateProjectWithOrganization() {
|
|||||||
if (Project2?.setOrganization) {
|
if (Project2?.setOrganization) {
|
||||||
await Project2.setOrganization(relatedOrganization2);
|
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() {
|
||||||
|
const relatedOrganization0 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Project0 = await Projects.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 0,
|
||||||
|
});
|
||||||
|
if (Project0?.setOrganization) {
|
||||||
|
await Project0.setOrganization(relatedOrganization0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization1 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Project1 = await Projects.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 1,
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 associateDepartmentWithOrganization() {
|
async function associateDepartmentWithOrganization() {
|
||||||
@ -658,6 +1109,28 @@ async function associateDepartmentWithOrganization() {
|
|||||||
if (Department2?.setOrganization) {
|
if (Department2?.setOrganization) {
|
||||||
await Department2.setOrganization(relatedOrganization2);
|
await Department2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Department3 = await Departments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Department3?.setOrganization) {
|
||||||
|
await Department3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization4 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Department4 = await Departments.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 4,
|
||||||
|
});
|
||||||
|
if (Department4?.setOrganization) {
|
||||||
|
await Department4.setOrganization(relatedOrganization4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function associatePlaceWithOrganization() {
|
async function associatePlaceWithOrganization() {
|
||||||
@ -693,6 +1166,28 @@ async function associatePlaceWithOrganization() {
|
|||||||
if (Place2?.setOrganization) {
|
if (Place2?.setOrganization) {
|
||||||
await Place2.setOrganization(relatedOrganization2);
|
await Place2.setOrganization(relatedOrganization2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const relatedOrganization3 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Place3 = await Places.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 3,
|
||||||
|
});
|
||||||
|
if (Place3?.setOrganization) {
|
||||||
|
await Place3.setOrganization(relatedOrganization3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const relatedOrganization4 = await Organizations.findOne({
|
||||||
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
||||||
|
});
|
||||||
|
const Place4 = await Places.findOne({
|
||||||
|
order: [['id', 'ASC']],
|
||||||
|
offset: 4,
|
||||||
|
});
|
||||||
|
if (Place4?.setOrganization) {
|
||||||
|
await Place4.setOrganization(relatedOrganization4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -707,17 +1202,19 @@ module.exports = {
|
|||||||
|
|
||||||
await Projects.bulkCreate(ProjectsData);
|
await Projects.bulkCreate(ProjectsData);
|
||||||
|
|
||||||
|
await Organizations.bulkCreate(OrganizationsData);
|
||||||
|
|
||||||
await Departments.bulkCreate(DepartmentsData);
|
await Departments.bulkCreate(DepartmentsData);
|
||||||
|
|
||||||
await Places.bulkCreate(PlacesData);
|
await Places.bulkCreate(PlacesData);
|
||||||
|
|
||||||
await Organizations.bulkCreate(OrganizationsData);
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
// Similar logic for "relation_many"
|
// Similar logic for "relation_many"
|
||||||
|
|
||||||
await associateUserWithOrganization(),
|
await associateUserWithOrganization(),
|
||||||
|
|
||||||
|
await associateDocumentWithProject(),
|
||||||
|
|
||||||
await associateDocumentWithOrganization(),
|
await associateDocumentWithOrganization(),
|
||||||
|
|
||||||
await associateFieldSitePaymentRequisitionWithOrganization(),
|
await associateFieldSitePaymentRequisitionWithOrganization(),
|
||||||
@ -753,10 +1250,10 @@ module.exports = {
|
|||||||
|
|
||||||
await queryInterface.bulkDelete('projects', null, {});
|
await queryInterface.bulkDelete('projects', null, {});
|
||||||
|
|
||||||
|
await queryInterface.bulkDelete('organizations', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('departments', null, {});
|
await queryInterface.bulkDelete('departments', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('places', null, {});
|
await queryInterface.bulkDelete('places', null, {});
|
||||||
|
|
||||||
await queryInterface.bulkDelete('organizations', null, {});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,87 +0,0 @@
|
|||||||
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,10 +35,6 @@ const rolesRoutes = require('./routes/roles');
|
|||||||
|
|
||||||
const permissionsRoutes = require('./routes/permissions');
|
const permissionsRoutes = require('./routes/permissions');
|
||||||
|
|
||||||
const departmentsRoutes = require('./routes/departments');
|
|
||||||
|
|
||||||
const placesRoutes = require('./routes/places');
|
|
||||||
|
|
||||||
const organizationsRoutes = require('./routes/organizations');
|
const organizationsRoutes = require('./routes/organizations');
|
||||||
|
|
||||||
const getBaseUrl = (url) => {
|
const getBaseUrl = (url) => {
|
||||||
@ -148,18 +144,6 @@ app.use(
|
|||||||
permissionsRoutes,
|
permissionsRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/departments',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
departmentsRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
|
||||||
'/api/places',
|
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
placesRoutes,
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/organizations',
|
'/api/organizations',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
|||||||
@ -22,23 +22,20 @@ router.use(checkCrudPermissions('documents'));
|
|||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
|
|
||||||
* nameofemployee_organization:
|
|
||||||
* type: string
|
|
||||||
* default: nameofemployee_organization
|
|
||||||
* document_number:
|
* document_number:
|
||||||
* type: string
|
* type: string
|
||||||
* default: document_number
|
* default: document_number
|
||||||
* description:
|
* prepared_by:
|
||||||
* type: string
|
* type: string
|
||||||
* default: description
|
* default: prepared_by
|
||||||
* project_code:
|
|
||||||
* type: string
|
|
||||||
* default: project_code
|
|
||||||
* shelf_number:
|
* shelf_number:
|
||||||
* type: string
|
* type: string
|
||||||
* default: shelf_number
|
* default: shelf_number
|
||||||
|
* approved_by:
|
||||||
|
* type: string
|
||||||
|
* default: approved_by
|
||||||
|
|
||||||
* Amount:
|
* amount:
|
||||||
* type: integer
|
* type: integer
|
||||||
* format: int64
|
* format: int64
|
||||||
|
|
||||||
@ -330,15 +327,13 @@ router.get(
|
|||||||
if (filetype && filetype === 'csv') {
|
if (filetype && filetype === 'csv') {
|
||||||
const fields = [
|
const fields = [
|
||||||
'id',
|
'id',
|
||||||
'nameofemployee_organization',
|
|
||||||
'document_number',
|
'document_number',
|
||||||
'description',
|
'prepared_by',
|
||||||
'project_code',
|
|
||||||
'shelf_number',
|
'shelf_number',
|
||||||
|
'approved_by',
|
||||||
|
|
||||||
'Amount',
|
'amount',
|
||||||
|
'payment_date',
|
||||||
'date',
|
|
||||||
];
|
];
|
||||||
const opts = { fields };
|
const opts = { fields };
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -44,15 +44,13 @@ module.exports = class SearchService {
|
|||||||
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
users: ['firstName', 'lastName', 'phoneNumber', 'email'],
|
||||||
|
|
||||||
documents: [
|
documents: [
|
||||||
'nameofemployee_organization',
|
|
||||||
|
|
||||||
'document_number',
|
'document_number',
|
||||||
|
|
||||||
'description',
|
'prepared_by',
|
||||||
|
|
||||||
'project_code',
|
|
||||||
|
|
||||||
'shelf_number',
|
'shelf_number',
|
||||||
|
|
||||||
|
'approved_by',
|
||||||
],
|
],
|
||||||
|
|
||||||
field_site_payment_requisitions: [
|
field_site_payment_requisitions: [
|
||||||
@ -62,6 +60,8 @@ module.exports = class SearchService {
|
|||||||
|
|
||||||
'departure_place',
|
'departure_place',
|
||||||
|
|
||||||
|
'arrival_place',
|
||||||
|
|
||||||
'requester',
|
'requester',
|
||||||
|
|
||||||
'approver',
|
'approver',
|
||||||
@ -72,7 +72,7 @@ module.exports = class SearchService {
|
|||||||
organizations: ['name'],
|
organizations: ['name'],
|
||||||
};
|
};
|
||||||
const columnsInt = {
|
const columnsInt = {
|
||||||
documents: ['Amount'],
|
documents: ['amount'],
|
||||||
|
|
||||||
field_site_payment_requisitions: ['requested_amount'],
|
field_site_payment_requisitions: ['requested_amount'],
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ const CardDocuments = ({
|
|||||||
href={`/documents/documents-view/?id=${item.id}`}
|
href={`/documents/documents-view/?id=${item.id}`}
|
||||||
className='text-lg font-bold leading-6 line-clamp-1'
|
className='text-lg font-bold leading-6 line-clamp-1'
|
||||||
>
|
>
|
||||||
{item.id}
|
{item.document_number}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className='ml-auto '>
|
<div className='ml-auto '>
|
||||||
@ -78,31 +78,7 @@ 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'>
|
<dl className='divide-y divide-stone-300 dark:divide-dark-700 px-6 py-4 text-sm leading-6 h-64 overflow-y-auto'>
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
organizations
|
DocumentNumber
|
||||||
</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>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
@ -113,31 +89,66 @@ const CardDocuments = ({
|
|||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
Description
|
Project
|
||||||
</dt>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
{item.description}
|
{dataFormatter.projectsOneListFormatter(item.project)}
|
||||||
</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>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
Payment Type
|
DocumentType
|
||||||
</dt>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
{item.payment_type}
|
{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)}
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
@ -148,36 +159,14 @@ const CardDocuments = ({
|
|||||||
</dt>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
{item.Amount}
|
{item.amount}
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
Project Code
|
ShelfNumber
|
||||||
</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>
|
</dt>
|
||||||
<dd className='flex items-start gap-x-2'>
|
<dd className='flex items-start gap-x-2'>
|
||||||
<div className='font-medium line-clamp-4'>
|
<div className='font-medium line-clamp-4'>
|
||||||
@ -185,6 +174,17 @@ const CardDocuments = ({
|
|||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
|
ApprovedBy
|
||||||
|
</dt>
|
||||||
|
<dd className='flex items-start gap-x-2'>
|
||||||
|
<div className='font-medium line-clamp-4'>
|
||||||
|
{item.approved_by}
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -55,69 +55,61 @@ const ListDocuments = ({
|
|||||||
>
|
>
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>
|
<p className={'text-xs text-gray-500 '}>
|
||||||
organizations
|
DocumentNumber
|
||||||
</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>
|
||||||
<p className={'line-clamp-2'}>{item.document_number}</p>
|
<p className={'line-clamp-2'}>{item.document_number}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Description</p>
|
<p className={'text-xs text-gray-500 '}>Project</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'}>
|
<p className={'line-clamp-2'}>
|
||||||
{dataFormatter.dateFormatter(item.date)}
|
{dataFormatter.projectsOneListFormatter(item.project)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Payment Type</p>
|
<p className={'text-xs text-gray-500 '}>DocumentType</p>
|
||||||
<p className={'line-clamp-2'}>{item.payment_type}</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Amount</p>
|
<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>
|
||||||
|
|
||||||
<div className={'flex-1 px-3'}>
|
<div className={'flex-1 px-3'}>
|
||||||
<p className={'text-xs text-gray-500 '}>Project Code</p>
|
<p className={'text-xs text-gray-500 '}>ShelfNumber</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>
|
<p className={'line-clamp-2'}>{item.shelf_number}</p>
|
||||||
</div>
|
</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>
|
</Link>
|
||||||
<ListActionsPopover
|
<ListActionsPopover
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
|
|||||||
@ -39,8 +39,20 @@ export const loadColumns = async (
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
field: 'organizations',
|
field: 'document_number',
|
||||||
headerName: 'organizations',
|
headerName: 'DocumentNumber',
|
||||||
|
flex: 1,
|
||||||
|
minWidth: 120,
|
||||||
|
filterable: false,
|
||||||
|
headerClassName: 'datagrid--header',
|
||||||
|
cellClassName: 'datagrid--cell',
|
||||||
|
|
||||||
|
editable: hasUpdatePermission,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
field: 'project',
|
||||||
|
headerName: 'Project',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -53,14 +65,14 @@ export const loadColumns = async (
|
|||||||
type: 'singleSelect',
|
type: 'singleSelect',
|
||||||
getOptionValue: (value: any) => value?.id,
|
getOptionValue: (value: any) => value?.id,
|
||||||
getOptionLabel: (value: any) => value?.label,
|
getOptionLabel: (value: any) => value?.label,
|
||||||
valueOptions: await callOptionsApi('organizations'),
|
valueOptions: await callOptionsApi('projects'),
|
||||||
valueGetter: (params: GridValueGetterParams) =>
|
valueGetter: (params: GridValueGetterParams) =>
|
||||||
params?.value?.id ?? params?.value,
|
params?.value?.id ?? params?.value,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'nameofemployee_organization',
|
field: 'document_type',
|
||||||
headerName: 'Nameofemployee Organization',
|
headerName: 'DocumentType',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -71,8 +83,8 @@ export const loadColumns = async (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'document_number',
|
field: 'prepared_by',
|
||||||
headerName: 'Document Number',
|
headerName: 'PreparedBy',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -83,8 +95,8 @@ export const loadColumns = async (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'description',
|
field: 'status',
|
||||||
headerName: 'Description',
|
headerName: 'Status',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -95,8 +107,8 @@ export const loadColumns = async (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'date',
|
field: 'cash_balance',
|
||||||
headerName: 'Date',
|
headerName: 'CashBalance',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -105,13 +117,12 @@ export const loadColumns = async (
|
|||||||
|
|
||||||
editable: hasUpdatePermission,
|
editable: hasUpdatePermission,
|
||||||
|
|
||||||
type: 'date',
|
type: 'boolean',
|
||||||
valueGetter: (params: GridValueGetterParams) => new Date(params.row.date),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'payment_type',
|
field: 'payment_date',
|
||||||
headerName: 'Payment Type',
|
headerName: 'PaymentDate',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
@ -119,10 +130,14 @@ export const loadColumns = async (
|
|||||||
cellClassName: 'datagrid--cell',
|
cellClassName: 'datagrid--cell',
|
||||||
|
|
||||||
editable: hasUpdatePermission,
|
editable: hasUpdatePermission,
|
||||||
|
|
||||||
|
type: 'dateTime',
|
||||||
|
valueGetter: (params: GridValueGetterParams) =>
|
||||||
|
new Date(params.row.payment_date),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'Amount',
|
field: 'amount',
|
||||||
headerName: 'Amount',
|
headerName: 'Amount',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
@ -135,33 +150,21 @@ export const loadColumns = async (
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
field: 'project_code',
|
|
||||||
headerName: 'Project Code',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: hasUpdatePermission,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
field: 'document_status',
|
|
||||||
headerName: 'Document Status',
|
|
||||||
flex: 1,
|
|
||||||
minWidth: 120,
|
|
||||||
filterable: false,
|
|
||||||
headerClassName: 'datagrid--header',
|
|
||||||
cellClassName: 'datagrid--cell',
|
|
||||||
|
|
||||||
editable: hasUpdatePermission,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'shelf_number',
|
field: 'shelf_number',
|
||||||
headerName: 'Shelf Number',
|
headerName: 'ShelfNumber',
|
||||||
|
flex: 1,
|
||||||
|
minWidth: 120,
|
||||||
|
filterable: false,
|
||||||
|
headerClassName: 'datagrid--header',
|
||||||
|
cellClassName: 'datagrid--cell',
|
||||||
|
|
||||||
|
editable: hasUpdatePermission,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
field: 'approved_by',
|
||||||
|
headerName: 'ApprovedBy',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
|
|||||||
@ -65,7 +65,7 @@ const CardField_site_payment_requisitions = ({
|
|||||||
href={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${item.id}`}
|
href={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${item.id}`}
|
||||||
className='text-lg font-bold leading-6 line-clamp-1'
|
className='text-lg font-bold leading-6 line-clamp-1'
|
||||||
>
|
>
|
||||||
{item.employee_name}
|
{item.id}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className='ml-auto '>
|
<div className='ml-auto '>
|
||||||
@ -147,17 +147,6 @@ const CardField_site_payment_requisitions = ({
|
|||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
|
||||||
ArrivalPlace
|
|
||||||
</dt>
|
|
||||||
<dd className='flex items-start gap-x-2'>
|
|
||||||
<div className='font-medium line-clamp-4'>
|
|
||||||
{item.arrival_place}
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='flex justify-between gap-x-4 py-3'>
|
<div className='flex justify-between gap-x-4 py-3'>
|
||||||
<dt className=' text-gray-500 dark:text-dark-600'>
|
<dt className=' text-gray-500 dark:text-dark-600'>
|
||||||
ReturnDate
|
ReturnDate
|
||||||
|
|||||||
@ -157,7 +157,7 @@ const ListField_site_payment_requisitions = ({
|
|||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
itemId={item.id}
|
itemId={item.id}
|
||||||
pathEdit={`/field_site_payment_requisitions/field_site_payment_requisitions-edit/?id=${item.id}`}
|
pathEdit={`/field_site_payment_requisitions/field_site_payment_requisitions-edit/?id=${item.id}`}
|
||||||
pathView={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${item.id}`}
|
pathEdit={`/field_site_payment_requisitions/${item.id}/edit`}
|
||||||
hasUpdatePermission={hasUpdatePermission}
|
hasUpdatePermission={hasUpdatePermission}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -471,6 +471,8 @@ const TableSampleField_site_payment_requisitions = ({
|
|||||||
|
|
||||||
{dataGrid}
|
{dataGrid}
|
||||||
|
|
||||||
|
{showGrid && dataGrid}
|
||||||
|
|
||||||
{selectedRows.length > 0 &&
|
{selectedRows.length > 0 &&
|
||||||
createPortal(
|
createPortal(
|
||||||
<BaseButton
|
<BaseButton
|
||||||
|
|||||||
@ -266,12 +266,12 @@ export const loadColumns = async (
|
|||||||
<div key={params?.row?.id}>
|
<div key={params?.row?.id}>
|
||||||
<ListActionsPopover
|
<ListActionsPopover
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
itemId={params?.row?.id}
|
itemId={params.row.id}
|
||||||
pathEdit={`/field_site_payment_requisitions/field_site_payment_requisitions-edit/?id=${params?.row?.id}`}
|
pathEdit={`/field_site_payment_requisitions/${params.row.id}`}
|
||||||
pathView={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${params?.row?.id}`}
|
pathView={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${params.row.id}`}
|
||||||
hasUpdatePermission={hasUpdatePermission}
|
hasUpdatePermission={hasUpdatePermission}
|
||||||
/>
|
/>
|
||||||
</div>,
|
</div>
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -65,7 +65,7 @@ const CardOrganizations = ({
|
|||||||
href={`/organizations/organizations-view/?id=${item.id}`}
|
href={`/organizations/organizations-view/?id=${item.id}`}
|
||||||
className='text-lg font-bold leading-6 line-clamp-1'
|
className='text-lg font-bold leading-6 line-clamp-1'
|
||||||
>
|
>
|
||||||
{item.id}
|
{item.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className='ml-auto '>
|
<div className='ml-auto '>
|
||||||
|
|||||||
@ -17,7 +17,7 @@ export default function WebSiteFooter({ projectName }: WebSiteFooterProps) {
|
|||||||
const borders = useAppSelector((state) => state.style.borders);
|
const borders = useAppSelector((state) => state.style.borders);
|
||||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||||
|
|
||||||
const style = FooterStyle.WITH_PAGES;
|
const style = FooterStyle.WITH_PROJECT_NAME;
|
||||||
|
|
||||||
const design = FooterDesigns.DEFAULT_DESIGN;
|
const design = FooterDesigns.DEFAULT_DESIGN;
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
|
|||||||
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
|
||||||
const borders = useAppSelector((state) => state.style.borders);
|
const borders = useAppSelector((state) => state.style.borders);
|
||||||
|
|
||||||
const style = HeaderStyle.PAGES_RIGHT;
|
const style = HeaderStyle.PAGES_LEFT;
|
||||||
|
|
||||||
const design = HeaderDesigns.DESIGN_DIVERSITY;
|
const design = HeaderDesigns.DESIGN_DIVERSITY;
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -41,21 +41,21 @@ export default {
|
|||||||
|
|
||||||
documentsManyListFormatter(val) {
|
documentsManyListFormatter(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => item.id);
|
return val.map((item) => item.document_number);
|
||||||
},
|
},
|
||||||
documentsOneListFormatter(val) {
|
documentsOneListFormatter(val) {
|
||||||
if (!val) return '';
|
if (!val) return '';
|
||||||
return val.id;
|
return val.document_number;
|
||||||
},
|
},
|
||||||
documentsManyListFormatterEdit(val) {
|
documentsManyListFormatterEdit(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => {
|
return val.map((item) => {
|
||||||
return { id: item.id, label: item.id };
|
return { id: item.id, label: item.document_number };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
documentsOneListFormatterEdit(val) {
|
documentsOneListFormatterEdit(val) {
|
||||||
if (!val) return '';
|
if (!val) return '';
|
||||||
return { label: val.id, id: val.id };
|
return { label: val.document_number, id: val.id };
|
||||||
},
|
},
|
||||||
|
|
||||||
projectsManyListFormatter(val) {
|
projectsManyListFormatter(val) {
|
||||||
@ -117,20 +117,20 @@ export default {
|
|||||||
|
|
||||||
organizationsManyListFormatter(val) {
|
organizationsManyListFormatter(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => item.id);
|
return val.map((item) => item.name);
|
||||||
},
|
},
|
||||||
organizationsOneListFormatter(val) {
|
organizationsOneListFormatter(val) {
|
||||||
if (!val) return '';
|
if (!val) return '';
|
||||||
return val.id;
|
return val.name;
|
||||||
},
|
},
|
||||||
organizationsManyListFormatterEdit(val) {
|
organizationsManyListFormatterEdit(val) {
|
||||||
if (!val || !val.length) return [];
|
if (!val || !val.length) return [];
|
||||||
return val.map((item) => {
|
return val.map((item) => {
|
||||||
return { id: item.id, label: item.id };
|
return { id: item.id, label: item.name };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
organizationsOneListFormatterEdit(val) {
|
organizationsOneListFormatterEdit(val) {
|
||||||
if (!val) return '';
|
if (!val) return '';
|
||||||
return { label: val.id, id: val.id };
|
return { label: val.name, id: val.id };
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -76,22 +76,6 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
icon: icon.mdiShieldAccountOutline ?? icon.mdiTable,
|
||||||
permissions: 'READ_PERMISSIONS',
|
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',
|
href: '/organizations/organizations-list',
|
||||||
label: 'Organizations',
|
label: 'Organizations',
|
||||||
|
|||||||
@ -36,8 +36,6 @@ const Dashboard = () => {
|
|||||||
const [projects, setProjects] = React.useState(loadingMessage);
|
const [projects, setProjects] = React.useState(loadingMessage);
|
||||||
const [roles, setRoles] = React.useState(loadingMessage);
|
const [roles, setRoles] = React.useState(loadingMessage);
|
||||||
const [permissions, setPermissions] = 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 [organizations, setOrganizations] = React.useState(loadingMessage);
|
||||||
|
|
||||||
const [widgetsRole, setWidgetsRole] = React.useState({
|
const [widgetsRole, setWidgetsRole] = React.useState({
|
||||||
@ -59,8 +57,6 @@ const Dashboard = () => {
|
|||||||
'projects',
|
'projects',
|
||||||
'roles',
|
'roles',
|
||||||
'permissions',
|
'permissions',
|
||||||
'departments',
|
|
||||||
'places',
|
|
||||||
'organizations',
|
'organizations',
|
||||||
];
|
];
|
||||||
const fns = [
|
const fns = [
|
||||||
@ -71,8 +67,6 @@ const Dashboard = () => {
|
|||||||
setProjects,
|
setProjects,
|
||||||
setRoles,
|
setRoles,
|
||||||
setPermissions,
|
setPermissions,
|
||||||
setDepartments,
|
|
||||||
setPlaces,
|
|
||||||
setOrganizations,
|
setOrganizations,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -437,70 +431,6 @@ const Dashboard = () => {
|
|||||||
</Link>
|
</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') && (
|
{hasPermission(currentUser, 'READ_ORGANIZATIONS') && (
|
||||||
<Link href={'/organizations/organizations-list'}>
|
<Link href={'/organizations/organizations-list'}>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -1,137 +0,0 @@
|
|||||||
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;
|
|
||||||
@ -1,135 +0,0 @@
|
|||||||
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;
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
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,25 +38,27 @@ const EditDocuments = () => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const initVals = {
|
const initVals = {
|
||||||
organizations: null,
|
|
||||||
|
|
||||||
nameofemployee_organization: '',
|
|
||||||
|
|
||||||
document_number: '',
|
document_number: '',
|
||||||
|
|
||||||
description: '',
|
project: null,
|
||||||
|
|
||||||
date: new Date(),
|
document_type: '',
|
||||||
|
|
||||||
payment_type: '',
|
prepared_by: '',
|
||||||
|
|
||||||
Amount: '',
|
status: '',
|
||||||
|
|
||||||
project_code: '',
|
cash_balance: false,
|
||||||
|
|
||||||
document_status: '',
|
payment_date: new Date(),
|
||||||
|
|
||||||
|
amount: '',
|
||||||
|
|
||||||
shelf_number: '',
|
shelf_number: '',
|
||||||
|
|
||||||
|
approved_by: '',
|
||||||
|
|
||||||
|
organizations: null,
|
||||||
};
|
};
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
const [initialValues, setInitialValues] = useState(initVals);
|
||||||
|
|
||||||
@ -113,6 +115,86 @@ const EditDocuments = () => {
|
|||||||
onSubmit={(values) => handleSubmit(values)}
|
onSubmit={(values) => handleSubmit(values)}
|
||||||
>
|
>
|
||||||
<Form>
|
<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'>
|
<FormField label='organizations' labelFor='organizations'>
|
||||||
<Field
|
<Field
|
||||||
name='organizations'
|
name='organizations'
|
||||||
@ -120,81 +202,10 @@ const EditDocuments = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</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 />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -38,25 +38,27 @@ const EditDocumentsPage = () => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const initVals = {
|
const initVals = {
|
||||||
organizations: null,
|
|
||||||
|
|
||||||
nameofemployee_organization: '',
|
|
||||||
|
|
||||||
document_number: '',
|
document_number: '',
|
||||||
|
|
||||||
description: '',
|
project: null,
|
||||||
|
|
||||||
date: new Date(),
|
document_type: '',
|
||||||
|
|
||||||
payment_type: '',
|
prepared_by: '',
|
||||||
|
|
||||||
Amount: '',
|
status: '',
|
||||||
|
|
||||||
project_code: '',
|
cash_balance: false,
|
||||||
|
|
||||||
document_status: '',
|
payment_date: new Date(),
|
||||||
|
|
||||||
|
amount: '',
|
||||||
|
|
||||||
shelf_number: '',
|
shelf_number: '',
|
||||||
|
|
||||||
|
approved_by: '',
|
||||||
|
|
||||||
|
organizations: null,
|
||||||
};
|
};
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
const [initialValues, setInitialValues] = useState(initVals);
|
||||||
|
|
||||||
@ -111,6 +113,86 @@ const EditDocumentsPage = () => {
|
|||||||
onSubmit={(values) => handleSubmit(values)}
|
onSubmit={(values) => handleSubmit(values)}
|
||||||
>
|
>
|
||||||
<Form>
|
<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'>
|
<FormField label='organizations' labelFor='organizations'>
|
||||||
<Field
|
<Field
|
||||||
name='organizations'
|
name='organizations'
|
||||||
@ -118,81 +200,10 @@ const EditDocumentsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</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 />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -29,28 +29,27 @@ const DocumentsTablesPage = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([
|
||||||
{
|
{ label: 'DocumentNumber', title: 'document_number' },
|
||||||
label: 'Nameofemployee Organization',
|
{ label: 'PreparedBy', title: 'prepared_by' },
|
||||||
title: 'nameofemployee_organization',
|
{ label: 'ShelfNumber', title: 'shelf_number' },
|
||||||
},
|
{ label: 'ApprovedBy', title: 'approved_by' },
|
||||||
{ 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: 'Amount', title: 'amount', number: 'true' },
|
||||||
|
{ label: 'PaymentDate', title: 'payment_date', date: 'true' },
|
||||||
|
|
||||||
|
{ label: 'Project', title: 'project' },
|
||||||
|
|
||||||
{
|
{
|
||||||
label: 'Payment Type',
|
label: 'DocumentType',
|
||||||
title: 'payment_type',
|
title: 'document_type',
|
||||||
type: 'enum',
|
type: 'enum',
|
||||||
options: ['BPV', 'JV', 'RV', 'CPV'],
|
options: ['BPV', 'JV', 'RV'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Document Status',
|
label: 'Status',
|
||||||
title: 'document_status',
|
title: 'status',
|
||||||
type: 'enum',
|
type: 'enum',
|
||||||
options: ['Approved', 'Complete', 'On progress', 'Filled'],
|
options: ['Filed', 'InProgress'],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -33,26 +33,27 @@ import { useRouter } from 'next/router';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
organizations: '',
|
|
||||||
|
|
||||||
nameofemployee_organization: '',
|
|
||||||
|
|
||||||
document_number: '',
|
document_number: '',
|
||||||
|
|
||||||
description: '',
|
project: '',
|
||||||
|
|
||||||
date: '',
|
document_type: 'BPV',
|
||||||
dateDate: '',
|
|
||||||
|
|
||||||
payment_type: 'BPV',
|
prepared_by: '',
|
||||||
|
|
||||||
Amount: '',
|
status: 'Filed',
|
||||||
|
|
||||||
project_code: '',
|
cash_balance: false,
|
||||||
|
|
||||||
document_status: 'Approved',
|
payment_date: '',
|
||||||
|
|
||||||
|
amount: '',
|
||||||
|
|
||||||
shelf_number: '',
|
shelf_number: '',
|
||||||
|
|
||||||
|
approved_by: '',
|
||||||
|
|
||||||
|
organizations: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const DocumentsNew = () => {
|
const DocumentsNew = () => {
|
||||||
@ -82,6 +83,74 @@ const DocumentsNew = () => {
|
|||||||
onSubmit={(values) => handleSubmit(values)}
|
onSubmit={(values) => handleSubmit(values)}
|
||||||
>
|
>
|
||||||
<Form>
|
<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'>
|
<FormField label='organizations' labelFor='organizations'>
|
||||||
<Field
|
<Field
|
||||||
name='organizations'
|
name='organizations'
|
||||||
@ -92,65 +161,6 @@ const DocumentsNew = () => {
|
|||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</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 />
|
<BaseDivider />
|
||||||
<BaseButtons>
|
<BaseButtons>
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
<BaseButton type='submit' color='info' label='Submit' />
|
||||||
|
|||||||
@ -29,28 +29,27 @@ const DocumentsTablesPage = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([
|
||||||
{
|
{ label: 'DocumentNumber', title: 'document_number' },
|
||||||
label: 'Nameofemployee Organization',
|
{ label: 'PreparedBy', title: 'prepared_by' },
|
||||||
title: 'nameofemployee_organization',
|
{ label: 'ShelfNumber', title: 'shelf_number' },
|
||||||
},
|
{ label: 'ApprovedBy', title: 'approved_by' },
|
||||||
{ 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: 'Amount', title: 'amount', number: 'true' },
|
||||||
|
{ label: 'PaymentDate', title: 'payment_date', date: 'true' },
|
||||||
|
|
||||||
|
{ label: 'Project', title: 'project' },
|
||||||
|
|
||||||
{
|
{
|
||||||
label: 'Payment Type',
|
label: 'DocumentType',
|
||||||
title: 'payment_type',
|
title: 'document_type',
|
||||||
type: 'enum',
|
type: 'enum',
|
||||||
options: ['BPV', 'JV', 'RV', 'CPV'],
|
options: ['BPV', 'JV', 'RV'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Document Status',
|
label: 'Status',
|
||||||
title: 'document_status',
|
title: 'status',
|
||||||
type: 'enum',
|
type: 'enum',
|
||||||
options: ['Approved', 'Complete', 'On progress', 'Filled'],
|
options: ['Filed', 'InProgress'],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -59,70 +59,81 @@ const DocumentsView = () => {
|
|||||||
</SectionTitleLineWithButton>
|
</SectionTitleLineWithButton>
|
||||||
<CardBox>
|
<CardBox>
|
||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>organizations</p>
|
<p className={'block font-bold mb-2'}>DocumentNumber</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>
|
<p>{documents?.document_number}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Description</p>
|
<p className={'block font-bold mb-2'}>Project</p>
|
||||||
<p>{documents?.description}</p>
|
|
||||||
|
<p>{documents?.project?.name ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormField label='Date'>
|
<div className={'mb-4'}>
|
||||||
{documents.date ? (
|
<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 ? (
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd'
|
dateFormat='yyyy-MM-dd hh:mm'
|
||||||
showTimeSelect
|
showTimeSelect
|
||||||
selected={
|
selected={
|
||||||
documents.date
|
documents.payment_date
|
||||||
? new Date(dayjs(documents.date).format('YYYY-MM-DD hh:mm'))
|
? new Date(
|
||||||
|
dayjs(documents.payment_date).format(
|
||||||
|
'YYYY-MM-DD hh:mm',
|
||||||
|
),
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<p>No Date</p>
|
<p>No PaymentDate</p>
|
||||||
)}
|
)}
|
||||||
</FormField>
|
</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'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Amount</p>
|
<p className={'block font-bold mb-2'}>Amount</p>
|
||||||
<p>{documents?.Amount || 'No data'}</p>
|
<p>{documents?.amount || 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Project Code</p>
|
<p className={'block font-bold mb-2'}>ShelfNumber</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>
|
<p>{documents?.shelf_number}</p>
|
||||||
</div>
|
</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>
|
<p className={'block font-bold mb-2'}>Payments Document</p>
|
||||||
<CardBox
|
<CardBox
|
||||||
|
|||||||
@ -53,6 +53,8 @@ const EditField_site_payment_requisitions = () => {
|
|||||||
|
|
||||||
departure_date: new Date(),
|
departure_date: new Date(),
|
||||||
|
|
||||||
|
arrival_place: '',
|
||||||
|
|
||||||
return_date: new Date(),
|
return_date: new Date(),
|
||||||
|
|
||||||
requisition_date: new Date(),
|
requisition_date: new Date(),
|
||||||
@ -138,7 +140,7 @@ const EditField_site_payment_requisitions = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organization}
|
options={initialValues.organization}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
)}
|
)}
|
||||||
@ -185,6 +187,10 @@ const EditField_site_payment_requisitions = () => {
|
|||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<FormField label='ArrivalPlace'>
|
||||||
|
<Field name='arrival_place' placeholder='ArrivalPlace' />
|
||||||
|
</FormField>
|
||||||
|
|
||||||
<FormField label='ReturnDate'>
|
<FormField label='ReturnDate'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd hh:mm'
|
||||||
@ -288,7 +294,7 @@ const EditField_site_payment_requisitions = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,8 @@ const EditField_site_payment_requisitionsPage = () => {
|
|||||||
|
|
||||||
departure_date: new Date(),
|
departure_date: new Date(),
|
||||||
|
|
||||||
|
arrival_place: '',
|
||||||
|
|
||||||
return_date: new Date(),
|
return_date: new Date(),
|
||||||
|
|
||||||
requisition_date: new Date(),
|
requisition_date: new Date(),
|
||||||
@ -136,7 +138,7 @@ const EditField_site_payment_requisitionsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organization}
|
options={initialValues.organization}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
)}
|
)}
|
||||||
@ -183,6 +185,10 @@ const EditField_site_payment_requisitionsPage = () => {
|
|||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<FormField label='ArrivalPlace'>
|
||||||
|
<Field name='arrival_place' placeholder='ArrivalPlace' />
|
||||||
|
</FormField>
|
||||||
|
|
||||||
<FormField label='ReturnDate'>
|
<FormField label='ReturnDate'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
dateFormat='yyyy-MM-dd hh:mm'
|
||||||
@ -286,7 +292,7 @@ const EditField_site_payment_requisitionsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,6 @@ const Field_site_payment_requisitionsTablesPage = () => {
|
|||||||
{ label: 'Department', title: 'department' },
|
{ label: 'Department', title: 'department' },
|
||||||
{ label: 'EmployeeName', title: 'employee_name' },
|
{ label: 'EmployeeName', title: 'employee_name' },
|
||||||
{ label: 'DeparturePlace', title: 'departure_place' },
|
{ label: 'DeparturePlace', title: 'departure_place' },
|
||||||
{ label: 'ArrivalPlace', title: 'arrival_place' },
|
|
||||||
{ label: 'Requester', title: 'requester' },
|
{ label: 'Requester', title: 'requester' },
|
||||||
{ label: 'Approver', title: 'approver' },
|
{ label: 'Approver', title: 'approver' },
|
||||||
|
|
||||||
@ -155,6 +154,16 @@ const Field_site_payment_requisitionsTablesPage = () => {
|
|||||||
<div className='md:inline-flex items-center ms-auto'>
|
<div className='md:inline-flex items-center ms-auto'>
|
||||||
<div id='delete-rows-button'></div>
|
<div id='delete-rows-button'></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='md:inline-flex items-center ms-auto'>
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
'/field_site_payment_requisitions/field_site_payment_requisitions-table'
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Switch to Table
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
|
|
||||||
<CardBox className='mb-6' hasTable>
|
<CardBox className='mb-6' hasTable>
|
||||||
|
|||||||
@ -95,15 +95,14 @@ const Field_site_payment_requisitionsNew = () => {
|
|||||||
onSubmit={(values) => handleSubmit(values)}
|
onSubmit={(values) => handleSubmit(values)}
|
||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
<FormField label='Organization' labelFor='organization'>
|
|
||||||
<Field
|
<Field
|
||||||
name='organization'
|
name='organization'
|
||||||
id='organization'
|
id='organization'
|
||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={[]}
|
options={[]}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='Department'>
|
<FormField label='Department'>
|
||||||
<Field name='department' placeholder='Department' />
|
<Field name='department' placeholder='Department' />
|
||||||
|
|||||||
@ -35,7 +35,6 @@ const Field_site_payment_requisitionsTablesPage = () => {
|
|||||||
{ label: 'Department', title: 'department' },
|
{ label: 'Department', title: 'department' },
|
||||||
{ label: 'EmployeeName', title: 'employee_name' },
|
{ label: 'EmployeeName', title: 'employee_name' },
|
||||||
{ label: 'DeparturePlace', title: 'departure_place' },
|
{ label: 'DeparturePlace', title: 'departure_place' },
|
||||||
{ label: 'ArrivalPlace', title: 'arrival_place' },
|
|
||||||
{ label: 'Requester', title: 'requester' },
|
{ label: 'Requester', title: 'requester' },
|
||||||
{ label: 'Approver', title: 'approver' },
|
{ label: 'Approver', title: 'approver' },
|
||||||
|
|
||||||
@ -160,7 +159,7 @@ const Field_site_payment_requisitionsTablesPage = () => {
|
|||||||
'/field_site_payment_requisitions/field_site_payment_requisitions-list'
|
'/field_site_payment_requisitions/field_site_payment_requisitions-list'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Back to <span className='capitalize'>table</span>
|
Back to <span className='capitalize'></span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
|
|||||||
@ -65,7 +65,8 @@ const Field_site_payment_requisitionsView = () => {
|
|||||||
<p className={'block font-bold mb-2'}>Organization</p>
|
<p className={'block font-bold mb-2'}>Organization</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{field_site_payment_requisitions?.organization?.id ?? 'No data'}
|
{field_site_payment_requisitions?.organization?.name ??
|
||||||
|
'No data'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -112,6 +113,11 @@ const Field_site_payment_requisitionsView = () => {
|
|||||||
)}
|
)}
|
||||||
</FormField>
|
</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'>
|
<FormField label='ReturnDate'>
|
||||||
{field_site_payment_requisitions.return_date ? (
|
{field_site_payment_requisitions.return_date ? (
|
||||||
<DatePicker
|
<DatePicker
|
||||||
@ -206,7 +212,8 @@ const Field_site_payment_requisitionsView = () => {
|
|||||||
<p className={'block font-bold mb-2'}>organizations</p>
|
<p className={'block font-bold mb-2'}>organizations</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{field_site_payment_requisitions?.organizations?.id ?? 'No data'}
|
{field_site_payment_requisitions?.organizations?.name ??
|
||||||
|
'No data'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -126,23 +126,23 @@ const OrganizationsView = () => {
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nameofemployee Organization</th>
|
<th>DocumentNumber</th>
|
||||||
|
|
||||||
<th>Document Number</th>
|
<th>DocumentType</th>
|
||||||
|
|
||||||
<th>Description</th>
|
<th>PreparedBy</th>
|
||||||
|
|
||||||
<th>Date</th>
|
<th>Status</th>
|
||||||
|
|
||||||
<th>Payment Type</th>
|
<th>CashBalance</th>
|
||||||
|
|
||||||
|
<th>PaymentDate</th>
|
||||||
|
|
||||||
<th>Amount</th>
|
<th>Amount</th>
|
||||||
|
|
||||||
<th>Project Code</th>
|
<th>ShelfNumber</th>
|
||||||
|
|
||||||
<th>Document Status</th>
|
<th>ApprovedBy</th>
|
||||||
|
|
||||||
<th>Shelf Number</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -157,31 +157,31 @@ const OrganizationsView = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<td data-label='nameofemployee_organization'>
|
|
||||||
{item.nameofemployee_organization}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td data-label='document_number'>
|
<td data-label='document_number'>
|
||||||
{item.document_number}
|
{item.document_number}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td data-label='description'>{item.description}</td>
|
<td data-label='document_type'>
|
||||||
|
{item.document_type}
|
||||||
<td data-label='date'>
|
|
||||||
{dataFormatter.dateFormatter(item.date)}
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td data-label='payment_type'>{item.payment_type}</td>
|
<td data-label='prepared_by'>{item.prepared_by}</td>
|
||||||
|
|
||||||
<td data-label='Amount'>{item.Amount}</td>
|
<td data-label='status'>{item.status}</td>
|
||||||
|
|
||||||
<td data-label='project_code'>{item.project_code}</td>
|
<td data-label='cash_balance'>
|
||||||
|
{dataFormatter.booleanFormatter(item.cash_balance)}
|
||||||
<td data-label='document_status'>
|
|
||||||
{item.document_status}
|
|
||||||
</td>
|
</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='shelf_number'>{item.shelf_number}</td>
|
||||||
|
|
||||||
|
<td data-label='approved_by'>{item.approved_by}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -213,6 +213,8 @@ const OrganizationsView = () => {
|
|||||||
|
|
||||||
<th>DepartureDate</th>
|
<th>DepartureDate</th>
|
||||||
|
|
||||||
|
<th>ArrivalPlace</th>
|
||||||
|
|
||||||
<th>ReturnDate</th>
|
<th>ReturnDate</th>
|
||||||
|
|
||||||
<th>RequisitionDate</th>
|
<th>RequisitionDate</th>
|
||||||
@ -261,6 +263,10 @@ const OrganizationsView = () => {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td data-label='arrival_place'>
|
||||||
|
{item.arrival_place}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td data-label='return_date'>
|
<td data-label='return_date'>
|
||||||
{dataFormatter.dateTimeFormatter(
|
{dataFormatter.dateTimeFormatter(
|
||||||
item.return_date,
|
item.return_date,
|
||||||
@ -321,6 +327,8 @@ const OrganizationsView = () => {
|
|||||||
|
|
||||||
<th>DepartureDate</th>
|
<th>DepartureDate</th>
|
||||||
|
|
||||||
|
<th>ArrivalPlace</th>
|
||||||
|
|
||||||
<th>ReturnDate</th>
|
<th>ReturnDate</th>
|
||||||
|
|
||||||
<th>RequisitionDate</th>
|
<th>RequisitionDate</th>
|
||||||
@ -369,6 +377,10 @@ const OrganizationsView = () => {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td data-label='arrival_place'>
|
||||||
|
{item.arrival_place}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td data-label='return_date'>
|
<td data-label='return_date'>
|
||||||
{dataFormatter.dateTimeFormatter(
|
{dataFormatter.dateTimeFormatter(
|
||||||
item.return_date,
|
item.return_date,
|
||||||
@ -546,72 +558,6 @@ const OrganizationsView = () => {
|
|||||||
</CardBox>
|
</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 />
|
<BaseDivider />
|
||||||
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
|
|||||||
@ -108,7 +108,7 @@ const EditPayments = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.document}
|
options={initialValues.document}
|
||||||
itemRef={'documents'}
|
itemRef={'documents'}
|
||||||
showField={'id'}
|
showField={'document_number'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ const EditPayments = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const EditPaymentsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.document}
|
options={initialValues.document}
|
||||||
itemRef={'documents'}
|
itemRef={'documents'}
|
||||||
showField={'id'}
|
showField={'document_number'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ const EditPaymentsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ const PaymentsView = () => {
|
|||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Document</p>
|
<p className={'block font-bold mb-2'}>Document</p>
|
||||||
|
|
||||||
<p>{payments?.document?.id ?? 'No data'}</p>
|
<p>{payments?.document?.document_number ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormField label='PaymentDate'>
|
<FormField label='PaymentDate'>
|
||||||
@ -94,7 +94,7 @@ const PaymentsView = () => {
|
|||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>organizations</p>
|
<p className={'block font-bold mb-2'}>organizations</p>
|
||||||
|
|
||||||
<p>{payments?.organizations?.id ?? 'No data'}</p>
|
<p>{payments?.organizations?.name ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
|
|||||||
@ -1,135 +0,0 @@
|
|||||||
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;
|
|
||||||
@ -1,133 +0,0 @@
|
|||||||
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;
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
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}
|
component={SelectField}
|
||||||
options={initialValues.organization}
|
options={initialValues.organization}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
)}
|
)}
|
||||||
@ -141,7 +141,7 @@ const EditProjects = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ const EditProjectsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organization}
|
options={initialValues.organization}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
)}
|
)}
|
||||||
@ -139,7 +139,7 @@ const EditProjectsPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -77,16 +77,93 @@ const ProjectsView = () => {
|
|||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Organization</p>
|
<p className={'block font-bold mb-2'}>Organization</p>
|
||||||
|
|
||||||
<p>{projects?.organization?.id ?? 'No data'}</p>
|
<p>{projects?.organization?.name ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>organizations</p>
|
<p className={'block font-bold mb-2'}>organizations</p>
|
||||||
|
|
||||||
<p>{projects?.organizations?.id ?? 'No data'}</p>
|
<p>{projects?.organizations?.name ?? 'No data'}</p>
|
||||||
</div>
|
</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'}>
|
<p className={'block font-bold mb-2'}>
|
||||||
Field_site_payment_requisitions Project
|
Field_site_payment_requisitions Project
|
||||||
@ -107,6 +184,8 @@ const ProjectsView = () => {
|
|||||||
|
|
||||||
<th>DepartureDate</th>
|
<th>DepartureDate</th>
|
||||||
|
|
||||||
|
<th>ArrivalPlace</th>
|
||||||
|
|
||||||
<th>ReturnDate</th>
|
<th>ReturnDate</th>
|
||||||
|
|
||||||
<th>RequisitionDate</th>
|
<th>RequisitionDate</th>
|
||||||
@ -155,6 +234,10 @@ const ProjectsView = () => {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td data-label='arrival_place'>
|
||||||
|
{item.arrival_place}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td data-label='return_date'>
|
<td data-label='return_date'>
|
||||||
{dataFormatter.dateTimeFormatter(
|
{dataFormatter.dateTimeFormatter(
|
||||||
item.return_date,
|
item.return_date,
|
||||||
|
|||||||
@ -183,7 +183,7 @@ const EditUsers = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -181,7 +181,7 @@ const EditUsersPage = () => {
|
|||||||
component={SelectField}
|
component={SelectField}
|
||||||
options={initialValues.organizations}
|
options={initialValues.organizations}
|
||||||
itemRef={'organizations'}
|
itemRef={'organizations'}
|
||||||
showField={'id'}
|
showField={'name'}
|
||||||
></Field>
|
></Field>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ const UsersView = () => {
|
|||||||
<div className={'mb-4'}>
|
<div className={'mb-4'}>
|
||||||
<p className={'block font-bold mb-2'}>Organizations</p>
|
<p className={'block font-bold mb-2'}>Organizations</p>
|
||||||
|
|
||||||
<p>{users?.organizations?.id ?? 'No data'}</p>
|
<p>{users?.organizations?.name ?? 'No data'}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export default function WebSite() {
|
|||||||
<FeaturesSection
|
<FeaturesSection
|
||||||
projectName={'Nimona E-filling System'}
|
projectName={'Nimona E-filling System'}
|
||||||
image={['Dashboard showcasing CRM features']}
|
image={['Dashboard showcasing CRM features']}
|
||||||
withBg={1}
|
withBg={0}
|
||||||
features={features_points}
|
features={features_points}
|
||||||
mainText={`Unlock Efficiency with Gojo CRM Features`}
|
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.`}
|
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
|
<FeaturesSection
|
||||||
projectName={'Nimona E-filling System'}
|
projectName={'Nimona E-filling System'}
|
||||||
image={['Feature-rich CRM dashboard view']}
|
image={['Feature-rich CRM dashboard view']}
|
||||||
withBg={0}
|
withBg={1}
|
||||||
features={features_points}
|
features={features_points}
|
||||||
mainText={`Discover the Power of Gojo CRM`}
|
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.`}
|
subTitle={`Explore the robust features of ${projectName} that are designed to elevate your law firm's efficiency and client management capabilities.`}
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import paymentsSlice from './payments/paymentsSlice';
|
|||||||
import projectsSlice from './projects/projectsSlice';
|
import projectsSlice from './projects/projectsSlice';
|
||||||
import rolesSlice from './roles/rolesSlice';
|
import rolesSlice from './roles/rolesSlice';
|
||||||
import permissionsSlice from './permissions/permissionsSlice';
|
import permissionsSlice from './permissions/permissionsSlice';
|
||||||
import departmentsSlice from './departments/departmentsSlice';
|
|
||||||
import placesSlice from './places/placesSlice';
|
|
||||||
import organizationsSlice from './organizations/organizationsSlice';
|
import organizationsSlice from './organizations/organizationsSlice';
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
@ -29,8 +27,6 @@ export const store = configureStore({
|
|||||||
projects: projectsSlice,
|
projects: projectsSlice,
|
||||||
roles: rolesSlice,
|
roles: rolesSlice,
|
||||||
permissions: permissionsSlice,
|
permissions: permissionsSlice,
|
||||||
departments: departmentsSlice,
|
|
||||||
places: placesSlice,
|
|
||||||
organizations: organizationsSlice,
|
organizations: organizationsSlice,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user