Revert to version bd3620b

This commit is contained in:
Flatlogic Bot 2025-07-09 18:09:43 +00:00
parent b40e80b9b2
commit dd29c9c1fa
14 changed files with 92 additions and 276 deletions

5
.gitignore vendored
View File

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

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@ 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,
@ -68,6 +69,7 @@ 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,
@ -120,6 +122,9 @@ 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;
@ -354,6 +359,17 @@ 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,
@ -616,22 +632,26 @@ module.exports = class Field_site_payment_requisitionsDBApi {
where = { where = {
[Op.or]: [ [Op.or]: [
{ ['id']: Utils.uuid(query) }, { ['id']: Utils.uuid(query) },
Utils.ilike('field_site_payment_requisitions', 'id', query), Utils.ilike(
'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', 'id'], attributes: ['id', 'employee_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: [['employee_name', 'ASC']],
}); });
return records.map((record) => ({ return records.map((record) => ({
id: record.id, id: record.id,
label: record.id, label: record.employee_name,
})); }));
} }
}; };

View File

@ -1,36 +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 transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -11,10 +11,6 @@ const Projects = db.projects;
const Organizations = db.organizations; const Organizations = db.organizations;
const Departments = db.departments;
const Places = db.places;
const DocumentsData = [ const DocumentsData = [
{ {
document_number: 'DOC001', document_number: 'DOC001',
@ -25,7 +21,7 @@ const DocumentsData = [
prepared_by: 'jdoe', prepared_by: 'jdoe',
status: 'InProgress', status: 'Filed',
cash_balance: true, cash_balance: true,
@ -45,7 +41,7 @@ const DocumentsData = [
// type code here for "relation_one" field // type code here for "relation_one" field
document_type: 'BPV', document_type: 'JV',
prepared_by: 'asmith', prepared_by: 'asmith',
@ -69,7 +65,7 @@ const DocumentsData = [
// type code here for "relation_one" field // type code here for "relation_one" field
document_type: 'JV', document_type: 'RV',
prepared_by: 'bwhite', prepared_by: 'bwhite',
@ -97,7 +93,7 @@ const DocumentsData = [
prepared_by: 'cgreen', prepared_by: 'cgreen',
status: 'Filed', status: 'InProgress',
cash_balance: true, cash_balance: true,
@ -121,7 +117,7 @@ const DocumentsData = [
prepared_by: 'dblack', prepared_by: 'dblack',
status: 'Filed', status: 'InProgress',
cash_balance: true, cash_balance: true,
@ -151,13 +147,15 @@ const FieldSitePaymentRequisitionsData = [
departure_date: new Date('2023-10-01T08:00:00Z'), departure_date: new Date('2023-10-01T08:00:00Z'),
arrival_place: 'London',
return_date: new Date('2023-10-10T18:00:00Z'), return_date: new Date('2023-10-10T18:00:00Z'),
requisition_date: new Date('2023-09-25T09:00:00Z'), requisition_date: new Date('2023-09-25T09:00:00Z'),
requested_amount: 5000, requested_amount: 5000,
payment_type: 'BPV', payment_type: 'JV',
status: 'Paid', status: 'Paid',
@ -183,13 +181,15 @@ const FieldSitePaymentRequisitionsData = [
departure_date: new Date('2023-10-02T09:00:00Z'), departure_date: new Date('2023-10-02T09:00:00Z'),
arrival_place: 'Paris',
return_date: new Date('2023-10-12T19:00:00Z'), return_date: new Date('2023-10-12T19:00:00Z'),
requisition_date: new Date('2023-09-26T10:00:00Z'), requisition_date: new Date('2023-09-26T10:00:00Z'),
requested_amount: 6000, requested_amount: 6000,
payment_type: 'RV', payment_type: 'JV',
status: 'Pending', status: 'Pending',
@ -215,6 +215,8 @@ const FieldSitePaymentRequisitionsData = [
departure_date: new Date('2023-10-03T10:00:00Z'), departure_date: new Date('2023-10-03T10:00:00Z'),
arrival_place: 'Berlin',
return_date: new Date('2023-10-13T20:00:00Z'), return_date: new Date('2023-10-13T20:00:00Z'),
requisition_date: new Date('2023-09-27T11:00:00Z'), requisition_date: new Date('2023-09-27T11:00:00Z'),
@ -223,7 +225,7 @@ const FieldSitePaymentRequisitionsData = [
payment_type: 'BPV', payment_type: 'BPV',
status: 'Pending', status: 'Paid',
requester: 'bwhite', requester: 'bwhite',
@ -247,6 +249,8 @@ const FieldSitePaymentRequisitionsData = [
departure_date: new Date('2023-10-04T11:00:00Z'), departure_date: new Date('2023-10-04T11:00:00Z'),
arrival_place: 'Tokyo',
return_date: new Date('2023-10-14T21:00:00Z'), return_date: new Date('2023-10-14T21:00:00Z'),
requisition_date: new Date('2023-09-28T12:00:00Z'), requisition_date: new Date('2023-09-28T12:00:00Z'),
@ -255,7 +259,7 @@ const FieldSitePaymentRequisitionsData = [
payment_type: 'JV', payment_type: 'JV',
status: 'Approved', status: 'Paid',
requester: 'cgreen', requester: 'cgreen',
@ -279,15 +283,17 @@ const FieldSitePaymentRequisitionsData = [
departure_date: new Date('2023-10-05T12:00:00Z'), departure_date: new Date('2023-10-05T12:00:00Z'),
arrival_place: 'Sydney',
return_date: new Date('2023-10-15T22:00:00Z'), return_date: new Date('2023-10-15T22:00:00Z'),
requisition_date: new Date('2023-09-29T13:00:00Z'), requisition_date: new Date('2023-09-29T13:00:00Z'),
requested_amount: 9000, requested_amount: 9000,
payment_type: 'RV', payment_type: 'JV',
status: 'Pending', status: 'Approved',
requester: 'dblack', requester: 'dblack',
@ -307,7 +313,7 @@ const PaymentsData = [
amount: 500, amount: 500,
payment_type: 'Addition', payment_type: 'Subtraction',
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
@ -319,7 +325,7 @@ const PaymentsData = [
amount: 1000, amount: 1000,
payment_type: 'Subtraction', payment_type: 'Addition',
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
@ -331,7 +337,7 @@ const PaymentsData = [
amount: 750, amount: 750,
payment_type: 'Addition', payment_type: 'Subtraction',
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
@ -343,7 +349,7 @@ const PaymentsData = [
amount: 1250, amount: 1250,
payment_type: 'Subtraction', payment_type: 'Addition',
// type code here for "relation_one" field // type code here for "relation_one" field
}, },
@ -367,7 +373,7 @@ const ProjectsData = [
code: 'PA001', code: 'PA001',
type: 'CDC', type: 'MOH',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -379,7 +385,7 @@ const ProjectsData = [
code: 'PB002', code: 'PB002',
type: 'MOH', type: 'CDC',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -403,7 +409,7 @@ const ProjectsData = [
code: 'PD004', code: 'PD004',
type: 'CDC', type: 'Other',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -415,7 +421,7 @@ const ProjectsData = [
code: 'PE005', code: 'PE005',
type: 'Other', type: 'MOH',
// type code here for "relation_one" field // type code here for "relation_one" field
@ -445,50 +451,6 @@ const OrganizationsData = [
}, },
]; ];
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
},
{
// type code here for "relation_one" field
},
];
const PlacesData = [
{
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
},
{
// type code here for "relation_one" field
},
];
// Similar logic for "relation_many" // Similar logic for "relation_many"
async function associateUserWithOrganization() { async function associateUserWithOrganization() {
@ -1076,120 +1038,6 @@ async function associateProjectWithOrganization() {
} }
} }
async function associateDepartmentWithOrganization() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Department0 = await Departments.findOne({
order: [['id', 'ASC']],
offset: 0,
});
if (Department0?.setOrganization) {
await Department0.setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Department1 = await Departments.findOne({
order: [['id', 'ASC']],
offset: 1,
});
if (Department1?.setOrganization) {
await Department1.setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Department2 = await Departments.findOne({
order: [['id', 'ASC']],
offset: 2,
});
if (Department2?.setOrganization) {
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() {
const relatedOrganization0 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Place0 = await Places.findOne({
order: [['id', 'ASC']],
offset: 0,
});
if (Place0?.setOrganization) {
await Place0.setOrganization(relatedOrganization0);
}
const relatedOrganization1 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Place1 = await Places.findOne({
order: [['id', 'ASC']],
offset: 1,
});
if (Place1?.setOrganization) {
await Place1.setOrganization(relatedOrganization1);
}
const relatedOrganization2 = await Organizations.findOne({
offset: Math.floor(Math.random() * (await Organizations.count())),
});
const Place2 = await Places.findOne({
order: [['id', 'ASC']],
offset: 2,
});
if (Place2?.setOrganization) {
await Place2.setOrganization(relatedOrganization2);
}
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 = {
up: async (queryInterface, Sequelize) => { up: async (queryInterface, Sequelize) => {
await Documents.bulkCreate(DocumentsData); await Documents.bulkCreate(DocumentsData);
@ -1204,10 +1052,6 @@ module.exports = {
await Organizations.bulkCreate(OrganizationsData); await Organizations.bulkCreate(OrganizationsData);
await Departments.bulkCreate(DepartmentsData);
await Places.bulkCreate(PlacesData);
await Promise.all([ await Promise.all([
// Similar logic for "relation_many" // Similar logic for "relation_many"
@ -1230,10 +1074,6 @@ module.exports = {
await associateProjectWithOrganization(), await associateProjectWithOrganization(),
await associateProjectWithOrganization(), await associateProjectWithOrganization(),
await associateDepartmentWithOrganization(),
await associatePlaceWithOrganization(),
]); ]);
}, },
@ -1251,9 +1091,5 @@ module.exports = {
await queryInterface.bulkDelete('projects', null, {}); await queryInterface.bulkDelete('projects', null, {});
await queryInterface.bulkDelete('organizations', null, {}); await queryInterface.bulkDelete('organizations', null, {});
await queryInterface.bulkDelete('departments', null, {});
await queryInterface.bulkDelete('places', null, {});
}, },
}; };

View File

@ -1 +0,0 @@
{}

View File

@ -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.id} {item.employee_name}
</Link> </Link>
<div className='ml-auto '> <div className='ml-auto '>
@ -147,6 +147,17 @@ 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

View File

@ -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}`}
pathEdit={`/field_site_payment_requisitions/${item.id}/edit`} pathView={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${item.id}`}
hasUpdatePermission={hasUpdatePermission} hasUpdatePermission={hasUpdatePermission}
/> />
</div> </div>

View File

@ -471,8 +471,6 @@ const TableSampleField_site_payment_requisitions = ({
{dataGrid} {dataGrid}
{showGrid && dataGrid}
{selectedRows.length > 0 && {selectedRows.length > 0 &&
createPortal( createPortal(
<BaseButton <BaseButton

View File

@ -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/${params.row.id}`} pathEdit={`/field_site_payment_requisitions/field_site_payment_requisitions-edit/?id=${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>,
]; ];
}, },
}, },

View File

@ -19,7 +19,7 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
const style = HeaderStyle.PAGES_LEFT; const style = HeaderStyle.PAGES_LEFT;
const design = HeaderDesigns.DESIGN_DIVERSITY; const design = HeaderDesigns.DEFAULT_DESIGN;
return ( return (
<header id='websiteHeader' className='overflow-hidden'> <header id='websiteHeader' className='overflow-hidden'>
<div <div

View File

@ -35,6 +35,7 @@ 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' },
@ -154,16 +155,6 @@ 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>

View File

@ -95,14 +95,15 @@ 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' />

View File

@ -35,6 +35,7 @@ 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' },
@ -159,7 +160,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'></span> Back to <span className='capitalize'>table</span>
</Link> </Link>
</div> </div>
</CardBox> </CardBox>