|
|
|
@ -32,7 +32,7 @@ import { |
|
|
|
|
} from '@mui/material'; |
|
|
|
|
import { |
|
|
|
|
Add as AddIcon, Delete as DeleteIcon, ShoppingBasket as ShoppingBasketIcon, |
|
|
|
|
SoupKitchen as SoupKitchenIcon |
|
|
|
|
SoupKitchen as SoupKitchenIcon, Edit as EditIcon |
|
|
|
|
} from '@mui/icons-material'; |
|
|
|
|
import { ToBuy, Stuff, Stock } from '../types/types'; |
|
|
|
|
import { TOBUY_ERRORS } from '../constants/errorMessages'; |
|
|
|
@ -133,7 +133,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
const handleBuy = async (tobuyId: number) => { |
|
|
|
|
try { |
|
|
|
|
const today = new Date().toISOString().substring(0, 10); |
|
|
|
|
await toBuyApi.buy({tobuyId, ...newStock, lastUpdate: today}); |
|
|
|
|
await toBuyApi.buy({ tobuyId, ...newStock, lastUpdate: today }); |
|
|
|
|
fetchTasks(); // 削除後の買うもの一覧を再取得
|
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(`${TOBUY_ERRORS.BUY_FAILED}:`, error); |
|
|
|
@ -194,13 +194,28 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
textDecoration: false ? 'line-through' : 'none', |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
{/* 買い物リスト:食材情報記入ボタン */} |
|
|
|
|
<ListItemSecondaryAction> |
|
|
|
|
{/* 買い物リスト:数量変更ボタン */} |
|
|
|
|
<Tooltip title="数量変更"> |
|
|
|
|
<IconButton |
|
|
|
|
edge="end" |
|
|
|
|
aria-label="数量変更" |
|
|
|
|
sx={{ marginRight: 2 }} |
|
|
|
|
onClick={() => { |
|
|
|
|
setOpenInfoDialog(true) |
|
|
|
|
//setSelectedTask(tobuy.tobuyId)
|
|
|
|
|
// handleDeleteTask(tobuy.tobuyId)
|
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<EditIcon /> |
|
|
|
|
</IconButton> |
|
|
|
|
</Tooltip> |
|
|
|
|
{/* 買い物リスト:食材情報記入ボタン */} |
|
|
|
|
<Tooltip title="食材情報追加"> |
|
|
|
|
<IconButton |
|
|
|
|
edge="end" |
|
|
|
|
aria-label="食材情報追加" |
|
|
|
|
//sx={{ marginRight: 2 }}
|
|
|
|
|
//sx={{ marginRight: 3 }}
|
|
|
|
|
onClick={() => { |
|
|
|
|
setOpenInfoDialog(true) |
|
|
|
|
setSelectedTask(tobuy.tobuyId) |
|
|
|
@ -371,7 +386,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
label="価格" |
|
|
|
|
fullWidth |
|
|
|
|
value={newStock.price} |
|
|
|
|
onChange={(e) => setNewStock({...newStock, price: parseInt(e.target.value)})} |
|
|
|
|
onChange={(e) => setNewStock({ ...newStock, price: parseInt(e.target.value) })} |
|
|
|
|
/> |
|
|
|
|
{/* 消費・賞味期限入力フィールド */} |
|
|
|
|
<TextField |
|
|
|
@ -380,7 +395,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
fullWidth |
|
|
|
|
multiline |
|
|
|
|
value={newStock.expDate} |
|
|
|
|
onChange={(e) => setNewStock({...newStock, expDate: e.target.value})} |
|
|
|
|
onChange={(e) => setNewStock({ ...newStock, expDate: e.target.value })} |
|
|
|
|
/> |
|
|
|
|
{/* 購入日入力フィールド */} |
|
|
|
|
<TextField |
|
|
|
@ -389,7 +404,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
fullWidth |
|
|
|
|
multiline |
|
|
|
|
value={newStock.buyDate} |
|
|
|
|
onChange={(e) => setNewStock({...newStock, buyDate: e.target.value})} |
|
|
|
|
onChange={(e) => setNewStock({ ...newStock, buyDate: e.target.value })} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
</DialogContent> |
|
|
|
|