Commit a8011e07 authored by Chanelle Lunod's avatar Chanelle Lunod

initial commit

parents 34538002 3262b5df
File added
class Product < ApplicationRecord
validates :name, presence: true
has_many :transactions
has_many :comments
end
......@@ -17,20 +17,16 @@
<body>
<style>
body,h2,h3,h4,h5,h6 {font-family: "Montserrat", sans-serif}
h1 {font-family: "Clibri", 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
font-family:'Calibri';
</style> -->
<body class="w3-black">
<nav class="w3-sidebar w3-bar-block w3-small w3-hide-small w3-center">
<!-- Avatar image in top left corner -->
<img src="https://218run.com/wp-content/uploads/2013/10/yonex_logo_wp-300x300.jpg" style="width:100%">
<img src="https://lh3.googleusercontent.com/PYzkAZJEGDPjS9BMr-haoxCo5X3bCX_EVkDsua3Tc6Il29mjbWO6pBrS6URoR6KF86NjU_t1Io9Y0kJPW7cebTEbe-ZkBUHIvlN8rTUi0fHa4rtnRtR4CTF8QHyOLU6TPqotE0SeuOVTwkN4qkJqMHcjqHH0IRQgrjA186OdjdidOfwNu0zFEx2N5jWXML02mfCgtSpTlxxc7gMHT1p-e1zrFvJ7h6QXpGmNIU3OYcJanMqB-NZuDPrSOMFVCujy0ruWqBcIVaUyn_hwe9_GxRTUx1w1bpnWctWjv-KzsiW2xsB9PuRqlp3SvVfeEwh3oBg7f4WfrpHZWSLWsneVNhnpw9xfHCFwh3ayA7DD0DjhoKOAzwAZKRfJ3vU7dBA8OiadZ3XKq30p4QNBjbWTvB72SKPuBH8amFvyAisLdrMlAEA74tighN_ne8SWDT_hHtR1JOsJ039iDcfyH2L5rzz9L8s2sPbsZbko4ffShwLohhCnq3G8gX9P0ISEvcMocZJimTS0xaupkvXmHyKDLxbpMw1_gDm9-B7cRIOxfSs--oddVyggQjj7PukDkwqqb32Vn9EvfaM4glMJx_iLI1Bm5wWhZlpbyc0P9g=s300-no" style="width:100%">
<a href="#" class="w3-bar-item w3-button w3-padding-large w3-black">
<i class="fa fa-home w3-xxlarge"></i>
<p>HOME</p>
......@@ -67,7 +63,7 @@
<!-- 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>
<p>"The #1 trusted brand by all athletes accross the globe."</p>
<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>
......@@ -98,15 +94,15 @@
<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:99%"></div>
<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:97%"></div>
<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:95%"></div>
<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">
......
<% if admin_user_signed_in? %>
<h1>Products</h1>
<h1>PRODUCTS</h1>
<div>
<%= link_to "Add new Product", new_product_path, class: "btn btn-primary" %>
</div>
......@@ -12,7 +12,7 @@
</small>
<% else %>
<table class = "table", cellspacing="0", cellpadding="0">
<thead style="background-color: #F08080">
<thead>
<th>Name</th>
<th>Description</th>
<th>Status</th>
......@@ -26,7 +26,7 @@
<% @products.each do |product| %>
<tr>
<td>
<%= product.name %>
<%= link_to product.name, product_path(product) %>
</td>
<td>
<%= product.description %>
......@@ -39,7 +39,7 @@
<% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @supplies += trans.quantity %>
<% end %>
......@@ -51,7 +51,7 @@
<% product.transactions.each do |trans| %>
<% if trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @orders += trans.quantity %>
<% end %>
......@@ -61,10 +61,17 @@
<td>
<% @total = 0 %>
<% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @total += trans.quantity %>
<% elsif trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity = 0 %>
<% end %>
<% @total -= trans.quantity %>
<% end %>
<% end %>
<%= @total %>
</td>
......@@ -81,12 +88,6 @@
<%= link_to "Activate", product_path(product), method: :delete, class: "btn btn-success"%>
<% end %>
</td>
<!-- <td>
<%= link_to "Delete", product_path(product), class: "btn btn-danger", method: :post, data: { confirm: "Are you sure you want to delete?" } %>
</td> -->
<td>
<%= link_to "View", product_path(product), class: "btn btn-primary" %>
</td>
</tr>
<% end%>
</tbody>
......@@ -94,7 +95,7 @@
<% end %>
<% elsif user_signed_in? %>
<h1>Transactions</h1>
<h1>TRANSACTIONS</h1>
<br>
<% if @products.empty? %>
......@@ -103,7 +104,7 @@
</small>
<% else %>
<table class = "table", cellspacing="0", cellpadding="0">
<thead style="background-color: #76D7C4">
<thead>
<th>Name</th>
<th>Description</th>
<th>Status</th>
......@@ -129,7 +130,7 @@
<% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @supplies += trans.quantity %>
<% end %>
......@@ -141,7 +142,7 @@
<% product.transactions.each do |trans| %>
<% if trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @orders += trans.quantity %>
<% end %>
......@@ -151,10 +152,17 @@
<td>
<% @total = 0 %>
<% product.transactions.each do |trans| %>
<% if trans.mode == "Supply" %>
<% if trans.quantity == nil %>
<% trans.quantity == 0 %>
<% trans.quantity = 0 %>
<% end %>
<% @total += trans.quantity %>
<% elsif trans.mode == "Order" %>
<% if trans.quantity == nil %>
<% trans.quantity = 0 %>
<% end %>
<% @total -= trans.quantity %>
<% end %>
<% end %>
<%= @total %>
</td>
......
......@@ -4,10 +4,6 @@
<%= @product.description %>
</p>
<p>
Status: <%= @product.status %>
</p>
<p>
<small>
Created At: <%= @product.created_at.to_s :short %>
......
<h1>New Supply</h1>
<%= simple_form_for([@product, @supply], url: product_supplies_path) do |f| %>
<%= f.input :quantity %>
<%= f.button :submit, "Add Supply", class: "btn btn-primary" %>
<%= 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