|
|
|
@ -44,7 +44,7 @@ const EMPTY_TASK: Omit<ToBuy, 'tobuy_id'> & {category: string} & {newAddition: b |
|
|
|
amount: 0, |
|
|
|
amount: 0, |
|
|
|
shop: '', |
|
|
|
shop: '', |
|
|
|
category: '', |
|
|
|
category: '', |
|
|
|
newAddition: false |
|
|
|
newAddition: false, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const TaskListPage: React.FC = () => { |
|
|
|
const TaskListPage: React.FC = () => { |
|
|
|
@ -52,12 +52,11 @@ const TaskListPage: React.FC = () => { |
|
|
|
const [tobuys, setToBuys] = useState<ToBuy[]>([]); |
|
|
|
const [tobuys, setToBuys] = useState<ToBuy[]>([]); |
|
|
|
// 新規タスク作成ダイアログの表示状態
|
|
|
|
// 新規タスク作成ダイアログの表示状態
|
|
|
|
const [openDialog, setOpenDialog] = useState(false); |
|
|
|
const [openDialog, setOpenDialog] = useState(false); |
|
|
|
// 新規タスクの入力内容
|
|
|
|
|
|
|
|
const [newTask, setNewTask] = useState(EMPTY_TASK); |
|
|
|
|
|
|
|
//在庫登録ダイアログの表示状態
|
|
|
|
//在庫登録ダイアログの表示状態
|
|
|
|
const [openInfoDialog, setOpenInfoDialog] = useState(false); |
|
|
|
const [openInfoDialog, setOpenInfoDialog] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const [selectedTask, setSelectedTask] = useState<Task>(); |
|
|
|
const [selectedTask, setSelectedTask] = useState<ToBuy>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [newToBuy, setNewToBuy] = useState(EMPTY_TASK); |
|
|
|
const [newToBuy, setNewToBuy] = useState(EMPTY_TASK); |
|
|
|
@ -165,6 +164,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
<IconButton |
|
|
|
<IconButton |
|
|
|
edge="end" |
|
|
|
edge="end" |
|
|
|
aria-label="食材情報追加" |
|
|
|
aria-label="食材情報追加" |
|
|
|
|
|
|
|
onClick={() => setOpenInfoDialog(true)} |
|
|
|
//onClick={() => handleDeleteTask(task.id)}
|
|
|
|
//onClick={() => handleDeleteTask(task.id)}
|
|
|
|
> |
|
|
|
> |
|
|
|
<ShoppingBasketIcon /> |
|
|
|
<ShoppingBasketIcon /> |
|
|
|
@ -228,7 +228,8 @@ const TaskListPage: React.FC = () => { |
|
|
|
<FormControlLabel |
|
|
|
<FormControlLabel |
|
|
|
control={<Checkbox />} |
|
|
|
control={<Checkbox />} |
|
|
|
label="食材を新規追加" |
|
|
|
label="食材を新規追加" |
|
|
|
checked={newTask.newAddition} |
|
|
|
checked={newToBuy.newAddition} |
|
|
|
|
|
|
|
onChange={(e) => setNewToBuy({ ...newToBuy, newAddition:(e.target as HTMLInputElement).checked })} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
@ -306,7 +307,7 @@ const TaskListPage: React.FC = () => { |
|
|
|
<Button onClick={() => setOpenInfoDialog(false)}>キャンセル</Button> |
|
|
|
<Button onClick={() => setOpenInfoDialog(false)}>キャンセル</Button> |
|
|
|
<Button onClick={() => { |
|
|
|
<Button onClick={() => { |
|
|
|
if (selectedTask) { |
|
|
|
if (selectedTask) { |
|
|
|
handleDeleteTask(selectedTask.id) |
|
|
|
handleDeleteTask(selectedTask.tobuy_id) |
|
|
|
setOpenInfoDialog(false) |
|
|
|
setOpenInfoDialog(false) |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
}} |
|
|
|
|