Updated via schema editor on 2025-07-08 14:51

This commit is contained in:
Flatlogic Bot 2025-07-08 14:52:29 +00:00
parent bd3620b434
commit 93986afe7a
14 changed files with 275 additions and 92 deletions

5
.gitignore vendored
View File

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

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
employee_name: data.employee_name || null,
departure_place: data.departure_place || null,
departure_date: data.departure_date || null,
arrival_place: data.arrival_place || null,
return_date: data.return_date || null,
requisition_date: data.requisition_date || null,
requested_amount: data.requested_amount || null,
@ -69,7 +68,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
employee_name: item.employee_name || null,
departure_place: item.departure_place || null,
departure_date: item.departure_date || null,
arrival_place: item.arrival_place || null,
return_date: item.return_date || null,
requisition_date: item.requisition_date || null,
requested_amount: item.requested_amount || null,
@ -122,9 +120,6 @@ module.exports = class Field_site_payment_requisitionsDBApi {
if (data.departure_date !== undefined)
updatePayload.departure_date = data.departure_date;
if (data.arrival_place !== undefined)
updatePayload.arrival_place = data.arrival_place;
if (data.return_date !== undefined)
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) {
where = {
...where,
@ -632,26 +616,22 @@ module.exports = class Field_site_payment_requisitionsDBApi {
where = {
[Op.or]: [
{ ['id']: Utils.uuid(query) },
Utils.ilike(
'field_site_payment_requisitions',
'employee_name',
query,
),
Utils.ilike('field_site_payment_requisitions', 'id', query),
],
};
}
const records = await db.field_site_payment_requisitions.findAll({
attributes: ['id', 'employee_name'],
attributes: ['id', 'id'],
where,
limit: limit ? Number(limit) : undefined,
offset: offset ? Number(offset) : undefined,
orderBy: [['employee_name', 'ASC']],
orderBy: [['id', 'ASC']],
});
return records.map((record) => ({
id: record.id,
label: record.employee_name,
label: record.id,
}));
}
};

View File

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

View File

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

View File

@ -0,0 +1 @@
{}

View File

@ -65,7 +65,7 @@ const CardField_site_payment_requisitions = ({
href={`/field_site_payment_requisitions/field_site_payment_requisitions-view/?id=${item.id}`}
className='text-lg font-bold leading-6 line-clamp-1'
>
{item.employee_name}
{item.id}
</Link>
<div className='ml-auto '>
@ -147,17 +147,6 @@ const CardField_site_payment_requisitions = ({
</dd>
</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'>
<dt className=' text-gray-500 dark:text-dark-600'>
ReturnDate

View File

@ -157,7 +157,7 @@ const ListField_site_payment_requisitions = ({
onDelete={onDelete}
itemId={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}
/>
</div>

View File

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

View File

@ -266,12 +266,12 @@ export const loadColumns = async (
<div key={params?.row?.id}>
<ListActionsPopover
onDelete={onDelete}
itemId={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}`}
itemId={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}`}
hasUpdatePermission={hasUpdatePermission}
/>
</div>,
</div>
];
},
},

View File

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

View File

@ -35,7 +35,6 @@ const Field_site_payment_requisitionsTablesPage = () => {
{ label: 'Department', title: 'department' },
{ label: 'EmployeeName', title: 'employee_name' },
{ label: 'DeparturePlace', title: 'departure_place' },
{ label: 'ArrivalPlace', title: 'arrival_place' },
{ label: 'Requester', title: 'requester' },
{ label: 'Approver', title: 'approver' },
@ -155,6 +154,16 @@ const Field_site_payment_requisitionsTablesPage = () => {
<div className='md:inline-flex items-center ms-auto'>
<div id='delete-rows-button'></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 className='mb-6' hasTable>

View File

@ -95,15 +95,14 @@ const Field_site_payment_requisitionsNew = () => {
onSubmit={(values) => handleSubmit(values)}
>
<Form>
<FormField label='Organization' labelFor='organization'>
<Field
name='organization'
id='organization'
component={SelectField}
options={[]}
itemRef={'organizations'}
showField={'name'}
></Field>
</FormField>
<FormField label='Department'>
<Field name='department' placeholder='Department' />

View File

@ -35,7 +35,6 @@ const Field_site_payment_requisitionsTablesPage = () => {
{ label: 'Department', title: 'department' },
{ label: 'EmployeeName', title: 'employee_name' },
{ label: 'DeparturePlace', title: 'departure_place' },
{ label: 'ArrivalPlace', title: 'arrival_place' },
{ label: 'Requester', title: 'requester' },
{ label: 'Approver', title: 'approver' },
@ -160,7 +159,7 @@ const Field_site_payment_requisitionsTablesPage = () => {
'/field_site_payment_requisitions/field_site_payment_requisitions-list'
}
>
Back to <span className='capitalize'>table</span>
Back to <span className='capitalize'></span>
</Link>
</div>
</CardBox>