Skip to content

Commit f341133

Browse files
Merge pull request #3362 from OneCommunityGlobal/SaiPreetham-add-functions-material-list-bmdashboard
Sai preetham add functions material list bmdashboard
2 parents 6946f7a + ede2895 commit f341133

4 files changed

Lines changed: 98 additions & 10 deletions

File tree

src/components/BMDashboard/ItemList/ItemListView.css

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,54 @@
4040
}
4141

4242
.select_input {
43+
display: grid;
44+
grid-template-columns: auto 1fr auto 1fr auto 1fr;
45+
align-items: center;
46+
gap: 15px;
47+
width: 100%;
48+
max-width: 1200px;
49+
margin: 0 auto 10px auto;
50+
overflow: visible;
51+
}
52+
53+
.select_input label {
54+
font-weight: bold;
55+
text-align: right;
56+
min-width: 100px;
57+
white-space: nowrap;
58+
margin-bottom: 8px;
59+
}
60+
61+
.select_input input,
62+
.select_input select {
63+
height: 38px;
64+
width: 100%;
65+
min-width: 220px;
66+
max-width: 240px;
67+
padding: 5px;
68+
border: 1px solid #ccc;
69+
border-radius: 4px;
70+
margin-bottom: 8px;
71+
}
72+
73+
.select_input input[type='text'] {
74+
padding: 5px;
75+
margin-bottom: 8px;
76+
}
77+
.btn-primary {
78+
background-color: #468ef9;
79+
color: white;
80+
border: none;
81+
padding: 8px 12px;
82+
border-radius: 4px;
83+
cursor: pointer;
84+
}
85+
.buttons-row {
4386
display: flex;
44-
background-color: blanchedalmond;
45-
align-items: flex-end;
46-
width: 300px;
47-
column-gap: 1rem;
87+
justify-content: center;
88+
gap: 15px;
89+
margin-bottom: 15px;
90+
}
91+
.btn-primary:hover {
92+
background-color: #3b82f6;
4893
}

src/components/BMDashboard/ItemList/ItemListView.jsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState, useEffect } from 'react';
22
import PropTypes from 'prop-types';
3-
3+
import DatePicker from 'react-datepicker';
4+
import 'react-datepicker/dist/react-datepicker.css';
45
import BMError from '../shared/BMError';
56
import SelectForm from './SelectForm';
67
import SelectItem from './SelectItem';
@@ -12,6 +13,7 @@ export function ItemListView({ itemType, items, errors, UpdateItemModal, dynamic
1213
const [selectedProject, setSelectedProject] = useState('all');
1314
const [selectedItem, setSelectedItem] = useState('all');
1415
const [isError, setIsError] = useState(false);
16+
const [selectedTime, setSelectedTime] = useState(new Date());
1517

1618
useEffect(() => {
1719
if (items) setFilteredItems([...items]);
@@ -53,9 +55,19 @@ export function ItemListView({ itemType, items, errors, UpdateItemModal, dynamic
5355
<main className="items_list_container">
5456
<h3>{itemType}</h3>
5557
<section>
56-
<span style={{ display: 'flex', margin: '5px' }}>
58+
<span>
5759
{items && (
58-
<>
60+
<div className="select_input">
61+
<label>Time:</label>
62+
<DatePicker
63+
selected={selectedTime}
64+
onChange={date => setSelectedTime(date)}
65+
showTimeSelect
66+
timeFormat="HH:mm"
67+
timeIntervals={15}
68+
dateFormat="yyyy-MM-dd HH:mm:ss"
69+
placeholderText="Select date and time"
70+
/>
5971
<SelectForm
6072
items={items}
6173
setSelectedProject={setSelectedProject}
@@ -67,8 +79,19 @@ export function ItemListView({ itemType, items, errors, UpdateItemModal, dynamic
6779
selectedItem={selectedItem}
6880
setSelectedItem={setSelectedItem}
6981
/>
70-
</>
82+
</div>
7183
)}
84+
<div className="buttons-row">
85+
<button type="button" className="btn-primary">
86+
Add Material
87+
</button>
88+
<button type="button" className="btn-primary">
89+
Edit Name/Measurement
90+
</button>
91+
<button type="button" className="btn-primary">
92+
View Update History
93+
</button>
94+
</div>
7295
</span>
7396
{filteredItems && (
7497
<ItemsTable

src/components/BMDashboard/ItemList/ItemsTable.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export default function ItemsTable({
117117
{dynamicColumns.map(({ label }) => (
118118
<th key={label}>{label}</th>
119119
))}
120+
<th>Usage Record</th>
120121
<th>Updates</th>
121122
<th>Purchases</th>
122123
</tr>
@@ -132,6 +133,23 @@ export default function ItemsTable({
132133
{dynamicColumns.map(({ label, key }) => (
133134
<td key={label}>{getNestedValue(el, key)}</td>
134135
))}
136+
<td className="items_cell">
137+
<button
138+
type="button"
139+
onClick={() => handleEditRecordsClick(el, 'UsageRecord')}
140+
aria-label="Edit Record"
141+
>
142+
<BiPencil />
143+
</button>
144+
<Button
145+
color="primary"
146+
outline
147+
size="sm"
148+
onClick={() => handleViewRecordsClick(el, 'UsageRecord')}
149+
>
150+
View
151+
</Button>
152+
</td>
135153
<td className="items_cell">
136154
<button
137155
type="button"

src/components/BMDashboard/MaterialList/MaterialListView.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ function MaterialListView() {
3131
const itemType = 'Materials';
3232

3333
const dynamicColumns = [
34-
{ label: 'Unit', key: 'itemType.unit' },
34+
{ label: 'PID', key: 'product id' },
35+
{ label: 'Measurement', key: 'itemType.unit' },
3536
{ label: 'Bought', key: 'stockBought' },
3637
{ label: 'Used', key: 'stockUsed' },
3738
{ label: 'Available', key: 'stockAvailable' },
38-
{ label: 'Waste', key: 'stockWasted' },
39+
{ label: 'Wasted', key: 'stockWasted' },
40+
{ label: 'Hold', key: 'stockHold' },
3941
];
4042

4143
return (

0 commit comments

Comments
 (0)