diff --git a/Gemfile b/Gemfile index af5619a..e56b709 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "rails", "~> 8.0.2" # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem "propshaft" # Use postgresql as the database for Active Record -gem "pg", "~> 1.1" +gem "pg", "~> 1.5" # Use the Puma web server [https://github.com/puma/puma] gem "puma", ">= 5.0" # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] @@ -16,7 +16,7 @@ gem "turbo-rails" gem "stimulus-rails" # Build JSON APIs with ease [https://github.com/rails/jbuilder] gem "jbuilder" - +gem 'hotwire-rails' gem "devise" # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] diff --git a/Gemfile.lock b/Gemfile.lock index 6098c88..fa7973e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,6 +78,7 @@ GEM base64 (0.3.0) bcrypt (3.1.20) bcrypt_pbkdf (1.1.1) + bcrypt_pbkdf (1.1.1-x64-mingw-ucrt) bcrypt_pbkdf (1.1.1-x86-mingw32) benchmark (0.4.1) bigdecimal (3.2.2) @@ -127,6 +128,10 @@ GEM raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) + hotwire-rails (0.1.3) + rails (>= 6.0.0) + stimulus-rails + turbo-rails i18n (1.14.7) concurrent-ruby (~> 1.0) importmap-rails (2.1.0) @@ -188,6 +193,8 @@ GEM nokogiri (1.18.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) + nokogiri (1.18.4-x64-mingw-ucrt) + racc (~> 1.4) nokogiri (1.18.4-x86_64-linux-gnu) racc (~> 1.4) orm_adapter (0.5.0) @@ -196,6 +203,7 @@ GEM parser (3.3.9.0) ast (~> 2.4.1) racc + pg (1.6.0-x64-mingw-ucrt) pg (1.6.0-x86-mingw32) pg (1.6.0-x86_64-linux) pp (0.6.2) @@ -211,7 +219,7 @@ GEM date stringio public_suffix (6.0.2) - puma (6.6.0) + puma (6.6.1) nio4r (~> 2.0) raabro (1.4.0) racc (1.8.1) @@ -379,6 +387,7 @@ GEM zeitwerk (2.7.3) PLATFORMS + x64-mingw-ucrt x86-mingw32 x86_64-linux @@ -389,10 +398,11 @@ DEPENDENCIES debug devise factory_bot_rails + hotwire-rails importmap-rails jbuilder kamal - pg (~> 1.1) + pg (~> 1.5) propshaft puma (>= 5.0) rails (~> 8.0.2) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index fe93333..5e053a6 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,10 +1,589 @@ -/* - * This is a manifest file that'll be compiled into application.css. - * - * With Propshaft, assets are served efficiently without preprocessing steps. You can still include - * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard - * cascading order, meaning styles declared later in the document or manifest will override earlier ones, - * depending on specificity. - * - * Consider organizing styles into separate files for maintainability. - */ +*, +body { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} + + +.header-user { + display: flex; + align-items: center; + justify-content: space-between; + background-color: #0077b6; + padding-bottom: 3px; +} + +.header-user .email-user { + color: #fff; + font-size: 11px; + padding-right: 3px; +} + +.header-user .btn-logout { + background: none; + border: none; + color: #fff; + text-decoration: underline; + padding-left: 3px; + cursor: pointer; +} + +.header-user .btn-logout:hover { + color: #492b4f; +} + +.login-page { + height: 100vh; + background: #8a26d1; + background: #c8d9ed; + display: flex; +} + +.login-page .login-page-box { + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + height: 350px; + background-color: #ffffff; + width: 250px; + margin: auto; + padding-top: 25px; +} + +.login-page .login-page-form { + margin-top: 20px; + margin-bottom: 20px; +} + +.login-page .login-page-inputs { + height: 35px; + background-color: #d0d0d0; + width: 205px; + margin-top: 5px; + border: none; + margin-bottom: 5px; + padding-left: 10px; +} + +.login-page .login-page-inputs:focus { + outline: none; + box-shadow: none; +} + +.login-page .field.remember-me { + display: flex; + align-items: center; + gap: 6px; +} + +.login-page .field.remember-me .label { + font-size: 11px; + color: #d0d0d0; + gap: 6px; +} + +.login-page .actions .btn { + width: 205px; + height: 35px; + border: none; + text-transform: uppercase; + background-color: #ae28b5; + color: white; + cursor: pointer; +} + +.login-page-signup { + text-decoration: none; + font-size: 12px; + color: #d0d0d0; +} + +.login-page-forgot-your-password { + font-size: 10px; + color: #d0d0d0; +} + + +/* ///// */ + +.text-registration-password { + font-size: 11px +} + +.login-singup-page { + font-size: 10px; + color: #d0d0d0; + padding-bottom: 40px; + margin-top: 10px; +} + +/* ////// */ + + +.container-home-page-macro { + background-color: #faf0e6; + padding-top: 50px; + height: 100vh; +} + +.home-page-macro { + border-radius: 6px; + width: 410px; + height: 300px; + background: #ffffff; + margin: auto; + margin-top: auto; + align-items: center; + display: flex; + flex-direction: column; + margin-top: 100px; + padding-top: 20px; +} + + + +.container-macro-form { + display: flex; + flex-direction: column; +} + +.macro-form .input-macro-form { + margin-top: 5px; + margin-bottom: 5px; + border: none; + height: 30px; + width: 300px; + border-radius: 6px; + border: 1px solid #F4E7E1; +} + +.macro-form .macro-form-fields { + display: flex; + flex-direction: column; +} + + +.macro-form .btn-macro-form { + height: 30px; + border-radius: 6px; + width: 300px; + margin-top: 10px; + border: none; + text-align: center; + font-weight: bold; + text-transform: uppercase; + cursor: pointer; + color: #ffffff; + background: #2A7B9B; + background: #4663ac; +} + +.btn-macro-form:hover { + background-color: #c1d8f0; +} + +/* ///// */ + + +.daily-macros { + display: flex; + align-items: center; + background-color: #0077b6; + justify-content: space-between; + color: #ffffff; + gap: 10px; + padding-top: 4px; + padding-bottom: 4px; +} + +.daily-macros div { + display: flex; + gap: 20px; + align-items: center; +} + +.daily-macros .daily-macros-foods { + width: 20%; +} + + +/* //// */ + +.food-page { + display: flex; + justify-content: space-between; +} + +.food-page .food-page-total-macros { + margin-top: 5px; + margin-bottom: 45px; +} + +.food-page .food-page-total-macros .btn-change-macros { + color: #ffffff; + background: #0077b6; + width: 80px; + height: 25px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + text-decoration: none; + font-size: 10px; + border-radius: 2px; + margin-top: 10px; + font-weight: bold; +} + +.food-page .food-page-total-macros .btn-change-macros:hover { + background-color: red; +} + +.food-page .food-page-food-selection { + border: 1px solid; + display: flex; + flex-direction: column; + width: 60%; + height: max-content; +} + +.food-page-food-selection .food-data { + display: flex; + flex-direction: column; + border-bottom: 1px solid #000000; +} + +.food-page-food-selection .container-btn-new-food { + margin-top: 150px; + background: #04a12b; + width: 100%; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; +} + +.food-page-food-selection .container-btn-new-food .btn-new-food { + text-decoration: none; + color: #ffffff; + font-size: 15px; +} + +.food-page-food-selection .container-btn-new-food:hover { + background-color: #218838; +} + +.food-page-food-selection .food-data>div:first-of-type { + display: flex; + align-items: center; + justify-content: space-between; + background: #DADADA +} + + + +.food-page-food-selection .food-data>div:nth-of-type(2) { + display: flex; + flex-direction: column; +} + +.food-page-food-selection .food-data span { + font-size: 13px; +} + +.food-page-food-selection .food-data .serving-text { + font-size: 12px; + padding-right: 10px; +} + + + +.food-card-container { + display: flex; + align-items: center; + border-bottom: 1px solid; + width: 97%; + justify-content: space-between; + margin-bottom: 5px; +} + + + +.food-card-container .food-card { + margin-left: 3px; + margin-bottom: 5px; +} + + +.food-card-meal-type { + font-size: 22px; + padding-left: 3px; + text-decoration: none; + color: #000000; + +} + +.food-card .name { + font-size: 14px; + font-weight: bold; + padding-left: 1px; + +} + +.food-card .macros { + font-size: 12px; + padding-left: 1px; +} + +.food-card-image { + display: flex; + align-items: center; + background-color: #DADADA; + gap: 3px; + margin-bottom: 3px; + width: 100%; + justify-content: space-between; + +} + +.food-page-container { + display: flex; + align-items: center; + background-color: #DADADA; + gap: 3px; + margin-bottom: 3px; + justify-content: space-between; +} + +.food-card-image p { + padding-left: 3px; +} + +.food-card-image .img { + max-width: 30px; + height: auto; +} + + +.meal-display-none { + display: none; +} + +.meal-link { + text-decoration: none; + color: #000000; +} + +.meal { + cursor: pointer; +} + +.saved-foods { + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.saved-foods .add-new-food:hover { + background-color: #218838 !important; +} + +.saved-foods .saved-foods-food-name { + font-size: 16px; +} + +.saved-foods .saved-foods-calories { + font-size: 12px; +} + +.saved-foods .saved-foods-serving, +.saved-foods .saved-foods-fats, +.saved-foods .saved-foods-protein, +.saved-foods .saved-foods-carbs { + font-size: 11px; + color: #c0c0c0; +} + + + + +.food-page>div:first-of-type { + display: flex; + flex-direction: column; +} + +.food-page .food-page-table-of-macros { + display: flex; + align-items: end; +} + +.food-page .food-page-table-of-macros .table { + display: flex; + flex-direction: column; +} + + +.food-page .food-page-table-of-macros .macro-data { + font-size: 11px; + height: 30px; + border: 1px solid; + padding-right: 3px; + padding-left: 3px; + display: flex; + justify-content: center; + align-items: center; +} + +.food-page .food-page-table-of-macros .macro-data.goal { + background-color: #caf0f8; + font-weight: bold; +} + +.food-page .food-page-table-of-macros .macro { + background-color: #0077b6; + display: flex; + justify-content: center; + align-items: center; + padding-right: 3px; + padding-left: 3px; + font-size: 12px; + height: 30px; + border: 1px solid #000000; +} + +.search-food-container { + background-color: #f6f6f6; +} + +.search-food { + display: flex; + flex-direction: column; + align-items: center; + height: 340px; + background-color: #c8d9ed; + width: 300px; + margin: auto; + padding-top: 25px; + border-radius: 20px; +} + +.search-food>div>h5 { + font-size: 20px; + color: #000000; + text-transform: uppercase; +} + +.search-food>div>img { + width: 25px; +} + +.search-food .meal-type { + display: flex; + align-items: center; + justify-content: center; + gap: 5px; +} + + + +.search-food .search-food-inputs { + border-radius: 6px; + border: none; + width: 260px; + height: 25px; + +} + +.search-food .search-food-labels { + color: #000000; + margin-bottom: 5px; + margin-top: 5px; + font-size: 13px; +} + +.search-food .search-food-inputs:focus { + outline: none; + box-shadow: none; +} + +.search-food .search-food-label-input { + display: flex; + flex-direction: column; +} + +.search-food .btn-search-food { + color: #ffffff; + background: #0077b6; + width: 260px; + height: 35px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + text-decoration: none; + font-size: 10px; + border-radius: 5px; + margin-top: 10px; + font-weight: bold; + border: none; +} + +.search-food .btn-search-food:hover { + background-color: #339edc; +} + + +.search-food-container { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + + +@media (min-width: 360px) and (max-width: 1100px) { + .food-page { + flex-direction: column; + align-items: center; + } + + .food-page>div:first-of-type { + flex-direction: column; + } + + .text-header-calories-mobile { + font-size: 12px; + } + + .daily-macros .daily-macros-foods { + width: unset; + } + + .food-page .food-page-total-macros { + margin-bottom: 15px; + } + + .food-page .food-page-total-macros { + text-align: center; + display: flex; + flex-direction: column; + align-items: center; + } + + .food-page .food-page-table-of-macros { + margin-bottom: 20px; + } + + .saved-foods .foods { + text-align: center; + } + + .home-page-macro { + width: 380px; + } + +} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index aca268e..97274c3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,5 +12,5 @@ def set_daily_macros # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. - allow_browser versions: :modern + # allow_browser versions: :modern end diff --git a/app/controllers/daily_macros_controller.rb b/app/controllers/daily_macros_controller.rb index 24a345c..21e989d 100644 --- a/app/controllers/daily_macros_controller.rb +++ b/app/controllers/daily_macros_controller.rb @@ -6,20 +6,19 @@ class DailyMacrosController < ApplicationController def index @daily_macros = DailyMacro.all - render json: @daily_macros - # transforma os dados que vao vindo em json + respond_to do | format | + format.html + format.json {render json: @daily_macros} + end end def create - @daily_macro = DailyMacro.new @daily_macro = current_user.daily_macros.new(daily_macros_params) - if @daily_macro.save - redirect_to daily_macros_path, notice: "criado" + redirect_to foods_path, notice: "criado" else - render :new - # se der errado renderiza a view dailymacros/new - end + render :index + end end def show diff --git a/app/controllers/foods_controller.rb b/app/controllers/foods_controller.rb index d72c841..f39b60f 100644 --- a/app/controllers/foods_controller.rb +++ b/app/controllers/foods_controller.rb @@ -4,18 +4,42 @@ class FoodsController < ApplicationController def index @foods = Food.all @food = Food.new + @user = current_user end + + def create + + + + # validando se os parametros estao presentes, antes de chamar a api + if params[:query].blank? || params[:unit].blank? || params[:meal_type].blank? + @food = Food.new + return render :new + end + + + + + client = CaloriesNinjaClientApi.new("guHq9j7UywoDJ+Hq1cHD0w==VBcqIaYVifJRhKwF") # chama a classe CaloriesNinjaClientApi que esta dentro da pasta services. Passa a chave que o site da api te manda como parametro. - + foodsearch = client.search_food(params[:query], params[:unit]) # dentro da classe CalorieNinjaClientApi tem um metodo chamado search_food. Vc esta acionando ele. Ele tem dois parametros que vc esta passando como :query e :unit + + items = foodsearch["items"][0] + if items.blank? || items["name"].blank? + @food = Food.new + + return render :new + end + + user_id = current_user.id - items = foodsearch["items"][0] # retorna a api com o index 0 # aqui embaixo retorna o resto dos valores da api @@ -24,24 +48,46 @@ def create fats = items["fat_total_g"] protein = items["protein_g"] calories = items["calories"] - serving = items["serving_size_g"] + serving = items["serving_size_g"].to_i + + + + @food= Food.new(foodname: name, carbs: carbs, fats: fats, proteins: protein, calories: calories, user_id: user_id, meal_type: params[:meal_type], serving_size: serving) if @food.save - render json: @food, status: :created - # redirect_to @food, notice: "Comida salva com sucesso" + respond_to do | format | + format.html { redirect_to foods_path } + format.json {render json: @food, status: :created} + end else - - render :new, alert: "Erro ao salvar" + respond_to do | format | + format.html { render :new, status: :unprocessable_entity } + format.json { render json: @food.errors, status: :unprocessable_entity } + end end + + end def new - @food = current_user.foods.order(created_at: :desc) - # pega os dados de food que foi criado pelo usuario, e coloca em ordem crescente(no caso primeiro os ultimos que foram chamados) - - @meal_type = params[:meal_type] || "cafe" # padrão para café se não passar + @food = Food.new + @meal_type = params[:meal_type] || "cafe" # padrão para café se não passareeeeeeeeeeeeeeeeeeeeeee end + + + def show + @food = Food.find(params[:id]) + end + + def destroy + @food = Food.find(params[:id]) + @food.destroy + end + + + + end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 95f2992..fd8228c 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,4 +1,6 @@ class HomeController < ApplicationController - def index - end + before_action :authenticate_user! + + + end diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js index 5975c07..1ea16d4 100644 --- a/app/javascript/controllers/hello_controller.js +++ b/app/javascript/controllers/hello_controller.js @@ -2,6 +2,6 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { connect() { - this.element.textContent = "Hello World!" + console.log('teste') } } diff --git a/app/javascript/controllers/log_button_controller.js b/app/javascript/controllers/log_button_controller.js new file mode 100644 index 0000000..d4fa63a --- /dev/null +++ b/app/javascript/controllers/log_button_controller.js @@ -0,0 +1,21 @@ +import { Controller } from "@hotwired/stimulus" + +// Connects to data-controller="log-button" +export default class extends Controller { + + + + connect() { + const mealTitles = document.querySelectorAll('.meal'); + + mealTitles.forEach((mealTitle) => { + mealTitle.addEventListener('click', () => { + const currentContent = mealTitle.nextElementSibling; + + // Alterna a classe no próprio conteúdo + currentContent.classList.toggle('meal-display-none'); + }); + }); + + } +} diff --git a/app/models/daily_macro.rb b/app/models/daily_macro.rb index 99d8482..a938e60 100644 --- a/app/models/daily_macro.rb +++ b/app/models/daily_macro.rb @@ -1,4 +1,7 @@ class DailyMacro < ApplicationRecord - validates :calories, numericality: { less_than_or_equal_to: 9000 } + validates :calories, numericality: { less_than_or_equal_to: 9000 }, presence: true + validates :protein, :carbs, :fats, presence: true + + belongs_to :user end diff --git a/app/models/food.rb b/app/models/food.rb index 3d78123..f897d28 100644 --- a/app/models/food.rb +++ b/app/models/food.rb @@ -5,7 +5,24 @@ class Food < ApplicationRecord validates :fats, presence: true validates :carbs, presence: true - belongs_to :user + + + belongs_to :user validates :user, presence: true + + after_destroy_commit do + broadcast_remove_to "removefood", target: "food_#{id}" + + broadcast_replace_to "updatecalories", + target: "food_#{self.meal_type}", + partial: "shared/calories_update", + locals: { meal: self.meal_type, user: self.user } + end + # esse aqui só é chamado, quando algo é destruido do banco de dados after_destroy_commit + # pra isso funcionar precisa ter <%= turbo_stream_from "updatecalories" e <%= turbo_stream_from "removefood" %> na view de onde tu quer chamar %> + # broadcast_remove_to "removefood", target: "food_#{id}" ta pegando todo elemento com food_#{id} e removendo + # broadcast_replace_to "updatecalories" ta pegando food_#{self.meal_type}(USAMOS SELF PORQUE AQUI NO MODELO PRECISA USAR SELF QUANDO QUER SELCIONAR ALGO) + + end diff --git a/app/models/user.rb b/app/models/user.rb index 12711bb..d745c82 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,9 +10,36 @@ class User < ApplicationRecord def sum_macros { calories: Food.sum(:calories), - proteins: Food.sum(:proteins), fats: Food.sum(:fats), - carbs: Food.sum(:carbs) + carbs: Food.sum(:carbs), + proteins: Food.sum(:proteins), + } + + end + + + def calculate + last_macro = daily_macros.last + { + totalcalories: last_macro.calories - Food.sum(:calories), + totalfats: last_macro.fats - Food.sum(:fats), + totalcarbs: last_macro.carbs - Food.sum(:carbs), + totalprotein: last_macro.protein - Food.sum(:proteins) + } + end + + + def sum_calories(meal_type = nil) + scope = Food.all + scope = scope.where(meal_type: meal_type) if meal_type.present? + { + calories: scope.sum(:calories) } end + + + + + + end diff --git a/app/services/calories_ninja_client_api.rb b/app/services/calories_ninja_client_api.rb index fa1ddca..8dab1db 100644 --- a/app/services/calories_ninja_client_api.rb +++ b/app/services/calories_ninja_client_api.rb @@ -19,6 +19,7 @@ def search_food(query, unit) #query e unit sao dois parametros que estao sendo pegados por :unit e :query no controlador encoded_query = ERB::Util.url_encode(unit) + # transforma o unit(que é a quantidade do alimento) em uma string sem espaços, quebras etc uri = URI("#{API_URL}?query=#{encoded_query}g #{query}") diff --git a/app/views/daily_macros/index.html.erb b/app/views/daily_macros/index.html.erb new file mode 100644 index 0000000..3d7752c --- /dev/null +++ b/app/views/daily_macros/index.html.erb @@ -0,0 +1,6 @@ +
Welcome <%= @email %>!
+ +You can confirm your account email through the link below:
+ +<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +Hello <%= @email %>!
+ +<% if @resource.try(:unconfirmed_email?) %> +We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.
+<% else %> +We're contacting you to notify you that your email has been changed to <%= @resource.email %>.
+<% end %> diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +Hello <%= @resource.email %>!
+ +We're contacting you to notify you that your password has been changed.
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +Hello <%= @resource.email %>!
+ +Someone has requested a link to change your password. You can do this through the link below.
+ +<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
+ +If you didn't request this, please ignore this email.
+Your password won't change until you access the link above and create a new one.
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +Hello <%= @resource.email %>!
+ +Your account has been locked due to an excessive number of unsuccessful sign in attempts.
+ +Click the link below to unlock your account:
+ +<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..5fbb9ff --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,25 @@ +Name:<%= food.foodname %>
-protein:<%= food.proteins %>
-fats:<%= food.fats %>
-carbs:<%= food.carbs %>
-calories:<%= food.calories %>
-Calories Remaining:
+<%= current_user.daily_macros.last.calories %> - <%= current_user.sum_macros[:calories]%>: <%= current_user.calculate[:totalcalories] %>kcal
+Foods
+Saved Foods
+Calories: <%= current_user.sum_macros[:calories] %>
+Protein: <%= current_user.sum_macros[:proteins] %>
+Carbs: <%= current_user.sum_macros[:fats] %>
+Fats: <%= current_user.sum_macros[:carbs] %>
+ <%= link_to "Change Macros", daily_macros_path, class: "btn-change-macros" %> +Goal:
+Consumed:
+Remaining:
+<%= current_user.daily_macros.last.calories%>
+<%= current_user.sum_macros[:calories]%>
+<%= current_user.calculate[:totalcalories] %>
+<%= current_user.daily_macros.last.fats %>
+<%= current_user.sum_macros[:fats] %>
+<%= current_user.calculate[:totalfats] %>
+<%= current_user.daily_macros.last.carbs %>
+<%= current_user.sum_macros[:carbs] %>
+<%= current_user.calculate[:totalcarbs] %>
+<%= current_user.daily_macros.last.protein %>
+<%= current_user.sum_macros[:proteins] %>
+<%= current_user.calculate[:totalprotein] %>
+<%= meal %>
+ <%= image_tag("/images/#{meal}.png", alt: "Logo", class: "img") %> +<%= food.foodname %>
+Calories: <%= food.calories %>
+Fats: <%= food.fats %>
+Carbs: <%= food.carbs %>
+Protein: <%= food.proteins %>
+Serving: <%= food.serving_size %>g
+