Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f02683b96 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -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
@ -33,6 +33,11 @@ module.exports = class InventoryDBApi {
|
||||
|
||||
returned_quantity: data.returned_quantity
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
picture: data.picture
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
@ -72,6 +77,11 @@ module.exports = class InventoryDBApi {
|
||||
returned_quantity: item.returned_quantity
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
picture: item.picture
|
||||
||
|
||||
null
|
||||
,
|
||||
|
||||
importHash: item.importHash || null,
|
||||
@ -102,6 +112,8 @@ module.exports = class InventoryDBApi {
|
||||
|
||||
if (data.returned_quantity !== undefined) updatePayload.returned_quantity = data.returned_quantity;
|
||||
|
||||
if (data.picture !== undefined) updatePayload.picture = data.picture;
|
||||
|
||||
updatePayload.updatedById = currentUser.id;
|
||||
|
||||
await inventory.update(updatePayload, {transaction});
|
||||
@ -208,6 +220,17 @@ module.exports = class InventoryDBApi {
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.picture) {
|
||||
where = {
|
||||
...where,
|
||||
[Op.and]: Utils.ilike(
|
||||
'inventory',
|
||||
'picture',
|
||||
filter.picture,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
if (filter.available_quantityRange) {
|
||||
const [start, end] = filter.available_quantityRange;
|
||||
|
||||
|
||||
54
backend/src/db/migrations/1751950386784.js
Normal file
54
backend/src/db/migrations/1751950386784.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(
|
||||
'inventory',
|
||||
'picture',
|
||||
{
|
||||
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(
|
||||
'inventory',
|
||||
'picture',
|
||||
{ transaction }
|
||||
);
|
||||
|
||||
await transaction.commit();
|
||||
} catch (err) {
|
||||
await transaction.rollback();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -34,6 +34,11 @@ returned_quantity: {
|
||||
|
||||
},
|
||||
|
||||
picture: {
|
||||
type: DataTypes.TEXT,
|
||||
|
||||
},
|
||||
|
||||
importHash: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
|
||||
@ -20,6 +20,9 @@ const { parse } = require('json2csv');
|
||||
* product_name:
|
||||
* type: string
|
||||
* default: product_name
|
||||
* picture:
|
||||
* type: string
|
||||
* default: picture
|
||||
|
||||
* available_quantity:
|
||||
* type: integer
|
||||
@ -286,7 +289,7 @@ router.get('/', wrapAsync(async (req, res) => {
|
||||
req.query, { currentUser }
|
||||
);
|
||||
if (filetype && filetype === 'csv') {
|
||||
const fields = ['id','product_name',
|
||||
const fields = ['id','product_name','picture',
|
||||
|
||||
'available_quantity','reserved_quantity','returned_quantity',
|
||||
|
||||
|
||||
@ -67,6 +67,8 @@ module.exports = class SearchService {
|
||||
|
||||
"product_name",
|
||||
|
||||
"picture",
|
||||
|
||||
],
|
||||
|
||||
"machinery": [
|
||||
|
||||
1
frontend/json/runtimeError.json
Normal file
1
frontend/json/runtimeError.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -97,6 +97,15 @@ const CardInventory = ({
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between gap-x-4 py-3'>
|
||||
<dt className='text-gray-500 dark:text-dark-600'>Picture</dt>
|
||||
<dd className='flex items-start gap-x-2'>
|
||||
<div className='font-medium line-clamp-4'>
|
||||
{ item.picture }
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@ -55,6 +55,11 @@ const ListInventory = ({ inventory, loading, onDelete, currentPage, numPages, on
|
||||
<p className={'line-clamp-2'}>{ item.returned_quantity }</p>
|
||||
</div>
|
||||
|
||||
<div className={'flex-1 px-3'}>
|
||||
<p className={'text-xs text-gray-500'}>Picture</p>
|
||||
<p className={'line-clamp-2'}>{ item.picture }</p>
|
||||
</div>
|
||||
|
||||
</Link>
|
||||
<ListActionsPopover
|
||||
onDelete={onDelete}
|
||||
|
||||
@ -82,6 +82,19 @@ export const loadColumns = async (
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
field: 'picture',
|
||||
headerName: 'Picture',
|
||||
flex: 1,
|
||||
minWidth: 120,
|
||||
filterable: false,
|
||||
headerClassName: 'datagrid--header',
|
||||
cellClassName: 'datagrid--cell',
|
||||
|
||||
editable: true,
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
field: 'actions',
|
||||
type: 'actions',
|
||||
|
||||
@ -40,6 +40,8 @@ const EditInventory = () => {
|
||||
|
||||
'returned_quantity': '',
|
||||
|
||||
'picture': '',
|
||||
|
||||
}
|
||||
const [initialValues, setInitialValues] = useState(initVals)
|
||||
|
||||
@ -129,6 +131,15 @@ const EditInventory = () => {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Picture"
|
||||
>
|
||||
<Field
|
||||
name="picture"
|
||||
placeholder="Picture"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -41,6 +41,8 @@ const EditInventoryPage = () => {
|
||||
|
||||
'returned_quantity': '',
|
||||
|
||||
'picture': '',
|
||||
|
||||
}
|
||||
const [initialValues, setInitialValues] = useState(initVals)
|
||||
|
||||
@ -127,6 +129,15 @@ const EditInventoryPage = () => {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Picture"
|
||||
>
|
||||
<Field
|
||||
name="picture"
|
||||
placeholder="Picture"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -22,7 +22,7 @@ const InventoryTablesPage = () => {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([{label: 'ProductName', title: 'product_name'},
|
||||
const [filters] = useState([{label: 'ProductName', title: 'product_name'},{label: 'Picture', title: 'picture'},
|
||||
|
||||
{label: 'AvailableQuantity', title: 'available_quantity', number: 'true'},{label: 'ReservedQuantity', title: 'reserved_quantity', number: 'true'},{label: 'ReturnedQuantity', title: 'returned_quantity', number: 'true'},
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ const initialValues = {
|
||||
|
||||
returned_quantity: '',
|
||||
|
||||
picture: '',
|
||||
|
||||
}
|
||||
|
||||
const InventoryNew = () => {
|
||||
@ -100,6 +102,15 @@ const InventoryNew = () => {
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<FormField
|
||||
label="Picture"
|
||||
>
|
||||
<Field
|
||||
name="picture"
|
||||
placeholder="Picture"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<BaseDivider />
|
||||
<BaseButtons>
|
||||
<BaseButton type="submit" color="info" label="Submit" />
|
||||
|
||||
@ -22,7 +22,7 @@ const InventoryTablesPage = () => {
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const [filters] = useState([{label: 'ProductName', title: 'product_name'},
|
||||
const [filters] = useState([{label: 'ProductName', title: 'product_name'},{label: 'Picture', title: 'picture'},
|
||||
|
||||
{label: 'AvailableQuantity', title: 'available_quantity', number: 'true'},{label: 'ReservedQuantity', title: 'reserved_quantity', number: 'true'},{label: 'ReturnedQuantity', title: 'returned_quantity', number: 'true'},
|
||||
|
||||
|
||||
@ -69,6 +69,11 @@ const InventoryView = () => {
|
||||
<p>{inventory?.returned_quantity || 'No data'}</p>
|
||||
</div>
|
||||
|
||||
<div className={'mb-4'}>
|
||||
<p className={'block font-bold mb-2'}>Picture</p>
|
||||
<p>{inventory?.picture}</p>
|
||||
</div>
|
||||
|
||||
<BaseDivider />
|
||||
|
||||
<BaseButton
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user