Auto commit: 2025-10-15T12:12:51.883Z

This commit is contained in:
Flatlogic Bot 2025-10-15 12:12:51 +00:00
parent 8e2425a39c
commit 4be5094439
22 changed files with 351 additions and 12 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
node_modules/
*/node_modules/
**/node_modules/
*/build/
**/build/
.DS_Store
.env

File diff suppressed because one or more lines are too long

View File

@ -38,6 +38,16 @@ module.exports = class InstallationsDBApi {
controller: data.controller controller: data.controller
|| ||
null
,
customer_name: data.customer_name
||
null
,
place: data.place
||
null null
, ,
@ -82,6 +92,16 @@ module.exports = class InstallationsDBApi {
controller: item.controller controller: item.controller
|| ||
null null
,
customer_name: item.customer_name
||
null
,
place: item.place
||
null
, ,
importHash: item.importHash || null, importHash: item.importHash || null,
@ -114,6 +134,10 @@ module.exports = class InstallationsDBApi {
if (data.controller !== undefined) updatePayload.controller = data.controller; if (data.controller !== undefined) updatePayload.controller = data.controller;
if (data.customer_name !== undefined) updatePayload.customer_name = data.customer_name;
if (data.place !== undefined) updatePayload.place = data.place;
updatePayload.updatedById = currentUser.id; updatePayload.updatedById = currentUser.id;
await installations.update(updatePayload, {transaction}); await installations.update(updatePayload, {transaction});
@ -231,6 +255,28 @@ module.exports = class InstallationsDBApi {
}; };
} }
if (filter.customer_name) {
where = {
...where,
[Op.and]: Utils.ilike(
'installations',
'customer_name',
filter.customer_name,
),
};
}
if (filter.place) {
where = {
...where,
[Op.and]: Utils.ilike(
'installations',
'place',
filter.place,
),
};
}
if (filter.installation_dateRange) { if (filter.installation_dateRange) {
const [start, end] = filter.installation_dateRange; const [start, end] = filter.installation_dateRange;
@ -339,7 +385,7 @@ module.exports = class InstallationsDBApi {
{ ['id']: Utils.uuid(query) }, { ['id']: Utils.uuid(query) },
Utils.ilike( Utils.ilike(
'installations', 'installations',
'email', 'place',
query, query,
), ),
], ],
@ -347,16 +393,16 @@ module.exports = class InstallationsDBApi {
} }
const records = await db.installations.findAll({ const records = await db.installations.findAll({
attributes: [ 'id', 'email' ], attributes: [ 'id', 'place' ],
where, where,
limit: limit ? Number(limit) : undefined, limit: limit ? Number(limit) : undefined,
offset: offset ? Number(offset) : undefined, offset: offset ? Number(offset) : undefined,
orderBy: [['email', 'ASC']], orderBy: [['place', 'ASC']],
}); });
return records.map((record) => ({ return records.map((record) => ({
id: record.id, id: record.id,
label: record.email, label: record.place,
})); }));
} }

View File

