Commit 3262b5df authored by Chanelle Lunod's avatar Chanelle Lunod

Initial commit

parent d1dbca7c
class Product < ApplicationRecord class Product < ApplicationRecord
validates :name, presence: true
has_many :transactions has_many :transactions
has_many :comments has_many :comments
end end
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>PRODUCTS</title> <title>PRODUCTS</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
...@@ -13,27 +16,63 @@ ...@@ -13,27 +16,63 @@
<body> <body>
<style> <style>
body,h2,h3,h4,h5,h6 {font-family: "Montserrat", sans-serif}
h1 {font-family: "Impact", sans-serif}
.w3-row-padding img {margin-bottom: 12px}
.w3-sidebar {width: 120px;background: #222;}
#main {margin-left: 120px}
@media only screen and (max-width: 600px) {#main {margin-left: 0}}
</style>
<!-- <style>
background-color: #ccfff2 background-color: #ccfff2
font-family:'Calibri'; font-family:'Calibri';
</style> </style> -->
<nav class="navbar navbar-expand-xl navbar-dark bg-dark"> <body class="w3-black">
<%= link_to "HOME", root_path, class: "navbar-brand" %> <nav class="w3-sidebar w3-bar-block w3-small w3-hide-small w3-center">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <!-- Avatar image in top left corner -->
<span class="navbar-toggler-icon"></span> <img src="https://218run.com/wp-content/uploads/2013/10/yonex_logo_wp-300x300.jpg" style="width:100%">
</button> <a href="#" class="w3-bar-item w3-button w3-padding-large w3-black">
<i class="fa fa-home w3-xxlarge"></i>
<p>HOME</p>
</a>
<a href="#signin" class="w3-bar-item w3-button w3-padding-large w3-hover-black">
<i class="fa fa-user w3-xxlarge"></i>
<p>SIGN IN</p>
</a>
<a href="#products" class="w3-bar-item w3-button w3-padding-large w3-hover-black">
<i class="fa fa-eye w3-xxlarge"></i>
<p>PRODUCTS</p>
</a>
<a href="#contact" class="w3-bar-item w3-button w3-padding-large w3-hover-black">
<i class="fa fa-envelope w3-xxlarge"></i>
<p>CONTACT</p>
</a>
<a href="#search" class="w3-bar-item w3-button w3-padding-large w3-hover-black">
<i class="fa fa-search w3-xxlarge"></i>
<p>SEARCH</p>
</a>
</nav>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="w3-top w3-hide-large w3-hide-medium" id="myNavbar">
<ul class="navbar-nav mr-auto"> <div class="w3-bar w3-black w3-opacity w3-hover-opacity-off w3-center w3-small">
<li class="nav-item"> <a href="#" class="w3-bar-item w3-button" style="width:25% !important">HOME</a>
<a class="nav-link" href="#">Sign In</a> <a href="#signin" class="w3-bar-item w3-button" style="width:25% !important">SIGN IN</a>
</li> <a href="#products" class="w3-bar-item w3-button" style="width:25% !important">PRODUCTS</a>
<li class="nav-item"> <a href="#contact" class="w3-bar-item w3-button" style="width:25% !important">CONTACT</a>
<a class="nav-link" href="#">Inventory</a> <a href="#search" class="w3-bar-item w3-button" style="width:25% !important">SEARCH</a>
</li> </div>
<li class="nav-item"> </div>
<a class="nav-link" href="#">Transactions</a>
</li> <div class="w3-padding-large" id="main">
</ul> <!-- Header/Home -->
<header class="w3-container w3-padding-32 w3-center w3-black" id="home">
<h1 class="w3-jumbo"><span class="w3-hide-small">YONEX</h1>
<i>"The #1 trusted brand by all athletes accross the globe."</i>
<img src="http://www.sunrisecatalogue.com/uploads/posters/duovsvt_ldlcw_YYSRSRC.jpg" alt="boy" class="w3-image" width="992" height="1108">
</header>
</span>
<div class="w3-content w3-justify w3-text-white w3-padding-64" id="signin">
<span class="navbar-text"> <span class="navbar-text">
<% if user_signed_in? %> <% if user_signed_in? %>
Logged in as <strong><%= current_user.email %></strong>. Logged in as <strong><%= current_user.email %></strong>.
...@@ -44,18 +83,6 @@ ...@@ -44,18 +83,6 @@
<%= link_to "Logout", destroy_admin_user_session_path, method: :delete, :class => 'navbar-link' %> <%= link_to "Logout", destroy_admin_user_session_path, method: :delete, :class => 'navbar-link' %>
<% end %> <% end %>
</span> </span>
<%= form_tag products_path, :method => 'get' do %>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search" %>
<% end %>
</div>
</nav>
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'af,ar,da,de,en,es,fi,fr,hi,id,is,ja,ko,mi,ms,my,nl,no,pt,sw,tl,zh-CN', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<div class="container" id="container"> <div class="container" id="container">
<% if notice %> <% if notice %>
...@@ -65,6 +92,130 @@ ...@@ -65,6 +92,130 @@
<p class="alert alert-danger"><%= alert %></p> <p class="alert alert-danger"><%= alert %></p>
<% end %> <% end %>
<%= yield %> <%= yield %>
</div><br>
<br>
<br>
<h3 class="w3-padding-16 w3-text-light-grey">Our Ratings</h3>
<p class="w3-wide">Badminton</p>
<div class="w3-white">
<div class="w3-dark-grey" style="height:28px;width:95%"></div>
</div>
<p class="w3-wide">Golf</p>
<div class="w3-white">
<div class="w3-dark-grey" style="height:28px;width:90%"></div>
</div>
<p class="w3-wide">Tennis</p>
<div class="w3-white">
<div class="w3-dark-grey" style="height:28px;width:85%"></div>
</div><br>
<div class="w3-row w3-center w3-padding-16 w3-section w3-light-grey">
<div class="w3-quarter w3-section">
<span class="w3-xlarge">500+</span><br>
Partners
</div>
<div class="w3-quarter w3-section">
<span class="w3-xlarge">800</span><br>
Stores Worldwide
</div>
<div class="w3-quarter w3-section">
<span class="w3-xlarge">1M++</span><br>
Happy Athletes
</div>
<div class="w3-quarter w3-section">
<span class="w3-xlarge">650+</span><br>
Distributors
</div>
</div>
</div> </div>
<!-- Portfolio Section -->
<div class="w3-padding-64 w3-content" id="products">
<h2 class="w3-text-light-grey">Featured</h2>
<hr style="width:200px" class="w3-opacity">
<!-- Grid for photos -->
<div class="w3-row-padding" style="margin:0 -16px">
<div class="w3-half">
<img src="http://www.sunrisecatalogue.com/uploads/posters/DUORA%20Series%20Ad.jpg" style="width:100%">
<img src="http://www.sunrisecatalogue.com/uploads/posters/Tour%20Racquets%202016.png" style="width:100%">
<img src="http://www.sunrisecatalogue.com/uploads/posters/NR95DX%20and%20NR70DX%20final.jpg" style="width:100%">
</div>
<div class="w3-half">
<img src="http://www.sunrisecatalogue.com/uploads/posters/duovsvt_version_YYSRSRC.jpg" style="width:100%">
<img src="http://www.sunrisecatalogue.com/uploads/posters/VTDG-10-and-7.jpg" style="width:100%">
<img src="http://www.sunrisecatalogue.com/uploads/posters/ARC10%20Poster.jpg" style="width:100%">
</div>
<!-- End photo grid -->
</div>
<!-- End Portfolio Section -->
</div>
<!-- Contact Section -->
<div class="w3-padding-64 w3-content w3-text-grey" id="contact">
<h2 class="w3-text-light-grey">Contact Us</h2>
<hr style="width:200px" class="w3-opacity">
<div class="w3-section">
<p><i class="fa fa-map-marker fa-fw w3-text-white w3-xxlarge w3-margin-right"></i> 3-23-13 Yushima, Bunkyo-ku, Tokyo 113-8543, Japan</p>
<p><i class="fa fa-phone fa-fw w3-text-white w3-xxlarge w3-margin-right"></i> Phone: +00 12345</p>
<p><i class="fa fa-envelope fa-fw w3-text-white w3-xxlarge w3-margin-right"> </i> Email: yonex@obf.ateneo.edu</p>
</div><br>
<p>If you have any questions, send us an email:</p>
<form action="/action_page.php" target="_blank">
<p><input class="w3-input w3-padding-16" type="text" placeholder="Name" required name="Name"></p>
<p><input class="w3-input w3-padding-16" type="text" placeholder="Email" required name="Email"></p>
<p><input class="w3-input w3-padding-16" type="text" placeholder="Subject" required name="Subject"></p>
<p><input class="w3-input w3-padding-16" type="text" placeholder="Message" required name="Message"></p>
<p>
<button class="w3-button w3-light-grey w3-padding-large" type="submit">
<i class="fa fa-paper-plane"></i> SEND EMAIL
</button>
</p>
</form>
</div>
<!-- End Contact Section -->
<div class="w3-padding-64 w3-content w3-text-white">
<h2>Our Founders</h2> <br>
<img src="https://scontent.fmnl4-4.fna.fbcdn.net/v/t31.0-8/26758507_10208855439018286_1377917175667961785_o.jpg?_nc_cat=0&oh=ff30e6770ff054370e1fa725ffe1580d&oe=5BD55DF1" alt="Avatar" class="w3-left w3-circle w3-margin-right" style="width:80px">
<p><span class="w3-large w3-margin-right">Andrea Dolendo -</span> Chief Executive Officer</p><br>
<img src="https://scontent.fmnl4-4.fna.fbcdn.net/v/t31.0-8/26232467_10204296200921706_5390473562677293564_o.jpg?_nc_cat=0&oh=e91a4fb887a4bd2437830cb9bb5999f0&oe=5C126350" alt="Avatar" class="w3-left w3-circle w3-margin-right" style="width:80px">
<p><span class="w3-large w3-margin-right">Chanelle Lunod -</span> Chief Operating Officer</p>
</div>
<!-- End About Section -->
<!-- Footer -->
<footer class="w3-content w3-padding-64 w3-text-grey w3-xlarge">
<i class="fa fa-facebook-official w3-hover-opacity"></i>
<i class="fa fa-instagram w3-hover-opacity"></i>
<i class="fa fa-snapchat w3-hover-opacity"></i>
<i class="fa fa-pinterest-p w3-hover-opacity"></i>
<i class="fa fa-twitter w3-hover-opacity"></i>
<i class="fa fa-linkedin w3-hover-opacity"></i>
<p class="w3-medium">Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank" class="w3-hover-text-green">w3.css</a></p>
<!-- End footer -->
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'af,ar,da,de,en,es,fi,fr,hi,id,is,ja,ko,mi,ms,my,nl,no,pt,sw,tl,zh-CN', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</footer>
</div>
</nav>
<!-- Search Section -->
<div class="w3-padding-64 w3-content w3-text-grey" id="search">
<h2 class="w3-text-light-grey">Search Products</h2>
<%= form_tag products_path, :method => 'get' do %>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", class: 'btn btn-outline-info my-2 my-sm-0' %>
<% end %>
</div>
</body> </body>
</html> </html>
<% if admin_user_signed_in? %> <% if admin_user_signed_in? %>
<h1>Products</h1> <h1>PRODUCTS</h1>
<div> <div>
<%= link_to "Add new Product", new_product_path, class: "btn btn-primary" %> <%= link_to "Add new Product", new_product_path, class: "btn btn-primary" %>
</div> </div>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</small> </small>
<% else %> <% else %>
<table class = "table", cellspacing="0", cellpadding="0"> <table class = "table", cellspacing="0", cellpadding="0">
<thead style="background-color: #F08080"> <thead>
<th>Name</th> <th>Name</th>
<th>Description</th> <th>Description</th>
<th>Status</th> <th>Status</th>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<% @products.each do |product| %> <% @products.each do |product| %>
<tr> <tr>
<td> <td>
<%= product.name %> <%= link_to product.name, product_path(product) %>
</td> </td>
<td> <td>
<%= product.description %> <%= product.description %>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %> <% if trans.mode == "Supply" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @supplies += trans.quantity %> <% @supplies += trans.quantity %>
<% end %> <% end %>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Order" %> <% if trans.mode == "Order" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @orders += trans.quantity %> <% @orders += trans.quantity %>
<% end %> <% end %>
...@@ -61,10 +61,17 @@ ...@@ -61,10 +61,17 @@
<td> <td>
<% @total = 0 %> <% @total = 0 %>
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @total += trans.quantity %> <% @total += trans.quantity %>
<% elsif trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity = 0 %>
<% end %>
<% @total -= trans.quantity %>
<% end %>
<% end %> <% end %>
<%= @total %> <%= @total %>
</td> </td>
...@@ -84,9 +91,6 @@ ...@@ -84,9 +91,6 @@
<!-- <td> <!-- <td>
<%= link_to "Delete", product_path(product), class: "btn btn-danger", method: :post, data: { confirm: "Are you sure you want to delete?" } %> <%= link_to "Delete", product_path(product), class: "btn btn-danger", method: :post, data: { confirm: "Are you sure you want to delete?" } %>
</td> --> </td> -->
<td>
<%= link_to "View", product_path(product), class: "btn btn-primary" %>
</td>
</tr> </tr>
<% end%> <% end%>
</tbody> </tbody>
...@@ -94,7 +98,7 @@ ...@@ -94,7 +98,7 @@
<% end %> <% end %>
<% elsif user_signed_in? %> <% elsif user_signed_in? %>
<h1>Transactions</h1> <h1>TRANSACTIONS</h1>
<br> <br>
<% if @products.empty? %> <% if @products.empty? %>
...@@ -103,7 +107,7 @@ ...@@ -103,7 +107,7 @@
</small> </small>
<% else %> <% else %>
<table class = "table", cellspacing="0", cellpadding="0"> <table class = "table", cellspacing="0", cellpadding="0">
<thead style="background-color: #76D7C4"> <thead>
<th>Name</th> <th>Name</th>
<th>Description</th> <th>Description</th>
<th>Status</th> <th>Status</th>
...@@ -129,7 +133,7 @@ ...@@ -129,7 +133,7 @@
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %> <% if trans.mode == "Supply" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @supplies += trans.quantity %> <% @supplies += trans.quantity %>
<% end %> <% end %>
...@@ -141,7 +145,7 @@ ...@@ -141,7 +145,7 @@
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Order" %> <% if trans.mode == "Order" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @orders += trans.quantity %> <% @orders += trans.quantity %>
<% end %> <% end %>
...@@ -151,10 +155,17 @@ ...@@ -151,10 +155,17 @@
<td> <td>
<% @total = 0 %> <% @total = 0 %>
<% product.transactions.each do |trans| %> <% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %> <% if trans.quantity == nil %>
<% trans.quantity == 0 %> <% trans.quantity = 0 %>
<% end %> <% end %>
<% @total += trans.quantity %> <% @total += trans.quantity %>
<% elsif trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity = 0 %>
<% end %>
<% @total -= trans.quantity %>
<% end %>
<% end %> <% end %>
<%= @total %> <%= @total %>
</td> </td>
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
<%= @product.description %> <%= @product.description %>
</p> </p>
<p>
Status: <%= @product.status %>
</p>
<p> <p>
<small> <small>
Created At: <%= @product.created_at.to_s :short %> Created At: <%= @product.created_at.to_s :short %>
......
<h1>New Supply</h1> <h1>New Supply</h1>
<%= simple_form_for([@product, @supply], url: product_supplies_path) do |f| %> <%= simple_form_for([@product, @supply], url: product_supplies_path) do |f| %>
<%= f.input :quantity %> <%= f.input :quantity %>
<%= f.button :submit, "Add Supply", class: "btn btn-primary" %> <%= f.button :submit, "Add Supply", class: "btn btn-primary" %>
<%= link_to "Back", authenticated_user_root_path, class: "btn-btn-default" %> <%= link_to "Back", authenticated_user_root_path, class: "btn-btn-default" %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment