|
|
|
@ -86,17 +86,17 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
|
|
|
|
|
const handleSaveRecipe = async () => { |
|
|
|
|
|
|
|
|
|
// if (!recipeName) {
|
|
|
|
|
// showErrorMessage('レシピ名が入力されていません!')
|
|
|
|
|
// console.log("yes1");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (!items.length) {
|
|
|
|
|
// showErrorMessage('材料が追加されていません!')
|
|
|
|
|
// console.log("yes2");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
if (!recipeName) { |
|
|
|
|
showErrorMessage('レシピ名が入力されていません!') |
|
|
|
|
console.log("yes1"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!items.length) { |
|
|
|
|
showErrorMessage('材料が追加されていません!') |
|
|
|
|
console.log("yes2"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
if (!recipeId) { |
|
|
|
@ -127,13 +127,13 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
const checkRecipeAndItems = async () => { |
|
|
|
|
|
|
|
|
|
if (!recipeName) { |
|
|
|
|
alert('レシピ名が入力されていません!') |
|
|
|
|
showErrorMessage('レシピ名が入力されていません!') |
|
|
|
|
console.log("yes1"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!items.length) { |
|
|
|
|
alert('材料が追加されていません!') |
|
|
|
|
showErrorMessage('材料が追加されていません!') |
|
|
|
|
console.log("yes2"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -154,7 +154,7 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
console.log("before"); |
|
|
|
|
if (!recipeId) return false; |
|
|
|
|
console.log("ds"); |
|
|
|
|
await toBuyApi.addByRecipe(recipeId); |
|
|
|
|
await toBuyApi.addByRecipe(recipeId, numOfPeaple); |
|
|
|
|
showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); |
|
|
|
|
navigate('/tasks'); |
|
|
|
|
} |
|
|
|
@ -312,12 +312,13 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
setOpenAmountDialog(false); |
|
|
|
|
}} /> |
|
|
|
|
|
|
|
|
|
{/* 人数入力ダイアログ */} |
|
|
|
|
<Dialog open={openNumOfPeapleDialog} onClose={() => setOpenNumOfPeapleDialog(false)} disableScrollLock={true} |
|
|
|
|
style={{ width : '100%', position : 'fixed', left: '50%', transform: 'translateX(-50%)' }} |
|
|
|
|
> |
|
|
|
|
<Box display="flex" alignItems="center" |
|
|
|
|
> |
|
|
|
|
<DialogTitle sx={{ flexGrow: 1 }}>何人前かを入力</DialogTitle> |
|
|
|
|
<DialogTitle sx={{ flexGrow: 1 }}>買うものリストへ追加</DialogTitle> |
|
|
|
|
</Box> |
|
|
|
|
<DialogContent> |
|
|
|
|
<div> |
|
|
|
@ -343,10 +344,10 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
</DialogContent> |
|
|
|
|
<DialogActions> |
|
|
|
|
<Button onClick={() => setOpenNumOfPeapleDialog(false)}>前の画面に戻る</Button> |
|
|
|
|
<Button onClick={() => handleSubmitAndAddToBuy} variant="contained" |
|
|
|
|
style={{ width: '40%', fontSize: '1vw' }} |
|
|
|
|
<Button onClick={() => handleSubmitAndAddToBuy()} variant="contained" |
|
|
|
|
style={{ width: '40%', fontSize: 'clamp(12px, 3vw, 20px)' }} |
|
|
|
|
> |
|
|
|
|
人数分の食材を買い物リストへ登録 |
|
|
|
|
追加 |
|
|
|
|
</Button> |
|
|
|
|
</DialogActions> |
|
|
|
|
</Dialog> |
|
|
|
|