@ -0,0 +1,54 @@
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(
'installations',
'customer_name',
{
type: Sequelize.DataTypes.TEXT,
},
{ 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(
'installations',
'customer_name',
{ transaction }
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
}
};

View File

@ -0,0 +1,54 @@
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(
'installations',
'place',
{
type: Sequelize.DataTypes.TEXT,
},
{ 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(
'installations',
'place',
{ transaction }
);
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
}
};

View File

@ -67,6 +67,16 @@ controller: {
}, },
customer_name: {
type: DataTypes.TEXT,
},
place: {
type: DataTypes.TEXT,
},
importHash: { importHash: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: true, allowNull: true,

View File

@ -23,6 +23,12 @@ const { parse } = require('json2csv');
* customer_details: * customer_details:
* type: string * type: string
* default: customer_details * default: customer_details
* customer_name:
* type: string
* default: customer_name
* place:
* type: string
* default: place
* *
* *
@ -281,7 +287,7 @@ router.get('/', wrapAsync(async (req, res) => {
req.query, { currentUser } req.query, { currentUser }
); );
if (filetype && filetype === 'csv') { if (filetype && filetype === 'csv') {
const fields = ['id','email','customer_details', const fields = ['id','email','customer_details','customer_name','place',
'installation_date', 'installation_date',
]; ];

View File

@ -61,6 +61,10 @@ module.exports = class SearchService {
"customer_details", "customer_details",
"customer_name",
"place",
], ],
}; };

14
cloudbuild.yaml Normal file
View File

@ -0,0 +1,14 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/fldemo-315215/employee-portal-34976-dev:latest || exit 0']
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'-t', 'gcr.io/fldemo-315215/employee-portal-34976-dev:latest',
'--file', 'Dockerfile.dev',
'--cache-from', 'gcr.io/fldemo-315215/employee-portal-34976-dev:latest',
'.'
]
images: ['gcr.io/fldemo-315215/employee-portal-34976-dev:latest']
logsBucket: 'gs://fldemo-315215-cloudbuild-logs'

View File

@ -0,0 +1 @@
{}

View File

@ -46,7 +46,7 @@ const CardInstallations = ({
}`} }`}
> >
<Link href={`/installations/installations-view/?id=${item.id}`} className='text-lg font-bold leading-6 line-clamp-1'> <Link href={`/installations/installations-view/?id=${item.id}`} className='text-lg font-bold leading-6 line-clamp-1'>
{item.email} {item.place}
</Link> </Link>
<div className='ml-auto'> <div className='ml-auto'>
@ -115,6 +115,24 @@ const CardInstallations = ({
</dd> </dd>
</div> </div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className='text-gray-500 dark:text-dark-600'>Customer name</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{ item.customer_name }
</div>
</dd>
</div>
<div className='flex justify-between gap-x-4 py-3'>
<dt className='text-gray-500 dark:text-dark-600'>Place</dt>
<dd className='flex items-start gap-x-2'>
<div className='font-medium line-clamp-4'>
{ item.place }
</div>
</dd>
</div>
</dl> </dl>
</li> </li>
))} ))}

View File

