Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/BMDashboard/AddMaterial/AddMaterial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export default function AddMaterialForm() {
enableLongNumbers={false}
inputStyle={{ height: 'auto', width: '40%', fontSize: 'inherit' }}
inputProps={{ id: 'phone-number' }}
containerClass={darkMode ? styles.phoneDark : ''}
/>
{showPhoneValidationError && !phoneValid && formData.phoneNumber && (
<div
Expand All @@ -559,6 +560,7 @@ export default function AddMaterialForm() {
value={formData.images}
// onFilesSelected={handleFilesSelected}
updateUploadedFiles={setUploadedFiles}
wrapperClass={darkMode ? styles.dragWrapper : ''}
/>
{uploadedFiles.length > 0 && (
<div className={`${styles.filePreviewContainer}`}>
Expand Down
15 changes: 11 additions & 4 deletions src/components/BMDashboard/InventoryTypesList/TypesTable.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useState } from 'react';
import { Table, Button, Form } from 'react-bootstrap';
import { connect } from 'react-redux';
import { connect, useSelector } from 'react-redux';
import { addInvType } from '../../../actions/bmdashboard/invTypeActions';
import TypeRow from './TypeRow';
import styles from './TypesList.module.css';

export function TypesTable(props) {
const { itemTypes, category, dispatch } = props;
const units = useSelector(state => state.bmInvUnits.list) || [];
const [isAdding, setIsAdding] = useState(false);
const [newType, setNewType] = useState({ name: '', description: '', unit: '', fuel: '' });

Expand Down Expand Up @@ -98,13 +99,19 @@ export function TypesTable(props) {
{requiresUnit && (
<td>
<Form.Control
type="text"
as="select"
name="unit"
value={newType.unit}
onChange={handleInputChange}
placeholder="Enter unit"
size="sm"
/>
>
<option value="">Select unit</option>
{units.map(u => (
<option key={u._id || u.unit} value={u.unit}>
{u.unit}
</option>
))}
</Form.Control>
</td>
)}
{category === 'Equipments' && (
Expand Down
35 changes: 32 additions & 3 deletions src/components/BMDashboard/ItemList/ItemsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,31 @@ export default function ItemsTable({
ItemsTable.propTypes = {
selectedProject: PropTypes.string,
selectedItem: PropTypes.string,
filteredItems: PropTypes.arrayOf(PropTypes.object),
filteredItems: PropTypes.arrayOf(
PropTypes.shape({
_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
itemType: PropTypes.shape({
name: PropTypes.string,
unit: PropTypes.string,
}),
project: PropTypes.shape({
_id: PropTypes.string,
name: PropTypes.string,
}),
}),
),
UpdateItemModal: PropTypes.elementType,
dynamicColumns: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string,
key: PropTypes.string,
}),
).isRequired,
),
darkMode: PropTypes.bool,
itemType: PropTypes.string,
sortConfig: PropTypes.shape({
key: PropTypes.string,
direction: PropTypes.string,
direction: PropTypes.oneOf(['asc', 'desc']),
}),
onSort: PropTypes.func,
totalItems: PropTypes.number,
Expand All @@ -331,3 +343,20 @@ ItemsTable.propTypes = {
onPageChange: PropTypes.func,
onRowsPerPageChange: PropTypes.func,
};

ItemsTable.defaultProps = {
selectedProject: '',
selectedItem: '',
filteredItems: [],
UpdateItemModal: null,
dynamicColumns: [],
darkMode: false,
itemType: '',
sortConfig: { key: null, direction: 'asc' },
totalItems: 0,
currentPage: 1,
totalPages: 1,
rowsPerPage: 25,
startRow: 0,
endRow: 0,
};
Loading
Loading