Auto commit: 2025-10-15T12:12:51.883Z
This commit is contained in:
parent
8e2425a39c
commit
4be5094439
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal 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
@ -38,6 +38,16 @@ module.exports = class InstallationsDBApi {
|
||||
|
||||
controller: data.controller
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
customer_name: data.customer_name
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
place: data.place
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
@ -82,6 +92,16 @@ module.exports = class InstallationsDBApi {
|
||||
controller: item.controller
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
customer_name: item.customer_name
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
place: item.place
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
importHash: item.importHash || null,
|
||||
@ -114,6 +134,10 @@ module.exports = class InstallationsDBApi {
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
const [start, end] = filter.installation_dateRange;
|
||||
|
||||
@ -339,7 +385,7 @@ module.exports = class InstallationsDBApi {
|
||||
{ ['id']: Utils.uuid(query) },
|
||||
Utils.ilike(
|
||||
'installations',
|
||||
'email',
|
||||
'place',
|
||||
query,
|
||||
),
|
||||
],
|
||||
@ -347,16 +393,16 @@ module.exports = class InstallationsDBApi {
|
||||
}
|
||||
|
||||
const records = await db.installations.findAll({
|
||||
attributes: [ 'id', 'email' ],
|
||||
attributes: [ 'id', 'place' ],
|
||||
where,
|
||||
limit: limit ? Number(limit) : undefined,
|
||||
offset: offset ? Number(offset) : undefined,
|
||||
orderBy: [['email', 'ASC']],
|
||||
orderBy: [['place', 'ASC']],
|
||||
});
|
||||
|
||||
return records.map((record) => ({
|
||||
id: record.id,
|
||||
label: record.email,
|
||||
label: record.place,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
54
backend/src/db/migrations/1760530098426.js
Normal file
54
backend/src/db/migrations/1760530098426.js
Normal 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
54
backend/src/db/migrations/1760530104335.js
Normal file
54
backend/src/db/migrations/1760530104335.js
Normal 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -67,6 +67,16 @@ controller: {
|
||||
|
||||
},
|
||||
|
||||
customer_name: {
|
||||
type: DataTypes.TEXT,
|
||||
|
||||
},
|
||||
|
||||
place: {
|
||||
type: DataTypes.TEXT,
|
||||
|
||||
},
|
||||
|
||||
importHash: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
|
||||
@ -23,6 +23,12 @@ const { parse } = require('json2csv');
|
||||
* customer_details:
|
||||
* type: string
|
||||
* 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 }
|
||||
);
|
||||
if (filetype && filetype === 'csv') {
|
||||
const fields = ['id','email','customer_details',
|
||||
const fields = ['id','email','customer_details','customer_name','place',
|
||||
|
||||
'installation_date',
|
||||
];
|
||||
|
||||
@ -61,6 +61,10 @@ module.exports = class SearchService {
|
||||
|
||||
"customer_details",
|
||||
|
||||
"customer_name",
|
||||
|
||||
"place",
|
||||
|
||||
],
|
||||
|
||||
};
|
||||
|
||||
14
cloudbuild.yaml
Normal file
14
cloudbuild.yaml
Normal 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'
|
||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -46,7 +46,7 @@ const CardInstallations = ({
|
||||
}`}
|
||||
>
|
||||
<Link href={`/installations/installations-view/?id=${item.id}`} className='text-lg font-bold leading-6 line-clamp-1'>
|
||||
{item.email}
|
||||
{item.place}
|
||||
</Link>
|
||||
|
||||
<div className='ml-auto'>
|
||||
@ -115,6 +115,24 @@ const CardInstallations = ({
|
||||
</dd>
|
||||
</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>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@ -65,6 +65,16 @@ const ListInstallations = ({ installations, loading, onDelete, currentPage, numP
|
||||
<p className={'line-clamp-2'}>{ dataFormatter.usersOneListFormatter(item.manager) }</p>
|
||||
</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>
|
||||
<ListActionsPopover
|
||||
onDelete={onDelete}
|
||||
|
||||
@ -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',
|
||||
type: 'actions',
|
||||
|
||||
@ -44,6 +44,10 @@ const EditInstallations = () => {
|
||||
|
||||
manager: null,
|
||||
|
||||
'customer_name': '',
|
||||
|
||||
'place': '',
|
||||
|
||||
}
|
||||
const [initialValues, setInitialValues] = useState(initVals)
|
||||
|
||||
@ -167,6 +171,24 @@ const EditInstallations = () => {
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Customer name"
|
||||
>
|
||||
<Field
|
||||
name="customer_name"
|
||||
placeholder="Customer name"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Place"
|
||||
>
|
||||
<Field
|
||||
name="place"
|
||||
placeholder="Place"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -45,6 +45,10 @@ const EditInstallationsPage = () => {
|
||||
|
||||
manager: null,
|
||||
|
||||
'customer_name': '',
|
||||
|
||||
'place': '',
|
||||
|
||||
}
|
||||
const [initialValues, setInitialValues] = useState(initVals)
|
||||
|
||||
@ -165,6 +169,24 @@ const EditInstallationsPage = () => {
|
||||
></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Customer name"
|
||||
>
|
||||
<Field
|
||||
name="customer_name"
|
||||
placeholder="Customer name"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Place"
|
||||
>
|
||||
<Field
|
||||
name="place"
|
||||
placeholder="Place"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -22,7 +22,7 @@ const InstallationsTablesPage = () => {
|
||||
|
||||
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'},
|
||||
|
||||
|
||||
@ -37,6 +37,10 @@ const initialValues = {
|
||||
|
||||
manager: '',
|
||||
|
||||
customer_name: '',
|
||||
|
||||
place: '',
|
||||
|
||||
}
|
||||
|
||||
const InstallationsNew = () => {
|
||||
@ -124,6 +128,24 @@ const InstallationsNew = () => {
|
||||
<Field name="manager" id="manager" component={SelectField} options={[]} itemRef={'users'}></Field>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Customer name"
|
||||
>
|
||||
<Field
|
||||
name="customer_name"
|
||||
placeholder="Customer name"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Place"
|
||||
>
|
||||
<Field
|
||||
name="place"
|
||||
placeholder="Place"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -22,7 +22,7 @@ const InstallationsTablesPage = () => {
|
||||
|
||||
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'},
|
||||
|
||||
|
||||
@ -88,6 +88,16 @@ const InstallationsView = () => {
|
||||
|
||||
</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 />
|
||||
|
||||
<BaseButton
|
||||
|
||||
@ -98,6 +98,10 @@ const UsersView = () => {
|
||||
|
||||
<th>Controller</th>
|
||||
|
||||
<th>Customer name</th>
|
||||
|
||||
<th>Place</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -125,6 +129,14 @@ const UsersView = () => {
|
||||
{ item.controller }
|
||||
</td>
|
||||
|
||||
<td data-label="customer_name">
|
||||
{ item.customer_name }
|
||||
</td>
|
||||
|
||||
<td data-label="place">
|
||||
{ item.place }
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
1
pids/backend.pid
Normal file
1
pids/backend.pid
Normal file
@ -0,0 +1 @@
|
||||
4
|
||||
1
pids/frontend.pid
Normal file
1
pids/frontend.pid
Normal file
@ -0,0 +1 @@
|
||||
3
|
||||
Loading…
x
Reference in New Issue
Block a user