@ -65,6 +65,16 @@ const ListInstallations = ({ installations, loading, onDelete, currentPage, numP
<p className={'line-clamp-2'}>{ dataFormatter.usersOneListFormatter(item.manager) }</p> <p className={'line-clamp-2'}>{ dataFormatter.usersOneListFormatter(item.manager) }</p>
</div> </div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500'}>Customer name</p>
<p className={'line-clamp-2'}>{ item.customer_name }</p>
</div>
<div className={'flex-1 px-3'}>
<p className={'text-xs text-gray-500'}>Place</p>
<p className={'line-clamp-2'}>{ item.place }</p>
</div>
</Link> </Link>
<ListActionsPopover <ListActionsPopover
onDelete={onDelete} onDelete={onDelete}

View File

@ -115,6 +115,32 @@ export const loadColumns = async (
}, },
{
field: 'customer_name',
headerName: 'Customer name',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: true,
},
{
field: 'place',
headerName: 'Place',
flex: 1,
minWidth: 120,
filterable: false,
headerClassName: 'datagrid--header',
cellClassName: 'datagrid--cell',
editable: true,
},
{ {
field: 'actions', field: 'actions',
type: 'actions', type: 'actions',

View File

@ -44,6 +44,10 @@ const EditInstallations = () => {
manager: null, manager: null,
'customer_name': '',
'place': '',
} }
const [initialValues, setInitialValues] = useState(initVals) const [initialValues, setInitialValues] = useState(initVals)
@ -167,6 +171,24 @@ const EditInstallations = () => {
></Field> ></Field>
</FormField> </FormField>
<FormField
label="Customer name"
>
<Field
name="customer_name"
placeholder="Customer name"
/>
</FormField>
<FormField
label="Place"
>
<Field
name="place"
placeholder="Place"
/>
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type="submit" color="info" label="Submit" /> <BaseButton type="submit" color="info" label="Submit" />

View File

@ -45,6 +45,10 @@ const EditInstallationsPage = () => {
manager: null, manager: null,
'customer_name': '',
'place': '',
} }
const [initialValues, setInitialValues] = useState(initVals) const [initialValues, setInitialValues] = useState(initVals)
@ -165,6 +169,24 @@ const EditInstallationsPage = () => {
></Field> ></Field>
</FormField> </FormField>
<FormField
label="Customer name"
>
<Field
name="customer_name"
placeholder="Customer name"
/>
</FormField>
<FormField
label="Place"
>
<Field
name="place"
placeholder="Place"
/>
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type="submit" color="info" label="Submit" /> <BaseButton type="submit" color="info" label="Submit" />

View File

@ -22,7 +22,7 @@ const InstallationsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([{label: 'Email', title: 'email'},{label: 'CustomerDetails', title: 'customer_details'}, const [filters] = useState([{label: 'Email', title: 'email'},{label: 'CustomerDetails', title: 'customer_details'},{label: 'Customer name', title: 'customer_name'},{label: 'Place', title: 'place'},
{label: 'InstallationDate', title: 'installation_date', date: 'true'}, {label: 'InstallationDate', title: 'installation_date', date: 'true'},

View File

@ -37,6 +37,10 @@ const initialValues = {
manager: '', manager: '',
customer_name: '',
place: '',
} }
const InstallationsNew = () => { const InstallationsNew = () => {
@ -124,6 +128,24 @@ const InstallationsNew = () => {
<Field name="manager" id="manager" component={SelectField} options={[]} itemRef={'users'}></Field> <Field name="manager" id="manager" component={SelectField} options={[]} itemRef={'users'}></Field>
</FormField> </FormField>
<FormField
label="Customer name"
>
<Field
name="customer_name"
placeholder="Customer name"
/>
</FormField>
<FormField
label="Place"
>
<Field
name="place"
placeholder="Place"
/>
</FormField>
<BaseDivider /> <BaseDivider />
<BaseButtons> <BaseButtons>
<BaseButton type="submit" color="info" label="Submit" /> <BaseButton type="submit" color="info" label="Submit" />

View File

@ -22,7 +22,7 @@ const InstallationsTablesPage = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [filters] = useState([{label: 'Email', title: 'email'},{label: 'CustomerDetails', title: 'customer_details'}, const [filters] = useState([{label: 'Email', title: 'email'},{label: 'CustomerDetails', title: 'customer_details'},{label: 'Customer name', title: 'customer_name'},{label: 'Place', title: 'place'},
{label: 'InstallationDate', title: 'installation_date', date: 'true'}, {label: 'InstallationDate', title: 'installation_date', date: 'true'},

View File

@ -88,6 +88,16 @@ const InstallationsView = () => {
</div> </div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Customer name</p>
<p>{installations?.customer_name}</p>
</div>
<div className={'mb-4'}>
<p className={'block font-bold mb-2'}>Place</p>
<p>{installations?.place}</p>
</div>
<BaseDivider /> <BaseDivider />
<BaseButton <BaseButton

View File

@ -98,6 +98,10 @@ const UsersView = () => {
<th>Controller</th> <th>Controller</th>
<th>Customer name</th>
<th>Place</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -125,6 +129,14 @@ const UsersView = () => {
{ item.controller } { item.controller }
</td> </td>
<td data-label="customer_name">
{ item.customer_name }
</td>
<td data-label="place">
{ item.place }
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>

1
pids/backend.pid Normal file
View File

@ -0,0 +1 @@
4

1
pids/frontend.pid Normal file
View File

@ -0,0 +1 @@
3