|
|
|
@ -204,12 +204,8 @@ const StockPage: React.FC = () => { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* セルを選択する関数. 再度クリックで選択解除 → 修正 |
|
|
|
|
* セルを選択して編集画面 |
|
|
|
|
*/ |
|
|
|
|
// const handleRowClick = (stock: Stock) => {
|
|
|
|
|
// setSelectedRow(prev => (prev?.stockId === stock.stockId ? null : stock));
|
|
|
|
|
// };
|
|
|
|
|
// セルを選択して編集画面
|
|
|
|
|
const handleRowClick = (stock: Stock) => { |
|
|
|
|
setSelectedRow(stock); // 行選択
|
|
|
|
|
setEditStock({ ...stock }); // 編集対象にセット
|
|
|
|
@ -301,7 +297,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 編集ダイアログを閉じる */ |
|
|
|
|
const handleCloseEdit = () => { |
|
|
|
|
setIsEditOpen(false); |
|
|
|
@ -332,9 +327,9 @@ const StockPage: React.FC = () => { |
|
|
|
|
<Table> |
|
|
|
|
<TableHead sx={{ backgroundColor: "#dcdcdc", color: "#333" }}> |
|
|
|
|
<TableRow> |
|
|
|
|
<TableCell align="center" sx={{ width: '30%' }}>食材名</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '30%' }}>数量</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '40%' }}>消費・賞味期限</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '40%', fontSize: '16px'}}>食材名</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '20%', fontSize: '16px' }}>数量</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '40%', fontSize: '16px' }}>消費・賞味期限</TableCell> |
|
|
|
|
</TableRow> |
|
|
|
|
</TableHead> |
|
|
|
|
<TableBody> |
|
|
|
@ -361,9 +356,9 @@ const StockPage: React.FC = () => { |
|
|
|
|
onClick={() => handleRowClick(stock)} |
|
|
|
|
style={{ backgroundColor: selectedRow?.stockId === stock.stockId ? "yellow" : "white", cursor: "pointer" }} |
|
|
|
|
> |
|
|
|
|
<TableCell align="center" sx={{ width: '30%' }}>{stock.stuffName}</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '30%' }}>{stock.amount}</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '40%' }} |
|
|
|
|
<TableCell align="center" sx={{ width: '40%', fontSize: '16px' }}>{stock.stuffName}</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '20%', fontSize: '16px' }}>{stock.amount}</TableCell> |
|
|
|
|
<TableCell align="center" sx={{ width: '40%', fontSize: '16px' }} |
|
|
|
|
style={daysLeft <= 3 ? { color: "red", fontWeight: "bold" } : {}} |
|
|
|
|
> |
|
|
|
|
{formatDate(stock.expDate)} |
|
|
|
@ -375,7 +370,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
</Table> |
|
|
|
|
</TableContainer> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 編集ダイアログ */} |
|
|
|
|
<Dialog open={isEditOpen} onClose={handleCloseEdit} fullWidth maxWidth="sm"> |
|
|
|
|
<DialogTitle> |
|
|
|
@ -401,7 +395,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
/> |
|
|
|
|
<TextField |
|
|
|
|
label="購入価格" |
|
|
|
@ -417,7 +410,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
/> |
|
|
|
|
{/* 購入日・消費期限を横並びに */} |
|
|
|
|
<Box sx={{ display: 'flex', gap: 2, mb: 2 }}> |
|
|
|
@ -532,21 +524,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
在庫リスト |
|
|
|
|
</Typography> |
|
|
|
|
|
|
|
|
|
{/* <Box sx={{ textAlign: 'right' }}> */} |
|
|
|
|
{/* <Box |
|
|
|
|
sx={{ |
|
|
|
|
position: 'sticky', |
|
|
|
|
top: 0, |
|
|
|
|
zIndex: 1000, |
|
|
|
|
backgroundColor: '#f5f5f5', |
|
|
|
|
padding: 2, |
|
|
|
|
display: 'flex', |
|
|
|
|
gap: 0.5, |
|
|
|
|
justifyContent: 'flex-end', // ← 右寄せ
|
|
|
|
|
borderBottom: 'none', // ← これで線を消す
|
|
|
|
|
boxShadow: 'none', // ← 影も消す
|
|
|
|
|
}} |
|
|
|
|
> */} |
|
|
|
|
<Box |
|
|
|
|
sx={{ |
|
|
|
|
position: 'fixed', // ← sticky から fixed に変更
|
|
|
|
@ -557,28 +534,16 @@ const StockPage: React.FC = () => { |
|
|
|
|
backgroundColor: '#f5f5f5', |
|
|
|
|
padding: 2, |
|
|
|
|
display: 'flex', |
|
|
|
|
justifyContent: 'flex-end', // ← 左寄せ
|
|
|
|
|
boxShadow: 'none', // 軽めの上向きシャドウ
|
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
|
|
|
|
|
{/* 在庫の食材追加ボタン */} |
|
|
|
|
{/* <Button variant="contained" color="primary" onClick={handleOpenAdd} sx={{ mt: 3, mb: 2, mr: 1 }}> |
|
|
|
|
追加 |
|
|
|
|
</Button> */} |
|
|
|
|
{/* <Button variant="contained" color="primary" onClick={handleOpenAdd} sx={{ mt: 3, mb: 2, mr: 1 }}> |
|
|
|
|
追加 |
|
|
|
|
</Button> */} |
|
|
|
|
{/* <Typography variant="caption" color="textSecondary"> |
|
|
|
|
食材の追加 |
|
|
|
|
</Typography> |
|
|
|
|
<Fab |
|
|
|
|
color="primary" |
|
|
|
|
onClick={handleOpenAdd} |
|
|
|
|
> |
|
|
|
|
<AddIcon /> |
|
|
|
|
</Fab> */} |
|
|
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', |
|
|
|
|
ml: 90, }}> |
|
|
|
|
<Box sx={{ |
|
|
|
|
display: 'flex', flexDirection: 'column', alignItems: 'flex-end', |
|
|
|
|
mr: 2, |
|
|
|
|
}}> |
|
|
|
|
<Typography variant="caption" color="textSecondary"> |
|
|
|
|
食材の追加 |
|
|
|
|
</Typography> |
|
|
|
@ -587,7 +552,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
</Fab> |
|
|
|
|
</Box> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 新規タスク作成ダイアログ */} |
|
|
|
|
<Dialog open={isAddOpen} onClose={handleCloseAdd} disableScrollLock={true}> |
|
|
|
|
<Box display="flex" alignItems="center" > |
|
|
|
@ -732,17 +696,6 @@ const StockPage: React.FC = () => { |
|
|
|
|
</Button> |
|
|
|
|
</DialogActions> |
|
|
|
|
</Dialog> |
|
|
|
|
|
|
|
|
|
{/* 在庫の食材編集ボタン(全テーブル共通) |
|
|
|
|
<Button variant="contained" color="success" onClick={handleOpenEdit} sx={{ |
|
|
|
|
mt: 3, mb: 2, mr: 1 |
|
|
|
|
}}> |
|
|
|
|
詳細・編集 |
|
|
|
|
</Button> */} |
|
|
|
|
|
|
|
|
|
{/* 在庫の食材削除ボタン (全テーブル共通) |
|
|
|
|
<Button variant="contained" color="error" onClick={handleOpenDelete} sx={{ mt: 3, mb: 2 }}>削除</Button> */} |
|
|
|
|
|
|
|
|
|
</Box> |
|
|
|
|
|
|
|
|
|
{/* 在庫一覧リスト */} |
|
|
|
|