diff --git a/www/css/index.css b/www/css/index.css index c70666f..4a85f77 100644 --- a/www/css/index.css +++ b/www/css/index.css @@ -98,6 +98,9 @@ body.dollars span.price::before { body.dollars span.price::after { content: ''; } +span.recipeItemAmount::after { + content: 'x'; +} .subtotal { font-weight: bold; diff --git a/www/plan/do.php b/www/plan/do.php index 586e54b..f5a9076 100644 --- a/www/plan/do.php +++ b/www/plan/do.php @@ -90,7 +90,11 @@ if(!empty($data) && isset($user_id)){ returns("Missing a value: $temp", 1); } - if( ($itemID = addItem($data['storeID'], $data['name'], $data['price'])) !== false ){ + if(!isset($data['amount'])){ + $data['amount'] = 1; + } + + if( ($itemID = addItem($data['storeID'], $data['name'], $data['price'], $data['amount'])) !== false ){ returns($itemID); } else { @@ -370,13 +374,13 @@ function deleteStore($storeID, $storeName, $itemsLength){ return false; } -function addItem($storeID, $name, $price){ +function addItem($storeID, $name, $price, $amount){ global $db, $spaceID; $verifyUserOwnershipSQL = "SELECT plan_store_id FROM plan_store WHERE `space_id` = '$spaceID' AND plan_store_id = '$storeID'"; - $insertItemSQL = "INSERT INTO plan_store_item (`plan_store_id`, `pos`, `name`, `price`) - SELECT ($verifyUserOwnershipSQL), count(0)+1, '$name', $price FROM plan_store_item WHERE plan_store_id = '$storeID';"; + $insertItemSQL = "INSERT INTO plan_store_item (`plan_store_id`, `pos`, `name`, `price`, `amount`) + SELECT ($verifyUserOwnershipSQL), count(0)+1, '$name', $price, $amount FROM plan_store_item WHERE plan_store_id = '$storeID';"; if($db->query($insertItemSQL)){ return $db->insert_id; @@ -418,7 +422,7 @@ function moveItem($storeID, $itemID, $afterID){ if($sameStoreCheck = $db->query($sameStoreCheckSQL)){ $stores = $sameStoreCheck->fetch_array(); - if($stores[0] != $stores[1]){ + if(isset($stores[1]) && $stores[0] != $stores[1]){ // DIFFERENT STORES $storeID = $stores[1]; $differentStoreAddSQL = ", plan_store_id = $storeID"; diff --git a/www/plan/index.php b/www/plan/index.php index 629bf24..fbc0712 100644 --- a/www/plan/index.php +++ b/www/plan/index.php @@ -28,15 +28,55 @@