Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21_Final_Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanelle Lunod
MIS21_Final_Project
Commits
a8011e07
Commit
a8011e07
authored
Jul 20, 2018
by
Chanelle Lunod
Browse files
Options
Browse Files
Download
Plain Diff
initial commit
parents
34538002
3262b5df
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
63 deletions
+65
-63
COA.pdf
COA.pdf
+0
-0
product.rb
app/models/product.rb
+1
-0
application.html.erb
app/views/layouts/application.html.erb
+6
-10
index.html.erb
app/views/products/index.html.erb
+57
-49
show.html.erb
app/views/products/show.html.erb
+0
-4
new.html.erb
app/views/supplies/new.html.erb
+1
-0
No files found.
COA.pdf
0 → 100644
View file @
a8011e07
File added
app/models/product.rb
View file @
a8011e07
class
Product
<
ApplicationRecord
validates
:name
,
presence:
true
has_many
:transactions
has_many
:comments
end
app/views/layouts/application.html.erb
View file @
a8011e07
...
...
@@ -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:9
9
%"
></div>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:9
5
%"
></div>
</div>
<p
class=
"w3-wide"
>
Golf
</p>
<div
class=
"w3-white"
>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:9
7
%"
></div>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:9
0
%"
></div>
</div>
<p
class=
"w3-wide"
>
Tennis
</p>
<div
class=
"w3-white"
>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:
9
5%"
></div>
<div
class=
"w3-dark-grey"
style=
"height:28px;width:
8
5%"
></div>
</div><br>
<div
class=
"w3-row w3-center w3-padding-16 w3-section w3-light-grey"
>
...
...
app/views/products/index.html.erb
View file @
a8011e07
<%
if
admin_user_signed_in?
%>
<h1>
P
roducts
</h1>
<h1>
P
RODUCTS
</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>
T
ransactions
</h1>
<h1>
T
RANSACTIONS
</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>
...
...
app/views/products/show.html.erb
View file @
a8011e07
...
...
@@ -4,10 +4,6 @@
<%=
@product
.
description
%>
</p>
<p>
Status:
<%=
@product
.
status
%>
</p>
<p>
<small>
Created At:
<%=
@product
.
created_at
.
to_s
:short
%>
...
...
app/views/supplies/new.html.erb
View file @
a8011e07
<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"
%>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment